fstests: move test group info to test files
[xfstests-dev.git] / tests / generic / 390
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test 999
6 #
7 # Multi-threads freeze/unfreeze testing. This's a stress test case,
8 # it won't do functional check.
9 #
10 . ./common/preamble
11 _begin_fstest auto freeze stress
12
13 # Override the default cleanup function.
14 _cleanup()
15 {
16         cd /
17         # Make sure $SCRATCH_MNT is unfreezed
18         xfs_freeze -u $SCRATCH_MNT 2>/dev/null
19         rm -f $tmp.*
20 }
21
22 # Import common functions.
23 . ./common/filter
24
25 # real QA test starts here
26 echo "Silence is golden"
27
28 # Modify as appropriate.
29 _supported_fs generic
30 _require_scratch
31 _require_freeze
32 _require_test_program "feature"
33
34 _scratch_mkfs >>$seqres.full 2>&1
35 # We don't want to freeze/unfreeze root fs if mount scratch dev failed
36 _scratch_mount
37
38 num_cpus=`$here/src/feature -o`
39
40 # Start fsstress in background
41 procs=$num_cpus
42 if [ $procs -gt 20 ]; then
43         procs=20
44 elif [ $procs -le 1 ]; then
45         procs=2
46 fi
47 nops=1000
48 stress_dir="$SCRATCH_MNT/fsstress_test_dir"
49 mkdir "$stress_dir"
50 fsstress_args=`_scale_fsstress_args -d $stress_dir -p $procs -n $nops $FSSTRESS_AVOID`
51 $FSSTRESS_PROG $fsstress_args >>$seqres.full 2>&1 &
52 fsstress_pid=$!
53
54 # Start multi-threads freeze/unfreeze
55 for ((i=0; i<$procs; i++)); do
56         while kill -0 $fsstress_pid 2>/dev/null; do
57                 xfs_freeze -f $SCRATCH_MNT 2>/dev/null
58                 xfs_freeze -u $SCRATCH_MNT 2>/dev/null
59         done &
60         freeze_pids="$! $freeze_pids"
61 done
62
63 wait $fsstress_pid
64 result=$?
65 wait $freeze_pids
66
67 # Exit with fsstress return value
68 status=$result
69 exit