@@ -29,6 +29,12 @@ package="${OS_TEST_PACKAGE:-test/integration}"
29
29
name=" $( basename ${package} ) "
30
30
dlv_debug=" ${DLV_DEBUG:- } "
31
31
verbose=" ${VERBOSE:- } "
32
+ junit_report=" ${JUNIT_REPORT:- } "
33
+
34
+ if [[ -n " ${JUNIT_REPORT:- } " ]]; then
35
+ export JUNIT_REPORT_OUTPUT=" ${LOG_DIR} /raw_test_output.log"
36
+ rm -rf " ${JUNIT_REPORT_OUTPUT} "
37
+ fi
32
38
33
39
# CGO must be disabled in order to debug
34
40
if [[ -n " ${dlv_debug} " ]]; then
@@ -61,6 +67,10 @@ function exectest() {
61
67
# run tests with extra verbosity
62
68
out=$( " ${testexec} " -vmodule=* =5 -test.v -test.timeout=4m -test.run=" ^$1 $" " ${@: 2} " 2>&1 )
63
69
result=$?
70
+ elif [[ -n " ${junit_report} " ]]; then
71
+ # run tests and generate jUnit xml
72
+ out=$( " ${testexec} " -test.v -test.timeout=4m -test.run=" ^$1 $" " ${@: 2} " 2> /dev/null | tee -a " ${JUNIT_REPORT_OUTPUT} " )
73
+ result=$?
64
74
else
65
75
# run tests normally
66
76
out=$( " ${testexec} " -test.timeout=4m -test.run=" ^$1 $" " ${@: 2} " 2>&1 )
@@ -96,16 +106,26 @@ loop="${TIMES:-1}"
96
106
# hack/test-integration.sh Template*
97
107
# hack/test-integration.sh "(WatchBuilds|Template)"
98
108
tests=( $( go run " ${OS_ROOT} /hack/listtests.go" -prefix=" ${OS_GO_PACKAGE} /${package} .Test" " ${testexec} " | grep -E " ${1-Test} " ) )
109
+
99
110
# run each test as its own process
100
111
ret=0
112
+ test_result=" ok"
101
113
pushd " ${OS_ROOT} /${package} " & > /dev/null
114
+ test_start_time=$( date +%s%3N)
102
115
for test in " ${tests[@]} " ; do
103
116
for(( i= 0 ;i< ${loop} ;i+= 1 )) ; do
104
117
if ! (exectest " ${test} " ${@: 2} ); then
105
118
ret=1
119
+ test_result=" FAIL"
106
120
fi
107
121
done
108
122
done
123
+ test_end_time=$( date +%s%3N)
124
+ test_duration=$(( test_end_time - test_start_time))
125
+
126
+ echo " ${test_result} github.com/openshift/origin/test/integration $(( test_duration / 1000 )) .$(( test_duration % 1000 )) s" >> " ${JUNIT_REPORT_OUTPUT:-/ dev/ null} "
127
+ os::test::junit::generate_gotest_report
128
+
109
129
popd & > /dev/null
110
130
111
- ENDTIME=$( date +%s) ; echo " $0 took $(( $ ENDTIME - $ STARTTIME)) seconds" ; exit " $ret "
131
+ ENDTIME=$( date +%s) ; echo " $0 took $(( ENDTIME - STARTTIME)) seconds" ; exit " $ret "
0 commit comments