aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2018-12-11 11:48:01 -0500
committerBryan C. Mills <bcmills@google.com>2018-12-11 19:50:23 +0000
commitec510045675ac112184052bc303be190872fd51c (patch)
treeee7dee6ecb2a7178f86a1d4bf1d18b4a7fb881d3 /src/cmd
parentf36a53e95ca86cc57349dc9320f9d87fef783708 (diff)
downloadgo-ec510045675ac112184052bc303be190872fd51c.tar.xz
cmd/go: add a [root] condition to script_test
[root] reports whether the current effective user ID is 0. Updates #29127 Change-Id: I9ef42f1271ea669689011e7ceff4d918c0cecb6b Reviewed-on: https://go-review.googlesource.com/c/153637 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/go/script_test.go2
-rw-r--r--src/cmd/go/testdata/script/README1
2 files changed, 3 insertions, 0 deletions
diff --git a/src/cmd/go/script_test.go b/src/cmd/go/script_test.go
index e180080a9d..284b3548c4 100644
--- a/src/cmd/go/script_test.go
+++ b/src/cmd/go/script_test.go
@@ -274,6 +274,8 @@ Script:
ok = testenv.HasExternalNetwork()
case "link":
ok = testenv.HasLink()
+ case "root":
+ ok = os.Geteuid() == 0
case "symlink":
ok = testenv.HasSymlink()
default:
diff --git a/src/cmd/go/testdata/script/README b/src/cmd/go/testdata/script/README
index 392ff34fc2..76d4b36b01 100644
--- a/src/cmd/go/testdata/script/README
+++ b/src/cmd/go/testdata/script/README
@@ -75,6 +75,7 @@ should only run when the condition is satisfied. The available conditions are:
- [cgo], [msan], [race] for whether cgo, msan, and the race detector can be used
- [net] for whether the external network can be used
- [link] for testenv.HasLink()
+ - [root] for os.Geteuid() == 0
- [symlink] for testenv.HasSymlink()
- [exec:prog] for whether prog is available for execution (found by exec.LookPath)