From d053ca9b73f156c243dd98bf55ab1359318eb800 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Wed, 4 Sep 2024 15:53:25 +0800 Subject: [PATCH 1/2] . --- testkit/src/mill/testkit/IntegrationTesterBase.scala | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/testkit/src/mill/testkit/IntegrationTesterBase.scala b/testkit/src/mill/testkit/IntegrationTesterBase.scala index 2419b09e108..c9bd59e00ff 100644 --- a/testkit/src/mill/testkit/IntegrationTesterBase.scala +++ b/testkit/src/mill/testkit/IntegrationTesterBase.scala @@ -2,18 +2,15 @@ package mill.testkit trait IntegrationTesterBase { def workspaceSourcePath: os.Path - private val workspacePathBase = os.pwd / "out" / "integration-tester-workdir" - os.makeDir.all(workspacePathBase) /** * The working directory of the integration test suite, which is the root of the * Mill build being tested. Contains the `build.mill` file, any application code, and * the `out/` folder containing the build output * - * Make sure it lives inside `os.pwd` because somehow the tests fail on windows - * if it lives in the global temp folder. + * Typically just `pwd`, which is a sandbox directory for test suites run using Mill. */ - val workspacePath: os.Path = os.temp.dir(workspacePathBase, deleteOnExit = false) + val workspacePath: os.Path = os.pwd /** * Initializes the workspace in preparation for integration testing From 97788264fcf838457e841fd3130b356c5e45dd77 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Wed, 4 Sep 2024 16:11:12 +0800 Subject: [PATCH 2/2] . --- testkit/src/mill/testkit/IntegrationTesterBase.scala | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/testkit/src/mill/testkit/IntegrationTesterBase.scala b/testkit/src/mill/testkit/IntegrationTesterBase.scala index c9bd59e00ff..a67f5a7b27d 100644 --- a/testkit/src/mill/testkit/IntegrationTesterBase.scala +++ b/testkit/src/mill/testkit/IntegrationTesterBase.scala @@ -1,4 +1,5 @@ package mill.testkit +import mill.main.client.OutFiles.out trait IntegrationTesterBase { def workspaceSourcePath: os.Path @@ -17,11 +18,8 @@ trait IntegrationTesterBase { */ def initWorkspace(): Unit = { println(s"Copying integration test sources from $workspaceSourcePath to $workspacePath") - os.remove.all(workspacePath) - os.makeDir.all(workspacePath / os.up) - // somehow os.copy does not properly preserve symlinks - // os.copy(scriptSourcePath, workspacePath) - os.call(("cp", "-R", workspaceSourcePath, workspacePath)) + os.list(workspacePath).foreach(os.remove.all(_)) + os.list(workspaceSourcePath).filter(_.last != out).foreach(os.copy.into(_, workspacePath)) os.remove.all(workspacePath / "out") } }