Skip to content

Commit

Permalink
Merge pull request #10891 from LongyuZhang/cds1
Browse files Browse the repository at this point in the history
Added CDSAdaptorTest with updated osgi verison
  • Loading branch information
llxia committed Nov 13, 2020
2 parents 804b89b + fc544bf commit 498e89d
Show file tree
Hide file tree
Showing 19 changed files with 1,203 additions and 0 deletions.
26 changes: 26 additions & 0 deletions cdsadapter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!--
Copyright (c) 2020, 2020 IBM Corp. and others
This program and the accompanying materials are made available under
the terms of the Eclipse Public License 2.0 which accompanies this
distribution and is available at https://www.eclipse.org/legal/epl-2.0/
or the Apache License, Version 2.0 which accompanies this distribution and
is available at https://www.apache.org/licenses/LICENSE-2.0.
This Source Code may also be made available under the following
Secondary Licenses when the conditions for such availability set
forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
General Public License, version 2 with the GNU Classpath
Exception [1] and GNU General Public License, version 2 with the
OpenJDK Assembly Exception [2].
[1] https://www.gnu.org/software/classpath/license.html
[2] http://openjdk.java.net/legal/assembly-exception.html
SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
-->

Documentation
=============

Since CDS has been transferred to Eclipse OSGI, the Eclipse version cds is under package org.eclipse.osgi.internal.cds, with source code available [here](https://github.com/eclipse/rt.equinox.framework/tree/master/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/cds).
30 changes: 30 additions & 0 deletions test/functional/cmdLineTests/CDSAdaptorTest/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*******************************************************************************
* Copyright (c) 2001, 2020 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
* or the Apache License, Version 2.0 which accompanies this distribution and
* is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* This Source Code may also be made available under the following
* Secondary Licenses when the conditions for such availability set
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
* General Public License, version 2 with the GNU Classpath
* Exception [1] and GNU General Public License, version 2 with the
* OpenJDK Assembly Exception [2].
*
* [1] https://www.gnu.org/software/classpath/license.html
* [2] http://openjdk.java.net/legal/assembly-exception.html
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
*******************************************************************************/
-->
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="lib" path="resources/org.eclipse.osgi_3.16.100.v20200904-1304.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="output" path="bin"/>
</classpath>
114 changes: 114 additions & 0 deletions test/functional/cmdLineTests/CDSAdaptorTest/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<?xml version="1.0"?>

<!--
Copyright (c) 2001, 2020 IBM Corp. and others
This program and the accompanying materials are made available under
the terms of the Eclipse Public License 2.0 which accompanies this
distribution and is available at https://www.eclipse.org/legal/epl-2.0/
or the Apache License, Version 2.0 which accompanies this distribution and
is available at https://www.apache.org/licenses/LICENSE-2.0.
This Source Code may also be made available under the following
Secondary Licenses when the conditions for such availability set
forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
General Public License, version 2 with the GNU Classpath
Exception [1] and GNU General Public License, version 2 with the
OpenJDK Assembly Exception [2].
[1] https://www.gnu.org/software/classpath/license.html
[2] http://openjdk.java.net/legal/assembly-exception.html
SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
-->

<project name="CDS Adaptor Tests" default="build" basedir=".">
<taskdef resource='net/sf/antcontrib/antlib.xml'/>
<description>
Build CDSAdaptorTest
</description>

<!-- set global properties for this build -->
<property name="DEST" value="${BUILD_ROOT}/functional/cmdLineTests/CDSAdaptorTest" />
<property name="dist" location="${DEST}"/>
<!--Properties for this particular build-->
<property name="src" location="./src"/>
<property name="src_resources_testBundle" location="./resources/TestBundle/src"/>
<property name="src_resources_weavinghookTest" location="./resources/WeavinghookTest/src"/>
<property name="build" location="./bin"/>
<property name="build_resource_testBundle" location="./bin_resource_testBundle"/>
<property name="build_resource_weavinghookTest" location="./bin_resource_weavinghookTest"/>
<property name="resources" location="./resources"/>

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

<target name="compile" depends="init" 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_resources_testBundle}" destdir="${build_resource_testBundle}" debug="true" fork="true" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1">
<classpath>
<fileset dir="${LIB_DIR}" casesensitive="yes">
<include name="org.eclipse.osgi*.jar" />
</fileset>
</classpath>
</javac>
<javac srcdir="${src_resources_weavinghookTest}" destdir="${build_resource_weavinghookTest}" debug="true" fork="true" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1">
<classpath>
<fileset dir="${LIB_DIR}" casesensitive="yes">
<include name="org.eclipse.osgi*.jar" />
</fileset>
</classpath>
</javac>
<javac srcdir="${src}" destdir="${build}" debug="true" fork="true" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1">
<classpath>
<fileset dir="${LIB_DIR}" casesensitive="yes">
<include name="org.eclipse.osgi*.jar" />
</fileset>
</classpath>
</javac>
</target>

<target name="dist" depends="compile" description="generate the distribution" >
<jar jarfile="${DEST}/CDSAdaptorOrphanTestBundles/org.openj9.test.testbundle_1.0.0._v1.jar" manifest="${src_resources_testBundle}/../MANIFEST.MF" filesonly="true">
<fileset dir="${build_resource_testBundle}" />
</jar>
<jar jarfile="${DEST}/CDSAdaptorOrphanTestBundles/org.openj9.test.weavinghooktest_1.0.0._v1.jar" manifest="${src_resources_weavinghookTest}/../MANIFEST.MF" filesonly="true">
<fileset dir="${build_resource_weavinghookTest}" />
</jar>
<copy todir="${DEST}">
<fileset dir="${src}/../" includes="*.xml" />
<fileset dir="${src}/../" includes="*.mk" />
<fileset dir="${build}" />
<fileset dir="${resources}" />
</copy>
</target>

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

<target name="build" >
<if>
<or>
<equals arg1="${JDK_IMPL}" arg2="ibm" />
<equals arg1="${JDK_IMPL}" arg2="openj9" />
</or>
<then>
<antcall target="clean" inheritall="true" />
</then>
</if>
</target>
</project>
101 changes: 101 additions & 0 deletions test/functional/cmdLineTests/CDSAdaptorTest/cdsadaptortest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<!--
Copyright (c) 2001, 2020 IBM Corp. and others
This program and the accompanying materials are made available under
the terms of the Eclipse Public License 2.0 which accompanies this
distribution and is available at https://www.eclipse.org/legal/epl-2.0/
or the Apache License, Version 2.0 which accompanies this distribution and
is available at https://www.apache.org/licenses/LICENSE-2.0.
This Source Code may also be made available under the following
Secondary Licenses when the conditions for such availability set
forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
General Public License, version 2 with the GNU Classpath
Exception [1] and GNU General Public License, version 2 with the
OpenJDK Assembly Exception [2].
[1] https://www.gnu.org/software/classpath/license.html
[2] http://openjdk.java.net/legal/assembly-exception.html
SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
-->

<!DOCTYPE suite SYSTEM "cmdlinetester.dtd">

<suite id="CDS Adaptor CommandLineOptionTests Suite">

<variable name="CACHENAME" value="cdsadaptor_cache" />

<variable name="XSHARECLASSES" value="-Xshareclasses:name=$CACHENAME$" />

<!-- NOTE: Update the version of org.eclipse.osgi whenever new version are checked in -->
<variable name="OSGI_JAR_PATH" value="$TEST_MATERIAL_DIR$$CPDL$$LIB_DIR$$PATHSEP$org.eclipse.osgi_3.16.100.v20200904-1304.jar" />

<variable name="FRAMEWORK_BUNDLE_LOCATION" value="$TEST_MATERIAL_DIR$$PATHSEP$FrameworkBundles" />
<variable name="TEST_BUNDLE_LOCATION" value="$TEST_MATERIAL_DIR$$PATHSEP$CDSAdaptorOrphanTestBundles" />

<test id="Test 0: Destroy existing shared class cache" timeout="600" runPath=".">
<command>$EXE$ $XSHARECLASSES$,destroy</command>
<output type="success" caseSensitive="yes" regex="no">has been destroyed</output>
<output type="success" caseSensitive="yes" regex="no">is destroyed</output>
<output type="success" caseSensitive="yes" regex="no">Cache does not exist</output>
<output type="failure" caseSensitive="no" regex="no">Unhandled Exception</output>
<output type="failure" caseSensitive="yes" regex="no">Exception:</output>
<output type="failure" caseSensitive="no" regex="no">corrupt</output>
<output type="failure" caseSensitive="yes" regex="no">Processing dump event</output>
</test>

<test id="Test 1-a: Create a shared class cache while using weaving hooks" timeout="600" runPath=".">
<command>$EXE$ $XSHARECLASSES$ -cp $OSGI_JAR_PATH$ org.openj9.test.cdsadaptortest.CDSAdaptorOrphanTest -frameworkBundleLocation $FRAMEWORK_BUNDLE_LOCATION$ -testBundleLocation $TEST_BUNDLE_LOCATION$</command>
<output type="success" caseSensitive="no" regex="no">A message from modified class</output>
<output type="failure" caseSensitive="no" regex="no">original</output>
<output type="failure" caseSensitive="yes" regex="no">Exception:</output>
<output type="failure" caseSensitive="yes" regex="no">Processing dump event</output>
</test>

<test id="Test 1-b: Check shared class cache for presence of Orphan class" timeout="600" runPath=".">
<command>$EXE$ $XSHARECLASSES$,printStats=orphan+romclass</command>
<output type="success" caseSensitive="no" regex="no">ORPHAN: org/openj9/test/testbundle/SomeMessageV1</output>
<output type="failure" caseSensitive="no" regex="no">ROMCLASS: org/openj9/test/testbundle/SomeMessageV1</output>
<output type="failure" caseSensitive="yes" regex="no">Exception:</output>
<output type="failure" caseSensitive="yes" regex="no">Processing dump event</output>
</test>

<test id="Test 1-c: Reuse previous cache without using weaving hooks" timeout="600" runPath=".">
<command>$EXE$ $XSHARECLASSES$ -cp $OSGI_JAR_PATH$ org.openj9.test.cdsadaptortest.CDSAdaptorOrphanTest -frameworkBundleLocation $FRAMEWORK_BUNDLE_LOCATION$ -testBundleLocation $TEST_BUNDLE_LOCATION$ -ignoreWeavingHookBundle</command>
<output type="success" caseSensitive="no" regex="no">A message from original class</output>
<output type="failure" caseSensitive="no" regex="no">modified</output>
<output type="failure" caseSensitive="yes" regex="no">Exception:</output>
<output type="failure" caseSensitive="yes" regex="no">Processing dump event</output>
</test>

<test id="Test 1-d: Check shared class cache for presence of ROMClass class" timeout="600" runPath=".">
<command>$EXE$ $XSHARECLASSES$,printStats=orphan+romclass</command>
<output type="success" caseSensitive="no" regex="no">ORPHAN: org/openj9/test/testbundle/SomeMessageV1</output>
<output type="required" caseSensitive="no" regex="no">ROMCLASS: org/openj9/test/testbundle/SomeMessageV1</output>
<output type="failure" caseSensitive="yes" regex="no">Exception:</output>
<output type="failure" caseSensitive="yes" regex="no">Processing dump event</output>
</test>

<test id="Test 1-e: Reuse previous cache while using weaving hooks" timeout="600" runPath=".">
<command>$EXE$ $XSHARECLASSES$ -cp $OSGI_JAR_PATH$ org.openj9.test.cdsadaptortest.CDSAdaptorOrphanTest -frameworkBundleLocation $FRAMEWORK_BUNDLE_LOCATION$ -testBundleLocation $TEST_BUNDLE_LOCATION$</command>
<output type="success" caseSensitive="no" regex="no">A message from modified class</output>
<output type="failure" caseSensitive="no" regex="no">original</output>
<output type="failure" caseSensitive="yes" regex="no">Exception:</output>
<output type="failure" caseSensitive="yes" regex="no">Processing dump event</output>
</test>

<test id="Cleanup: Destroy any existing shared class cache" timeout="600" runPath=".">
<command>$EXE$ $XSHARECLASSES$,destroy</command>
<output type="success" caseSensitive="yes" regex="no">has been destroyed</output>
<output type="success" caseSensitive="yes" regex="no">is destroyed</output>
<output type="failure" caseSensitive="yes" regex="no">Cache does not exist</output>
<output type="failure" caseSensitive="no" regex="no">Unhandled Exception</output>
<output type="failure" caseSensitive="yes" regex="no">Exception:</output>
<output type="failure" caseSensitive="no" regex="no">corrupt</output>
<output type="failure" caseSensitive="yes" regex="no">Processing dump event</output>
</test>

</suite>
47 changes: 47 additions & 0 deletions test/functional/cmdLineTests/CDSAdaptorTest/playlist.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2020, 2020 IBM Corp. and others
This program and the accompanying materials are made available under
the terms of the Eclipse Public License 2.0 which accompanies this
distribution and is available at https://www.eclipse.org/legal/epl-2.0/
or the Apache License, Version 2.0 which accompanies this distribution and
is available at https://www.apache.org/licenses/LICENSE-2.0.
This Source Code may also be made available under the following
Secondary Licenses when the conditions for such availability set
forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
General Public License, version 2 with the GNU Classpath
Exception [1] and GNU General Public License, version 2 with the
OpenJDK Assembly Exception [2].
[1] https://www.gnu.org/software/classpath/license.html
[2] http://openjdk.java.net/legal/assembly-exception.html
SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
-->
<playlist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../TKG/playlist.xsd">
<test>
<testCaseName>CDSAdaptorTest</testCaseName>
<variations>
<variation>NoOptions</variation>
</variations>
<command>$(JAVA_COMMAND) $(JVM_OPTIONS) \
-DEXE=$(SQ)$(JAVA_COMMAND) $(JVM_OPTIONS) $(SQ) \
-DTEST_MATERIAL_DIR=$(TEST_RESROOT) \
-DLIB_DIR=${LIB_DIR} -DCPDL=$(Q)$(P)$(Q) -DPATHSEP=$(Q)$(D)$(Q) \
-jar $(CMDLINETESTER_JAR) -config $(Q)$(TEST_RESROOT)$(D)cdsadaptortest.xml$(Q) \
-verbose -nonZeroExitWhenError; \
$(TEST_STATUS)</command>
<levels>
<level>extended</level>
</levels>
<groups>
<group>functional</group>
</groups>
<impls>
<impl>openj9</impl>
<impl>ibm</impl>
</impls>
</test>
</playlist>

0 comments on commit 498e89d

Please sign in to comment.