Skip to content

Commit

Permalink
Fix 4 + fix bug in parsing jcstress results
Browse files Browse the repository at this point in the history
  • Loading branch information
DLochmelis33 committed Jul 7, 2024
1 parent cbc23b3 commit 29cfa94
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-litmus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Run litmus tests via CLI (x64 + release)
run: ./cli/build/bin/macosX64/releaseExecutable/cli.kexe -r pthread ".*"
- name: Run a single test with JCStress
run: ./gradlew :cli:jvmRun --args="-r jcstress -j '-m quick' .*"
run: ./gradlew :cli:jvmRun --args="-r jcstress -j '-m quick' StoreBuffering.Plain"
- name: Assemble CLI binary (arm + release)
run: ./gradlew cli:linkReleaseExecutableMacosArm64
- name: Run litmus tests via CLI (arm + release)
Expand Down
6 changes: 5 additions & 1 deletion cli/src/jvmMain/kotlin/org/jetbrains/litmuskt/CliJvm.kt
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ class CliJvm : CliCommon() {
val results = jcsRunner.runTests(tests, jcsParams)

echo()
(tests zip results).forEach { (test, result) ->
if (results.isEmpty()) {
echo("no tests were run, perhaps they are missing jcstress wrappers?", err = true)
return
}
results.forEach { (test, result) ->
echo("results for ${test.alias}:")
echo(result.generateTable() + "\n")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class JCStressRunner(
internal fun startTests(
tests: List<LitmusTest<*>>,
params: LitmusRunParams
): () -> List<LitmusResult> {
): () -> Map<LitmusTest<*>, LitmusResult> {
val mvn = ProcessBuilder("mvn", "install", "verify", "-U")
.directory(jcstressDirectory.toFile())
.redirectOutput(ProcessBuilder.Redirect.INHERIT)
Expand Down Expand Up @@ -71,13 +71,13 @@ class JCStressRunner(
return handle@{
jcs.waitFor()
if (jcs.exitValue() != 0) error("jcstress exited with code ${jcs.exitValue()}")
return@handle tests.map { test -> parseJCStressResults(test) }
return@handle tests.associateWith { test -> parseJCStressResults(test) }
}
}

override fun <S : Any> startTest(test: LitmusTest<S>, params: LitmusRunParams): () -> LitmusResult {
val handle = startTests(listOf(test), params)
return { handle().first() }
return { handle()[test] ?: error("test $test did not produce a result; perhaps its wrapper is missing?") }
}

/**
Expand Down Expand Up @@ -142,7 +142,7 @@ class JCStressRunner(
fun JCStressRunner.runTests(
tests: List<LitmusTest<*>>,
params: LitmusRunParams,
): List<LitmusResult> = startTests(tests, params).invoke()
): Map<LitmusTest<*>, LitmusResult> = startTests(tests, params).invoke()

/**
* Split a sequence into two: one with the first [size] elements and one with the rest.
Expand Down

0 comments on commit 29cfa94

Please sign in to comment.