Skip to content

Checking stuff #13

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 2 commits into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class ScalaJsCliNativeImage(val scalaJsVersion0: String) extends ScalaModule wit
System.err.println(s"Testing ${path.relativeTo(os.pwd)}")
val cwd = T.dest / "workdir"
os.makeDir.all(cwd)
os.proc(bash, os.pwd / "scripts" / "test-cli.sh", path)
os.proc(bash, os.pwd / "scripts" / "test-cli.sh", path, scalaJsVersion)
.call(cwd = cwd, stdin = os.Inherit, stdout = os.Inherit)
}
}
Expand Down Expand Up @@ -339,7 +339,7 @@ object ci extends Module {
if (version.endsWith("-SNAPSHOT")) ("launchers", true)
else ("v" + version, false)

Upload.upload("scala-cli", "scala-js-cli-native-image", ghToken, tag, dryRun = false, overwrite = overwriteAssets)(launchers: _*)
Upload.upload("scala-cli", "scala-js-cli", ghToken, tag, dryRun = false, overwrite = overwriteAssets)(launchers: _*)
}

def testCli() = {
Expand All @@ -353,7 +353,7 @@ object ci extends Module {
System.err.println(s"Testing Scala.JS $scalaJsVer")
val cwd = workDir / scalaJsVer
os.makeDir.all(cwd)
os.proc(bash, os.pwd / "scripts" / "test-cli.sh", launcher.path)
os.proc(bash, os.pwd / "scripts" / "test-cli.sh", launcher.path, scalaJsVer)
.call(cwd = cwd, stdin = os.Inherit, stdout = os.Inherit)
}
}
Expand Down
15 changes: 8 additions & 7 deletions scripts/test-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
set -ev

launcher="$1"
scalaJsVersion="$2"

if [ "$launcher" == "" ]; then
echo "Usage: $0 launcher" 1>&2
if [ "$launcher" == "" -o "$scalaJsVersion" == "" ]; then
echo "Usage: $0 launcher scala-js-version" 1>&2
exit 1
fi

echo "Using launcher $launcher"
echo "Using launcher $launcher, Scala.JS $scalaJsVersion"

fail() {
echo "$1" >&2
Expand All @@ -29,11 +30,11 @@ object Foo {
EOF

cs launch scalac:2.13.6 -- \
-classpath "$(cs fetch --intransitive org.scala-js::scalajs-library:1.9.0)" \
-Xplugin:"$(cs fetch --intransitive org.scala-js:scalajs-compiler_2.13.6:1.9.0)" \
-classpath "$(cs fetch --intransitive org.scala-js::scalajs-library:$scalaJsVersion)" \
-Xplugin:"$(cs fetch --intransitive org.scala-js:scalajs-compiler_2.13.6:$scalaJsVersion)" \
-d bin foo.scala

"$launcher" --stdlib "$(cs fetch --intransitive org.scala-js::scalajs-library:1.9.0)" -s -o test.js -mm Foo.main bin 2> test_stderr.txt || cat test_stderr.txt
"$launcher" --stdlib "$(cs fetch --intransitive org.scala-js::scalajs-library:$scalaJsVersion)" -s -o test.js -mm Foo.main bin 2> test_stderr.txt || cat test_stderr.txt
grep -Fxq "Warning: using a single file as output (--output) is deprecated since Scala.js 1.3.0. Use --outputDir instead." test_stderr.txt \
|| fail "expected warning. Got: $(cat test_stderr.txt)"
test -s test.js || fail "scalajsld: empty output"
Expand All @@ -47,7 +48,7 @@ EOF
diff got-legacy.run want-legacy.run

mkdir test-output
"$launcher" --stdlib "$(cs fetch --intransitive org.scala-js::scalajs-library:1.9.0)" -s --outputDir test-output --moduleSplitStyle SmallestModules --moduleKind CommonJSModule -mm Foo.main bin
"$launcher" --stdlib "$(cs fetch --intransitive org.scala-js::scalajs-library:$scalaJsVersion)" -s --outputDir test-output --moduleSplitStyle SmallestModules --moduleKind CommonJSModule -mm Foo.main bin
test "$(ls test-output/*.js| wc -w)" -gt "1" || fail "scalajsld: produced single js output file"

node test-output/main.js > got.run
Expand Down