blob: 38648d84fde770771f0290353a32c10041945f58 (
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
83
84
85
86
87
88
89
90
91
92
93
|
#!/bin/bash
source ./test_env
FBCODE="$HOME/fbsource/fbcode"
N=0
HOSTS=$(smcc ls-hosts -s gluster.build.ash gluster.build.prn | xargs)
TESTS=$DESIRED_TESTS
FLAKY=$KNOWN_FLAKY_TESTS
FLAGS=""
function print_env {
echo "Settings:"
echo "FBCODE=$FBCODE"
echo "N=$N"
echo -e "-------\nHOSTS\n$HOSTS\n-------"
echo -e "TESTS\n$TESTS\n-------"
echo -e "FLAKY\n$FLAKY\n-------"
}
function cleanup {
rm -f /tmp/test-*.log
}
function usage {
echo "Usage: $0 [-h or --help] [-v or --verbose]
[--fbcode <fbcode root>]
[--valgrind] [--asan] [--asan-noleaks]
[--hosts <hosts>] [--smc-tier <tier name>] [-n <parallelism>]
[--tests <tests>] [--flaky <tests>]
"
}
function tiers_to_hosts {
hosts=""
for t in $1; do
hosts="$hosts $(smcc ls-hosts -s $t | xargs)"
done
echo $hosts
}
function parse_args () {
args=`getopt \
-o hvn: \
--long help,verbose,valgrind,asan,asan-noleaks,fbcode:,hosts:,smc-tier:,tests:,flaky: \
-n 'fb-remote-test.sh' -- "$@"`
if [ $? != 0 ]; then
echo "Error parsing getopt"
exit 1
fi
eval set -- "$args"
while true; do
case "$1" in
-h | --help) usage ; exit 1 ;;
--fbcode) FBCODE=$2 ; shift 2 ;;
-v | --verbose) FLAGS="$FLAGS -v" ; shift ;;
--valgrind) FLAGS="$FLAGS --valgrind" ; shift ;;
--asan-noleaks) FLAGS="$FLAGS --asan-noleaks"; shift ;;
--asan) FLAGS="$FLAGS --asan" ; shift ;;
--hosts) HOSTS=$2; shift 2 ;;
--smc-tier) HOSTS=$(tiers_to_hosts $2) ; shift 2 ;;
--tests) TESTS=$2; shift 2 ;;
--flaky) FLAKY=$2; shift 2 ;;
-n) N=$2; shift 2 ;;
*) break ;;
esac
done
run_tests_args="$@"
}
function main {
parse_args "$@"
if [ ! -d "$FBCODE" ]; then
echo "fbcode does not exists. Please checkout fbcode"
return 1
fi
print_env
cleanup
"$FBCODE/storage/gluster/gluster-build/fb-gluster-test.py" $FLAGS --tester \
--n "$N" --hosts "$HOSTS" --tests "$TESTS" --flaky_tests "$FLAKY"
exit $?
}
main "$@"
|