forked from distributed-system-analysis/pbench
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-unittests
executable file
·60 lines (46 loc) · 1.16 KB
/
run-unittests
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
#!/bin/bash
dir=$(dirname $0)
let sts=0
function tail_and_wait {
pid=$1
name=$2
file=$3
printf -- "+++ ${name} Unit Tests +++\n\n"
tail -n 9999999 -f ${file} --pid ${pid}
if [[ $? -ne 0 ]]; then
printf -- "tail -f ${file} --pid ${pid} failed\n" >&2
return 1
fi
wait ${pid}
let tw_sts=$?
if [[ $tw_sts -ne 0 ]]; then
status="FAILED"
else
status="SUCCEEDED"
fi
rm -f ${file}
printf -- "\n--- ${name} Unit Tests ($status) ---\n"
return $tw_sts
}
trap "kill -KILL -$$ > /dev/null 2>&1" INT TERM QUIT
> /var/tmp/agent.out
$dir/agent/run-unittests > /var/tmp/agent.out 2>&1 < /dev/null &
apid=$!
> /var/tmp/server.out
$dir/server/bin/unittests > /var/tmp/server.out 2>&1 < /dev/null &
spid=$!
> /var/tmp/dashboard.out
$dir/web-server/v0.4/unittests > /var/tmp/dashboard.out 2>&1 < /dev/null &
dpid=$!
tail_and_wait $apid 'Agent' /var/tmp/agent.out
let sts=sts+$?
printf -- "\n\n\n"
tail_and_wait $spid 'Server' /var/tmp/server.out
let sts=sts+$?
printf -- "\n\n\n"
tail_and_wait $dpid 'Dashboard' /var/tmp/dashboard.out
let sts=sts+$?
if [ $sts -gt 0 ]; then
echo "Unit tests FAILED"
fi
exit $sts