Skip to content

Commit ec303a9

Browse files
committed
Merge remote-tracking branch 'origin/main' into checker
2 parents 8c02044 + 7263129 commit ec303a9

File tree

9 files changed

+21
-12
lines changed

9 files changed

+21
-12
lines changed

.mill-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.11.12
1+
0.12.0

build.sc renamed to build.mill

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
package build
12
// plugins
23
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0`
34
import $ivy.`com.github.lolgab::mill-mima::0.1.1`
@@ -104,7 +105,8 @@ trait OsLibModule
104105
// we check the textual output of system commands and expect it in english
105106
def forkEnv = super.forkEnv() ++ Map(
106107
"LC_ALL" -> "C",
107-
"TEST_SUBPROCESS_ENV" -> "value"
108+
"TEST_SUBPROCESS_ENV" -> "value",
109+
"OS_TEST_RESOURCE_FOLDER" -> os.jvm(crossValue).test.resources().head.path.toString
108110
)
109111
}
110112
}
@@ -209,6 +211,7 @@ object os extends Module {
209211
def ivyDeps = Agg(Deps.jna)
210212
object test extends ScalaTests with OsLibTestModule {
211213
def moduleDeps = super.moduleDeps ++ Seq(os.jvm().test)
214+
212215
}
213216
}
214217
}

mill

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
set -e
88

99
if [ -z "${DEFAULT_MILL_VERSION}" ] ; then
10-
DEFAULT_MILL_VERSION=0.11.0
10+
DEFAULT_MILL_VERSION=0.11.12
1111
fi
1212

1313
if [ -z "$MILL_VERSION" ] ; then
@@ -53,7 +53,9 @@ if [ -z "$MILL_MAIN_CLI" ] ; then
5353
fi
5454

5555
MILL_FIRST_ARG=""
56-
if [ "$1" = "--bsp" ] || [ "$1" = "-i" ] || [ "$1" = "--interactive" ] || [ "$1" = "--no-server" ] || [ "$1" = "--repl" ] || [ "$1" = "--help" ] ; then
56+
57+
# first arg is a long flag for "--interactive" or starts with "-i"
58+
if [ "$1" = "--bsp" ] || [ "${1#"-i"}" != "$1" ] || [ "$1" = "--interactive" ] || [ "$1" = "--no-server" ] || [ "$1" = "--repl" ] || [ "$1" = "--help" ] ; then
5759
# Need to preserve the first position of those listed options
5860
MILL_FIRST_ARG=$1
5961
shift

os/test/src-jvm/ExampleTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ object ExampleTests extends TestSuite {
254254
}
255255
test("findWc") {
256256

257-
val wd = os.pwd / "os/test/resources/test"
257+
val wd = os.Path(sys.env("OS_TEST_RESOURCE_FOLDER")) / "test"
258258

259259
// find . -name '*.txt' | xargs wc -l
260260
val lines = os.walk(wd)

os/test/src-jvm/OpTestsJvmOnly.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import java.nio.charset.Charset
1010
object OpTestsJvmOnly extends TestSuite {
1111

1212
val tests = Tests {
13-
val res = os.pwd / "os/test/resources/test"
13+
val res = os.Path(sys.env("OS_TEST_RESOURCE_FOLDER")) / "test"
1414
val testFolder = os.pwd / "out/scratch/test"
1515
test("lsRecPermissions") {
1616
if (Unix()) {
@@ -74,7 +74,7 @@ object OpTestsJvmOnly extends TestSuite {
7474
// Not sure why this doesn't work on native
7575
test("redirectSubprocessInheritedOutput") {
7676
if (Unix()) { // relies on bash scripts that don't run on windows
77-
val scriptFolder = os.pwd / "os/test/resources/test"
77+
val scriptFolder = os.Path(sys.env("OS_TEST_RESOURCE_FOLDER")) / "test"
7878
val lines = collection.mutable.Buffer.empty[String]
7979
os.Inherit.out.withValue(os.ProcessOutput.Readlines(lines.append(_))) {
8080
// Redirected

os/test/src-jvm/ProcessPipelineTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import TestUtil.prep
99
import scala.util.Try
1010

1111
object ProcessPipelineTests extends TestSuite {
12-
val scriptFolder = pwd / "os/test/resources/scripts"
12+
val scriptFolder = os.Path(sys.env("OS_TEST_RESOURCE_FOLDER")) / "scripts"
1313

1414
lazy val scalaHome = sys.env("SCALA_HOME")
1515

os/test/src/OpTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import java.nio.charset.Charset
1010
object OpTests extends TestSuite {
1111

1212
val tests = Tests {
13-
val res = os.pwd / "os/test/resources/test"
13+
val res = os.Path(sys.env("OS_TEST_RESOURCE_FOLDER")) / "test"
1414
test("ls") - assert(
1515
os.list(res).toSet == Set(
1616
res / "folder1",

os/test/src/SubprocessTests.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import utest._
99
import scala.collection.mutable
1010

1111
object SubprocessTests extends TestSuite {
12-
val scriptFolder = pwd / "os/test/resources/test"
12+
val scriptFolder = os.Path(sys.env("OS_TEST_RESOURCE_FOLDER")) / "test"
1313

1414
val lsCmd = if (scala.util.Properties.isWin) "dir" else "ls"
1515

@@ -38,6 +38,8 @@ object SubprocessTests extends TestSuite {
3838
}
3939
}
4040
test("chained") {
41+
proc("git", "init").call()
42+
os.write.over(os.pwd / "Readme.adoc", "hello")
4143
assert(
4244
proc("git", "init").call().out.text().contains("Reinitialized existing Git repository"),
4345
proc("git", "init").call().out.text().contains("Reinitialized existing Git repository"),
@@ -46,6 +48,8 @@ object SubprocessTests extends TestSuite {
4648
}
4749
test("basicList") {
4850
val files = List("Readme.adoc", "build.sc")
51+
os.write.over(os.pwd / "Readme.adoc", "hello")
52+
os.write.over(os.pwd / "build.sc", "world")
4953
val output = TestUtil.proc(lsCmd, files).call().out.text()
5054
assert(files.forall(output.contains))
5155
}
@@ -193,7 +197,7 @@ object SubprocessTests extends TestSuite {
193197
}
194198
test("jarTf") {
195199
// This was the original repro for the multi-chunk concurrency bugs
196-
val jarFile = os.pwd / "os/test/resources/misc/out.jar"
200+
val jarFile = os.Path(sys.env("OS_TEST_RESOURCE_FOLDER")) / "misc/out.jar"
197201
assert(TestUtil.eqIgnoreNewlineStyle(
198202
os.proc("jar", "-tf", jarFile).call().out.text(),
199203
"""META-INF/MANIFEST.MF

os/test/src/TestUtil.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ object TestUtil {
5757
}
5858
)
5959

60-
val original = Paths.get("os", "test", "resources", "test")
60+
val original = Paths.get(sys.env("OS_TEST_RESOURCE_FOLDER"), "test")
6161
Files.walkFileTree(
6262
original,
6363
new SimpleFileVisitor[Path]() {

0 commit comments

Comments
 (0)