This repository has been archived by the owner on Sep 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 82
/
integration-suites.sh
executable file
·129 lines (100 loc) · 3.19 KB
/
integration-suites.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
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/bin/bash
NIMBUS_SRC_REL="`dirname $0`/.."
NIMBUS_SRC=`cd $NIMBUS_SRC_REL; pwd`
NATIVELIB_DIR="$NIMBUS_SRC/lib/native"
JAVA_OPTIONS="-Dorg.newsclub.net.unix.library.path=${NATIVELIB_DIR}"
ALL_TEST_SUITES="basic01 basic02 basic03 basic04 basic05 basic06 basic07 failure01 failure02 spot01 spot02 spot03 spot04 spot05 spot06"
if [ "X" == "X$1" ]; then
echo "Must supply argument: test report directory absolute path"
exit 1
fi
REPORTS_DIR=$1
# remaining arguments are specific tests to run. If unspecified, all will be run.
shift 1
RUN_TEST_SUITES=$@
if [ "X$RUN_TEST_SUITES" = "X" ]; then
RUN_TEST_SUITES=$ALL_TEST_SUITES
fi
if [ -e $REPORTS_DIR ]; then
echo "Directory exists, use a different argument: $REPORTS_DIR"
exit 1
else
echo "Creating reports directory: $REPORTS_DIR"
mkdir $REPORTS_DIR
if [ $? -ne 0 ]; then
echo "Failed to create reports directory: $REPORTS_DIR"
exit 1
fi
fi
THISDIR_REL="`dirname $0`"
THISDIR=`cd $THISDIR_REL; pwd`
ANTFILE="$THISDIR/../service/service/java/tests/suites/build.xml"
BANNER="Nimbus -"
NIMBUS_PRINTNAME="Internal Service Integration Test Suites"
echo ""
echo " *** $BANNER $NIMBUS_PRINTNAME:"
ant -Dnimbussuites.test.reports.dir=$REPORTS_DIR -f $ANTFILE clean depclean
RET=$?
if [ $RET -ne 0 ]; then
echo "PROBLEM: could not clean? exit code $RET - $BANNER $NIMBUS_PRINTNAME"
exit $RET
fi
count=0
error_count=0
possible_count=0
FAILED_SUITES=""
TIMINGS="Timings:\n"
total_time=0
for test_suite in $RUN_TEST_SUITES; do
possible_count=`expr $possible_count + 1`
done
for test_suite in $RUN_TEST_SUITES; do
echo ""
echo ""
echo ""
echo "****************************************************************************"
echo "********************* NIMBUS TEST SUITE ******************************"
echo "****************************************************************************"
echo ""
echo ""
ms_before=`python -c "import time; print int(time.time()*1000)"`
ant ${JAVA_OPTIONS} -Dnimbussuites.test.reports.dir=$REPORTS_DIR -f $ANTFILE $test_suite
RET=$?
if [ $RET -eq 0 ]; then
echo "Test Suite Passed: $test_suite"
count=`expr $count + 1`
else
echo "Test Suite Failed: $test_suite"
error_count=`expr $error_count + 1`
FAILED_SUITES="$test_suite $FAILED_SUITES"
fi
ms_after=`python -c "import time; print int(time.time()*1000)"`
ms_this=`expr $ms_after - $ms_before`
TIMINGS="$TIMINGS - $test_suite: $ms_this ms\n"
total_time=`expr $total_time + $ms_this`
done
# Don't print this every time, mainly because it only uses the key names, not
# the real suite names.
#echo -e $TIMINGS
# Print result and exit with error if any suite failed.
echo -e "\n\n** $BANNER $NIMBUS_PRINTNAME:\n"
echo " - Took $total_time milliseconds."
if [ $possible_count -eq 1 ]; then
echo " - 1 possible test suite."
else
echo " - $possible_count possible test suites."
fi
if [ $count -eq 1 ]; then
echo " - 1 test suite succeeded."
else
echo " - $count test suites succeeded."
fi
if [ $error_count -eq 0 ]; then
echo " - 0 test suites failed."
elif [ $error_count -eq 1 ]; then
echo " - 1 test suite failed: $FAILED_SUITES"
else
echo " - $error_count test suites failed: $FAILED_SUITES"
fi
echo ""
exit $error_count