summaryrefslogtreecommitdiffstats
path: root/tests/fallocate.rc
blob: 3756bb949bd94c576b00c81b0acdb3e6d00c7d4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash

# Helper to verify a given fallocate command is supported and skip a test
# otherwise. Older versions of the fallocate utility might not support all modes
# (i.e., discard) and older versions of fuse might not support the associated
# fallocate requests.

function require_fallocate()
{
	output=`fallocate $* 2>&1`
	ret=$?
	if [ ! $ret -eq 0 ] && ([[ $output == *unsupported* ]] ||
				[[ $output == *invalid* ]] ||
				[[ $output == *"not supported"* ]])
	then
		SKIP_TESTS
		exit
	fi
}