-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathrun.sh
executable file
·180 lines (151 loc) · 6.17 KB
/
run.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
#!/bin/bash
#
# Copyright (c) 2019-2023 Payara Foundation and/or its affiliates. All rights reserved.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0, which is available at
# http://www.eclipse.org/legal/epl-2.0.
#
# This Source Code may also be made available under the following Secondary
# Licenses when the conditions for such availability set forth in the
# Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
# version 2 with the GNU Classpath Exception, which is available at
# https://www.gnu.org/software/classpath/license.html.
#
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
############
# Payara Jakarta EE TCK Runner.
# Any environment customization is marked in commend with prefix (ENV) below.
#
# Usage:
# 1. copy or link tck binary, glassfish binary and payara binary to bundles/ (see BUNDLES below)
# 2. run bundles/run_server.sh
# This starts download server at port 8000
# 3. run ./run.sh <test_bundle>
# 4. swear appropriately to number of failing test cases
# 5. collect failure logs
# 6. adjust test properties in ./ts.override.properties
# BUNDLES
#
# URLs to respective binaries that get downloaded thoughout the process. By default it assumes server
# running off bundles directory that serves on port 80. Any of these variables are overridable
# (ENV) BASE_URL - parent url, assuming binaries called jakartaeetck.zip, latest-glassfish.zip and payara-prerelease.zip
# (ENV) TCK_URL - full url to TCK
# (ENV) GLASSFISH_URL - full url to glassfish
# (ENV) PAYARA_URL - full url to payara
# (ENV) PAYARA_VERSION - version to use maven to retrieve - alternative to PAYARA_URL
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
. $SCRIPTPATH/functions.sh
init_urls
# Since this is multi-step process, there are some environment variables that help when troubleshooting
# (ENV) SKIP_TCK - skips cleaning CTS home and downloading TCK again
export CTS_HOME=$SCRIPTPATH/cts_home
export WORKSPACE=$CTS_HOME/jakartaeetck
echo "Cleaning and installing TCK"
# kill any leftover glassfish/payara instances
pkill -KILL -f glassfish
# check the required ports
echo Checking ports: 8080
ss -tupanr | grep 8080
echo Checking ports: 8181
ss -tupanr | grep 8181
echo Checking ports: 4848
ss -tupanr | grep 4848
if [ -z "$JAVA_HOME" ]; then
export JAVA_HOME=`readlink -f /usr/bin/java | sed "s:\(/jre\)\?/bin/java::"`
fi
echo "Remove trailing / from JAVA_HOME and JDK11_HOME, which causes problems in the TCK script"
JAVA_HOME=$(echo "${JAVA_HOME}" | sed 's:/$::')
JDK11_HOME=$(echo "${JDK11_HOME}" | sed 's:/$::')
if [ -z "$SKIP_TCK" ]; then
# clean cts directory
rm -rf $CTS_HOME/*
# download and unzip TCK
TCK_TEMP=`mktemp --suffix .zip`
echo "Downloading TCK from $TCK_URL"
curl $TCK_URL -o $TCK_TEMP
echo -n "Unzipping TCK to $CTS_HOME... "
unzip -q -d $CTS_HOME $TCK_TEMP
rm $TCK_TEMP
cp $WORKSPACE/bin/ts.jte $CTS_HOME/ts.jte.dist
echo "Done"
# test for https://github.com/eclipse-ee4j/jakartaee-tck/pull/89/
if ! grep -q config.vi.javadb $WORKSPACE/docker/run_jakartaeetck.sh; then
echo "Replacing runner script with patched one"
cp patch/run_jakartaeetck.sh $WORKSPACE/docker/
fi;
# Copy patched ant_sun.jar
echo "Replacing ant_sun.jar with patched one"
cp patch/ant_sun.jar $CTS_HOME/jakartaeetck/lib/ant_sun.jar
fi
# link VI impl
rm -rf $WORKSPACE/bin/xml/impl/payara
ln -s $SCRIPTPATH/cts-impl $WORKSPACE/bin/xml/impl/payara
# patch ts.jte
echo "Patching ts.jte"
apply_overrides
echo "Comparison with ts.jte of original distribution:"
diff $WORKSPACE/bin/ts.jte $CTS_HOME/ts.jte.dist
# run mailserver container
# (ENV) SKIP_MAIL - do not attempt to start mailserver container
if [ -z "$SKIP_MAIL"]; then
JAMES_CONTAINER=`docker ps -f name='james-mail' -q`
if [ -z "$JAMES_CONTAINER" ]; then
echo "Starting email server Docker container"
docker run --name james-mail --rm -d -p 1025:1025 -p 1143:1143 --entrypoint=/bin/bash jakartaee/cts-mailserver:0.1 -c /root/startup.sh
sleep 10
echo "Initializing container"
docker exec -it james-mail /bin/bash -c /root/create_users.sh
fi
fi
if [ "$1" == "jaxr" ]; then
JWSDP_CONTAINER=`docker ps -f name='jwsdp' -q`
if [ -z "$JWSDP_CONTAINER" ]; then
echo "Starting JWSDP Docker container"
docker run --name jwsdp --rm -d -p 8280:8080 --entrypoint=/bin/bash jakartaee/cts-base:0.1 /opt/jwsdp-1.3/bin/catalina.sh run
fi
export UDDI_REGISTRY_URL="http://localhost:8280/RegistryServer/"
fi
# run testcase
# Set the env to run against payara
export PROFILE=$PROFILE
export LANG="en_US.UTF-8"
export GF_BUNDLE_URL=$GLASSFISH_URL
export DATABASE=JavaDB
export GF_VI_BUNDLE_URL=$PAYARA_URL
export PAYARA_VERSION=$PAYARA_VERSION
export GF_VI_TOPLEVEL_DIR=payara5
export DERBY_PATH=./bundles/javadb.zip
export EJBTIMER_DERBY_SQL_PATH=./bundles/ejbtimer_derby.sql
export JSR352_DERBY_SQL_PATH=./bundles/jsr352-derby.sql
TEST_SUITE=`echo "$1" | tr '/' '_'`
# (ENV) SKIP_TEST - if just testing the script
if [ -z "$SKIP_TEST" ]; then
echo "Environment"
printenv
echo "Starting test!"
time bash -x $SCRIPTPATH/jakartaeetck.sh "$@" |& tee $CTS_HOME/$TEST_SUITE.log
./asadmin stop-domain
# print Payara log
echo "***********************************"
echo "* Payara LOGS *"
echo "***********************************"
cat $CTS_HOME/vi/${GF_VI_TOPLEVEL_DIR}/glassfish/domains/domain1/logs/server.log
echo "***********************************"
echo "* End of Payara LOGS *"
echo "***********************************"
fi
# collect results
summary=$CTS_HOME/jakartaeetck-report/${TEST_SUITE}/text/summary.txt
ALL=`wc -l $summary`
NOT_PASS=`cat $summary | grep -v Passed. | wc -l`
echo "Not passed: ${NOT_PASS}/${ALL}"
./slim_report.sh $WORKSPACE/$TEST_SUITE-results.tar.gz
TIMESTAMP=`date -Iminutes | tr -d :`
TARGET=$SCRIPTPATH/results/$TEST_SUITE-$TIMESTAMP
mkdir -p $TARGET
mv $WORKSPACE/$TEST_SUITE-results.slim.tar.gz $TARGET
cp $WORKSPACE/results/junitreports/*.xml $TARGET
cp $summary $TARGET
echo "Not passed: ${NOT_PASS}/${ALL}" > $TARGET/count.txt
make_stage_log $1 $TEST_SUITE $USER_KEYWORDS