summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRahat Mahmood <rahat@google.com>2020-08-31 11:56:49 -0700
committergVisor bot <gvisor-bot@google.com>2020-08-31 11:58:45 -0700
commita3d189301d811729742a38de9a3cad453f858475 (patch)
tree22ac3fcd284807ff340f7b1c52d20755a6d2d55d
parent3bee863aee7d3975c044e9558ca3ddbf0b3e4a19 (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
-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 {