blob: 81555079cb3ae79728d382528e5f2da0afe903b6 (
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
|
#!/bin/bash
# Copyright (C) 2009 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
iterations=150
failures=0
i=0
LOGDIR="$HOME/backup_tests"
LOGFILE="$LOGDIR/backup_stress.`date +%s`.log"
export BUGREPORT_DIR="$LOGDIR/bugreports"
# make sure that we have a place to put logs and bugreports
mkdir -p $LOGDIR $BUGREPORT_DIR
echo "logfile is $LOGFILE"
(while (sleep 10); do
failed=0
echo
echo "Iteration $i at `date`"
echo
./test_backup.sh "$@" 2>&1
sleep 10
echo "Restore at `date`"
echo
./test_restore.sh "$@" 2>&1 || failed=1
if [ "$failed" -ne 0 ]; then
failures=$(($failures+1))
# Long and verbose so it sticks out
echo "FAILED iteration $i of $iterations; $failures failures so far"
echo "FAILED iteration $i of $iterations; $failures failures so far" > /dev/stderr
else
printf "Iteration %d:\tPASS; remaining: %d\n" $i $(($iterations - $i - 1))
printf "Iteration %d:\tPASS; remaining: %d\n" $i $(($iterations - $i - 1)) > /dev/stderr
fi
echo "End $i at `date`"
i=$(($i+1))
if [ $i -eq $iterations ]; then
echo "DONE: $iterations iterations with $failures failures."
echo "DONE: $iterations iterations with $failures failures." > /dev/stderr
[ "$failures" -eq 0 ] && exit 0
exit 1
fi
done) > "$LOGFILE"
|