summaryrefslogtreecommitdiff
path: root/tests/fs/fstests.sh
blob: cb6d2c96c7143eb624b8d08cb4b4211dfb604044 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash
# xfstests wrapper:

. $(dirname $(readlink -e "${BASH_SOURCE[0]}"))/../test-libs.sh

require-git http://evilpiepirate.org/git/xfstests.git xfstests

# disable io_uring - io_uring is currently broken w.r.t. unmounting, we get
# spurious umount failures with -EBUSY
export ac_cv_header_liburing_h=no

require-kernel-config BSD_PROCESS_ACCT
require-kernel-config FAULT_INJECTION,FAULT_INJECTION_DEBUG_FS,FAIL_MAKE_REQUEST
require-kernel-config MD,BLK_DEV_DM,DM_FLAKEY,DM_SNAPSHOT,DM_LOG_WRITES
require-kernel-config DM_THIN_PROVISIONING
require-kernel-config DM_ZERO
require-kernel-config BLK_DEV,BLK_DEV_LOOP
require-kernel-config SCSI_DEBUG=m
require-kernel-config USER_NS
require-kernel-config OVERLAY_FS

# 038,048,312 require > 10G
config-scratch-devs 14G
config-scratch-devs 14G
config-scratch-devs 14G

# swap
config-scratch-devs 2G

config-timeout 7200

list_tests()
{
    pushd $(dirname $(readlink -e "${BASH_SOURCE[0]}"))/xfstests > /dev/null

    for i in tests/*; do
	if [[ -d $i ]]; then
	    pushd $i > /dev/null
	    ../../tools/mkgroupfile group.list
	    popd > /dev/null
	fi
    done

    for g in generic shared "$FSTYP"; do
	[[ ! -f tests/$g/group.list ]] && continue
	grep -hE '[0-9][0-9][0-9] .*(auto|dangerous)' tests/$g/group.list|
	    sed -e "s/ .*//" -e "s/^/$g\//"
    done

    popd > /dev/null
}

run_fstests()
{
    if [[ ! -f /xfstests-init-done ]]; then
	mkswap ${ktest_scratch_dev[3]}
	swapon ${ktest_scratch_dev[3]}

	useradd -m fsgqa
	useradd fsgqa2
	useradd 123456-fsgqa

	mkdir -p /mnt/test /mnt/scratch

	if $ktest_interactive; then
	    run_quiet "building $(basename $i)" make -j $ktest_cpus -C "$ktest_dir/tests/fs/xfstests"
	fi

	rm -rf /ktest-out/xfstests

	touch /xfstests-init-done
    fi

    if [[ ! -f /xfstests-config-done ]]; then
	wipefs -af ${ktest_scratch_dev[0]}
	mkfs.$FSTYP $MKFS_OPTIONS -q ${ktest_scratch_dev[0]}

	# mkfs.xfs 5.19 requires these variables to be exported into its
	# environment to allow sub-300MB filesystems for fstests.
	export TEST_DEV=${ktest_scratch_dev[0]}
	export TEST_DIR=/mnt/test

	rm -f /ktest/tests/fs/xfstests/local.config
	cat << EOF > /tmp/xfstests.config
TEST_DEV=${ktest_scratch_dev[0]}
TEST_DIR=$TEST_DIR
SCRATCH_DEV=${ktest_scratch_dev[1]}
SCRATCH_MNT=/mnt/scratch
LOGWRITES_DEV=${ktest_scratch_dev[2]}
RESULT_BASE=/ktest-out/xfstests
LOGGER_PROG=true
EOF
	touch /xfstests-config-done
    fi

    export HOST_OPTIONS=/tmp/xfstests.config
    export MKFS_OPTIONS

    cd "$ktest_dir/tests/fs/xfstests"
    ./check "$@"
}