summaryrefslogtreecommitdiffhomepage
path: root/test/runner
diff options
context:
space:
mode:
authorRahat Mahmood <rahat@google.com>2020-08-31 11:56:49 -0700
committerAndrei Vagin <avagin@gmail.com>2020-09-09 17:53:10 -0700
commitbf4f4fceafcbd672f7dbbd4cdde0ff78fe216403 (patch)
tree8ab2193eefd9dc42709902dd23adf5bcdca4de84 /test/runner
parent56a948dba6beca969d34b8581cd03acf21bd7a1d (diff)
Run syscall tests in uts namespaces.
Some syscall tests, namely uname_test_* modify the host and domain name, which modifies the execution environment and can have unintended consequences on other tests. For example, modifying the hostname causes some networking tests to fail DNS lookups. Run all syscall tests in their own uts namespaces to isolate these changes. PiperOrigin-RevId: 329348127
Diffstat (limited to 'test/runner')
-rw-r--r--test/runner/runner.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/test/runner/runner.go b/test/runner/runner.go
index 5ac91310d..22d535f8d 100644
--- a/test/runner/runner.go
+++ b/test/runner/runner.go
@@ -106,11 +106,14 @@ func runTestCaseNative(testBin string, tc gtest.TestCase, t *testing.T) {
cmd.Env = env
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
+ cmd.SysProcAttr = &syscall.SysProcAttr{}
+
+ if specutils.HasCapabilities(capability.CAP_SYS_ADMIN) {
+ cmd.SysProcAttr.Cloneflags |= syscall.CLONE_NEWUTS
+ }
if specutils.HasCapabilities(capability.CAP_NET_ADMIN) {
- cmd.SysProcAttr = &syscall.SysProcAttr{
- Cloneflags: syscall.CLONE_NEWNET,
- }
+ cmd.SysProcAttr.Cloneflags |= syscall.CLONE_NEWNET
}
if err := cmd.Run(); err != nil {