]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: add a [root] condition to script_test
authorBryan C. Mills <bcmills@google.com>
Tue, 11 Dec 2018 16:48:01 +0000 (11:48 -0500)
committerBryan C. Mills <bcmills@google.com>
Tue, 11 Dec 2018 19:50:23 +0000 (19:50 +0000)
[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>
src/cmd/go/script_test.go
src/cmd/go/testdata/script/README

index e180080a9da0fbb3059f1e02ce96d00f93f605dc..284b3548c451c724adb4e871cdef82024dc57604 100644 (file)
@@ -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:
index 392ff34fc2d401586458c40457fb3c503804ecb8..76d4b36b017ca66edb6e911534cf9acc0ce77ddc 100644 (file)
@@ -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)