From 01679f3b5ab957c274690a62f0fce5d332ee94af Mon Sep 17 00:00:00 2001 From: Fabricio Voznika Date: Thu, 24 Jan 2019 14:19:07 -0800 Subject: Increase gofer coverage in tests Lots of tests use /tmp for the tests. Force /tmp to be mounted over fsgofer instead of tmpfs. PiperOrigin-RevId: 230788985 Change-Id: Id6597ed88133232d15e808c48126bf77cb32673e --- test/syscalls/syscall_test_runner.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'test/syscalls/syscall_test_runner.go') diff --git a/test/syscalls/syscall_test_runner.go b/test/syscalls/syscall_test_runner.go index e5c2358a0..e8593ec73 100644 --- a/test/syscalls/syscall_test_runner.go +++ b/test/syscalls/syscall_test_runner.go @@ -45,6 +45,7 @@ var ( debug = flag.Bool("debug", false, "enable debug logs") strace = flag.Bool("strace", false, "enable strace logs") platform = flag.String("platform", "ptrace", "platform to run on") + useTmpfs = flag.Bool("use-tmpfs", false, "mounts tmpfs for /tmp") parallel = flag.Bool("parallel", false, "run tests in parallel") runscPath = flag.String("runsc", "", "path to runsc binary") ) @@ -109,10 +110,14 @@ func runTestCaseRunsc(testBin string, tc gtest.TestCase, t *testing.T) { // write to the rootfs, and expect EACCES, not EROFS. spec.Root.Readonly = false - // Forces '/tmp' to be mounted as tmpfs, otherwise test that rely on features - // available in gVisor's tmpfs and not gofers, may fail. - spec.Mounts = []specs.Mount{ - {Destination: "/tmp", Type: "tmpfs"}, + // Test spec comes with pre-defined mounts that we don't want. Reset it. + spec.Mounts = nil + if *useTmpfs { + // Forces '/tmp' to be mounted as tmpfs, otherwise test that rely on + // features available in gVisor's tmpfs and not gofers, may fail. + spec.Mounts = []specs.Mount{ + {Destination: "/tmp", Type: "tmpfs"}, + } } // Set environment variable that indicates we are -- cgit v1.2.3