generic/611: Use _getfattr instead of GETFATTR_PROG
[xfstests-dev.git] / tests / generic / 288
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright 2012 (C) Red Hat, Inc., Lukas Czerner <lczerner@redhat.com>
4 #
5 # FS QA Test No. 288
6 #
7 # This check the FITRIM argument handling in the corner case where length is
8 # smaller than block size or zero.
9 #
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13
14 status=0
15 trap "exit \$status" 0 1 2 3 15
16
17 # get standard environment, filters and checks
18 . ./common/rc
19 . ./common/filter
20
21 # real QA test starts here
22 _supported_fs generic
23
24 _require_scratch
25
26 _scratch_mkfs >/dev/null 2>&1
27 _scratch_mount
28 _require_batched_discard $SCRATCH_MNT
29
30 echo "[+] Length is zero (should fail)"
31 out=$("$FSTRIM_PROG" -v -o0 -l0 $SCRATCH_MNT 2>&1)
32 [ $? -eq 0 ] && status=1
33 echo $out | _filter_scratch
34
35 echo "[+] Length is smaller than block size (should fail)"
36 out=$("$FSTRIM_PROG" -v -o0 -l100 $SCRATCH_MNT 2>&1)
37 [ $? -eq 0 ] && status=1
38 echo $out | _filter_scratch
39
40 echo "Test done"
41 exit