diff options
author | Fabricio Voznika <fvoznika@google.com> | 2019-01-24 14:19:07 -0800 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-01-24 14:20:16 -0800 |
commit | 01679f3b5ab957c274690a62f0fce5d332ee94af (patch) | |
tree | d8379c22c1a4df03c096984eb2cfe0b3c5582311 /test/syscalls/syscall_test_runner.go | |
parent | 79e0451bd11645b0dff34c3a6c6131ed68c822f7 (diff) |
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
Diffstat (limited to 'test/syscalls/syscall_test_runner.go')
-rw-r--r-- | test/syscalls/syscall_test_runner.go | 13 |
1 files changed, 9 insertions, 4 deletions
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 |