forked from diem/move
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_quarantined.sh
executable file
·54 lines (46 loc) · 1 KB
/
run_quarantined.sh
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
#!/bin/bash
# Copyright (c) The Diem Core Contributors
# SPDX-License-Identifier: Apache-2.0
crate=
retries=
shouldfail=false
usage() {
echo -r number of times to retry
echo -f fail of the script does not succeed at least once
echo -c crates to run
}
while getopts 'fr:c:' OPTION; do
case "$OPTION" in
f)
shouldfail=true
;;
r)
retries=$OPTARG
;;
c)
crate="$OPTARG"
;;
?)
usage
exit 1
;;
esac
done
if ! [[ "$retries" =~ ^[0-9]+$ ]]; then usage; exit 1; fi
if [ -z "$crate" ]; then usage; exti 1; fi
if [[ "$shouldfail" == false ]]; then echo command will never fail; fi
count=0
success=-1
RUST_BACKTRACE=1
while [ $count -lt $retries ] && [ $success -ne 0 ]
do
cargo xtest --package $crate && success=0
count=$(( $count + 1 ))
done
if [ "$success" -eq "0" ] || [ "$shouldfail" == false ]; then
echo Crates: $crate succeeded after $count executions.
exit 0;
else
echo Crates: $crate failed after $count executions.
exit 1;
fi