From a3d189301d811729742a38de9a3cad453f858475 Mon Sep 17 00:00:00 2001 From: Rahat Mahmood Date: Mon, 31 Aug 2020 11:56:49 -0700 Subject: 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 --- test/runner/runner.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'test/runner/runner.go') 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 { -- cgit v1.2.3