fstests: move test group info to test files
[xfstests-dev.git] / tests / btrfs / 068
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2014 Red Hat Inc. All rights reserved.
4 #
5 # FSQA Test No. btrfs/068
6 #
7 # Run btrfs subvolume create/mount/umount/delete and remount with
8 # different compress algorithms simultaneously, with fsstress running
9 # in background.
10 #
11 . ./common/preamble
12 _begin_fstest auto subvol remount compress
13
14 # Import common functions.
15 . ./common/filter
16
17 # real QA test starts here
18 _supported_fs btrfs
19 # we check scratch dev after each loop
20 _require_scratch_nocheck
21 _require_scratch_dev_pool 4
22 _btrfs_get_profile_configs
23
24 run_test()
25 {
26         local mkfs_opts=$1
27         local subvol_mnt=$TEST_DIR/$seq.mnt
28         local stop_file=$TEST_DIR/$seq.stop.$$
29
30         echo "Test $mkfs_opts with $with_compress" >>$seqres.full
31
32         _scratch_pool_mkfs $mkfs_opts >>$seqres.full 2>&1
33         # make sure we created btrfs with desired options
34         if [ $? -ne 0 ]; then
35                 echo "mkfs $mkfs_opts failed"
36                 return
37         fi
38         _scratch_mount >>$seqres.full 2>&1
39
40         args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
41         echo "Run fsstress $args" >>$seqres.full
42         $FSSTRESS_PROG $args >/dev/null 2>&1 &
43         fsstress_pid=$!
44
45         # make sure the stop sign is not there
46         rm -f $stop_file
47         echo -n "Start subvolume worker: " >>$seqres.full
48         _btrfs_stress_subvolume $SCRATCH_DEV $SCRATCH_MNT subvol_$$ $subvol_mnt $stop_file >/dev/null 2>&1 &
49         subvol_pid=$!
50         echo "$subvol_pid" >>$seqres.full
51
52         echo -n "Start remount worker: " >>$seqres.full
53         _btrfs_stress_remount_compress $SCRATCH_MNT >/dev/null 2>&1 &
54         remount_pid=$!
55         echo "$remount_pid" >>$seqres.full
56
57         echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
58         wait $fsstress_pid
59
60         touch $stop_file
61         kill $remount_pid
62         wait
63         # wait for the remount loop process to finish
64         while ps aux | grep "mount.*$SCRATCH_MNT" | grep -qv grep; do
65                 sleep 1
66         done
67
68         echo "Scrub the filesystem" >>$seqres.full
69         $BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
70         if [ $? -ne 0 ]; then
71                 echo "Scrub find errors in \"$mkfs_opts\" test" | tee -a $seqres.full
72         fi
73
74         # in case the subvolume is still mounted
75         $UMOUNT_PROG $subvol_mnt >/dev/null 2>&1
76         _scratch_unmount
77         # we called _require_scratch_nocheck instead of _require_scratch
78         # do check after test for each profile config
79         _check_scratch_fs
80 }
81
82 echo "Silence is golden"
83 for t in "${_btrfs_profile_configs[@]}"; do
84         run_test "$t"
85 done
86
87 status=0
88 exit