Skip to content

Commit f890e87

Browse files
authored
Re-enable Scala Native (0.5.8); keep ZipOps JVM-only; split zip tests to JVM (com-lihaoyi#400)
- Enable Native tests with nativeLinkStubs=true; update build.mill - Move ZipOps to os/src-jvm; add shared placeholder for Native - Move zip/unzip tests to os/test/src-jvm; add CheckerZipTests and Native placeholder suite - Stabilize FilesystemMetadataTests.isExecutable - Docs: README note on JVM-only Zip APIs and changelog Fixes com-lihaoyi#395 --------- Signed-off-by: Rishi Jat <[email protected]>
1 parent 29e60d5 commit f890e87

15 files changed

+1549
-1225
lines changed

Readme.adoc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,11 @@ os.list(tempDir) ==> Seq(tempDir / "file")
12201220

12211221
=== Zip & Unzip Files
12221222

1223+
[NOTE]
1224+
====
1225+
JVM only: Zip-related APIs are available on the JVM but not on Scala Native. The following symbols are JVM-only and are not defined on Native builds: `os.zip`, `os.unzip`, `os.zip.stream`, `os.unzip.stream`, `os.unzip.list`, and `os.zip.open`.
1226+
====
1227+
12231228
==== `os.zip`
12241229

12251230
[source,scala]
@@ -2579,6 +2584,10 @@ string, int or set representations of the `os.PermSet` via:
25792584

25802585
== Changelog
25812586

2587+
=== 0.11.6
2588+
2589+
* Re-enabled Scala Native builds (tested with Scala Native 0.5.8). Zip APIs remain JVM-only.
2590+
25822591
=== 0.11.5
25832592

25842593
* Dropped support for Scala-Native, until https://github.com/com-lihaoyi/os-lib/issues/395[Fix and re-enable Scala-Native build (500USD Bounty)]

build.mill

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,23 @@ object os extends Module {
234234
}
235235
}
236236

237-
/*object native extends Cross[OsNativeModule](scalaVersions)
237+
object native extends Cross[OsNativeModule](scalaVersions)
238238
trait OsNativeModule extends OsModule with ScalaNativeModule {
239-
def scalaNativeVersion = "0.5.2"
239+
def scalaNativeVersion = "0.5.9"
240+
241+
// Configurable native mode for debugging/performance testing
242+
def nativeMode = sys.props.get("native.mode") match {
243+
case Some("release-fast") => mill.scalanativelib.api.ReleaseMode.ReleaseFast
244+
case Some("release-full") => mill.scalanativelib.api.ReleaseMode.ReleaseFull
245+
case _ => mill.scalanativelib.api.ReleaseMode.Debug
246+
}
247+
240248
object test extends ScalaNativeTests with OsLibTestModule {
249+
// Keep stubs linked to tolerate optional symbols across platforms
241250
def nativeLinkStubs = true
242251
}
243252
object nohometest extends ScalaNativeTests with OsLibTestModule
244-
}*/
253+
}
245254

246255
object watch extends Module {
247256
object jvm extends Cross[WatchJvmModule](scalaVersions)

debug-subprocess-loop.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
3+
# Script to help debug intermittent subprocess failures locally
4+
# Usage: ./debug-subprocess-loop.sh [iterations] [target]
5+
6+
ITERATIONS=${1:-50}
7+
TARGET=${2:-"test.os.SubprocessTests"}
8+
SCALA_VERSION="2.13.16"
9+
10+
echo "Running $TARGET in loop for $ITERATIONS iterations..."
11+
echo "Set SUBPROCESS_STRESS_ITERATIONS env var to control stress test iterations"
12+
13+
SUCCESS_COUNT=0
14+
FAILURE_COUNT=0
15+
16+
for i in $(seq 1 $ITERATIONS); do
17+
echo "=== Iteration $i/$ITERATIONS ==="
18+
19+
if ./mill -i "os.jvm[$SCALA_VERSION].test.testOnly" "$TARGET" 2>&1; then
20+
SUCCESS_COUNT=$((SUCCESS_COUNT + 1))
21+
echo "✓ Iteration $i: SUCCESS"
22+
else
23+
FAILURE_COUNT=$((FAILURE_COUNT + 1))
24+
echo "✗ Iteration $i: FAILED"
25+
26+
# Optionally stop on first failure
27+
if [ "$3" = "--stop-on-failure" ]; then
28+
echo "Stopping on first failure as requested"
29+
break
30+
fi
31+
fi
32+
33+
# Small delay between runs
34+
sleep 0.1
35+
done
36+
37+
echo ""
38+
echo "=== SUMMARY ==="
39+
echo "Total iterations: $ITERATIONS"
40+
echo "Successes: $SUCCESS_COUNT"
41+
echo "Failures: $FAILURE_COUNT"
42+
echo "Success rate: $(( SUCCESS_COUNT * 100 / (SUCCESS_COUNT + FAILURE_COUNT) ))%"
43+
44+
if [ $FAILURE_COUNT -gt 0 ]; then
45+
echo ""
46+
echo "Failures detected! This may help reproduce the CI issue."
47+
exit 1
48+
else
49+
echo ""
50+
echo "All tests passed. Try increasing iterations or running under stress."
51+
exit 0
52+
fi

0 commit comments

Comments
 (0)