forked from taskcluster/taskcluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
helper_posix_broken_on_docker_test.go
87 lines (79 loc) · 1.38 KB
/
helper_posix_broken_on_docker_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
// +build darwin,!docker linux,!docker freebsd
package main
import (
"fmt"
"strconv"
)
func checkSHASums() [][]string {
return [][]string{
{
"chmod",
"u+x",
"preloaded/check-shasums.sh",
},
{
"preloaded/check-shasums.sh",
},
}
}
func incrementCounterInCache() [][]string {
return [][]string{
{
"/bin/bash",
"-c",
`if [ ! -f "my-task-caches/test-modifications/counter" ]; then
echo -n '1' > "my-task-caches/test-modifications/counter"
else
let x=$(cat "my-task-caches/test-modifications/counter")+1
echo -n "${x}" > "my-task-caches/test-modifications/counter"
fi`,
},
}
}
func GoEnv() [][]string {
return [][]string{
{
"go",
"env",
},
{
"env",
},
{
"which",
"go",
},
{
"go",
"version",
},
}
}
func logOncePerSecond(count uint, file string) [][]string {
return [][]string{
{
"/bin/bash",
"-c",
// don't use ping since that isn't available on travis-ci.org !
fmt.Sprintf(`for ((i=0; i<%v; i++)); do echo $i; sleep 1; done > '%v'`, count, file),
},
}
}
func goRun(goFile string, args ...string) [][]string {
copy := copyTestdataFile(goFile)
run := []string{
"go",
"run",
goFile,
}
runWithArgs := append(run, args...)
return append(copy, runWithArgs)
}
func sleep(seconds uint) [][]string {
return [][]string{
{
"sleep",
strconv.Itoa(int(seconds)),
},
}
}