forked from junit-team/junit4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_tests.sh
executable file
·55 lines (46 loc) · 909 Bytes
/
build_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
set -e
function TEST_get_junit_version {
version=$(get_junit_version)
if [[ ! ($version == 4.*) ]]; then
echo "Bad version: $version"
return 1
fi
}
function TEST_ant_dist {
version=$(get_junit_version)
ant dist
ls junit${version}/junit-${version}.jar
}
function TEST_ant_profile {
rm -rf java.hprof.txt
ant profile
ls java.hprof.txt
}
function get_junit_version {
ant print.version | grep echo | sed 's/.*echo..\([1-9].*\)/\1/'
}
SCRIPT_NAME=$0
function get_tests() {
part1=function
part2=TEST_
grep "$part1 $part2" $SCRIPT_NAME | sed 's/.*\(TEST_[A-Za-z0-9_]*\).*/\1/'
}
function run_tests() {
local exit_code=0
for t in $(get_tests); do
echo "RUNNING: $t"
if "$t"; then
echo "PASSED: $t"
else
echo "FAILED: $t"
return 1
fi
done
}
if run_tests; then
echo "ALL TESTS PASSED"
exit 0
else
echo "A TEST FAILED"
exit 1
fi