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

Added new MockitoTests SegmentationErrorTest #5133

Merged
merged 31 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
fdc7ab8
$Signed-off-by: sophiaxu0424 <[email protected]>
sophiaxu0424 Mar 11, 2024
f1fc7cf
fif
sophiaxu0424 Mar 20, 2024
4f459ed
fix
sophiaxu0424 Apr 2, 2024
f8b0793
fix testng
sophiaxu0424 Apr 2, 2024
099f4d0
fix
sophiaxu0424 Apr 2, 2024
00792b1
fix
sophiaxu0424 Apr 2, 2024
37403ed
fixx
sophiaxu0424 Apr 2, 2024
11cd5b1
add command element
sophiaxu0424 Apr 2, 2024
b6d54ae
added command part
sophiaxu0424 Apr 4, 2024
727a49d
fix command
sophiaxu0424 Apr 8, 2024
902d696
added junit-platform-console-standalone.jar
sophiaxu0424 Apr 8, 2024
6148f3d
fix
sophiaxu0424 Apr 8, 2024
e9aa17e
fix
sophiaxu0424 Apr 8, 2024
52ca84a
fix version with 21+
sophiaxu0424 Apr 9, 2024
d206a7b
fix /> error
sophiaxu0424 Apr 9, 2024
933282c
fix tab not 8 spaces error
sophiaxu0424 Apr 9, 2024
3d3ddac
fix line 7 syntax error: unexpected end of file
sophiaxu0424 Apr 9, 2024
4bd01ba
fix classpath from org.example to test.java in playlist command
sophiaxu0424 Apr 9, 2024
6b0747e
added junit-platform-console-standalone-1.10.2.jar in the <command> e…
sophiaxu0424 Apr 9, 2024
9403f42
adjust <command>
sophiaxu0424 Apr 9, 2024
794cdb2
fix all
sophiaxu0424 Apr 9, 2024
2bb5662
remove mockito-junit-jupiter.jar
sophiaxu0424 Apr 9, 2024
e313460
removed byte-buddy.jar
sophiaxu0424 Apr 9, 2024
12f0fe2
removed mockito-core.jar
sophiaxu0424 Apr 9, 2024
92b5c17
added back mockito-core.jar
sophiaxu0424 Apr 9, 2024
1e5ed79
added two test case output
sophiaxu0424 Apr 9, 2024
081f198
fixed as to the review comment
sophiaxu0424 Apr 10, 2024
8f797e3
added license info
sophiaxu0424 Apr 12, 2024
e649563
disabled test on zos platform
sophiaxu0424 Apr 17, 2024
893cbc4
Added tracking issue
sophiaxu0424 Apr 17, 2024
0534ec2
updated the comment
sophiaxu0424 Apr 17, 2024
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
24 changes: 24 additions & 0 deletions functional/MockitoTests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Mockito Tests
There are two OpenJ9 user issues where a crash with Mockito is reported:

- Issue: https://github.com/eclipse-openj9/openj9/issues/18750 and

- Issue: https://github.com/eclipse-openj9/openj9/issues/18781

- Crash with Java 21 0.42, and set testing jdk version to 17+ as required for now

- Segmentation error when using Mockito with Java 21

- More Testcases would be added later as required

# This Mockito test cases will help identify the above crashes in our builds.
Test case added: test.java.MockitoMockTest

# Next test case to be added
Test case: test.java.MockitoJunitTest(TBD)

# Dependencies Required:
- mockito-core
- byte-buddy
- byte-buddy-agent
- objenesis
71 changes: 71 additions & 0 deletions functional/MockitoTests/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?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="Mockito Tests" default="build" basedir=".">
<taskdef resource="net/sf/antcontrib/antlib.xml" />
<description>
Mockito Tests
</description>
<import file="${TEST_ROOT}/functional/build.xml"/>
<property name="LIB" value="byte_buddy,byte_buddy_agent,objenesis,mockito_core" />
<import file="${TEST_ROOT}/TKG/scripts/getDependencies.xml"/>

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

<!--Properties for this particular build-->
<property name="src" location="./src" />
<property name="build" location="./bin" />

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

<target name="compile" depends="init,getDependentLibs" 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">
<src path="${src}" />
<classpath>
<pathelement location="${LIB_DIR}/mockito-core.jar"/>
</classpath>
</javac>
</target>

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

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

<target name="build" >
<antcall target="clean" inheritall="true" />
</target>
</project>
38 changes: 38 additions & 0 deletions functional/MockitoTests/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>MockitoMockTest</testCaseName>
<disables>
<disable>
<comment>https://github.com/eclipse-openj9/openj9/issues/19331</comment>
<platform>.*zos.*</platform>
</disable>
</disables>
<command>
$(JAVA_COMMAND) $(JVM_OPTIONS) -cp $(Q)$(RESOURCES_DIR)$(P)$(TEST_RESROOT)$(D)MockitoTests.jar$(P)$(LIB_DIR)$(D)mockito-core.jar$(P)$(LIB_DIR)$(D)byte-buddy.jar$(P)$(LIB_DIR)$(D)byte-buddy-agent.jar$(P)$(LIB_DIR)$(D)objenesis.jar$(Q) test.java.MockitoMockTest ; \
$(TEST_STATUS)</command>
<levels>
<level>extended</level>
</levels>
<groups>
<group>functional</group>
</groups>
<versions>
<version>11+</version>
</versions>
</test>
</playlist>
24 changes: 24 additions & 0 deletions functional/MockitoTests/src/test/java/MockitoMockTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*******************************************************************************
* 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.
*******************************************************************************/
package test.java;
sophiaxu0424 marked this conversation as resolved.
Show resolved Hide resolved

import java.util.ArrayList;
import org.mockito.Mockito;

public class MockitoMockTest {
public static void main(String[] args) {
System.out.println("Call Mockito.mock(ArrayList.class)");
Mockito.mock(ArrayList.class);
}
}