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 OpenJcePlusTests #5024

Merged
merged 1 commit into from
Feb 2, 2024
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ autoGen.mk
TestConfig
TKG
functional
!functional/MBCS_Tests
!functional/OpenJcePlusTests
!functional/security
!functional/security/AQAvit
!functional/security/Crypto
!functional/SyntheticGCWorkload
!functional/MBCS_Tests

Utils
systemtest_prereqs/*
Expand Down
117 changes: 117 additions & 0 deletions functional/OpenJcePlusTests/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<?xml version="1.0"?>

<!--
# 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.
-->

<project name="OpenJcePlus tests" default="build" basedir=".">
<taskdef resource="net/sf/antcontrib/antlib.xml" />
<description>
OpenJCEPlus Tests
</description>

<!-- set global properties for this build -->
<property name="DEST" value="${BUILD_ROOT}/functional/OpenJcePlusTests" />

<!--Properties for this particular build-->
<property name="src" location="./OpenJCEPlus/src/" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that we should be compiling and putting into a jar file just the test directories. I am not quite sure what would happen if we compile both the openjceplus provider itself and the test code like this. When the tests run do they test the OpenJCEPlus module included in the build itself or would they test what you just compiled? Id hope they test what is in the Semeru build itself.

To be safe should we be compiling just the files in the src/test directory here?

Or perhaps line 52 handles that and removes everything but the test directory?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we only compile tests and put them openjceplus-tests.jar into

<jar jarfile="${DEST}/openjceplus-tests.jar" filesonly="true">

line 52 removed everything but the test directory.

<property name="build" location="./bin" />
<property name="LIB" value="junit4,hamcrest_core,bcprov_jdk18on"/>
<import file="${TEST_ROOT}/TKG/scripts/getDependencies.xml"/>

<target name="openJcePlusTests.check">
<condition property="openJcePlusTests.exists">
<available file="OpenJCEPlus" type="dir"/>
</condition>
</target>

<if>
<contains string="${SPEC}" substring="zos"/>
<then>
<property name="GIT_REPO" value="[email protected]:" />
</then>
<else>
<property name="GIT_REPO" value="https://github.com/" />
</else>
</if>
<target name="getOpenJcePlusTests" depends="openJcePlusTests.check" unless="openJcePlusTests.exists">
<exec executable="git" failonerror="true">
<arg value="clone" />
<arg value="${GIT_REPO}IBM/OpenJCEPlus.git" />
</exec>
<delete dir="./OpenJCEPlus/src/main" />
</target>

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

<property name="addExports" value='--add-exports java.base/sun.security.internal.spec=openjceplus --add-exports java.base/sun.security.util=openjceplus,ALL-UNNAMED --add-exports java.base/sun.security.x509=openjceplus,ALL-UNNAMED --add-exports java.base/sun.security.pkcs=openjceplus,ALL-UNNAMED --add-exports java.base/sun.security.internal.interfaces=openjceplus --add-exports java.base/sun.util.logging=openjceplus --add-exports java.base/jdk.internal.logger=openjceplus --add-exports openjceplus/com.ibm.crypto.plus.provider.ock=ALL-UNNAMED --add-exports openjceplus/com.ibm.misc=ALL-UNNAMED' />

<target name="compile" depends="init,getDependentLibs,getOpenJcePlusTests" description="Using java ${JDK_VERSION} to compile the source ">
<echo>Ant version is ${ant.version}</echo>
<echo>============COMPILER SETTINGS============</echo>
<echo>===fork: yes</echo>
<echo>===executable: ${compiler.javac}</echo>
<echo>===debug: on</echo>
<echo>===destdir: ${DEST}</echo>
<javac srcdir="${src}" destdir="${build}" debug="true" fork="true" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1">
<compilerarg line='-Xlint:all ${addExports}' />
<src path="${src}" />
<classpath>
<pathelement location="${LIB_DIR}/junit4.jar" />
<pathelement location="${LIB_DIR}/hamcrest-core.jar" />
<pathelement location="${LIB_DIR}/bcprov-jdk18on.jar" />
</classpath>
</javac>
</target>

<target name="dist" depends="compile" description="generate the distribution">
<jar jarfile="${DEST}/openjceplus-tests.jar" filesonly="true">
<fileset dir="${build}" />
<fileset dir="${src}/../../" includes="*.properties,*.xml" />
</jar>
<copy todir="${DEST}">
<fileset dir="${src}/../../" includes="*.xml,*.mk" />
</copy>
</target>

<target name="clean" depends="dist" description="clean up">
<!-- Delete the ${build} directory trees -->
<delete dir="${build}" />
</target>

<target name="build" >
<if>
<or>
<contains string="${TEST_FLAG}" substring="OpenJcePlusTests"/>
<and>
<equals arg1="${JDK_VENDOR}" arg2="ibm" />
<equals arg1="${JDK_IMPL}" arg2="openj9" />
<equals arg1="${JDK_VERSION}" arg2="17" />
<or>
<contains string="${SPEC}" substring="aix_ppc-64"/>
<contains string="${SPEC}" substring="linux_ppc-64_le"/>
<contains string="${SPEC}" substring="linux_x86-64"/>
<contains string="${SPEC}" substring="win_x86-64"/>
</or>
</and>
</or>
<then>
<antcall target="clean" inheritall="true" />
</then>
</if>

</target>
</project>
47 changes: 47 additions & 0 deletions functional/OpenJcePlusTests/playlist.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?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>openJcePlusTests</testCaseName>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the framework run junit tests as individual tests such that they are reported with stack traces and as individual test passes and failures? I only noticed this looking at the results where after running 1800+ tests it reports just one test failed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, if the tests produce junit result report in xml, our framework will pick it up and show subtests. For example, testReport link. However, it looks like junit itself does not provide the report. The OpenJcePlusTests do not produce any output files. It looks like we will need to leverage ant and junit Integration <junit> or maven for this.

It may be better to get PR in, so we can get the test running. Meanwhile, we will look into junit output for OpenJcePlusTests.

<disables>
<disable>
<comment>only applicable for Semeru atm</comment>
<vendor>eclipse</vendor>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When testing a custom built openj9 build with OpenJCEPlus bundling turned on for development builds ( not the default for public nightly openj9 builds ) would these tests still be able to be run? I believe the answer is yes yet I am asking anyways due to this disablement of the tests when the vendor is eclipse.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, custom built openj9 build with OpenJCEPlus bundling can still run by setting TEST_FLAG=OpenJcePlusTests (for test compilation) and TARGET=disabled.openJcePlusTests (for test execution)

</disable>
<disable>
<comment>Only applicable on aix, pliunx, xlinux and wins64 atm</comment>
<platform>^((?!(ppc64_aix|ppc64le_linux|x86-64_linux|x86-64_windows)).)*$</platform>
</disable>
</disables>
<command>$(JAVA_COMMAND) $(JVM_OPTIONS) \
-cp $(Q)$(LIB_DIR)$(D)junit4.jar$(P)$(LIB_DIR)$(D)hamcrest-core.jar$(P)$(LIB_DIR)$(D)bcprov-jdk18on.jar$(P)$(TEST_RESROOT)$(D)openjceplus-tests.jar$(Q) \
--add-exports=java.base/sun.security.util=ALL-UNNAMED \
--add-exports=openjceplus/com.ibm.crypto.plus.provider.ock=ALL-UNNAMED \
ibm.jceplus.junit.TestAll; \
$(TEST_STATUS)</command>
<levels>
<level>extended</level>
</levels>
<groups>
<group>functional</group>
</groups>
<versions>
<version>17</version>
</versions>
<impls>
<impl>openj9</impl>
</impls>
</test>
</playlist>