2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Facebook. All Rights Reserved.
7 # Test invalid swap file (with holes)
10 _begin_fstest auto quick swap
12 # Import common functions.
16 _require_scratch_swapfile
17 _require_test_program mkswap
18 _require_test_program swapon
21 _scratch_mkfs >> $seqres.full 2>&1
24 # We can't use _format_swapfile because we're using our custom mkswap and
26 touch "$SCRATCH_MNT/swap"
27 $CHATTR_PROG +C "$SCRATCH_MNT/swap" >> $seqres.full 2>&1
28 chmod 0600 "$SCRATCH_MNT/swap"
29 $XFS_IO_PROG -c "truncate $(($(get_page_size) * 10))" "$SCRATCH_MNT/swap"
30 "$here/src/mkswap" "$SCRATCH_MNT/swap"
31 "$here/src/swapon" "$SCRATCH_MNT/swap"
32 swapoff "$SCRATCH_MNT/swap" >/dev/null 2>&1