Skip to content

Commit

Permalink
Merge pull request #115 from jamezp/update-jakarta-xml-binding
Browse files Browse the repository at this point in the history
Remove old class path entries. Allow a single test to be executed.
  • Loading branch information
bstansberry authored Oct 26, 2023
2 parents 7b42c57 + 3108c1d commit 246f4b5
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 18 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/jakarta-xml-binding-tck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# This is a basic workflow that is manually triggered

name: Jakarta XML Binding TCK with WildFly

# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
#push:
# branches-ignore:
# - 'dependabot/**'
#pull_request:
# branches:
# - '**'
# paths:
# - 'jakarta-xml-binding/**'
#schedule:
# - cron: '0 0 * * *' # Every day at 00:00 UTC
workflow_dispatch:

# Only run the latest job
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
jakarta-xml-binding-tck:
# The type of runner that the job will run on
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
java: ['11']

# Runner steps
steps:
- uses: actions/checkout@v4
- name: Setup Java JDK
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: 'maven'
- name: Build with Maven Java ${{ matrix.java }} on WildFly
run: |
cd jakarta-xml-binding
WORK_DIR="$(readlink -m .)"
echo "${WORK_DIR}"
WORK_DIR="${WORK_DIR}" ./bin/run-tck.sh -v
- uses: actions/upload-artifact@v3
if: failure()
with:
name: test-reports-${{ matrix.java }}
path: |
'**/reports/'
'**/logs/'
12 changes: 12 additions & 0 deletions jakarta-xml-binding/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,15 @@ pass the version of Java you want to use. The following are a list of the curren
----
javaenv 17
----

=== Running a Single Test

You can run a single test by passing the `-t` parameter. This can be a specific test like
`xml_schema/msData/datatypes/Facets/Schemas/jaxb/IDREFS_length006_395.html\#IDREFS_length006_395`, group of tests
like `xml_schema/msData/datatypes/Facets/Schemas/jaxb/IDREFS_length006_395.html` or a directory of tests like
`xml_schema/msData/datatypes/Facets/Schemas/jaxb/`.

.Example
----
JBOSS_HOME="${HOME}/wildfly-28.0.0.Beta1-SNAPSHOT" ./bin/run-tck.sh -t xml_schema/msData/datatypes/Facets/Schemas/jaxb/IDREFS_length006_395.html\#IDREFS_length006_395
----
81 changes: 63 additions & 18 deletions jakarta-xml-binding/bin/run-tck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ verbose=false
setupOnly=false

# Functions
printArgHelp() {
echo -e "${1}\t${2}"
}

printHelp() {
echo "Starts a container to execute the Jakarta XML Binding 4.0 TCK."
echo "Usage: JBOSS_HOME=/path/to/container ${0##*/}"
printArgHelp "-s" "Does the setup only and exits."
printArgHelp "-t" "Execute a single test. Example; xml_schema/msData/datatypes/Facets/Schemas/jaxb/IDREFS_length006_395.html\#IDREFS_length006_395"
printArgHelp "-v" "Prints verbose messages."
}

fail() {
echo "${1}"
Expand All @@ -21,9 +32,10 @@ addToClassPath() {
fi
}

# shellcheck disable=SC2086
createDir() {
if [ ! -d "${1}" ]; then
mkdir -p "${1}"
mkdir -p ${verboseArgs} "${1}"
fi
}

Expand All @@ -37,12 +49,20 @@ logDebug() {
fi
}

TEST_INFO="jck.keywords.keywords.mode=expr
jck.tests.needTests=No
jck.tests.tests="

# Parse incoming parameters
while getopts ":sv" opt; do
while getopts ":st:v" opt; do
case "${opt}" in
s)
setupOnly=true
;;
t)
TEST_INFO="jck.tests.needTests=Yes
jck.tests.tests=${OPTARG}"
;;
v)
verbose=true
;;
Expand All @@ -60,6 +80,12 @@ done

shift $((OPTIND - 1))

TCK_VERSION="4.0.0"
verboseArgs="";
if [ ${verbose} == true ]; then
verboseArgs="-v"
fi

# Set the default directory for the base TCK home
if [ -z "${WORK_DIR}" ]; then
WORK_DIR="/tmp/jakarta-xml-bind"
Expand All @@ -73,22 +99,32 @@ if [ -d "${WORK_DIR}/work_directory" ]; then
rm -rf "${WORK_DIR}/work_directory"
fi

cd "${WORK_DIR}"

if [ -z "${JBOSS_HOME}" ]; then
# Does wildfly.zip exist in the WORK_DIR?
WILDFLY_ZIP="${HOME}/wildfly.zip"
if [ ! -f "${WILDFLY_ZIP}" ]; then
fail "The WildFly zip ${WILDFLY_ZIP} does not exist"
# Download wildfly
wget ${verboseArgs} https://ci.wildfly.org/guestAuth/repository/download/WF_Nightly/latest.lastSuccessful/wildfly-latest-SNAPSHOT.zip -O wildfly-latest.zip
unzip wildfly-latest.zip
rm -rf ${verboseArgs} wildfly*-src.zip wildfly-latest.zip
logDebug "Unzipping ${WILDFLY_ZIP} to ${WORK_DIR}"
unzip -o -q -d "${WORK_DIR}" wildfly-*.zip
rm -rfv wildfly-*.zip
else
logDebug "Unzipping ${WILDFLY_ZIP} to ${WORK_DIR}"
unzip -o -q -d "${WORK_DIR}" "${WILDFLY_ZIP}"
fi
unzip -o -q -d "${WORK_DIR}" "${WILDFLY_ZIP}"
JBOSS_HOME="$(readlink -m "${WORK_DIR}"/wildfly-*)"
fi

# If the TCK does not exist, download it required and unzip it
if [ ! -d "${TCK_HOME}" ]; then
# Download the TCK if it does not already exist
TCK_ZIP="${WORK_DIR}/jakarta-xml-binding-tck-4.0.0.zip"
TCK_ZIP="${WORK_DIR}/jakarta-xml-binding-tck-${TCK_VERSION}.zip"
if [ ! -f "${TCK_ZIP}" ]; then
wget -O "${TCK_ZIP}" https://download.eclipse.org/jakartaee/xml-binding/4.0/jakarta-xml-binding-tck-4.0.0.zip
wget -O "${TCK_ZIP}" https://download.eclipse.org/jakartaee/xml-binding/4.0/jakarta-xml-binding-tck-${TCK_VERSION}.zip
fi
logDebug "Unzipping ${TCK_ZIP} to ${WORK_DIR}"
unzip -o -q -d "${WORK_DIR}" "${TCK_ZIP}"
Expand All @@ -108,23 +144,33 @@ BASE_MODULE_DIR="${JBOSS_HOME}/modules/system/layers/base"
# JAXB API
TCK_CLASS_PATH=""
addToClassPath "${BASE_MODULE_DIR}/jakarta/xml/bind/api/main/"
# Legacy implementation module
addToClassPath "${BASE_MODULE_DIR}/com/sun/xml/bind/main/"
# New implementation module
addToClassPath "${BASE_MODULE_DIR}/org/glassfish/jaxb/main/"
addToClassPath "${BASE_MODULE_DIR}/org/apache/xerces/main/"
addToClassPath "${BASE_MODULE_DIR}/jakarta/activation/api/main"
addToClassPath "${BASE_MODULE_DIR}/org/eclipse/angus/activation/main"
# Required for the com.sun.tools.jxc.SchemaGenerator. The options look for -cp or -classpath passed to the entry point.
# However, the TCK runner does not pass that argument so it falls back to the CLASSPATH environment variable.
CLASSPATH="${TCK_CLASS_PATH}"
export CLASSPATH

cd "${TCK_HOME}"

logDebug "Setup JAXB_HOME"
JAXB_HOME="${WORK_DIR}/jaxb-home"
if [ -d "${JAXB_HOME}" ]; then
rm -rf ${verboseArgs} "${JAXB_HOME}"
fi
createDir "${JAXB_HOME}"
for f in $(echo "${CLASSPATH}" | tr ':' '\n')
do
cp ${verboseArgs} "${f}" "${JAXB_HOME}"
done
export JAXB_HOME

echo ""
echo "JAVA_HOME: ${JAVA_HOME}"
echo "JBOSS_HOME: ${JBOSS_HOME}"
echo "TCK_HOME: ${TCK_HOME}"
echo "JAXB_HOME ${JAXB_HOME}"
echo "CLASSPATH ${CLASSPATH}"

# ensure agent isn't already running
Expand All @@ -133,10 +179,11 @@ killAgent
# Prepares configuration file
echo "
INTERVIEW=com.sun.jaxb_tck.interview.JAXBTCKParameters
LOCALE=cs_CZ
QUESTION=jck.epilog
TESTSUITE=${TCK_HOME}
WORKDIR=${TCK_HOME}/work_directory
DESCRIPTION=WildFly Jakarta XML Binding TCK Runner
NAME=jaxb40_wildfly
jck.concurrency.concurrency=3
jck.env.description=JAXB 4.0 TCK for WildFly
jck.env.envName=jaxb40_wildfly
Expand All @@ -147,8 +194,8 @@ jck.env.jaxb.agent.useAgentPortDefault=Yes
jck.env.jaxb.schemagen.run.schemagenWrapperClass=com.sun.jaxb_tck.lib.SchemaGen
jck.env.jaxb.schemagen.skipJ2XOptional=Yes
jck.env.jaxb.testExecute.cmdAsFile=${JAVA_HOME}/bin/java
jck.env.jaxb.testExecute.otherEnvVars=JBOSS_HOME\=${JBOSS_HOME} JAXB_HOME\=${TCK_HOME}/client JAVA_HOME\=${JAVA_HOME}
jck.env.jaxb.testExecute.otherOpts=-Xmx512m -Xms256m ${CLASSPATH}
jck.env.jaxb.testExecute.otherEnvVars=JAXB_HOME\=${JAXB_HOME} JAVA_HOME\=${JAVA_HOME}
jck.env.jaxb.testExecute.otherOpts=-Xmx512m -Xms256m
jck.env.jaxb.xsd_compiler.defaultOperationMode=Yes
jck.env.jaxb.xsd_compiler.run.compilerWrapperClass=com.sun.jaxb_tck.lib.SchemaCompiler
jck.env.jaxb.xsd_compiler.skipValidationOptional=Yes
Expand All @@ -160,12 +207,10 @@ jck.excludeList.latestAutoCheck=No
jck.excludeList.latestAutoCheckInterval=7
jck.excludeList.latestAutoCheckMode=everyXDays
jck.excludeList.needExcludeList=Yes
jck.keywords.keywords.mode=expr
jck.keywords.needKeywords=No
jck.priorStatus.needStatus=No
jck.priorStatus.status=
jck.tests.needTests=No
jck.tests.tests=
${TEST_INFO}
jck.tests.treeOrFile=tree
jck.timeout.timeout=2
Expand All @@ -181,12 +226,12 @@ if [ ${setupOnly} == true ]; then
fi

# Required for signature tests
cd ${TCK_HOME}/tests/api/signaturetest
cd "${TCK_HOME}/tests/api/signaturetest"

# Starts agent
echo "Starting Agent ...."
java -server -Xmx1024m -Xms128m \
-classpath "${TCK_HOME}/lib/javatest.jar:${TCK_HOME}/lib/jtlegacy.jar:${TCK_HOME}/classes:${CLASSPATH}" \
-classpath "${TCK_HOME}/lib/javatest.jar:${TCK_HOME}/classes:${CLASSPATH}" \
-Djava.security.policy="${TCK_HOME}"/lib/tck.policy \
com.sun.javatest.agent.AgentMain \
-passive 1>"${TCK_LOG_DIR}/agent.log" 2>"${TCK_LOG_DIR}/agent-err.log" &
Expand Down

0 comments on commit 246f4b5

Please sign in to comment.