Skip to content

Commit

Permalink
Support container-based tck tests (#5320)
Browse files Browse the repository at this point in the history
- Support container-based tck tests
- currently test is set in special.external for j9 only

Signed-off-by: LongyuZhang <[email protected]>
  • Loading branch information
LongyuZhang authored May 22, 2024
1 parent 05faa63 commit 8e0dc1e
Show file tree
Hide file tree
Showing 10 changed files with 211 additions and 15 deletions.
7 changes: 6 additions & 1 deletion buildenv/jenkins/JenkinsfileBase
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,12 @@ def runTest( ) {
echo "env.DISPLAY is ${env.DISPLAY}"
makeTest("${RUNTEST_CMD}")
}
} else {
} else if (BUILD_LIST.contains('external')) {
sshagent (credentials: ["$params.SSH_AGENT_CREDENTIAL"], ignoreMissing: true) {
makeTest("${RUNTEST_CMD}")
}
}
else {
makeTest("${RUNTEST_CMD}")
}
}
Expand Down
2 changes: 1 addition & 1 deletion external/build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function build_image() {
echo "The test in the build_image() function is ${test}"
# Used for tagging the image
tags="adoptopenjdk-${test}-test:${version}-${package}-${os}-${vm}-${build}"
if [[ "$test" == *"criu"* ]]; then
if [[ "$test" == *"criu"* || "$test" == *"tck"* ]]; then
container_build="sudo podman build"
fi

Expand Down
2 changes: 1 addition & 1 deletion external/common_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ supported_packages="jdk jre"
supported_builds="full"

# Supported tests
supported_tests="external_custom camel criu-functional criu-portable-checkpoint criu-portable-restore criu-ubi-portable-checkpoint criu-ubi-portable-restore derby elasticsearch jacoco jenkins functional-test kafka lucene-solr openliberty-mp-tck payara-mp-tck quarkus quarkus_quickstarts scala system-test tomcat tomee wildfly wycheproof netty spring zookeeper"
supported_tests="external_custom camel criu-functional criu-portable-checkpoint criu-portable-restore criu-ubi-portable-checkpoint criu-ubi-portable-restore derby elasticsearch jacoco jenkins functional-test kafka lucene-solr openliberty-mp-tck payara-mp-tck quarkus quarkus_quickstarts scala system-test tck-ubi-test tomcat tomee wildfly wycheproof netty spring zookeeper"

function check_os() {
os=$1
Expand Down
34 changes: 25 additions & 9 deletions external/dockerfile_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,13 @@ sanitize_test_names() {

print_image_args() {
local file=$1
local os=$2
local version=$3
local vm=$4
local package=$5
local build=$6
local base_docker_registry_dir="$7"
local test=$2
local os=$3
local version=$4
local vm=$5
local package=$6
local build=$7
local base_docker_registry_dir="$8"

image_name="eclipse-temurin"
tag=""
Expand All @@ -93,8 +94,11 @@ print_image_args() {
if [[ "${os}" == "ubuntu" ]]; then
image_name="docker.io/ibm-semeru-runtimes"
tag=open-${tag}
elif [[ "${os}" == *"ubi"* && "${test}" != *"criu"* ]]; then
image_name="registry.access.redhat.com/$base_docker_registry_dir"
tag="latest"
else
# os is ubi
# os is ubi, and test is criu
# temporarily all ubi based testing use internal base image
image_name="$DOCKER_REGISTRY_URL/$base_docker_registry_dir"
tag="latest"
Expand Down Expand Up @@ -163,6 +167,18 @@ print_jdk_install() {
"\n\t BUILD_ID_LAST_SUCCESS=\$(wget -qO- https://openj9-jenkins.osuosl.org/job/Build_JDK11_x86-64_linux_Nightly/lastSuccessfulBuild/buildNumber); \\" \
"\n\t BINARY_URL=\$(wget -qO- https://openj9-jenkins.osuosl.org/job/Build_JDK11_x86-64_linux_Nightly/lastSuccessfulBuild/consoleText | grep -Po \"(?<=Deploying artifact: )https://openj9-artifactory.osuosl.org/artifactory/ci-openj9/Build_JDK11_x86-64_linux_Nightly/\${BUILD_ID_LAST_SUCCESS}/OpenJ9-JDK11-x86-64_linux.*tar.gz\"); \\" \
"\n\t ;; \\" \
"\n\t *aarch64*) \\" \
"\n\t BUILD_ID_LAST_SUCCESS=\$(wget -qO- https://openj9-jenkins.osuosl.org/job/Build_JDK11_aarch64_linux_Nightly/lastSuccessfulBuild/buildNumber); \\" \
"\n\t BINARY_URL=\$(wget -qO- https://openj9-jenkins.osuosl.org/job/Build_JDK11_aarch64_linux_Nightly/lastSuccessfulBuild/consoleText | grep -Po \"(?<=Deploying artifact: )https://openj9-artifactory.osuosl.org/artifactory/ci-openj9/Build_JDK11_aarch64_linux_Nightly/\${BUILD_ID_LAST_SUCCESS}/OpenJ9-JDK11-aarch64_linux.*tar.gz\"); \\" \
"\n\t ;; \\" \
"\n\t *390*) \\" \
"\n\t BUILD_ID_LAST_SUCCESS=\$(wget -qO- https://openj9-jenkins.osuosl.org/job/Build_JDK11_s390x_linux_Nightly/lastSuccessfulBuild/buildNumber); \\" \
"\n\t BINARY_URL=\$(wget -qO- https://openj9-jenkins.osuosl.org/job/Build_JDK11_s390x_linux_Nightly/lastSuccessfulBuild/consoleText | grep -Po \"(?<=Deploying artifact: )https://openj9-artifactory.osuosl.org/artifactory/ci-openj9/Build_JDK11_s390x_linux_Nightly/\${BUILD_ID_LAST_SUCCESS}/OpenJ9-JDK11-s390x_linux.*tar.gz\"); \\" \
"\n\t ;; \\" \
"\n\t *ppc*) \\" \
"\n\t BUILD_ID_LAST_SUCCESS=\$(wget -qO- https://openj9-jenkins.osuosl.org/job/Build_JDK11_ppc64le_linux_Nightly/lastSuccessfulBuild/buildNumber); \\" \
"\n\t BINARY_URL=\$(wget -qO- https://openj9-jenkins.osuosl.org/job/Build_JDK11_ppc64le_linux_Nightly/lastSuccessfulBuild/consoleText | grep -Po \"(?<=Deploying artifact: )https://openj9-artifactory.osuosl.org/artifactory/ci-openj9/Build_JDK11_ppc64le_linux_Nightly/\${BUILD_ID_LAST_SUCCESS}/OpenJ9-JDK11-ppc64le_linux.*tar.gz\"); \\" \
"\n\t ;; \\" \
"\n\t *) \\" \
"\n\t echo \"Unsupported platform \"; \\" \
"\n\t exit 1; \\" \
Expand Down Expand Up @@ -500,7 +516,7 @@ print_clone_project() {
# Cause Test name to be capitalized
test_tag="$(sanitize_test_names ${test} | tr a-z A-Z)_TAG"
git_branch_tag="master"
if [[ "$test_tag" != *"CRIU"* ]]; then
if [[ "$test_tag" != *"CRIU"* && "$test_tag" != *"TCK"* ]]; then
git_branch_tag=$test_tag
fi

Expand Down Expand Up @@ -586,7 +602,7 @@ generate_dockerfile() {
echo -n "Writing ${file} ... "
print_legal ${file};
print_adopt_test ${file} ${test};
print_image_args ${file} ${os} ${version} ${vm} ${package} ${build} "${base_docker_registry_dir}";
print_image_args ${file} ${test} ${os} ${version} ${vm} ${package} ${build} "${base_docker_registry_dir}";
print_result_comment_arg ${file};
print_test_tag_arg ${file} ${test} ${tag_version};
print_${os}_pkg ${file} "${!packages}";
Expand Down
7 changes: 5 additions & 2 deletions external/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ usage () {
echo 'Usage : external.sh --dir TESTDIR --tag DOCKERIMAGE_TAG --version JDK_VERSION --impl JDK_IMPL [--docker_os docker_os][--platform PLATFORM] [--portable portable] [--node_name node_name] [--node_labels node_labels] [--docker_registry_required docker_registry_required] [--docker_registry_url DOCKER_REGISTRY_URL] [--docker_registry_dir DOCKER_REGISTRY_DIR] [--base_docker_registry_url baseDockerRegistryUrl] [--base_docker_registry_dir baseDockerRegistryDir] [--mount_jdk mount_jdk] [--test_root TEST_ROOT] [--reportsrc appReportDir] [--reportdst REPORTDIR] [--testtarget target] [--docker_args EXTRA_DOCKER_ARGS] [--build|--run|--load|--clean]'
}

supported_tests="external_custom aot camel criu-functional criu-portable-checkpoint criu-portable-restore criu-ubi-portable-checkpoint criu-ubi-portable-restore derby elasticsearch jacoco jenkins functional-test kafka lucene-solr openliberty-mp-tck payara-mp-tck quarkus quarkus_quickstarts scala system-test tomcat tomee wildfly wycheproof netty spring"
supported_tests="external_custom aot camel criu-functional criu-portable-checkpoint criu-portable-restore criu-ubi-portable-checkpoint criu-ubi-portable-restore derby elasticsearch jacoco jenkins functional-test kafka lucene-solr openliberty-mp-tck payara-mp-tck quarkus quarkus_quickstarts scala system-test tck-ubi-test tomcat tomee wildfly wycheproof netty spring"

function check_test() {
test=$1
Expand Down Expand Up @@ -98,7 +98,7 @@ parseCommandLineArgs() {
docker_os=ubi
fi

if [[ "${test}" == *"criu"* ]]; then
if [[ "${test}" == *"criu"* || "${test}" == *"tck"* ]]; then
container_run="sudo podman run"
container_login="sudo podman login"
container_inspect="sudo podman inspect"
Expand Down Expand Up @@ -127,6 +127,9 @@ parseCommandLineArgs() {
parse_docker_args $docker_args;
fi;;

"--docker_os" | "-dos" )
docker_os="$1"; shift;;

"--tag" | "-t" )
if [ -z "$1" ]; then
echo "No DOCKERIMAGE_TAG set, tag as default 'nightly'";
Expand Down
70 changes: 70 additions & 0 deletions external/tck-ubi-test/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0"?>
<project name="tck-ubi-test" default="build" basedir=".">
<taskdef resource="net/sf/antcontrib/antlib.xml" />
<description>
Build tck-ubi-test Docker image
</description>
<import file="${TEST_ROOT}/external/build.xml"/>
<import file="${TEST_ROOT}/jck/build.xml"/>

<!-- set properties for this build -->
<property name="TEST" value="tck-ubi-test" />
<property name="DEST" value="${BUILD_ROOT}/external/${TEST}" />
<mkdir dir="${BUILD_ROOT}/external/${TEST}/jck_root"/>
<property name="env.JCK_ROOT" value="${BUILD_ROOT}/external/${TEST}/jck_root/JCK${JDK_VERSION}-unzipped" />
<property name="src" location="." />

<target name="init">
<mkdir dir="${DEST}"/>
</target>

<target name="stage_jck_material" description="stage jck material">
<copy todir="${DEST_EXTERNAL}/${TEST}">
<fileset dir="${TEST_ROOT}/jck/" includes="*.sh"/>
</copy>
<echo message="${DEST_EXTERNAL}/${TEST}/update_git_material.sh ${env.JCK_ROOT} ${env.JCK_GIT_REPO} ${env.JCK_GIT_BRANCH} ${isZOS}" />
<exec executable="bash" failonerror="true">
<arg value="${DEST_EXTERNAL}/${TEST}/update_git_material.sh"/>
<arg value="${env.JCK_ROOT}" />
<arg value="${env.JCK_GIT_REPO}" />
<arg value="${env.JCK_GIT_BRANCH}" />
<arg value="${isZOS}" />
</exec>
</target>

<target name="build_image" depends="move_scripts,clean_image" description="build the image">
<echo message="Executing external.sh --build --dir ${TEST} --tag ${dockerImageTag} --version ${JDK_VERSION} --impl ${JDK_IMPL} --docker_os 'ubi' --platform ${env.SPEC} --base_docker_registry_dir 'ubi9/ubi' --docker_registry_url 'registry.access.redhat.com' --docker_args ${extra_docker_args} " />
<exec executable="bash" failonerror="true">
<arg value="${DEST_EXTERNAL}/external.sh"/>
<arg value="--build"/>
<arg value="--dir"/>
<arg value="${TEST}"/>
<arg value="--tag"/>
<arg value="${dockerImageTag}"/>
<arg value="--version"/>
<arg value="${JDK_VERSION}"/>
<arg value="--impl"/>
<arg value="${JDK_IMPL}"/>
<arg value="--docker_os"/>
<arg value="ubi"/>
<arg value="--platform"/>
<arg value="${env.SPEC}"/>
<arg value="--base_docker_registry_dir"/>
<arg value="ubi9/ubi"/>
<arg value="--docker_registry_url"/>
<arg value="registry.access.redhat.com"/>
<arg value="--docker_args"/>
<arg value="${extra_docker_args}"/>
</exec>
</target>

<target name="dist" depends="stage_jck_material,build_image" description="generate the distribution">
<copy todir="${DEST}">
<fileset dir="${src}" includes="*.xml, *.mk"/>
</copy>
</target>

<target name="build">
<antcall target="dist" inheritall="true" />
</target>
</project>
38 changes: 38 additions & 0 deletions external/tck-ubi-test/playlist.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version='1.0' encoding='UTF-8'?>
<!--
# 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
#
# https://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.
-->
<playlist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../TKG/resources/playlist.xsd">
<test>
<testCaseName>tck-ubi-test</testCaseName>
<command> $(TEST_ROOT)$(D)external$(D)external.sh --run --tag "${DOCKERIMAGE_TAG}" --dir tck-ubi-test --testtarget "_testList TESTLIST=jck-runtime-api-javax_annotation" --reportdst $(REPORTDIR) --docker_args "$(EXTRA_DOCKER_ARGS) -v ${BUILD_ROOT}/external/tck-ubi-test/jck_root/JCK${JDK_VERSION}-unzipped:/opt/jck_root/unzipped -v $(TEST_ROOT):/opt/test_root"; \
$(TEST_STATUS); \
$(TEST_ROOT)$(D)external$(D)external.sh --clean --tag "${DOCKERIMAGE_TAG}" --dir tck-ubi-test
</command>
<disables>
<disable>
<comment>Only applicable on xlinux, plinux, alinux, and zlinux atm</comment>
<platform>^((?!(x86-64_linux|ppc64le_linux|aarch64_linux|s390x_linux)).)*$</platform>
</disable>
</disables>
<impls>
<impl>openj9</impl>
</impls>
<levels>
<level>special</level>
</levels>
<groups>
<group>external</group>
</groups>
</test>
</playlist>
8 changes: 8 additions & 0 deletions external/tck-ubi-test/test.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
github_url="https://github.com/adoptium/aqa-tests.git"
test_results="testResults"
gradle_version="5.1"
environment_variable="MODE=java CC=gcc-7 CXX=g++-7"
ubi_packages="git wget perl tzdata openssl ca-certificates fontconfig glibc-langpack-en gzip tar"
ant_version="1.10.5"
ant_contrib_version="1.0b3"
jdk_install="true"
56 changes: 56 additions & 0 deletions external/tck-ubi-test/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#/bin/bash
# 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.
#

source $(dirname "$0")/test_base_functions.sh

MOUNTED_JDK_DIR="/opt/java/openjdk"
New_JDK_DIR="/internaljdk/java/openjdk"
if [ -d "$MOUNTED_JDK_DIR" ]; then
mkdir -p $New_JDK_DIR
cp -r $MOUNTED_JDK_DIR/* $New_JDK_DIR/
export TEST_JDK_HOME=$New_JDK_DIR
echo "TEST_JDK_HOME is : $TEST_JDK_HOME"
else
echo "No JDK found!"
exit 1
fi

echo_setup
unset JDK_VERSION
echo "TEST_JDK_HOME has been reset to $TEST_JDK_HOME, use TKG auto-detect to detect JDK_VERSION and JDK_IMPL."
export AUTO_DETECT=true
export DYNAMIC_COMPILE=false
export BUILD_LIST=jck

export STAGE_JCK_MATERIAL_FROM_GIT=false
mkdir /jck_unzipped
cp -r /opt/jck_root/unzipped/* /jck_unzipped/
export JCK_ROOT=/jck_unzipped
export JCK_ROOT_USED=${JCK_ROOT}
echo "JCK_ROOT in docker is ${JCK_ROOT}"
echo "JCK_ROOT_USED in docker is ${JCK_ROOT_USED}"
export DISPLAY = "unix:0"
echo "DISPLAY in docker is ${DISPLAY}"

set -e
cd /aqa-tests
./get.sh
rm -rf /aqa-tests/jck
cp -R /opt/test_root/jck /aqa-tests/

cd /aqa-tests/TKG
echo "Generating make files and running the target tests"
make compile
make $1
set +e
2 changes: 1 addition & 1 deletion get.sh
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ getVendorTestMaterial() {

if [[ "$dir" =~ "jck" ]]; then
echo "BUILD_LIST is $BUILD_LIST"
if [[ "$BUILD_LIST" =~ "jck" || "$BUILD_LIST" =~ "all" ]]; then
if [[ "$BUILD_LIST" =~ "jck" || "$BUILD_LIST" =~ "external" ||"$BUILD_LIST" =~ "all" ]]; then
echo "Remove existing subdir. $repoURL will be used..."
rm -rf jck
else
Expand Down

0 comments on commit 8e0dc1e

Please sign in to comment.