forked from tweag/rules_haskell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrules_go_integration_testing.patch
More file actions
47 lines (45 loc) · 2.25 KB
/
Copy pathrules_go_integration_testing.patch
File metadata and controls
47 lines (45 loc) · 2.25 KB
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
diff --git a/go/tools/bazel_testing/bazel_testing.go b/go/tools/bazel_testing/bazel_testing.go
index 4d1ea2f8..9d8ea3ca 100644
--- a/go/tools/bazel_testing/bazel_testing.go
+++ b/go/tools/bazel_testing/bazel_testing.go
@@ -86,11 +86,11 @@ type Args struct {
// instead of running tests.
const debug = false
-// outputUserRoot is set to the directory where Bazel should put its internal files.
+// OutputUserRoot is set to the directory where Bazel should put its internal files.
// Since Bazel 2.0.0, this needs to be set explicitly to avoid it defaulting to a
// deeply nested directory within the test, which runs into Windows path length limits.
// We try to detect the original value in setupWorkspace and set it to that.
-var outputUserRoot string
+var OutputUserRoot string
// TestMain should be called by tests using this framework from a function named
// "TestMain". For example:
@@ -164,8 +164,8 @@ func TestMain(m *testing.M, args Args) {
// hide that this code is executing inside a bazel test.
func BazelCmd(args ...string) *exec.Cmd {
cmd := exec.Command("bazel")
- if outputUserRoot != "" {
- cmd.Args = append(cmd.Args, "--output_user_root="+outputUserRoot)
+ if OutputUserRoot != "" {
+ cmd.Args = append(cmd.Args, "--output_user_root="+OutputUserRoot)
}
cmd.Args = append(cmd.Args, args...)
for _, e := range os.Environ() {
@@ -263,7 +263,7 @@ func setupWorkspace(args Args, files []string) (dir string, cleanup func() error
tmpDir = filepath.Clean(tmpDir)
if i := strings.Index(tmpDir, string(os.PathSeparator)+"execroot"+string(os.PathSeparator)); i >= 0 {
outBaseDir = tmpDir[:i]
- outputUserRoot = filepath.Dir(outBaseDir)
+ OutputUserRoot = filepath.Dir(outBaseDir)
cacheDir = filepath.Join(outBaseDir, "bazel_testing")
} else {
cacheDir = filepath.Join(tmpDir, "bazel_testing")
@@ -441,7 +441,7 @@ func loadWorkspaceName(workspacePath string) (string, error) {
if err != nil {
return "", err
}
- nameRe := regexp.MustCompile(`(?m)^workspace\(\s*name\s*=\s*("[^"]*"|'[^']*')\s*,?\s*\)$`)
+ nameRe := regexp.MustCompile(`(?m)^workspace\(\s*name\s*=\s*("[^"]*"|'[^']*')\s*,?\s*\)\s*$`)
match := nameRe.FindSubmatchIndex(workspaceData)
if match == nil {
return "", fmt.Errorf("%s: workspace name not set", workspacePath)