generic: convert tests to SPDX license tags
[xfstests-dev.git] / tests / generic / 461
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2013 Red Hat, Inc.  All Rights Reserved.
4 # Copyright (c) 2017 Google, Inc.  All Rights Reserved.
5 #
6 # FS QA Test No. 461
7 #
8 # Shutdown stress test - exercise shutdown codepath with fsstress,
9 # make sure we don't BUG/WARN. Coverage for all fs with shutdown.
10 #
11 seq=`basename $0`
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
14
15 here=`pwd`
16 tmp=/tmp/$$
17 status=1        # failure is the default!
18
19 # get standard environment, filters and checks
20 . ./common/rc
21 . ./common/filter
22
23 _cleanup()
24 {
25         cd /
26         _scratch_unmount 2>/dev/null
27         rm -f $tmp.*
28 }
29 trap "_cleanup; exit \$status" 0 1 2 3 15
30
31 # real QA test starts here
32 _supported_fs generic
33 _supported_os Linux
34
35 _require_scratch_nocheck
36 _require_scratch_shutdown
37 _require_command "$KILLALL_PROG" killall
38
39 rm -f $seqres.full
40
41 _scratch_mkfs > $seqres.full 2>&1
42 _scratch_mount
43
44 SLEEP_TIME=$((10 * $TIME_FACTOR))
45 PROCS=$((4 * LOAD_FACTOR))
46
47 load_dir=$SCRATCH_MNT/test
48
49 $FSSTRESS_PROG $FSSTRESS_AVOID -n10000000 -p $PROCS -d $load_dir >> $seqres.full 2>&1 &
50 sleep $SLEEP_TIME
51 sync
52
53 # now shutdown and unmount
54 sleep 5
55 _scratch_shutdown
56 $KILLALL_PROG -q $FSSTRESS_PROG
57 wait
58
59 # for some reason fsstress processes manage to live on beyond the wait?
60 sleep 5
61
62 _scratch_unmount
63
64 echo "Silence is golden"
65
66 status=0
67 exit