fstests: convert remaining tests to SPDX license tags
[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 _supported_os Linux
24
25 _require_scratch
26
27 _scratch_mkfs >/dev/null 2>&1
28 _scratch_mount
29 _require_batched_discard $SCRATCH_MNT
30
31 echo "[+] Length is zero (should fail)"
32 out=$("$FSTRIM_PROG" -v -o0 -l0 $SCRATCH_MNT 2>&1)
33 [ $? -eq 0 ] && status=1
34 echo $out | _filter_scratch
35
36 echo "[+] Length is smaller than block size (should fail)"
37 out=$("$FSTRIM_PROG" -v -o0 -l100 $SCRATCH_MNT 2>&1)
38 [ $? -eq 0 ] && status=1
39 echo $out | _filter_scratch
40
41 echo "Test done"
42 exit