Fix failing Windows guest command tests

This commit is contained in:
Shawn Neal 2015-08-20 15:50:58 -07:00
parent 7195b2f35b
commit 357e494ee3
1 changed files with 4 additions and 4 deletions

View File

@ -38,13 +38,13 @@ func TestCreateDir(t *testing.T) {
t.Fatalf("Failed to create new GuestCommands for OS: %s", WindowsOSType) t.Fatalf("Failed to create new GuestCommands for OS: %s", WindowsOSType)
} }
cmd = guestCmd.CreateDir("C:\\Windows\\Temp\\tempdir") cmd = guestCmd.CreateDir("C:\\Windows\\Temp\\tempdir")
if cmd != "New-Item -ItemType directory -Force -ErrorAction SilentlyContinue -Path C:\\Windows\\Temp\\tempdir" { if cmd != "powershell.exe -Command \"New-Item -ItemType directory -Force -ErrorAction SilentlyContinue -Path C:\\Windows\\Temp\\tempdir\"" {
t.Fatalf("Unexpected Windows create dir cmd: %s", cmd) t.Fatalf("Unexpected Windows create dir cmd: %s", cmd)
} }
// Windows OS w/ space in path // Windows OS w/ space in path
cmd = guestCmd.CreateDir("C:\\Windows\\Temp\\temp dir") cmd = guestCmd.CreateDir("C:\\Windows\\Temp\\temp dir")
if cmd != "New-Item -ItemType directory -Force -ErrorAction SilentlyContinue -Path C:\\Windows\\Temp\\temp` dir" { if cmd != "powershell.exe -Command \"New-Item -ItemType directory -Force -ErrorAction SilentlyContinue -Path C:\\Windows\\Temp\\temp` dir\"" {
t.Fatalf("Unexpected Windows create dir cmd: %s", cmd) t.Fatalf("Unexpected Windows create dir cmd: %s", cmd)
} }
} }
@ -108,13 +108,13 @@ func TestRemoveDir(t *testing.T) {
t.Fatalf("Failed to create new GuestCommands for OS: %s", WindowsOSType) t.Fatalf("Failed to create new GuestCommands for OS: %s", WindowsOSType)
} }
cmd = guestCmd.RemoveDir("C:\\Temp\\SomeDir") cmd = guestCmd.RemoveDir("C:\\Temp\\SomeDir")
if cmd != "rm C:\\Temp\\SomeDir -recurse -force" { if cmd != "powershell.exe -Command \"rm C:\\Temp\\SomeDir -recurse -force\"" {
t.Fatalf("Unexpected Windows remove dir cmd: %s", cmd) t.Fatalf("Unexpected Windows remove dir cmd: %s", cmd)
} }
// Windows OS w/ space in path // Windows OS w/ space in path
cmd = guestCmd.RemoveDir("C:\\Temp\\Some Dir") cmd = guestCmd.RemoveDir("C:\\Temp\\Some Dir")
if cmd != "rm C:\\Temp\\Some` Dir -recurse -force" { if cmd != "powershell.exe -Command \"rm C:\\Temp\\Some` Dir -recurse -force\"" {
t.Fatalf("Unexpected Windows remove dir cmd: %s", cmd) t.Fatalf("Unexpected Windows remove dir cmd: %s", cmd)
} }
} }