Skip to content

Commit

Permalink
Fix based on review request
Browse files Browse the repository at this point in the history
Signed-off-by: sophiaxu0424 <[email protected]>
  • Loading branch information
sophiaxu0424 committed Mar 12, 2024
1 parent ab2044f commit 0e72efa
Show file tree
Hide file tree
Showing 15 changed files with 77 additions and 300 deletions.
14 changes: 14 additions & 0 deletions functional/MockitoTests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Mockito Tests
There are two OpenJ9 user issues where a crash with Mockito is reported:

- Crash with Java 21 0.42

- Segmentation error when using Mockito and Byte-buddy-agent with Java 21

# This Mockito test cases will help identify the above crashes in our builds.
Test case 1: main.java.test.MainTest.java
Test case 2: main.java.test.SegmentationErrorDemo
Dependencies:
- Mockito
- Bytebuddy
- Maven
60 changes: 46 additions & 14 deletions functional/MockitoTests/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,60 @@ See the License for the specific language governing permissions and
limitations under the License.
-->

<project name="MockitoTests" default="build" basedir=".">
<project name="Mockito Tests" default="build" basedir=".">
<taskdef resource="net/sf/antcontrib/antlib.xml" />
<description>
Build MockitoTests
</description>
<import file="${TEST_ROOT}/functional/build.xml"/>
<!-- set properties for this build -->
Mockito Tests
</description>
<import file="${TEST_ROOT}/functional/build.xml"/>
<property name="LIB" value="mockito_core,byte_buddy" />
<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}" />
</target>

<target name="build" depends="dist">
<subant target="">
<fileset dir="." includes="*/build.xml" />
</subant>
<mkdir dir="${build}" />
</target>

<target name="dist" depends="init">
<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"/>
<pathelement location="${LIB_DIR}/byte-buddy.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="." includes="*.mk"/>
<fileset dir="${src}/../" includes="*.xml" />
<fileset dir="${src}/../" includes="*.mk" />
</copy>
</target>
</project>

<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>
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/resources/playlist.xsd">
<test>
<testCaseName>MockitoTests_ReproApp</testCaseName>
<testCaseName>MockitoTests</testCaseName>
<disables>
<disable>
<comment>https://github.com/adoptium/aqa-tests/issues/5073</comment>
Expand Down
73 changes: 0 additions & 73 deletions functional/MockitoTests/reproApp/build.xml

This file was deleted.

42 changes: 0 additions & 42 deletions functional/MockitoTests/reproApp/pom.xml

This file was deleted.

Binary file not shown.
Binary file not shown.
22 changes: 0 additions & 22 deletions functional/MockitoTests/reproApp/testng.xml

This file was deleted.

73 changes: 0 additions & 73 deletions functional/MockitoTests/segmentationerror/build.xml

This file was deleted.

33 changes: 0 additions & 33 deletions functional/MockitoTests/segmentationerror/playlist.xml

This file was deleted.

25 changes: 0 additions & 25 deletions functional/MockitoTests/segmentationerror/pom.xml

This file was deleted.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
package org.example;

package main.java.test;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

class MainTest {

public class MainTest {
class Some {}

@Test
public void reproduceCrash() {
Mockito.mock(Some.class);
}

}
Loading

0 comments on commit 0e72efa

Please sign in to comment.