Skip to content

Commit

Permalink
saving
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Riben <[email protected]>
  • Loading branch information
matteriben committed Mar 18, 2024
1 parent 1977c36 commit 237c06c
Show file tree
Hide file tree
Showing 4 changed files with 218 additions and 7 deletions.
112 changes: 105 additions & 7 deletions .github/workflows/run-reproducer.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,106 @@
name: Run reproducer on each commit
on: push
name: Run reproducer
on: workflow_dispatch
jobs:
gradle:
gradle-macos-test1:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 21
- uses: gradle/gradle-build-action@v2
with:
arguments: test --tests 'IOTest.test1' -i --debug --stacktrace --no-daemon --no-build-cache --no-configuration-cache --rerun-tasks
gradle-ubuntu-test1:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 21
- uses: gradle/gradle-build-action@v2
with:
arguments: test --tests 'IOTest.test1' -i --debug --stacktrace --no-daemon --no-build-cache --no-configuration-cache --rerun-tasks
gradle-windows-test1:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 21
- uses: gradle/gradle-build-action@v2
with:
arguments: test --tests 'IOTest.test1' -i --debug --stacktrace --no-daemon --no-build-cache --no-configuration-cache --rerun-tasks
gradle-macos-test2:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 21
- uses: gradle/gradle-build-action@v2
with:
arguments: test --tests 'IOTest.test2' -i --debug --stacktrace --no-daemon --no-build-cache --no-configuration-cache --rerun-tasks
gradle-ubuntu-test2:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 21
- uses: gradle/gradle-build-action@v2
with:
arguments: test --tests 'IOTest.test2' -i --debug --stacktrace --no-daemon --no-build-cache --no-configuration-cache --rerun-tasks
gradle-windows-test2:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 21
- uses: gradle/gradle-build-action@v2
with:
arguments: test --tests 'IOTest.test2' -i --debug --stacktrace --no-daemon --no-build-cache --no-configuration-cache --rerun-tasks
gradle-macos-test3:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 21
- uses: gradle/gradle-build-action@v2
with:
arguments: test --tests 'IOTest.test3' -i --debug --stacktrace --no-daemon --no-build-cache --no-configuration-cache --rerun-tasks
gradle-ubuntu-test3:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 21
- uses: gradle/gradle-build-action@v2
with:
arguments: test --tests 'IOTest.test3' -i --debug --stacktrace --no-daemon --no-build-cache --no-configuration-cache --rerun-tasks
gradle-windows-test3:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 21
- uses: gradle/gradle-build-action@v2
with:
arguments: test --tests 'IOTest.test3' -i --debug --stacktrace --no-daemon --no-build-cache --no-configuration-cache --rerun-tasks
maven-all-tests:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
Expand All @@ -11,7 +110,6 @@ jobs:
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 11
- uses: gradle/gradle-build-action@v2
with:
arguments: help --info
java-version: 21
- name: Use maven
run: mvn test
28 changes: 28 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* This file was generated by the Gradle 'init' task.
*/

plugins {
`java-library`
}

repositories {
mavenCentral()
}

dependencies {
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}

tasks.named<Test>("test") {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
setJvmArgs(listOf("-Xmx8G"))
}

34 changes: 34 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.example</groupId>
<artifactId>reproducer-project</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.10.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
</plugin>
</plugins>
</build>

</project>
51 changes: 51 additions & 0 deletions src/test/java/IOTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import org.junit.jupiter.api.RepeatedTest;
import org.junit.platform.commons.logging.Logger;
import org.junit.platform.commons.logging.LoggerFactory;

import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
import java.util.List;

public class IOTest {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

@RepeatedTest(50)
void test1() {
for (long loop = 0; loop < 10000; ++loop) {
System.out.println("0123456789".repeat(50));
System.out.println("0123456789".repeat(50));
}
}

@RepeatedTest(50)
void test2() throws Exception {
List<Thread> threads = new ArrayList<>();
for (int i = 0; i < 100; ++i) {
threads.add(Thread.ofPlatform().start(() -> {
for (int j = 0; j < 100; ++j) {
logger.info(() -> "0123456789".repeat(50));
logger.info(() -> "0123456789".repeat(50));
}
}));
}
for (Thread thread : threads) {
thread.join();
}
}

@RepeatedTest(50)
void test3() throws Exception {
List<Thread> threads = new ArrayList<>();
for (int i = 0; i < 100; ++i) {
threads.add(Thread.ofVirtual().start(() -> {
for (int j = 0; j < 100; ++j) {
logger.info(() -> "0123456789".repeat(50));
logger.info(() -> "0123456789".repeat(50));
}
}));
}
for (Thread thread : threads) {
thread.join();
}
}
}

0 comments on commit 237c06c

Please sign in to comment.