forked from cooperative-computing-lab/cctools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_all_tests.sh
executable file
·67 lines (58 loc) · 1.54 KB
/
run_all_tests.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
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/sh
if [ ! -r config.mk ]; then
echo "Please run ./configure && make before executing the test script"
exit 1
fi
CCTOOLS_PACKAGES=$(grep CCTOOLS_PACKAGES config.mk | cut -d = -f 2)
if [ -z "$CCTOOLS_TEST_LOG" ]; then
CCTOOLS_TEST_LOG="./cctools.test.log"
fi
#absolute path?
if [ -z "$(echo $CCTOOLS_TEST_LOG | sed -n 's:^/.*$:x:p')" ]; then
CCTOOLS_TEST_LOG="$(pwd)/${CCTOOLS_TEST_LOG}"
fi
export CCTOOLS_TEST_LOG
echo "[$(date)] Testing on $(uname -a)." > "$CCTOOLS_TEST_LOG"
SUCCESS=0
FAILURE=0
START_TIME=$(date +%s)
for package in ${CCTOOLS_PACKAGES}; do
if [ -d "${package}/test" ]; then
cd "${package}/test"
for script in TR_*; do
if [ -x "$script" ]; then
printf "%-72s" "--- Testing ${package}/test/${script} ... "
(
set -e
echo "./${script}" prepare
"./${script}" prepare
set +e
echo "./${script}" run
"./${script}" run
result=$?
set -e
echo "./${script}" clean
"./${script}" clean
exit $result
) >> "$CCTOOLS_TEST_LOG" 2>&1
if [ "$?" -eq 0 ]; then
SUCCESS=$((SUCCESS+1))
echo "success."
echo "=== Test ${package}/test/${script}: success." >> $CCTOOLS_TEST_LOG
else
FAILURE=$((FAILURE+1))
echo "failure."
echo "=== Test ${package}/test/${script}: failure." >> $CCTOOLS_TEST_LOG
fi
fi
done
cd ../..
fi
done
STOP_TIME=$(date +%s)
TOTAL=$((SUCCESS+FAILURE))
ELAPSED=$((STOP_TIME-START_TIME))
echo ""
echo "Test Results: ${FAILURE} of ${TOTAL} tests failed in ${ELAPSED} seconds."
echo ""
# vim: set noexpandtab tabstop=4: