Skip to content

Commit

Permalink
Remove old class path entries. Allow a single test to be executed.
Browse files Browse the repository at this point in the history
Signed-off-by: James R. Perkins <[email protected]>
  • Loading branch information
jamezp committed Oct 24, 2023
1 parent 7b42c57 commit 5a33793
Show file tree
Hide file tree
Showing 4 changed files with 164 additions and 20 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
----
69 changes: 49 additions & 20 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 @@ -23,7 +34,7 @@ addToClassPath() {

createDir() {
if [ ! -d "${1}" ]; then
mkdir -p "${1}"
mkdir -p -v "${1}"
fi
}

Expand All @@ -37,12 +48,19 @@ logDebug() {
fi
}

TEST_INFO="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 +78,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 +97,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,12 +142,9 @@ 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}"
Expand All @@ -132,9 +163,6 @@ 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
jck.concurrency.concurrency=3
Expand All @@ -148,26 +176,27 @@ 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.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
jck.env.testPlatform.local=Yes
jck.env.testPlatform.multiJVM=No
jck.env.testPlatform.multiJVM=Yes
jck.env.jaxb.classes.needJaxbClasses=No
jck.excludeList.customFiles=${TCK_HOME}/lib/jaxb_tck40.jtx
jck.excludeList.excludeListType=custom
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
jck.env.jaxb.schemagen.run.jxcCmd=/bin/sh ${TCK_HOME}/linux/bin/schemagen.sh
jck.env.jaxb.xsd_compiler.testCompile.xjcCmd=/bin/sh ${TCK_HOME}/linux/bin/xjc.sh
" > "${TCK_HOME}"/default_configuration.jti

Expand All @@ -181,12 +210,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
45 changes: 45 additions & 0 deletions jakarta-xml-binding/logging.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#
# JBoss, Home of Professional Open Source.
#
# Copyright 2023 Red Hat, Inc., and individual contributors
# as indicated by the @author tags.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# Additional logger names to configure (root logger is always configured)
loggers=

# Root logger level
logger.level=DEBUGX

# Root logger handlers
logger.handlers=CONSOLE,FILE

handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler
handler.CONSOLE.formatter=PATTERN
handler.CONSOLE.properties=autoFlush
handler.CONSOLE.autoFlush=true

# File handler configuration
handler.FILE=org.jboss.logmanager.handlers.FileHandler
handler.FILE.properties=autoFlush,append,fileName
handler.FILE.autoFlush=true
handler.FILE.fileName=${log.mode:unknown}-test.log
handler.FILE.formatter=PATTERN
handler.FILE.append=true

# Formatter pattern configuration
formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter
formatter.PATTERN.properties=pattern
formatter.PATTERN.pattern=[%#{log.mode}] %d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n

0 comments on commit 5a33793

Please sign in to comment.