fstests: move test group info to test files
[xfstests-dev.git] / tests / btrfs / 073
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/073
6 #
7 # Run btrfs scrub and remount with different compress algorithms
8 # simultaneously with fsstress running in background.
9 #
10 . ./common/preamble
11 _begin_fstest auto scrub remount compress
12
13 # Import common functions.
14 . ./common/filter
15
16 # real QA test starts here
17 _supported_fs btrfs
18 # we check scratch dev after each loop
19 _require_scratch_nocheck
20 _require_scratch_dev_pool 4
21 _btrfs_get_profile_configs
22
23 run_test()
24 {
25         local mkfs_opts=$1
26
27         echo "Test $mkfs_opts" >>$seqres.full
28
29         _scratch_pool_mkfs $mkfs_opts >>$seqres.full 2>&1
30         # make sure we created btrfs with desired options
31         if [ $? -ne 0 ]; then
32                 echo "mkfs $mkfs_opts failed"
33                 return
34         fi
35         _scratch_mount >>$seqres.full 2>&1
36
37         args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
38         echo "Run fsstress $args" >>$seqres.full
39         $FSSTRESS_PROG $args >/dev/null 2>&1 &
40         fsstress_pid=$!
41
42         echo -n "Start scrub worker: " >>$seqres.full
43         _btrfs_stress_scrub $SCRATCH_MNT >/dev/null 2>&1 &
44         scrub_pid=$!
45         echo "$scrub_pid" >>$seqres.full
46
47         echo -n "Start remount worker: " >>$seqres.full
48         _btrfs_stress_remount_compress $SCRATCH_MNT >/dev/null 2>&1 &
49         remount_pid=$!
50         echo "$remount_pid" >>$seqres.full
51
52         echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
53         wait $fsstress_pid
54         kill $scrub_pid $remount_pid
55         wait
56         # wait for the scrub and remount operations to finish
57         while ps aux | grep "scrub start" | grep -qv grep; do
58                 sleep 1
59         done
60         while ps aux | grep "mount.*$SCRATCH_MNT" | grep -qv grep; do
61                 sleep 1
62         done
63
64         echo "Scrub the filesystem" >>$seqres.full
65         $BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
66         if [ $? -ne 0 ]; then
67                 echo "Scrub find errors in \"$mkfs_opts\" test" | tee -a $seqres.full
68         fi
69
70         _scratch_unmount
71         # we called _require_scratch_nocheck instead of _require_scratch
72         # do check after test for each profile config
73         _check_scratch_fs
74 }
75
76 echo "Silence is golden"
77 for t in "${_btrfs_profile_configs[@]}"; do
78         run_test "$t"
79 done
80
81 status=0
82 exit