Skip to content
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

Remove unnecessary subfolder wrappers for integration tests #3458

Merged
merged 2 commits into from
Sep 5, 2024
Merged
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
15 changes: 5 additions & 10 deletions testkit/src/mill/testkit/IntegrationTesterBase.scala
Original file line number Diff line number Diff line change
@@ -1,30 +1,25 @@
package mill.testkit
import mill.main.client.OutFiles.out

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
*/
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")
}
}
Loading