summaryrefslogtreecommitdiff
path: root/tests/generic/636
blob: afb9df986b5c5d6bd679c54c858d690380f1486d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2018 Facebook. All Rights Reserved.
#
# FS QA Test 636
#
# Test invalid swap files.
# Empty swap file (only swap header)
#
. ./common/preamble
_begin_fstest auto quick swap

# Import common functions.
. ./common/filter

_supported_fs generic
_require_scratch_swapfile
_require_test_program mkswap
_require_test_program swapon

_scratch_mkfs >> $seqres.full 2>&1
_scratch_mount

touch "$SCRATCH_MNT/swap"
$CHATTR_PROG +C "$SCRATCH_MNT/swap" >> $seqres.full 2>&1
chmod 0600 "$SCRATCH_MNT/swap"
_pwrite_byte 0x61 0 $(_get_page_size) "$SCRATCH_MNT/swap" >> $seqres.full
"$here/src/mkswap" "$SCRATCH_MNT/swap"
"$here/src/swapon" "$SCRATCH_MNT/swap"
swapoff "$SCRATCH_MNT/swap" >/dev/null 2>&1

status=0
exit