summaryrefslogtreecommitdiff
path: root/tests/generic/051
blob: afde8e26e7270082c3605d473750ea51dd6f2f07 (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
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2013 Red Hat, Inc.  All Rights Reserved.
#
# FS QA Test No. 051
#
# Basic log recovery stress test - do lots of stuff, shut down in the middle of
# it and check that recovery runs to completion and everything can be
# successfully removed afterwards..
#
. ./common/preamble
_begin_fstest shutdown auto stress log metadata repair

# Import common functions.
. ./common/filter

# Override the default cleanup function.
_cleanup()
{
	cd /
	_scratch_unmount 2>/dev/null
	rm -f $tmp.*
}

# real QA test starts here
_supported_fs generic

_require_scratch
_require_scratch_shutdown
_require_command "$KILLALL_PROG" killall

_scratch_mkfs > $seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_scratch_mount

SLEEP_TIME=$((30 * $TIME_FACTOR))
PROCS=$((2 * LOAD_FACTOR))

load_dir=$SCRATCH_MNT/test

# let this run for a while
$FSSTRESS_PROG $FSSTRESS_AVOID -n10000000 -p $PROCS -d $load_dir >> $seqres.full 2>&1 &
sleep $SLEEP_TIME
$KILLALL_PROG -q $FSSTRESS_PROG
wait
sync
_scratch_unmount

# now mount again, run the load again, this time with a shutdown.
_scratch_mount
$XFS_FSR_PROG -v $load_dir >> $seqres.full 2>&1
$FSSTRESS_PROG -n10000000 -p $PROCS -d $load_dir >> $seqres.full 2>&1 &
sleep $SLEEP_TIME
sync

# now shutdown and unmount
sleep 5
_scratch_shutdown
$KILLALL_PROG -q $FSSTRESS_PROG
wait

# for some reason fsstress processes manage to live on beyond the wait?
sleep 5
_scratch_unmount

# now recover, check the filesystem for consistency
_scratch_mount
_scratch_unmount
_check_scratch_fs

# now clean up.
_scratch_mount
for d in $load_dir/*; do
        rm -rf $d > /dev/null 2>&1 &
done
wait
_scratch_unmount

echo "No output is good. Failures are loud."

status=0
exit