summaryrefslogtreecommitdiffstats
path: root/tests/fallocate.rc
blob: d117ba9c05199afb2ad1bdabea9706e16f6efa01 (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
}