Debian Codegraph @

tests/backup/backup_stress_test.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2
3 # Copyright (C) 2009 The Android Open Source Project
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 iterations=150
18 failures=0
19 i=0
20 LOGDIR="$HOME/backup_tests"
21 LOGFILE="$LOGDIR/backup_stress.`datescip-shell system . . date. +%s`.log"
22 export BUGREPORT_DIR="$LOGDIR/bugreports"
23
24 # make sure that we have a place to put logs and bugreports
25 mkdirscip-shell system . . mkdir. -p $LOGDIR $BUGREPORT_DIR
26
27 echoscip-shell system . . echo. "logfile is $LOGFILE"
28
29 (while (sleepscip-shell system . . sleep. 10); do
30 failed=0
31
32 echoscip-shell system . . echo.
33 echoscip-shell system . . echo. "Iteration $i at `datescip-shell system . . date.`"
34 echoscip-shell system . . echo.
35
36 ./test_backup.sh "$@" 2>&1
37
38 sleepscip-shell system . . sleep. 10
39 echoscip-shell system . . echo. "Restore at `datescip-shell system . . date.`"
40 echoscip-shell system . . echo.
41
42 ./test_restore.sh "$@" 2>&1 || failed=1
43
44 if [scip-shell system . . `[`. "$failed" -ne 0 ]; then
45 failures=$(($failures+1))
46 # Long and verbose so it sticks out
47 echoscip-shell system . . echo. "FAILED iteration $i of $iterations; $failures failures so far"
48 echoscip-shell system . . echo. "FAILED iteration $i of $iterations; $failures failures so far" > /dev/stderrscip-shell filesystem . . `/dev/stderr`.
49 else
50 printfscip-shell system . . printf. "Iteration %d:\tPASS; remaining: %d\n" $i $(($iterations - $i - 1))
51 printfscip-shell system . . printf. "Iteration %d:\tPASS; remaining: %d\n" $i $(($iterations - $i - 1)) > /dev/stderrscip-shell filesystem . . `/dev/stderr`.
52 fi
53
54 echoscip-shell system . . echo. "End $i at `datescip-shell system . . date.`"
55
56 i=$(($i+1))
57 if [scip-shell system . . `[`. $i -eq $iterations ]; then
58 echoscip-shell system . . echo. "DONE: $iterations iterations with $failures failures."
59 echoscip-shell system . . echo. "DONE: $iterations iterations with $failures failures." > /dev/stderrscip-shell filesystem . . `/dev/stderr`.
60 [scip-shell system . . `[`. "$failures" -eq 0 ] && exit 0
61 exit 1
62 fi
63 done) > "$LOGFILE"
64