Skip to content
This repository was archived by the owner on Nov 15, 2022. It is now read-only.

Commit 4dd471c

Browse files
arindam-bandyopadhyayyaminikb
authored andcommitted
Archiving the tests results even if the downstream job fails (#21967)
* no downstream failure * adding post test run in all run_test * the test suite will not fail if tests results are not generated
1 parent b1f8320 commit 4dd471c

File tree

14 files changed

+131
-39
lines changed

14 files changed

+131
-39
lines changed

appserver/tests/appserv-tests/devtests/admin/cli/run_test.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ run_test_id(){
6767
check_successful_run
6868
generate_junit_report $1
6969
change_junit_report_class_names
70+
}
71+
72+
post_test_run(){
7073
copy_test_artifects
7174
upload_test_results
7275
delete_bundle
@@ -93,5 +96,6 @@ case $OPT in
9396
list_test_ids )
9497
list_test_ids;;
9598
run_test_id )
99+
trap post_test_run EXIT
96100
run_test_id $TEST_ID ;;
97101
esac

appserver/tests/appserv-tests/devtests/cdi/run_test.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ run_test_id(){
7878
check_successful_run
7979
generate_junit_report $1
8080
change_junit_report_class_names
81+
}
82+
83+
post_test_run(){
8184
copy_test_artifects
8285
upload_test_results
8386
delete_bundle
@@ -96,5 +99,6 @@ case $OPT in
9699
list_test_ids )
97100
list_test_ids;;
98101
run_test_id )
102+
trap post_test_run EXIT
99103
run_test_id $TEST_ID ;;
100104
esac

appserver/tests/appserv-tests/devtests/deployment/run_test.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,13 @@ run_test_id(){
150150
check_successful_run
151151
generate_junit_report_deployment $1
152152
change_junit_report_class_names
153-
copy_test_artifects
154-
upload_test_results
155-
delete_bundle
156-
cd -
153+
}
154+
155+
post_test_run(){
156+
copy_test_artifects
157+
upload_test_results
158+
delete_bundle
159+
cd -
157160
}
158161

159162

@@ -168,6 +171,7 @@ case $OPT in
168171
list_test_ids )
169172
list_test_ids;;
170173
run_test_id )
174+
trap post_test_run EXIT
171175
run_test_id $TEST_ID ;;
172176
esac
173177

appserver/tests/appserv-tests/devtests/ejb/run_test.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,10 +310,13 @@ run_test_id(){
310310
check_successful_run
311311
generate_junit_report $1
312312
change_junit_report_class_names
313+
}
314+
315+
post_test_run(){
313316
copy_test_artifects
314317
upload_test_results
315318
delete_bundle
316-
cd $dname
319+
cd ${dname}
317320
}
318321

319322

@@ -328,5 +331,6 @@ case $OPT in
328331
list_test_ids )
329332
list_test_ids;;
330333
run_test_id )
334+
trap post_test_run EXIT
331335
run_test_id $TEST_ID ;;
332336
esac

appserver/tests/appserv-tests/devtests/security/run_test.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ run_test_id(){
112112
check_successful_run
113113
generate_junit_report $1
114114
change_junit_report_class_names
115+
}
116+
post_test_run(){
115117
copy_test_artifects
116118
upload_test_results
117119
delete_bundle
@@ -129,5 +131,6 @@ case $OPT in
129131
list_test_ids )
130132
list_test_ids;;
131133
run_test_id )
134+
trap post_test_run EXIT
132135
run_test_id $TEST_ID ;;
133136
esac

appserver/tests/appserv-tests/devtests/transaction/ee/run_test.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ run_test_id(){
139139
check_successful_run
140140
generate_junit_report $1
141141
change_junit_report_class_names
142+
}
143+
144+
post_test_run(){
142145
copy_test_artifects
143146
upload_test_results
144147
delete_bundle
@@ -152,6 +155,7 @@ case $OPT in
152155
list_test_ids )
153156
list_test_ids;;
154157
run_test_id )
158+
trap post_test_run EXIT
155159
run_test_id $TEST_ID ;;
156160
esac
157161

appserver/tests/appserv-tests/devtests/web/run_test.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,15 +265,17 @@ run_test_id(){
265265
check_successful_run
266266
generate_junit_report $1
267267
change_junit_report_class_names
268-
copy_test_artifects
269-
upload_test_results
270-
delete_bundle
271-
cd -
272268
}
273269

274270
list_test_ids(){
275271
echo web_all
276272
}
273+
post_test_run(){
274+
copy_test_artifects
275+
upload_test_results
276+
delete_bundle
277+
cd -
278+
}
277279

278280
OPT=$1
279281
TEST_ID=$2
@@ -282,5 +284,6 @@ case $OPT in
282284
list_test_ids )
283285
list_test_ids;;
284286
run_test_id )
287+
trap post_test_run EXIT
285288
run_test_id $TEST_ID ;;
286289
esac

appserver/tests/common_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ copy_test_artifects(){
131131
cp $S1AS_HOME/domains/domain1/logs/server.log* $WORKSPACE/results/ || true
132132
cp $TEST_RUN_LOG $WORKSPACE/results/
133133
cp $WORKSPACE/bundles/version-info.txt $WORKSPACE/results/
134-
cp $APS_HOME/test_results*.* $WORKSPACE/results/
134+
cp $APS_HOME/test_results*.* $WORKSPACE/results/ || true
135135
cp `pwd`/*/*logs.zip $WORKSPACE/results/ || true
136136
cp `pwd`/*/*/*logs.zip $WORKSPACE/results/ || true
137137
}

appserver/tests/copyright/run_test.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,15 @@ run_test_id(){
8282
unzip_test_resources "$WORKSPACE/bundles/main.zip -d main/"
8383
copyright_run
8484
generate_copyright_results
85-
upload_test_results
86-
delete_bundle
8785
}
8886

87+
post_test_run(){
88+
if [[ $? -ne 0 ]]; then
89+
generate_copyright_results
90+
fi
91+
upload_test_results
92+
delete_bundle
93+
}
8994

9095
list_test_ids(){
9196
echo copyright
@@ -98,5 +103,6 @@ case $OPT in
98103
list_test_ids )
99104
list_test_ids;;
100105
run_test_id )
106+
trap post_test_run EXIT
101107
run_test_id $TEST_ID ;;
102108
esac

appserver/tests/cts_smoke/run_test.sh

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,20 @@
3939
# holder.
4040
#
4141

42+
archive_cts(){
43+
cp $WORKSPACE/bundles/version-info.txt $WORKSPACE/results/
44+
cp $TS_HOME/bin/xml/config_vi.log $WORKSPACE/results
45+
cp $TS_HOME/bin/xml/smoke.log $WORKSPACE/results
46+
cp $S1AS_HOME/domains/domain1/logs/server.log* $WORKSPACE/results
47+
cp $TS_HOME/bin/ts.jte $WORKSPACE/results
48+
echo $BUILD_ID > $WORKSPACE/results/count.txt
49+
${GREP} "Number of Tests Passed" $WORKSPACE/results/smoke.log >> $WORKSPACE/results/count.txt
50+
${GREP} "Number of Tests Failed" $WORKSPACE/results/smoke.log >> $WORKSPACE/results/count.txt
51+
${GREP} "Number of Tests with Errors" $WORKSPACE/results/smoke.log >> $WORKSPACE/results/count.txt
52+
cat count.txt | ${SED} -e 's/\[javatest.batch\] Number/Number/g' > $WORKSPACE/results/CTS-GP-count.txt
53+
rm $WORKSPACE/results/count.txt
54+
}
55+
4256
test_run_cts_smoke(){
4357
TS_HOME=$WORKSPACE/javaee-smoke
4458
CTS_SMOKE=http://busgo1208.us.oracle.com/JWSCQE/links/builds/tcks/javaee_cts/8/promoted/
@@ -109,17 +123,14 @@ test_run_cts_smoke(){
109123
kill_process
110124

111125
#ARCHIVING
126+
archive_cts
127+
}
128+
129+
archive_servlet_tck(){
112130
cp $WORKSPACE/bundles/version-info.txt $WORKSPACE/results/
113-
cp $TS_HOME/bin/xml/config_vi.log $WORKSPACE/results
114-
cp $TS_HOME/bin/xml/smoke.log $WORKSPACE/results
115131
cp $S1AS_HOME/domains/domain1/logs/server.log* $WORKSPACE/results
116-
cp $TS_HOME/bin/ts.jte $WORKSPACE/results
117-
echo $BUILD_ID > $WORKSPACE/results/count.txt
118-
${GREP} "Number of Tests Passed" $WORKSPACE/results/smoke.log >> $WORKSPACE/results/count.txt
119-
${GREP} "Number of Tests Failed" $WORKSPACE/results/smoke.log >> $WORKSPACE/results/count.txt
120-
${GREP} "Number of Tests with Errors" $WORKSPACE/results/smoke.log >> $WORKSPACE/results/count.txt
121-
cat count.txt | ${SED} -e 's/\[javatest.batch\] Number/Number/g' > $WORKSPACE/results/CTS-GP-count.txt
122-
rm $WORKSPACE/results/count.txt
132+
cp $WORKSPACE/tests.log $WORKSPACE/results
133+
cp -r $TS_HOME/report/ $WORKSPACE/results
123134
}
124135

125136
test_run_servlet_tck(){
@@ -173,10 +184,7 @@ test_run_servlet_tck(){
173184
kill_process
174185

175186
#ARCHIVING
176-
cp $WORKSPACE/bundles/version-info.txt $WORKSPACE/results/
177-
cp $S1AS_HOME/domains/domain1/logs/server.log* $WORKSPACE/results
178-
cp $WORKSPACE/tests.log $WORKSPACE/results
179-
cp -r $TS_HOME/report/ $WORKSPACE/results
187+
archive_servlet_tck
180188
}
181189

182190
run_test_id(){
@@ -197,6 +205,17 @@ run_test_id(){
197205
exit 1
198206
fi
199207
cts_to_junit $result $WORKSPACE/results/junitreports/test_results_junit.xml $1
208+
}
209+
210+
post_test_run(){
211+
if [[ $? -ne 0 ]]; then
212+
if [[ $TEST_ID = "cts_smoke_all" ]]; then
213+
archive_cts || true
214+
fi
215+
if [[ $TEST_ID = "servlet_tck_all" ]]; then
216+
archive_servlet_tck || true
217+
fi
218+
fi
200219
upload_test_results
201220
delete_bundle
202221
cd -
@@ -252,5 +271,6 @@ case $OPT in
252271
list_test_ids )
253272
list_test_ids;;
254273
run_test_id )
274+
trap post_test_run EXIT
255275
run_test_id $TEST_ID ;;
256276
esac

0 commit comments

Comments
 (0)