2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Facebook. All Rights Reserved.
7 # Test invalid swap files.
8 # Empty swap file (only swap header)
11 _begin_fstest auto quick swap
13 # Import common functions.
17 _require_scratch_swapfile
18 _require_test_program mkswap
19 _require_test_program swapon
21 _scratch_mkfs >> $seqres.full 2>&1
24 touch "$SCRATCH_MNT/swap"
25 $CHATTR_PROG +C "$SCRATCH_MNT/swap" >> $seqres.full 2>&1
26 chmod 0600 "$SCRATCH_MNT/swap"
27 _pwrite_byte 0x61 0 $(get_page_size) "$SCRATCH_MNT/swap" >> $seqres.full
28 "$here/src/mkswap" "$SCRATCH_MNT/swap"
29 "$here/src/swapon" "$SCRATCH_MNT/swap"
30 swapoff "$SCRATCH_MNT/swap" >/dev/null 2>&1