2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Facebook. All Rights Reserved.
7 # Test invalid swap file (with holes)
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
15 status=1 # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
24 # get standard environment, filters and checks
28 # remove previous $seqres.full before test
32 _require_scratch_swapfile
33 _require_test_program mkswap
34 _require_test_program swapon
37 _scratch_mkfs >> $seqres.full 2>&1
40 # We can't use _format_swapfile because we're using our custom mkswap and
42 touch "$SCRATCH_MNT/swap"
43 $CHATTR_PROG +C "$SCRATCH_MNT/swap" >> $seqres.full 2>&1
44 chmod 0600 "$SCRATCH_MNT/swap"
45 $XFS_IO_PROG -c "truncate $(($(get_page_size) * 10))" "$SCRATCH_MNT/swap"
46 "$here/src/mkswap" "$SCRATCH_MNT/swap"
47 "$here/src/swapon" "$SCRATCH_MNT/swap"
48 swapoff "$SCRATCH_MNT/swap" >/dev/null 2>&1