generic: test MADV_POPULATE_READ with IO errors
[xfstests-dev.git] / tests / generic / 636
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Facebook. All Rights Reserved.
4 #
5 # FS QA Test 636
6 #
7 # Test invalid swap files.
8 # Empty swap file (only swap header)
9 #
10 . ./common/preamble
11 _begin_fstest auto quick swap
12
13 # Import common functions.
14 . ./common/filter
15
16 _supported_fs generic
17 _require_scratch_swapfile
18 _require_test_program mkswap
19 _require_test_program swapon
20
21 _scratch_mkfs >> $seqres.full 2>&1
22 _scratch_mount
23
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
31
32 status=0
33 exit