Skip to content

Commit

Permalink
Manually connect and run a test with jcstress
Browse files Browse the repository at this point in the history
  • Loading branch information
DLochmelis33 committed Oct 18, 2023
1 parent 1b2645c commit c5160dc
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 18 deletions.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
3 changes: 3 additions & 0 deletions jcstress/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
target/
libs/
results/
*.bin.gz
test.iml
8 changes: 7 additions & 1 deletion jcstress/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ THE POSSIBILITY OF SUCH DAMAGE.
<artifactId>litmuskt</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>1.9.10</version>
</dependency>
</dependencies>

<properties>
Expand Down Expand Up @@ -112,7 +117,8 @@ THE POSSIBILITY OF SUCH DAMAGE.
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.openjdk.jcstress.Main</mainClass>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/TestList</resource>
</transformer>
</transformers>
Expand Down
15 changes: 0 additions & 15 deletions jcstress/src/main/java/org/sample/AbaTest.java

This file was deleted.

43 changes: 43 additions & 0 deletions jcstress/src/main/java/org/sample/LitmusSB.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package org.sample;

import komem.litmus.LitmusTest;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import komem.litmus.testsuite.ClassicTestsKt;
import org.openjdk.jcstress.annotations.*;
import org.openjdk.jcstress.infra.results.II_Result;

import java.util.List;

@JCStressTest
@State
public class LitmusSB {

private static final LitmusTest<Object> sb = (LitmusTest<Object>) ClassicTestsKt.getSB();
private static final Function1<Object, Unit> fT0 = sb.getThreadFunctions().get(0);
private static final Function1<Object, Unit> fT1 = sb.getThreadFunctions().get(1);
private static final Function1<Object, Object> fA = sb.getOutcomeFinalizer();

public LitmusSB() {
}

public Object state = sb.getStateProducer().invoke();

@Actor
public void t1() {
fT0.invoke(state);
}

@Actor
public void t2() {
fT1.invoke(state);
}

@Arbiter
public void a(II_Result r) {
List<Integer> result = (List<Integer>) fA.invoke(state);
r.r1 = result.get(0);
r.r2 = result.get(1);
}

}
2 changes: 1 addition & 1 deletion litmus/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ kotlin {
mainClass.set("JvmMainKt")
}
withSourcesJar()
withJava()
jvmToolchain(8)
}

val affinitySupported = hostOs == "Linux"
Expand Down

0 comments on commit c5160dc

Please sign in to comment.