/
narayana.sh
executable file
·661 lines (557 loc) · 26.2 KB
/
narayana.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
function fatal {
if [[ -z $PROFILE ]]; then
comment_on_pull "Tests failed ($BUILD_URL): $1"
elif [[ $PROFILE == "BLACKTIE" ]]; then
comment_on_pull "$PROFILE profile tests failed on Linux ($BUILD_URL): $1"
else
comment_on_pull "$PROFILE profile tests failed ($BUILD_URL): $1"
fi
echo "$1"
exit 1
}
function get_pull_description {
PULL_NUMBER=$(echo $GIT_BRANCH | awk -F 'pull' '{ print $2 }' | awk -F '/' '{ print $2 }')
if [ "$PULL_NUMBER" != "" ]; then
echo $(curl -ujbosstm-bot:$BOT_PASSWORD -s https://api.github.com/repos/$GIT_ACCOUNT/$GIT_REPO/pulls/$PULL_NUMBER | grep \"body\":)
else
echo ""
fi
}
function init_test_options {
[ $NARAYANA_CURRENT_VERSION ] || NARAYANA_CURRENT_VERSION="5.0.5.Final-SNAPSHOT"
[ $ARQ_PROF ] || ARQ_PROF=arq # IPv4 arquillian profile
[ $IBM_ORB ] || IBM_ORB=0
PULL_DESCRIPTION=$(get_pull_description)
if [[ $PROFILE == "NO_TEST" ]] || [[ $PULL_DESCRIPTION == *NO_TEST* ]]; then
export COMMENT_ON_PULL=""
export AS_BUILD=0 NARAYANA_BUILD=0 NARAYANA_TESTS=0 BLACKTIE=0 XTS_AS_TESTS=0 XTS_TESTS=0 TXF_TESTS=0 txbridge=0
export RTS_AS_TESTS=0 RTS_TESTS=0 JTA_CDI_TESTS=0 QA_TESTS=0 SUN_ORB=0 JAC_ORB=0 JTA_AS_TESTS=0
elif [[ $PROFILE == "MAIN" ]] && [[ ! $PULL_DESCRIPTION == *!MAIN* ]]; then
FINDBUGS=findbugs,
comment_on_pull "Started testing this pull request with MAIN profile: $BUILD_URL"
export AS_BUILD=1 NARAYANA_BUILD=1 NARAYANA_TESTS=1 BLACKTIE=0 XTS_AS_TESTS=0 XTS_TESTS=0 TXF_TESTS=0 txbridge=0
export RTS_AS_TESTS=1 RTS_TESTS=1 JTA_CDI_TESTS=1 QA_TESTS=0 SUN_ORB=0 JAC_ORB=0 JTA_AS_TESTS=1 OSGI_TESTS=1
elif [[ $PROFILE == "XTS" ]] && [[ ! $PULL_DESCRIPTION == *!XTS* ]]; then
comment_on_pull "Started testing this pull request with XTS profile: $BUILD_URL"
export AS_BUILD=1 NARAYANA_BUILD=1 NARAYANA_TESTS=0 BLACKTIE=0 XTS_AS_TESTS=1 XTS_TESTS=1 TXF_TESTS=1 txbridge=1
export RTS_AS_TESTS=0 RTS_TESTS=0 JTA_CDI_TESTS=0 QA_TESTS=0 SUN_ORB=0 JAC_ORB=0 JTA_AS_TESTS=0
elif [[ $PROFILE == "QA_JTA" ]] && [[ ! $PULL_DESCRIPTION == *!QA_JTA* ]]; then
comment_on_pull "Started testing this pull request with QA_JTA profile: $BUILD_URL"
export AS_BUILD=0 NARAYANA_BUILD=1 NARAYANA_TESTS=0 BLACKTIE=0 XTS_AS_TESTS=0 XTS_TESTS=0 TXF_TESTS=0 txbridge=0
export RTS_AS_TESTS=0 RTS_TESTS=0 JTA_CDI_TESTS=0 QA_TESTS=1 SUN_ORB=0 JAC_ORB=1 QA_TARGET=ci-tests-nojts JTA_AS_TESTS=0
elif [[ $PROFILE == "QA_JTS_JACORB" ]] && [[ ! $PULL_DESCRIPTION == *!QA_JTS_JACORB* ]]; then
comment_on_pull "Started testing this pull request with QA_JTS_JACORB profile: $BUILD_URL"
export AS_BUILD=0 NARAYANA_BUILD=1 NARAYANA_TESTS=0 BLACKTIE=0 XTS_AS_TESTS=0 XTS_TESTS=0 TXF_TESTS=0 txbridge=0
export RTS_AS_TESTS=0 RTS_TESTS=0 JTA_CDI_TESTS=0 QA_TESTS=1 SUN_ORB=0 JAC_ORB=1 QA_TARGET=ci-jts-tests JTA_AS_TESTS=0
elif [[ $PROFILE == "QA_JTS_JDKORB" ]] && [[ ! $PULL_DESCRIPTION == *!QA_JTS_JDKORB* ]]; then
comment_on_pull "Started testing this pull request with QA_JTS_JDKORB profile: $BUILD_URL"
export AS_BUILD=0 NARAYANA_BUILD=1 NARAYANA_TESTS=0 BLACKTIE=0 XTS_AS_TESTS=0 XTS_TESTS=0 TXF_TESTS=0 txbridge=0
export RTS_AS_TESTS=0 RTS_TESTS=0 JTA_CDI_TESTS=0 QA_TESTS=1 SUN_ORB=1 JAC_ORB=0 QA_TARGET=ci-jts-tests JTA_AS_TESTS=0
elif [[ $PROFILE == "BLACKTIE" ]] && [[ ! $PULL_DESCRIPTION == *!BLACKTIE* ]]; then
comment_on_pull "Started testing this pull request with BLACKTIE profile on Linux: $BUILD_URL"
export AS_BUILD=1 NARAYANA_BUILD=1 NARAYANA_TESTS=0 BLACKTIE=1 XTS_AS_TESTS=0 XTS_TESTS=0 TXF_TESTS=0 txbridge=0
export RTS_AS_TESTS=0 RTS_TESTS=0 JTA_CDI_TESTS=0 QA_TESTS=0 SUN_ORB=0 JAC_ORB=0 JTA_AS_TESTS=0
elif [[ $PROFILE == "PERF" ]] && [[ ! $PULL_DESCRIPTION == *!PERF* ]]; then
comment_on_pull "Started testing this pull request with PERF profile: $BUILD_URL"
export AS_BUILD=0 NARAYANA_BUILD=1 NARAYANA_TESTS=0 BLACKTIE=0 XTS_AS_TESTS=0 XTS_TESTS=0 TXF_TESTS=0 txbridge=0
export RTS_AS_TESTS=0 RTS_TESTS=0 JTA_CDI_TESTS=0 QA_TESTS=0 SUN_ORB=0 JAC_ORB=0 JTA_AS_TESTS=0 OSGI_TESTS=0 PERF_TESTS=1
elif [[ -z $PROFILE ]]; then
comment_on_pull "Started testing this pull request: $BUILD_URL"
# if the following env variables have not been set initialize them to their defaults
[ $NARAYANA_TESTS ] || NARAYANA_TESTS=1 # run the narayana surefire tests
[ $NARAYANA_BUILD ] || NARAYANA_BUILD=1 # build narayana
[ $AS_BUILD ] || AS_BUILD=1 # git clone and build a fresh copy of the AS
[ $BLACKTIE ] || BLACKTIE=1 # Build BlackTie
[ $OSGI_TESTS ] || OSGI_TESTS=1 # OSGI tests
[ $TXF_TESTS ] || TXF_TESTS=1 # compensations tests
[ $XTS_TESTS ] || XTS_TESTS=1 # XTS tests
[ $XTS_AS_TESTS ] || XTS_AS_TESTS=1 # XTS tests
[ $RTS_AS_TESTS ] || RTS_AS_TESTS=1 # RTS tests
[ $RTS_TESTS ] || RTS_TESTS=1 # REST-AT Test
[ $JTA_CDI_TESTS ] || JTA_CDI_TESTS=1 # JTA CDI Tests
[ $JTA_AS_TESTS ] || JTA_AS_TESTS=1 # JTA AS tests
[ $QA_TESTS ] || QA_TESTS=1 # QA test suite
[ $SUN_ORB ] || SUN_ORB=1 # Run QA test suite against the Sun orb
[ $JAC_ORB ] || JAC_ORB=1 # Run QA test suite against JacORB
[ $txbridge ] || txbridge=1 # bridge tests
[ $PERF_TESTS ] || PERF_TESTS=0 # benchmarks
else
export COMMENT_ON_PULL=""
export AS_BUILD=0 NARAYANA_BUILD=0 NARAYANA_TESTS=0 BLACKTIE=0 XTS_AS_TESTS=0 XTS_TESTS=0 TXF_TESTS=0 txbridge=0
export RTS_AS_TESTS=0 RTS_TESTS=0 JTA_CDI_TESTS=0 QA_TESTS=0 SUN_ORB=0 JAC_ORB=0 JTA_AS_TESTS=0 PERF_TESTS=0 OSGI_TESTS=0
fi
}
function set_ulimit {
ulimit -u $1
ulimit -a
}
function comment_on_pull
{
if [ "$COMMENT_ON_PULL" = "" ]; then return; fi
PULL_NUMBER=$(echo $GIT_BRANCH | awk -F 'pull' '{ print $2 }' | awk -F '/' '{ print $2 }')
if [ "$PULL_NUMBER" != "" ]
then
JSON="{ \"body\": \"$1\" }"
curl -d "$JSON" -ujbosstm-bot:$BOT_PASSWORD https://api.github.com/repos/$GIT_ACCOUNT/$GIT_REPO/issues/$PULL_NUMBER/comments
else
echo "Not a pull request, so not commenting"
fi
}
function check_if_pull_closed
{
PULL_NUMBER=$(echo $GIT_BRANCH | awk -F 'pull' '{ print $2 }' | awk -F '/' '{ print $2 }')
if [ "$PULL_NUMBER" != "" ]
then
curl -ujbosstm-bot:$BOT_PASSWORD -s https://api.github.com/repos/$GIT_ACCOUNT/$GIT_REPO/pulls/$PULL_NUMBER | grep -q "\"state\": \"closed\""
if [ $? -eq 1 ]
then
echo "pull open"
else
echo "pull closed"
exit 0
fi
fi
}
function kill_qa_suite_processes
{
# list java processes including main class
jps -l | while read ln; do
pid=$(echo $ln | cut -f1 -d\ )
main=$(echo $ln | cut -f2 -d\ )
killit=0
# see if any of the passed in java main patterns match the main class name of the java process
for pat in $*; do
[[ $main == ${pat}* ]] && killit=1
done
if [[ $killit == 1 ]]; then
echo "Test suite process $pid still running - terminating it with signal 9"
kill -9 $pid
fi
done
}
#BUILD NARAYANA WITH FINDBUGS
function build_narayana {
echo "Building Narayana"
cd $WORKSPACE
[ $NARAYANA_TESTS = 1 ] && NARAYANA_ARGS= || NARAYANA_ARGS="-DskipTests"
if [ $IBM_ORB = 1 ]; then
ORBARG="-Dibmorb-enabled -Djacorb-disabled -Didlj-disabled"
${JAVA_HOME}/bin/java -version 2>&1 | grep IBM
[ $? = 0 ] || fatal "You must use the IBM jdk to build with ibmorb"
fi
./build.sh -P${FINDBUGS}release,community$OBJECT_STORE_PROFILE $ORBARG "$@" $NARAYANA_ARGS $IPV6_OPTS clean install
[ $? = 0 ] || fatal "narayana build failed"
return 0
}
function build_as {
echo "Building AS"
cd ${WORKSPACE}
if [ -d jboss-as ]; then
echo "Updating existing checkout of AS7"
cd jboss-as
git remote | grep upstream
if [ $? -ne 0 ]; then
git remote add upstream https://github.com/wildfly/wildfly.git
fi
#Abort any partially complete rebase
git rebase --abort
git checkout 5_BRANCH
[ $? = 0 ] || fatal "git checkout 5_BRANCH failed"
git fetch
[ $? = 0 ] || fatal "git fetch https://github.com/jbosstm/jboss-as.git failed"
git reset --hard jbosstm/5_BRANCH
[ $? = 0 ] || fatal "git reset 5_BRANCH failed"
git clean -f -d -x
[ $? > 1 ] || fatal "git clean failed"
git rebase --abort
rm -rf .git/rebase-apply
else
echo "First time checkout of AS7"
git clone https://github.com/jbosstm/jboss-as.git -o jbosstm
[ $? = 0 ] || fatal "git clone https://github.com/jbosstm/jboss-as.git failed"
cd jboss-as
git remote add upstream https://github.com/wildfly/wildfly.git
fi
[ -z "$AS_BRANCH" ] || git fetch jbosstm +refs/pull/*/head:refs/remotes/jbosstm/pull/*/head
[ $? = 0 ] || fatal "git fetch of pulls failed"
[ -z "$AS_BRANCH" ] || git checkout $AS_BRANCH
[ $? = 0 ] || fatal "git fetch of pull branch failed"
git fetch upstream
echo "This is the JBoss-AS commit"
echo $(git rev-parse upstream/master)
git pull --rebase --ff-only upstream master
[ $? = 0 ] || fatal "git rebase failed"
WILDFLY_VERSION_FROM_JBOSS_AS=`awk "/wildfly-parent/ {getline;print;}" pom.xml | cut -d \< -f 2|cut -d \> -f 2`
echo "AS version is ${WILDFLY_VERSION_FROM_JBOSS_AS}"
[ ${WILDFLY_MASTER_VERSION} == ${WILDFLY_VERSION_FROM_JBOSS_AS} ] || fatal "Need to upgrade the jboss-as.version in the narayana pom.xml to ${WILDFLY_VRESION_FROM_JBOSS_AS}"
export MAVEN_OPTS="$MAVEN_OPTS -XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC"
JAVA_OPTS="$JAVA_OPTS -Xms1303m -Xmx1303m -XX:MaxPermSize=512m" ./build.sh clean install -DskipTests -Dts.smoke=false $IPV6_OPTS -Drelease=true
[ $? = 0 ] || fatal "AS build failed"
#Enable remote debugger
echo JAVA_OPTS='"$JAVA_OPTS -agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n"' >> ./build/target/wildfly-${WILDFLY_MASTER_VERSION}/bin/standalone.conf
init_jboss_home
}
function init_jboss_home {
cd $WORKSPACE
JBOSS_HOME=${WORKSPACE}/jboss-as/build/target/wildfly-${WILDFLY_MASTER_VERSION}
export JBOSS_HOME=`echo $JBOSS_HOME`
[ -d $JBOSS_HOME ] || fatal "missing AS - $JBOSS_HOME is not a directory"
echo "JBOSS_HOME=$JBOSS_HOME"
cp ${JBOSS_HOME}/docs/examples/configs/standalone-xts.xml ${JBOSS_HOME}/standalone/configuration
cp ${JBOSS_HOME}/docs/examples/configs/standalone-rts.xml ${JBOSS_HOME}/standalone/configuration
}
function osgi_tests {
echo "#-1. OSGI Test"
cd ${WORKSPACE}
./build.sh -f osgi/jta/pom.xml -Parq-karaf-embedded clean test
[ $? = 0 ] || fatal "OSGI Test failed"
}
function xts_as_tests {
echo "#-1. XTS AS Integration Test"
cd ${WORKSPACE}/jboss-as
./build.sh -f ./testsuite/integration/xts/pom.xml -Pxts.integration.tests.profile "$@" test
[ $? = 0 ] || fatal "XTS AS Integration Test failed"
cd ${WORKSPACE}
}
function rts_as_tests {
echo "#-1. RTS AS Integration Test"
cd ${WORKSPACE}/jboss-as
./build.sh -f ./testsuite/integration/rts/pom.xml -Prts.integration.tests.profile "$@" test
[ $? = 0 ] || fatal "RTS AS Integration Test failed"
cd ${WORKSPACE}
}
function jta_as_tests {
echo "#-1. JTA AS Integration Test"
cp ArjunaJTA/jta/src/test/resources/standalone-cmr.xml ${JBOSS_HOME}/standalone/configuration/
MAVEN_OPTS="-XX:MaxPermSize=512m -Xms1303m -Xmx1303m" ./build.sh -f ./ArjunaJTA/jta/pom.xml -Parq "$@" test
[ $? = 0 ] || fatal "JTA AS Integration Test failed"
cd ${WORKSPACE}
}
function rts_tests {
echo "#0. REST-AT Integration Test"
./build.sh -f ./rts/at/integration/pom.xml -P$ARQ_PROF "$@" test
[ $? = 0 ] || fatal "REST-AT Integration Test failed"
echo "#0. REST-AT To JTA Bridge Test"
./build.sh -f ./rts/at/bridge/pom.xml -P$ARQ_PROF "$@" test
[ $? = 0 ] || fatal "REST-AT To JTA Bridge Test failed"
}
function blacktie {
echo "#0. BlackTie"
ulimit -c unlimited
if [ -z "${JBOSSAS_IP_ADDR+x}" ]; then
echo JBOSSAS_IP_ADDR not set
JBOSSAS_IP_ADDR=localhost
fi
# KILL ANY PREVIOUS BUILD REMNANTS
ps -f
for i in `ps -eaf | grep java | grep "standalone.*xml" | grep -v grep | cut -c10-15`; do kill -9 $i; done
pkill -9 memcheck # pkill arg is a pattern (cf killall -r)
pkill -9 testsuite
pkill -9 server
pkill -9 client
pkill -9 cs
ps -f
# FOR DEBUGGING SUBSEQUENT ISSUES
free -m
echo "Building Blacktie Subsystem"
cd ${WORKSPACE}
./build.sh -f blacktie/wildfly-blacktie/pom.xml clean install "$@"
[ $? = 0 ] || fatal "Blacktie Subsystem build failed"
rm -rf ${WORKSPACE}/blacktie/wildfly-${WILDFLY_MASTER_VERSION}
cp -rp ${WORKSPACE}/jboss-as/build/target/wildfly-${WILDFLY_MASTER_VERSION} -d $PWD/blacktie
[ $? = 0 ] || fatal "Could not unzip wildfly"
unzip ${WORKSPACE}/blacktie/wildfly-blacktie/build/target/wildfly-blacktie-build-5.0.5.Final-SNAPSHOT-bin.zip -d $PWD/blacktie/wildfly-${WILDFLY_MASTER_VERSION}
[ $? = 0 ] || fatal "Could not unzip blacktie into widfly"
# INITIALIZE JBOSS
ant -f blacktie/scripts/hudson/initializeJBoss.xml -DJBOSS_HOME=$WORKSPACE/blacktie/wildfly-${WILDFLY_MASTER_VERSION} initializeJBoss
if [ "$?" != "0" ]; then
fatal "Failed to init JBoss: $BUILD_URL"
fi
chmod u+x $WORKSPACE/blacktie/wildfly-${WILDFLY_MASTER_VERSION}/bin/standalone.sh
if [[ $# == 0 || $# > 0 && "$1" != "-DskipTests" ]]; then
# START JBOSS
JBOSS_HOME=`pwd`/blacktie/wildfly-${WILDFLY_MASTER_VERSION} JAVA_OPTS="$JAVA_OPTS -Xmx256m -XX:MaxPermSize=256m" blacktie/wildfly-${WILDFLY_MASTER_VERSION}/bin/standalone.sh -c standalone-blacktie.xml -Djboss.bind.address=$JBOSSAS_IP_ADDR -Djboss.bind.address.unsecure=$JBOSSAS_IP_ADDR -Djboss.bind.address.management=$JBOSSAS_IP_ADDR&
sleep 5
fi
# BUILD BLACKTIE
./build.sh -f blacktie/pom.xml clean install -Djbossas.ip.addr=$JBOSSAS_IP_ADDR "$@"
if [ "$?" != "0" ]; then
ps -f
for i in `ps -eaf | grep java | grep "standalone.*xml" | grep -v grep | cut -c10-15`; do kill -9 $i; done
pkill -9 testsuite
pkill -9 server
pkill -9 client
pkill -9 cs
ps -f
fatal "Some tests failed: $BUILD_URL"
fi
# KILL ANY BUILD REMNANTS
ps -f
for i in `ps -eaf | grep java | grep "standalone.*xml" | grep -v grep | cut -c10-15`; do kill -9 $i; done
pkill -9 testsuite
pkill -9 server
pkill -9 client
pkill -9 cs
ps -f
[ $? = 0 ] || fatal "BlackTie build failed: $BUILD_URL"
}
function jta_cdi_tests {
echo "#0. JTA CDI Tests"
./build.sh -f ./ArjunaJTA/cdi/pom.xml -P$ARQ_PROF "$@" test
[ $? = 0 ] || fatal "JTA CDI Test failed"
}
function compensations_tests {
echo "#0. compensations Test"
cp ./rts/at/webservice/target/restat-web-*.war $JBOSS_HOME/standalone/deployments
./build.sh -f ./txframework/pom.xml -P$ARQ_PROF "$@" test
[ $? = 0 ] || fatal "txframework build failed"
./build.sh -f ./txframework/pom.xml -P$ARQ_PROF-distributed "$@" test
[ $? = 0 ] || fatal "txframework build failed"
./build.sh -f ./compensations/pom.xml -P$ARQ_PROF "$@" test
[ $? = 0 ] || fatal "compensations build failed"
./build.sh -f ./compensations/pom.xml -P$ARQ_PROF-distributed "$@" test
[ $? = 0 ] || fatal "compensations build failed"
}
function xts_tests {
echo "#1 XTS: WSTX11 INTEROP, UNIT TESTS, xtstest and CRASH RECOVERY TESTS"
cd $WORKSPACE
ran_crt=1
set_ulimit 2048
if [ $WSTX_MODULES ]; then
[[ $WSTX_MODULES = *crash-recovery-tests* ]] || ran_crt=0
echo "BUILDING SPECIFIC WSTX11 modules"
./build.sh -f XTS/localjunit/pom.xml --projects "$WSTX_MODULES" -P$ARQ_PROF "$@" $IPV6_OPTS -Dorg.jboss.remoting-jmx.timeout=300 clean install "$@"
else
./build.sh -f XTS/localjunit/pom.xml -P$ARQ_PROF "$@" $IPV6_OPTS -Dorg.jboss.remoting-jmx.timeout=300 clean install "$@"
fi
[ $? = 0 ] || fatal "XTS: SOME TESTS failed"
if [ $ran_crt = 1 ]; then
if [[ $# == 0 || $# > 0 && "$1" != "-DskipTests" ]]; then
(cd XTS/localjunit/crash-recovery-tests && java -cp target/classes/ com.arjuna.qa.simplifylogs.SimplifyLogs ./target/log/ ./target/log-simplified)
[ $? = 0 ] || fatal "Simplify CRASH RECOVERY logs failed"
fi
fi
}
function tx_bridge_tests {
echo "XTS: TXBRIDGE TESTS update conf"
cd $WORKSPACE
CONF="${JBOSS_HOME}/standalone/configuration/standalone-xts.xml"
grep recovery-listener "$CONF"
sed -e s/recovery-listener=\"true\"//g -i $CONF
sed -e "s#\(recovery-environment\) \(socket-binding\)#\\1 recovery-listener=\"true\" \\2#" -i $CONF
# sed -e "s#\(recovery-environment\) \(socket-binding\)#\\1 recovery-listener=\"true\" \\2#" -i $CONF
[ $? = 0 ] || fatal "#3.TXBRIDGE TESTS: sed failed"
echo "XTS: TXBRIDGE TESTS"
./build.sh -f txbridge/pom.xml -P$ARQ_PROF "$@" $IPV6_OPTS install "$@"
[ $? = 0 ] || fatal "#3.TXBRIDGE TESTS failed"
}
function enable_qa_trace {
cat << 'EOF' > $WORKSPACE/qa/dist/${NARAYANA_VERSION}/etc/log4j.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out"/>
<param name="Threshold" value="TRACE"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ABSOLUTE} {%8.8t} (%x) [%-5p,%-10c{1}] %m%n"/>
</layout>
</appender>
<appender name="file" class="org.apache.log4j.FileAppender">
<param name="File" value="logs/test.log"/>
<param name="Append" value="false"/>
<param name="Threshold" value="TRACE"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d [%t] %p - %m%n"/>
</layout>
</appender>
<category name="com.arjuna">
<level value="TRACE"/>
<appender-ref ref="console"/>
<appender-ref ref="file"/>
</category>
</log4j:configuration>
EOF
}
function add_qa_xargs {
NXT=$(grep "NEXT_COMMAND_LINE_ARG=" TaskImpl.properties)
[ $? = 0 ] || return 1
let i=$(echo $NXT | sed 's/^.*[^0-9]\([0-9]*\).*$/\1/')
XARGS=
IFS=' ' read -ra ADDR <<< "$1"
for j in "${ADDR[@]}"; do
XARGS="${XARGS}\nCOMMAND_LINE_$i=$j"
let i=i+1
done
sed -i "s/NEXT_COMMAND_LINE_ARG=.*$/${XARGS}/" TaskImpl.properties
}
function qa_tests_once {
echo "QA Test Suite $@"
cd $WORKSPACE/qa
unset orb
codeCoverage=false;
# look for an argument of the form orb=<something>
for i in $@; do
[ ${i%%=*} = "orb" ] && orb=${i##*=}
[ $i = "-PcodeCoverage" ] && codeCoverage=true
done
git checkout TaskImpl.properties
# check to see which orb we are running against:
if [ x$orb = x"idlj" ]; then
orbtype=idlj
elif [ x$orb = x"ibmorb" ]; then
orbtype=ibmorb
sed -i TaskImpl.properties -e "s#^ dist# ${JAVA_HOME}\${file.separator}jre\${file.separator}lib\${file.separator}ibmorb.jar\\\\\\n \${path.separator}${JAVA_HOME}\${file.separator}jre\${file.separator}lib\${file.separator}ibmorb.jar\\\\\\n \${path.separator}dist#"
else
orbtype=jacorb
fi
testoutputzip="testoutput-${orbtype}.zip"
sed -i TaskImpl.properties -e "s#^COMMAND_LINE_0=.*#COMMAND_LINE_0=${JAVA_HOME}/bin/java#"
[ $? = 0 ] || fatal "sed TaskImpl.properties failed"
if [[ x"$EXTRA_QA_SYSTEM_PROPERTIES" != "x" ]]; then
add_qa_xargs "$EXTRA_QA_SYSTEM_PROPERTIES"
fi
# delete lines containing jacorb
[ $orbtype != "jacorb" ] && sed -i TaskImpl.properties -e '/^.*separator}jacorb/ d'
# if the env variable MFACTOR is set then set the bean property CoreEnvironmentBean.timeoutFactor
if [[ -n "$MFACTOR" ]] ; then
sed -i TaskImpl.properties -e "s/COMMAND_LINE_12=-DCoreEnvironmentBean.timeoutFactor=[0-9]*/COMMAND_LINE_12=-DCoreEnvironmentBean.timeoutFactor=${MFACTOR}/"
# Note that setting the timeout too high (eg 2*240) will cause the defaulttimeout test cases to take
# longer than the Task kill timeout period
let txtimeout=$MFACTOR*120
sed -i TaskImpl.properties -e "s/COMMAND_LINE_13=-DCoordinatorEnvironmentBean.defaultTimeout=[0-9]*/COMMAND_LINE_13=-DCoordinatorEnvironmentBean.defaultTimeout=${txtimeout}/"
fi
# if IPV6_OPTS is not set get the jdbc drivers (we do not run the jdbc tests in IPv6 mode)
[ -z "${IPV6_OPTS+x}" ] && ant -Dorbtype=$orbtype "$QA_BUILD_ARGS" get.drivers dist ||
ant -Dorbtype=$orbtype "$QA_BUILD_ARGS" dist
[ $? = 0 ] || fatal "qa build failed"
if [ $orbtype = "jacorb" ]; then
sed -i dist/narayana-full-${NARAYANA_CURRENT_VERSION}/jacorb/etc/jacorb.properties -e "s#^jacorb.log.default.verbosity=.*#jacorb.log.default.verbosity=2#"
sed -i dist/narayana-full-${NARAYANA_CURRENT_VERSION}/jacorb/etc/jacorb.properties -e "s#^jacorb.poa.thread_pool_max=.*#jacorb.poa.thread_pool_max=100#"
sed -i dist/narayana-full-${NARAYANA_CURRENT_VERSION}/jacorb/etc/jacorb.properties -e "s#^jacorb.poa.thread_pool_min=.*#jacorb.poa.thread_pool_min=40#"
fi
if [[ $# == 0 || $# > 0 && "$1" != "-DskipTests" ]]; then
# determine which QA test target to call
target="ci-tests" # the default is to run everything (ci-tests)
# if IPV6_OPTS is set then do not do the jdbc tests (ie run target junit-testsuite)
[ -z "${IPV6_OPTS+x}" ] || target="junit"
# if called with the sun or ibm orbs then only run the jtsremote tests
[ $orbtype != "jacorb" ] && target="ci-jts-tests"
# QA_TARGET overrides the previous settings
[ x$QA_TARGET = x ] || target=$QA_TARGET # the caller can force the build to run a specific target
# run the ant target (QA_TESTMETHODS is a list of method names in QA_TESTGROUP to be executed)
[ $QA_TRACE ] && enable_qa_trace
[ $QA_TESTMETHODS ] || QA_TESTMETHODS=""
if [ "x$QA_TESTGROUP" != "x" ]; then
if [[ -n "$QA_STRESS" ]] ; then
ok=0
for i in `seq 1 $QA_STRESS`; do
echo run $i;
ant -f run-tests.xml -Dtest.name=$QA_TESTGROUP -Dtest.methods="$QA_TESTMETHODS" onetest -Dcode.coverage=$codeCoverage;
if [ $? -ne 0 ]; then
ok=1; break;
fi
done
else
ant -f run-tests.xml -Dtest.name=$QA_TESTGROUP -Dtest.methods="$QA_TESTMETHODS" onetest -Dcode.coverage=$codeCoverage;
ok=$?
fi
else
ant -f run-tests.xml $target $QA_PROFILE -Dcode.coverage=$codeCoverage
ok=$?
fi
if [ -f TEST-failures.txt ]; then
echo "Test Failures:"
cat TEST-failures.txt
fi
if [ $codeCoverage = true ]; then
echo "generating test coverage report"
ant -f run-tests.xml jacoco-report
fi
# archive the jtsremote test output (use a name related to the orb that was used for the tests)
mv TEST-*.txt testoutput 2>/dev/null
ant -f run-tests.xml testoutput.zip -Dtestoutput.zipname=$testoutputzip
return $ok
fi
return 0
}
function qa_tests {
ok1=0;
ok2=0;
ok3=0;
if [ $IBM_ORB = 1 ]; then
qa_tests_once "orb=ibmorb" "$@" # run qa against the Sun orb
ok3=$?
else
if [ $SUN_ORB = 1 ]; then
qa_tests_once "orb=idlj" "$@" # run qa against the Sun orb
ok2=$?
fi
if [ $JAC_ORB = 1 ]; then
qa_tests_once "orb=jacorb" "$@" # run qa against the default orb
ok1=$?
fi
fi
[ $ok1 = 0 ] || echo some jacorb QA tests failed
[ $ok2 = 0 ] || echo some Sun ORB QA tests failed
[ $ok3 = 0 ] || echo some IBM ORB QA tests failed
[ $ok1 = 0 -a $ok2 = 0 -a $ok3 = 0 ] || fatal "some qa tests failed"
}
function perf_tests {
$WORKSPACE/scripts/hudson/benchmark.sh "$@"
res=$?
PERF_OUTPUT=$(cat $WORKSPACE/benchmark-output.txt | sed ':a;N;$!ba;s/\n/\\n/g')
grep -q improvement $WORKSPACE/benchmark-output.txt
if [ $? = 1 ]; then
PERF_OUTPUT="$PERF_OUTPUT\n\n*If the purpose of this PR is to improve performance then there has been insufficient improvement to warrant a pass. See the previous text for the threshold (range) for passing optimization related PRs%"
fi
PERF_OUTPUT="Benchmark output (please refer to the article https://developer.jboss.org/wiki/PerformanceGatesForAcceptingPerformanceFixesInNarayana for information on our testing procedures:\n$PERF_OUTPUT"
comment_on_pull "$PERF_OUTPUT" "$BUILD_URL"
[ $res = 0 ] || fatal "there were regressions in one or more of the benchmarks (see previous PR comment for details"
}
check_if_pull_closed
init_test_options
# if QA_BUILD_ARGS is unset then get the db drivers form the file system otherwise get them from the
# default location (see build.xml). Note ${var+x} substitutes null for the parameter if var is undefined
[ -z "${QA_BUILD_ARGS+x}" ] && QA_BUILD_ARGS="-Ddriver.url=file:///home/hudson/dbdrivers"
# Note: set QA_TARGET if you want to override the QA test ant target
# for IPv6 testing use export ARQ_PROF=arqIPv6
# if you don't want to run all the XTS tests set WSTX_MODULES to the ones you want, eg:
# export WSTX_MODULES="WSAS,WSCF,WSTX,WS-C,WS-T,xtstest,crash-recovery-tests"
[ -z "${WORKSPACE}" ] && fatal "UNSET WORKSPACE"
#[ -z "${WILDFLY_MASTER_VERSION}" ] && fatal "UNSET WILDFLY_MASTER_VERSION"
# INFER WILDFLY_MASTER_VERSION from pom.xml
WILDFLY_MASTER_VERSION=`grep 'jboss-as.version' pom.xml | cut -d \< -f 2|cut -d \> -f 2`
echo "SET WILDFLY_MASTER_VERSION=${WILDFLY_MASTER_VERSION}"
# FOR DEBUGGING SUBSEQUENT ISSUES
free -m
#Make sure no JBoss processes running
for i in `ps -eaf | grep java | grep "standalone.*.xml" | grep -v grep | cut -c10-15`; do kill -9 $i; done
#Make sure no processes from a previous test suite run is still running
MainClassPatterns="org.jboss.jbossts.qa com.arjuna.ats.arjuna.recovery.RecoveryManager"
kill_qa_suite_processes $MainClassPatterns
# if we are building with IPv6 tell ant about it
export ANT_OPTS="$ANT_OPTS $IPV6_OPTS"
# run the job
[ $NARAYANA_BUILD = 1 ] && build_narayana "$@"
[ $AS_BUILD = 1 ] && build_as "$@"
[ $BLACKTIE = 1 ] && blacktie "$@"
[ $OSGI_TESTS = 1 ] && osgi_tests "$@"
[ $JTA_CDI_TESTS = 1 ] && jta_cdi_tests "$@"
[ $XTS_AS_TESTS = 1 ] && xts_as_tests
[ $RTS_AS_TESTS = 1 ] && rts_as_tests
[ $JTA_AS_TESTS = 1 ] && jta_as_tests
[ $TXF_TESTS = 1 ] && compensations_tests "$@"
[ $XTS_TESTS = 1 ] && xts_tests "$@"
[ $txbridge = 1 ] && tx_bridge_tests "$@"
[ $RTS_TESTS = 1 ] && rts_tests "$@"
[ $QA_TESTS = 1 ] && qa_tests "$@"
[ $PERF_TESTS = 1 ] && perf_tests "$@"
if [[ -z $PROFILE ]]; then
comment_on_pull "All tests passed - Job complete $BUILD_URL"
elif [[ $PROFILE == "BLACKTIE" ]]; then
comment_on_pull "$PROFILE profile tests passed on Linux - Job complete $BUILD_URL"
else
comment_on_pull "$PROFILE profile tests passed - Job complete $BUILD_URL"
fi
exit 0 # any failure would have resulted in fatal being called which exits with a value of 1