-
-
Notifications
You must be signed in to change notification settings - Fork 83
Re-enable Scala Native (0.5.8); keep ZipOps JVM-only; split zip tests to JVM #400
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4102c2e
Re-enable Scala Native (0.5.8); keep ZipOps JVM-only
rishi-jat 1f74387
Scalafmt: reformat sources; fix check-formatting CI job
rishi-jat 9daf8f6
tests: make curl-based tests resilient in CI (reachability check + ti…
rishi-jat bf1cd65
tests: split SubprocessTests.envArgs into individually named tests fo…
rishi-jat 7502316
debug: enhance subprocess tests with detailed error reporting and str…
rishi-jat 89f70aa
fix: enhance subprocess test error reporting and resilience for CI
rishi-jat f5aa515
upgrade: update Scala Native to 0.5.9 with configurable release modes
rishi-jat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Script to help debug intermittent subprocess failures locally | ||
| # Usage: ./debug-subprocess-loop.sh [iterations] [target] | ||
|
|
||
| ITERATIONS=${1:-50} | ||
| TARGET=${2:-"test.os.SubprocessTests"} | ||
| SCALA_VERSION="2.13.16" | ||
|
|
||
| echo "Running $TARGET in loop for $ITERATIONS iterations..." | ||
| echo "Set SUBPROCESS_STRESS_ITERATIONS env var to control stress test iterations" | ||
|
|
||
| SUCCESS_COUNT=0 | ||
| FAILURE_COUNT=0 | ||
|
|
||
| for i in $(seq 1 $ITERATIONS); do | ||
| echo "=== Iteration $i/$ITERATIONS ===" | ||
|
|
||
| if ./mill -i "os.jvm[$SCALA_VERSION].test.testOnly" "$TARGET" 2>&1; then | ||
| SUCCESS_COUNT=$((SUCCESS_COUNT + 1)) | ||
| echo "✓ Iteration $i: SUCCESS" | ||
| else | ||
| FAILURE_COUNT=$((FAILURE_COUNT + 1)) | ||
| echo "✗ Iteration $i: FAILED" | ||
|
|
||
| # Optionally stop on first failure | ||
| if [ "$3" = "--stop-on-failure" ]; then | ||
| echo "Stopping on first failure as requested" | ||
| break | ||
| fi | ||
| fi | ||
|
|
||
| # Small delay between runs | ||
| sleep 0.1 | ||
| done | ||
|
|
||
| echo "" | ||
| echo "=== SUMMARY ===" | ||
| echo "Total iterations: $ITERATIONS" | ||
| echo "Successes: $SUCCESS_COUNT" | ||
| echo "Failures: $FAILURE_COUNT" | ||
| echo "Success rate: $(( SUCCESS_COUNT * 100 / (SUCCESS_COUNT + FAILURE_COUNT) ))%" | ||
|
|
||
| if [ $FAILURE_COUNT -gt 0 ]; then | ||
| echo "" | ||
| echo "Failures detected! This may help reproduce the CI issue." | ||
| exit 1 | ||
| else | ||
| echo "" | ||
| echo "All tests passed. Try increasing iterations or running under stress." | ||
| exit 0 | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,7 +82,20 @@ object SubprocessTests extends TestSuite { | |
| env = Map("ENV_ARG" -> "123") | ||
| ) | ||
|
|
||
| assert(res.out.text().trim() == "Hello123") | ||
| // Enhanced debugging: show exit code and raw output on failure | ||
| if (res.exitCode != 0) { | ||
| throw new Exception( | ||
| s"Subprocess failed with exit code ${res.exitCode}, stderr: '${res.err.text()}'" | ||
| ) | ||
| } | ||
| val actualOutput = res.out.text().trim() | ||
| val expectedOutput = "Hello123" | ||
| if (actualOutput != expectedOutput) { | ||
| throw new Exception( | ||
| s"Output mismatch: expected '$expectedOutput', got '$actualOutput' (${actualOutput.length} chars, exit code: ${res.exitCode})" | ||
| ) | ||
| } | ||
| assert(actualOutput == expectedOutput) | ||
| } | ||
| } | ||
| test("filebased2") { | ||
|
|
@@ -109,13 +122,27 @@ object SubprocessTests extends TestSuite { | |
| test("envArgs.doubleQuotesExpand-1") { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for the change from "locally" blocks to individual "test()" |
||
| if (Unix()) { | ||
| val res0 = proc("bash", "-c", "echo \"Hello$ENV_ARG\"").call(env = Map("ENV_ARG" -> "12")) | ||
| assert(res0.out.lines() == Seq("Hello12")) | ||
| val expectedLines = Seq("Hello12") | ||
| val actualLines = res0.out.lines() | ||
| if (actualLines != expectedLines) { | ||
| throw new Exception( | ||
| s"envArgs.doubleQuotesExpand-1 failed: expected $expectedLines, got $actualLines (exit code: ${res0.exitCode})" | ||
| ) | ||
| } | ||
| assert(actualLines == expectedLines) | ||
| } | ||
| } | ||
| test("envArgs.doubleQuotesExpand-2") { | ||
| if (Unix()) { | ||
| val res1 = proc("bash", "-c", "echo \"Hello$ENV_ARG\"").call(env = Map("ENV_ARG" -> "12")) | ||
| assert(res1.out.lines() == Seq("Hello12")) | ||
| val expectedLines = Seq("Hello12") | ||
| val actualLines = res1.out.lines() | ||
| if (actualLines != expectedLines) { | ||
| throw new Exception( | ||
| s"envArgs.doubleQuotesExpand-2 failed: expected $expectedLines, got $actualLines (exit code: ${res1.exitCode})" | ||
| ) | ||
| } | ||
| assert(actualLines == expectedLines) | ||
| } | ||
| } | ||
| test("envArgs.singleQuotesNoExpand") { | ||
|
|
@@ -250,5 +277,53 @@ object SubprocessTests extends TestSuite { | |
| assert(z.out.trim() == outsidePwd.toString) | ||
| } | ||
| } | ||
|
|
||
| // Stress test to help reproduce intermittent subprocess failures seen in CI | ||
| test("stressSubprocess") { | ||
| if (Unix()) { | ||
| val iterations = sys.env.get("SUBPROCESS_STRESS_ITERATIONS").map(_.toInt).getOrElse(10) | ||
| var failures = 0 | ||
| var successes = 0 | ||
|
|
||
| for (i <- 1 to iterations) { | ||
| try { | ||
| // Test the exact same pattern that's failing in CI | ||
| val res = proc("bash", "-c", "echo 'Hello'$ENV_ARG").call(env = Map("ENV_ARG" -> "123")) | ||
| val expected = "Hello123" | ||
| val actual = res.out.text().trim() | ||
|
|
||
| if (res.exitCode != 0) { | ||
| println(s"Iteration $i: subprocess failed with exit code ${res.exitCode}") | ||
| failures += 1 | ||
| } else if (actual != expected) { | ||
| println(s"Iteration $i: output mismatch - expected '$expected', got '$actual'") | ||
| failures += 1 | ||
| } else { | ||
| successes += 1 | ||
| } | ||
|
|
||
| // Add a small delay to potentially trigger race conditions | ||
| Thread.sleep(1) | ||
|
|
||
| } catch { | ||
| case ex: Throwable => | ||
| println(s"Iteration $i: exception - ${ex.getMessage}") | ||
| failures += 1 | ||
| } | ||
| } | ||
|
|
||
| println( | ||
| s"Stress test completed: $successes successes, $failures failures out of $iterations iterations" | ||
| ) | ||
|
|
||
| // Allow up to 10% failure rate for now to gather data | ||
| val failureRate = failures.toDouble / iterations | ||
| if (failureRate > 0.1) { | ||
| throw new Exception( | ||
| s"High failure rate in stress test: ${(failureRate * 100).toInt}% ($failures/$iterations)" | ||
| ) | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these changes will help debugging a lot. Thank you.
I'll check the logs of the next os-lib CI run and see what I can
glean.