Skip to content

Commit bfc298b

Browse files
OscarQQllxia
authored andcommitted
add cmdLineTester_jython to openj9
[ci skip] Signed-off-by: Yixin Qian <Yixin.Qian@ibm.com>
1 parent ca8cda0 commit bfc298b

4 files changed

Lines changed: 193 additions & 0 deletions

File tree

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?xml version="1.0"?>
2+
3+
<!--
4+
Copyright (c) 2021, 2021 IBM Corp. and others
5+
6+
This program and the accompanying materials are made available under
7+
the terms of the Eclipse Public License 2.0 which accompanies this
8+
distribution and is available at https://www.eclipse.org/legal/epl-2.0/
9+
or the Apache License, Version 2.0 which accompanies this distribution and
10+
is available at https://www.apache.org/licenses/LICENSE-2.0.
11+
12+
This Source Code may also be made available under the following
13+
Secondary Licenses when the conditions for such availability set
14+
forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
15+
General Public License, version 2 with the GNU Classpath
16+
Exception [1] and GNU General Public License, version 2 with the
17+
OpenJDK Assembly Exception [2].
18+
19+
[1] https://www.gnu.org/software/classpath/license.html
20+
[2] http://openjdk.java.net/legal/assembly-exception.html
21+
22+
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
23+
-->
24+
25+
<project name="libpathTest" default="build" basedir=".">
26+
<taskdef resource="net/sf/antcontrib/antlib.xml" />
27+
<description>
28+
Build jython hello
29+
</description>
30+
31+
<!-- set properties for this build -->
32+
<property name="DEST" value="${BUILD_ROOT}/functional/cmdLineTests/jython" />
33+
<property name="src" location="./src"/>
34+
<property name="build" location="./bin"/>
35+
<property name="LIB" value="jython"/>
36+
<import file="${TEST_ROOT}/TKG/scripts/getDependencies.xml"/>
37+
38+
<target name="init">
39+
<mkdir dir="${DEST}" />
40+
<mkdir dir="${build}" />
41+
</target>
42+
43+
<target name="compile" depends="init,getDependentLibs" description="Using java ${JDK_VERSION} to compile the source ">
44+
<echo>Ant version is ${ant.version}</echo>
45+
<echo>============COMPILER SETTINGS============</echo>
46+
<echo>===fork: yes</echo>
47+
<echo>===executable: ${compiler.javac}</echo>
48+
<echo>===debug: on</echo>
49+
<echo>===destdir: ${DEST}</echo>
50+
<javac srcdir="${src}" destdir="${build}" debug="true" fork="true" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1">
51+
<classpath>
52+
<pathelement location="${LIB_DIR}/jython-standalone.jar" />
53+
</classpath>
54+
</javac>
55+
</target>
56+
57+
<target name="dist" depends="compile" description="generate the distribution">
58+
<jar jarfile="${DEST}/cmdLineTester_jython.jar" filesonly="true">
59+
<fileset dir="${build}" />
60+
<fileset dir="${src}" />
61+
</jar>
62+
<copy todir="${DEST}">
63+
<fileset dir="${src}/../" includes="*.xml" />
64+
<fileset dir="${src}/../" includes="*.mk" />
65+
</copy>
66+
</target>
67+
68+
<target name="clean" depends="dist" description="clean up">
69+
<!-- Delete the ${build} directory trees -->
70+
<delete dir="${build}" />
71+
</target>
72+
73+
<target name="build" >
74+
<antcall target="clean" inheritall="true" />
75+
</target>
76+
</project>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
2+
3+
<!--
4+
Copyright (c) 2021, 2021 IBM Corp. and others
5+
6+
This program and the accompanying materials are made available under
7+
the terms of the Eclipse Public License 2.0 which accompanies this
8+
distribution and is available at https://www.eclipse.org/legal/epl-2.0/
9+
or the Apache License, Version 2.0 which accompanies this distribution and
10+
is available at https://www.apache.org/licenses/LICENSE-2.0.
11+
12+
This Source Code may also be made available under the following
13+
Secondary Licenses when the conditions for such availability set
14+
forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
15+
General Public License, version 2 with the GNU Classpath
16+
Exception [1] and GNU General Public License, version 2 with the
17+
OpenJDK Assembly Exception [2].
18+
19+
[1] https://www.gnu.org/software/classpath/license.html
20+
[2] http://openjdk.java.net/legal/assembly-exception.html
21+
22+
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
23+
-->
24+
25+
<!DOCTYPE suite SYSTEM "cmdlinetester.dtd">
26+
27+
<suite id="jython" timeout="300">
28+
29+
<test id="jython-hello">
30+
<command>$EXE$ -XshowSettings:vm -Dpython.options.showJavaExceptions=true -Dpython.options.includeJavaStackInExceptions=true -Dpython.options.showPythonProxyExceptions=true -cp $Q$$JARPATH$$Q$ JythonHello</command>
31+
<output type="success" regex="no">Hello Python World!</output>
32+
</test>
33+
34+
</suite>
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<!--
3+
Copyright (c) 2021, 2021 IBM Corp. and others
4+
5+
This program and the accompanying materials are made available under
6+
the terms of the Eclipse Public License 2.0 which accompanies this
7+
distribution and is available at https://www.eclipse.org/legal/epl-2.0/
8+
or the Apache License, Version 2.0 which accompanies this distribution and
9+
is available at https://www.apache.org/licenses/LICENSE-2.0.
10+
11+
This Source Code may also be made available under the following
12+
Secondary Licenses when the conditions for such availability set
13+
forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
14+
General Public License, version 2 with the GNU Classpath
15+
Exception [1] and GNU General Public License, version 2 with the
16+
OpenJDK Assembly Exception [2].
17+
18+
[1] https://www.gnu.org/software/classpath/license.html
19+
[2] http://openjdk.java.net/legal/assembly-exception.html
20+
21+
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
22+
-->
23+
<playlist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../TKG/playlist.xsd">
24+
<test>
25+
<testCaseName>cmdLineTester_jython</testCaseName>
26+
<variations>
27+
<variation>NoOptions</variation>
28+
<variation>Mode108</variation>
29+
<variation>Mode109</variation>
30+
<variation>Mode116</variation>
31+
<variation>Mode608</variation>
32+
<variation>Mode609</variation>
33+
</variations>
34+
<command>$(JAVA_COMMAND) $(JVM_OPTIONS)\
35+
-DJARPATH=$(Q)$(LIB_DIR)$(D)jython-standalone.jar$(P)$(TEST_RESROOT)$(D)cmdLineTester_jython.jar$(Q) \
36+
-DEXE=$(SQ)$(JAVA_COMMAND) $(JVM_OPTIONS)$(SQ) \
37+
-jar $(CMDLINETESTER_JAR) -config $(Q)$(TEST_RESROOT)$(D)jython.xml$(Q) \
38+
-explainExcludes -xids all,$(PLATFORM),$(VARIATION) -nonZeroExitWhenError; \
39+
$(TEST_STATUS)</command>
40+
<levels>
41+
<level>sanity</level>
42+
</levels>
43+
<groups>
44+
<group>functional</group>
45+
</groups>
46+
<impls>
47+
<impl>openj9</impl>
48+
<impl>ibm</impl>
49+
</impls>
50+
</test>
51+
</playlist>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2021, 2021 IBM Corp. and others
3+
*
4+
* This program and the accompanying materials are made available under
5+
* the terms of the Eclipse Public License 2.0 which accompanies this
6+
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
7+
* or the Apache License, Version 2.0 which accompanies this distribution and
8+
* is available at https://www.apache.org/licenses/LICENSE-2.0.
9+
*
10+
* This Source Code may also be made available under the following
11+
* Secondary Licenses when the conditions for such availability set
12+
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
13+
* General Public License, version 2 with the GNU Classpath
14+
* Exception [1] and GNU General Public License, version 2 with the
15+
* OpenJDK Assembly Exception [2].
16+
*
17+
* [1] https://www.gnu.org/software/classpath/license.html
18+
* [2] http://openjdk.java.net/legal/assembly-exception.html
19+
*
20+
* 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
21+
*******************************************************************************/
22+
import org.python.core.PyList;
23+
import org.python.core.PyObject;
24+
import org.python.core.PyString;
25+
import org.python.util.InteractiveInterpreter;
26+
27+
public class JythonHello {
28+
public static void main(String[] arg) throws Throwable {
29+
InteractiveInterpreter interp = new InteractiveInterpreter();
30+
interp.exec("print('Hello Python World!')");
31+
}
32+
}

0 commit comments

Comments
 (0)