forked from taskcluster/taskcluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
multiuser_windows_test.go
122 lines (105 loc) · 3.75 KB
/
multiuser_windows_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
//go:build multiuser
package main
import (
"os"
"testing"
)
// Test APPDATA / LOCALAPPDATA folder are not shared between tasks
func TestAppDataNotShared(t *testing.T) {
t.Skip("It isn't possible to test this without rebooting, which we can't do in the middle of a test, so disabling")
setup(t)
if config.RunTasksAsCurrentUser {
t.Skip("Not running, since APPDATA does not change when running as current user")
}
// Run two tasks in sequence...
// First task:
payload1 := GenericWorkerPayload{
Command: []string{
// make sure vars are set
// https://bugzilla.mozilla.org/show_bug.cgi?id=1338602
`if not defined APPDATA exit /b 68`,
`if not defined LOCALAPPDATA exit /b 69`,
"echo hello > %APPDATA%\\hello.txt",
"echo hello > %LOCALAPPDATA%\\sir.txt",
`if not exist "%APPDATA%\hello.txt" exit /b 64`,
`if not exist "%LOCALAPPDATA%\sir.txt" exit /b 65`,
},
MaxRunTime: 10,
}
td1 := testTask(t)
_ = submitAndAssert(t, td1, payload1, "completed", "completed")
// Second task:
payload2 := GenericWorkerPayload{
Command: []string{
// make sure vars are set
// https://bugzilla.mozilla.org/show_bug.cgi?id=1338602
`if not defined APPDATA exit /b 70`,
`if not defined LOCALAPPDATA exit /b 71`,
// make sure files don't already exist, because we should have
// fresh folders created
`if exist "%APPDATA%\hello.txt" exit /b 66`,
`if exist "%LOCALAPPDATA%\sir.txt" exit /b 67`,
},
MaxRunTime: 10,
}
td2 := testTask(t)
_ = submitAndAssert(t, td2, payload2, "completed", "completed")
}
// https://bugzilla.mozilla.org/show_bug.cgi?id=1360539
// Test we don't get weird error:
//
// c:\cygwin\bin\bash.exe: *** CreateFileMappingA, Win32 error 0. Terminating.
func TestNoCreateFileMappingError(t *testing.T) {
if os.Getenv("GW_SKIP_MOZILLA_BUILD_TESTS") != "" {
t.Skip("Skipping since GW_SKIP_MOZILLA_BUILD_TESTS env var is set")
}
setup(t)
if config.RunTasksAsCurrentUser {
t.Skip("Not running, since we never want to call msys directly from LocalSystem account")
}
payload := GenericWorkerPayload{
// run several bash commands, as running one is horribly slow, but
// let's make sure if you run a lot of them, they are not all slow -
// hopefully just the first one is the problem
Command: []string{
`c:\cygwin\bin\bash.exe -c "echo hello"`,
`c:\cygwin\bin\bash.exe -c "echo hello"`,
`c:\cygwin\bin\bash.exe -c "echo hello"`,
`c:\cygwin\bin\bash.exe -c "echo hello"`,
`c:\cygwin\bin\bash.exe -c "echo hello"`,
`c:\cygwin\bin\bash.exe -c "echo hello"`,
`c:\cygwin\bin\bash.exe -c "echo hello"`,
`c:\cygwin\bin\bash.exe -c "echo hello"`,
`c:\cygwin\bin\bash.exe -c "echo hello"`,
`c:\cygwin\bin\bash.exe -c "echo hello"`,
`c:\cygwin\bin\bash.exe -c "echo hello"`,
`c:\cygwin\bin\bash.exe -c "echo hello"`,
},
MaxRunTime: 120,
}
td := testTask(t)
_ = submitAndAssert(t, td, payload, "completed", "completed")
}
func TestDesktopResizeAndMovePointer(t *testing.T) {
if os.Getenv("GW_SKIP_PYTHON_TESTS") != "" {
t.Skip("Skipping since GW_SKIP_PYTHON_TESTS env var is set")
}
setup(t)
if config.RunTasksAsCurrentUser {
t.Skip("Skipping since running as current user...")
}
commands := copyTestdataFile("mouse_and_screen_resolution.py")
commands = append(commands, copyTestdataFile("machine-configuration.json")...)
commands = append(commands, "python mouse_and_screen_resolution.py --configuration-file machine-configuration.json")
payload := GenericWorkerPayload{
Command: commands,
MaxRunTime: 90,
// Don't assume python 2 is in the default system PATH, but rather
// require that python 2 is in the PATH of the test process.
Env: map[string]string{
"PATH": os.Getenv("PATH"),
},
}
td := testTask(t)
_ = submitAndAssert(t, td, payload, "completed", "completed")
}