Combine SetupWorkingDirectory for Linux and Windows
Signed-off-by: Darren Stahl <darst@microsoft.com> Upstream-commit: 6791230320fa9f8ae9df3e90d5c52d85621828a0 Component: engine
This commit is contained in:
@@ -6568,3 +6568,20 @@ func (s *DockerSuite) TestBuildFailsGitNotCallable(c *check.C) {
|
||||
c.Assert(err, checker.NotNil)
|
||||
c.Assert(out, checker.Contains, "unable to prepare context: unable to find 'git': ")
|
||||
}
|
||||
|
||||
// TestBuildWorkdirWindowsPath tests that a Windows style path works as a workdir
|
||||
func (s *DockerSuite) TestBuildWorkdirWindowsPath(c *check.C) {
|
||||
testRequires(c, DaemonIsWindows)
|
||||
name := "testbuildworkdirwindowspath"
|
||||
|
||||
_, err := buildImage(name, `
|
||||
FROM windowsservercore
|
||||
RUN mkdir C:\\work
|
||||
WORKDIR C:\\work
|
||||
RUN if "%CD%" NEQ "C:\work" exit -1
|
||||
`, true)
|
||||
|
||||
if err != nil {
|
||||
c.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1723,7 +1723,7 @@ func (s *DockerSuite) TestRunWorkdirExistsAndIsFile(c *check.C) {
|
||||
expected := "Cannot mkdir: /bin/cat is not a directory"
|
||||
if daemonPlatform == "windows" {
|
||||
existingFile = `\windows\system32\ntdll.dll`
|
||||
expected = "The directory name is invalid"
|
||||
expected = `Cannot mkdir: \windows\system32\ntdll.dll is not a directory.`
|
||||
}
|
||||
|
||||
out, exitCode, err := dockerCmdWithError("run", "-w", existingFile, "busybox")
|
||||
|
||||
Reference in New Issue
Block a user