Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add aot-portable test #3923

Merged
merged 1 commit into from
Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions external/aot/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0"?>
<project name="aot" default="build" basedir=".">
<taskdef resource="net/sf/antcontrib/antlib.xml" />
<description>
Build aot Test
</description>
<import file="${TEST_ROOT}/external/build.xml"/>

<!-- set properties for this build -->
<property name="TEST" value="aot" />
<property name="DEST" value="${BUILD_ROOT}/external/${TEST}" />
<property name="src" location="." />

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

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

<target name="build">
<antcall target="dist" inheritall="true" />
</target>
</project>
32 changes: 32 additions & 0 deletions external/aot/playlist.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?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/playlist.xsd">
<test>
<testCaseName>aot_test</testCaseName>
<command> $(TEST_ROOT)$(D)external$(D)external.sh --load --tag "${DOCKERIMAGE_TAG}" --dir aot --portable "true" --mount_jdk "false" --platform "${PLATFORM}" --node_name "${NODE_NAME}" --node_labels "${NODE_LABELS}" --test_root "$(TEST_ROOT)" --reportdst $(REPORTDIR) --docker_args "-v /var/run/docker.sock:/var/run/docker.sock $(EXTRA_DOCKER_ARGS)"; \
$(TEST_STATUS); \
$(TEST_ROOT)$(D)external$(D)external.sh --clean --tag "${DOCKERIMAGE_TAG}" --dir aot --platform "${PLATFORM}" --node_labels "${NODE_LABELS}"
</command>
<features>
<feature>AOT:applicable</feature>
</features>
<levels>
<level>sanity</level>
</levels>
<groups>
<group>external</group>
</groups>
</test>
</playlist>
27 changes: 27 additions & 0 deletions external/aot/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#/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.
#

set -e
echo "Testing AOT"
aot_failure_msg="AOT header validation failed"
java -Xjit:verbose -version >output 2>&1
fail_count=$(grep "$aot_failure_msg" output)
if [ -z "$fail_count" ]; then
echo "Test Passed!"
else
cat output
echo -e "\nError: $aot_failure_msg"
exit 1
fi
set +e
2 changes: 1 addition & 1 deletion external/criu-portable-checkpoint/playlist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<playlist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../TKG/playlist.xsd">
<test>
<testCaseName>criu-portable-checkpoint_test</testCaseName>
<command> $(TEST_ROOT)$(D)external$(D)external.sh --run --tag "${DOCKERIMAGE_TAG}" --dir criu-portable-checkpoint --testtarget _cmdLineTester_criu_keepCheckpoint --portable "true" --platform "${PLATFORM}" --node_name "${NODE_NAME}" --node_labels "${NODE_LABELS}" --docker_registry_url $(DOCKER_REGISTRY_URL) --reportdst $(REPORTDIR) --docker_args "-v /var/run/docker.sock:/var/run/docker.sock $(EXTRA_DOCKER_ARGS) --tmpfs /run"; \
<command> $(TEST_ROOT)$(D)external$(D)external.sh --run --tag "${DOCKERIMAGE_TAG}" --dir criu-portable-checkpoint --testtarget _cmdLineTester_criu_keepCheckpoint --portable "true" --platform "${PLATFORM}" --node_name "${NODE_NAME}" --node_labels "${NODE_LABELS}" --docker_registry_required "true" --docker_registry_url $(DOCKER_REGISTRY_URL) --reportdst $(REPORTDIR) --docker_args "-v /var/run/docker.sock:/var/run/docker.sock $(EXTRA_DOCKER_ARGS) --tmpfs /run"; \
$(TEST_STATUS); \
$(TEST_ROOT)$(D)external$(D)external.sh --clean --tag "${DOCKERIMAGE_TAG}" --dir criu-portable-checkpoint --platform "${PLATFORM}" --node_labels "${NODE_LABELS}" --docker_registry_url $(DOCKER_REGISTRY_URL)
</command>
Expand Down
2 changes: 1 addition & 1 deletion external/criu-portable-restore/playlist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<playlist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../TKG/playlist.xsd">
<test>
<testCaseName>criu-portable-restore_test</testCaseName>
<command> $(TEST_ROOT)$(D)external$(D)external.sh --load --tag "${DOCKERIMAGE_TAG}" --dir criu-portable-restore --testtarget _cmdLineTester_criu_keepCheckpoint --portable "true" --platform "${PLATFORM}" --node_name "${NODE_NAME}" --node_labels "${NODE_LABELS}" --docker_registry_url $(DOCKER_REGISTRY_URL) --reportdst $(REPORTDIR) --docker_args "-v /var/run/docker.sock:/var/run/docker.sock $(EXTRA_DOCKER_ARGS) --tmpfs /run"; \
<command> $(TEST_ROOT)$(D)external$(D)external.sh --load --tag "${DOCKERIMAGE_TAG}" --dir criu-portable-restore --testtarget _cmdLineTester_criu_keepCheckpoint --portable "true" --platform "${PLATFORM}" --node_name "${NODE_NAME}" --node_labels "${NODE_LABELS}" --docker_registry_required "true" --docker_registry_url $(DOCKER_REGISTRY_URL) --reportdst $(REPORTDIR) --docker_args "-v /var/run/docker.sock:/var/run/docker.sock $(EXTRA_DOCKER_ARGS) --tmpfs /run"; \
$(TEST_STATUS); \
$(TEST_ROOT)$(D)external$(D)external.sh --clean --tag "${DOCKERIMAGE_TAG}" --dir criu-portable-restore --platform "${PLATFORM}" --node_labels "${NODE_LABELS}" --docker_registry_url $(DOCKER_REGISTRY_URL)
</command>
Expand Down
2 changes: 1 addition & 1 deletion external/criu-ubi-portable-checkpoint/playlist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<playlist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../TKG/playlist.xsd">
<test>
<testCaseName>criu-ubi-portable-checkpoint_test</testCaseName>
<command> $(TEST_ROOT)$(D)external$(D)external.sh --run --tag "${DOCKERIMAGE_TAG}" --dir criu-ubi-portable-checkpoint --testtarget _cmdLineTester_criu_keepCheckpoint --portable "true" --platform "${PLATFORM}" --node_name "${NODE_NAME}" --node_labels "${NODE_LABELS}" --docker_registry_url $(DOCKER_REGISTRY_URL) --reportdst $(REPORTDIR) --docker_args "-v /var/run/docker.sock:/var/run/docker.sock $(EXTRA_DOCKER_ARGS) --tmpfs /run"; \
<command> $(TEST_ROOT)$(D)external$(D)external.sh --run --tag "${DOCKERIMAGE_TAG}" --dir criu-ubi-portable-checkpoint --testtarget _cmdLineTester_criu_keepCheckpoint --portable "true" --platform "${PLATFORM}" --node_name "${NODE_NAME}" --node_labels "${NODE_LABELS}" --docker_registry_required "true" --docker_registry_url $(DOCKER_REGISTRY_URL) --reportdst $(REPORTDIR) --docker_args "-v /var/run/docker.sock:/var/run/docker.sock $(EXTRA_DOCKER_ARGS) --tmpfs /run"; \
$(TEST_STATUS); \
$(TEST_ROOT)$(D)external$(D)external.sh --clean --tag "${DOCKERIMAGE_TAG}" --dir criu-ubi-portable-checkpoint --platform "${PLATFORM}" --node_labels "${NODE_LABELS}" --docker_registry_url $(DOCKER_REGISTRY_URL)
</command>
Expand Down
2 changes: 1 addition & 1 deletion external/criu-ubi-portable-restore/playlist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<playlist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../TKG/playlist.xsd">
<test>
<testCaseName>criu-ubi-portable-restore_test</testCaseName>
<command> $(TEST_ROOT)$(D)external$(D)external.sh --load --tag "${DOCKERIMAGE_TAG}" --dir criu-ubi-portable-restore --testtarget _cmdLineTester_criu_keepCheckpoint --portable "true" --platform "${PLATFORM}" --node_name "${NODE_NAME}" --node_labels "${NODE_LABELS}" --docker_registry_url $(DOCKER_REGISTRY_URL) --reportdst $(REPORTDIR) --docker_args "-v /var/run/docker.sock:/var/run/docker.sock $(EXTRA_DOCKER_ARGS) --tmpfs /run"; \
<command> $(TEST_ROOT)$(D)external$(D)external.sh --load --tag "${DOCKERIMAGE_TAG}" --dir criu-ubi-portable-restore --testtarget _cmdLineTester_criu_keepCheckpoint --portable "true" --platform "${PLATFORM}" --node_name "${NODE_NAME}" --node_labels "${NODE_LABELS}" --docker_registry_required "true" --docker_registry_url $(DOCKER_REGISTRY_URL) --reportdst $(REPORTDIR) --docker_args "-v /var/run/docker.sock:/var/run/docker.sock $(EXTRA_DOCKER_ARGS) --tmpfs /run"; \
$(TEST_STATUS); \
$(TEST_ROOT)$(D)external$(D)external.sh --clean --tag "${DOCKERIMAGE_TAG}" --dir criu-ubi-portable-restore --platform "${PLATFORM}" --node_labels "${NODE_LABELS}" --docker_registry_url $(DOCKER_REGISTRY_URL)
</command>
Expand Down
69 changes: 51 additions & 18 deletions external/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,21 @@ portable="false"
node_name=""
node_labels=""
node_label_micro_architecture=""
docker_registry_required="false"
docker_registry_url=""
reportdst="false"
reportsrc="false"
docker_args=""
mountV=""
mount_jdk="true"
imageArg=""


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_url DOCKER_REGISTRY_URL] [--reportsrc appReportDir] [--reportdst REPORTDIR] [--testtarget target] [--docker_args EXTRA_DOCKER_ARGS] [--build|--run|--load|--clean]'
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] [--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 camel 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-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"

function check_test() {
test=$1
Expand Down Expand Up @@ -109,6 +111,9 @@ parseCommandLineArgs() {
"--portable" )
portable="$1"; shift;;

"--mount_jdk" )
mount_jdk="$1"; shift;;

"--node_name" )
node_name="$1"; shift;;

Expand All @@ -123,9 +128,15 @@ parseCommandLineArgs() {
fi
done;;

"--docker_registry_required" )
docker_registry_required="$1"; shift;;

"--docker_registry_url" )
docker_registry_url="$1"; shift;;

"--test_root" )
test_root="$1"; shift;;

"--reportsrc" )
reportsrc="$1"; shift;;

Expand Down Expand Up @@ -260,21 +271,43 @@ fi

if [ $command_type == "load" ]; then
# TO-DO: Use a different micro architecture (e.g. skylake vs broadwell) to test when machine label completed.
if [[ $docker_registry_url ]]; then
echo "Private Docker Registry login starts:"
echo $DOCKER_REGISTRY_CREDENTIALS_PSW | docker login --username=$DOCKER_REGISTRY_CREDENTIALS_USR --password-stdin $docker_registry_url

current_micro_architecture=$node_label_micro_architecture
docker pull $docker_registry_url/criu-restore-ready-with-jdk:${JDK_VERSION}-${JDK_IMPL}-${docker_os}-${platform}-${current_micro_architecture}
docker image ls
# restore
echo "docker run --privileged $mountV --name restore-checkpoint --rm $docker_registry_url/criu-restore-ready-with-jdk:${JDK_VERSION}-${JDK_IMPL}-${docker_os}-${platform}-${current_micro_architecture}"
docker run --privileged $mountV --name restore-checkpoint --rm $docker_registry_url/criu-restore-ready-with-jdk:${JDK_VERSION}-${JDK_IMPL}-${docker_os}-${platform}-${current_micro_architecture}

docker logout $docker_registry_url
else
echo "Docker Regsitry is not avaialble on this Jenkins"
exit 1
if [[ $docker_registry_required != "false" ]]; then
if [[ $docker_registry_url ]]; then
echo "Private Docker Registry login starts:"
echo $DOCKER_REGISTRY_CREDENTIALS_PSW | docker login --username=$DOCKER_REGISTRY_CREDENTIALS_USR --password-stdin $docker_registry_url

current_micro_architecture=$node_label_micro_architecture
docker pull $docker_registry_url/criu-restore-ready-with-jdk:${JDK_VERSION}-${JDK_IMPL}-${docker_os}-${platform}-${current_micro_architecture}
docker image ls
mount_options=""
if [[ $mount_jdk != "false" ]]; then
echo "Mounting JDK"
mount_options="$mountV"
fi
# restore
echo "docker run --privileged $mount_options --name restore-test --rm $docker_registry_url/criu-restore-ready-with-jdk:${JDK_VERSION}-${JDK_IMPL}-${docker_os}-${platform}-${current_micro_architecture}"
docker run --privileged $mount_options --name restore-test --rm $docker_registry_url/criu-restore-ready-with-jdk:${JDK_VERSION}-${JDK_IMPL}-${docker_os}-${platform}-${current_micro_architecture}

docker logout $docker_registry_url
else
echo "Docker Regsitry is not avaialble on this Jenkins"
exit 1
fi
else # no need private docker registry
docker_image_name="eclipse-temurin:${JDK_VERSION}-jdk"
if [[ "${JDK_IMPL}" == *"openj9"* ]]; then
docker_image_name="ibm-semeru-runtimes:open-${JDK_VERSION}-jdk"
fi
test_script_path="$test_root/external/$test/test.sh"
chmod a+x $test_script_path
mount_test_script="-v $test_script_path:/test.sh"
mount_options=$mount_test_script
if [[ $mount_jdk != "false" ]]; then
echo "Mounting JDK and test script"
mount_options="$mountV $mount_test_script"
fi
echo "docker run --privileged $mount_options --name restore-test --rm $docker_image_name bash /test.sh"
docker run --privileged $mount_options --name restore-test --rm $docker_image_name bash /test.sh
fi
fi

Expand All @@ -283,6 +316,6 @@ if [ $command_type == "clean" ]; then
test="$(echo ${EXTERNAL_CUSTOM_REPO} | awk -F'/' '{print $NF}' | sed 's/.git//g')"
fi
docker rm -f $test-test; docker rmi -f adoptopenjdk-$test-test:${JDK_VERSION}-$package-$docker_os-${JDK_IMPL}-$build_type
docker rm -f restore-checkpoint
docker rm -f restore-test
docker rmi -f ${docker_registry_url}/criu-restore-ready-with-jdk:${JDK_VERSION}-${JDK_IMPL}-${docker_os}-${platform}-${node_label_micro_architecture}
fi