2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright 2012 (C) Red Hat, Inc., Lukas Czerner <lczerner@redhat.com>
7 # This check the FITRIM argument handling in the corner case where length is
8 # smaller than block size or zero.
11 _begin_fstest auto quick ioctl trim
15 # Import common functions.
18 # real QA test starts here
23 _scratch_mkfs >/dev/null 2>&1
25 _require_batched_discard $SCRATCH_MNT
27 echo "[+] Length is zero (should fail)"
28 out=$("$FSTRIM_PROG" -v -o0 -l0 $SCRATCH_MNT 2>&1)
29 [ $? -eq 0 ] && status=1
30 echo $out | _filter_scratch
32 echo "[+] Length is smaller than block size (should fail)"
33 out=$("$FSTRIM_PROG" -v -o0 -l100 $SCRATCH_MNT 2>&1)
34 [ $? -eq 0 ] && status=1
35 echo $out | _filter_scratch