From 1c2908c37c751fff8cb9e73a7b357bbbfe49737d Mon Sep 17 00:00:00 2001 From: Ayush Ranjan Date: Thu, 13 Apr 2023 13:21:35 -0700 Subject: [PATCH] Add directfs test variant to syscall tests. PiperOrigin-RevId: 524084716 --- test/runner/defs.bzl | 9 +++++++++ test/runner/main.go | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/test/runner/defs.bzl b/test/runner/defs.bzl index 1cec565f6..c8d9a0a9a 100644 --- a/test/runner/defs.bzl +++ b/test/runner/defs.bzl @@ -75,6 +75,7 @@ def _syscall_test( container = None, one_sandbox = True, fusefs = False, + directfs = False, **kwargs): # Prepend "runsc" to non-native platform names. full_platform = platform if platform == "native" else "runsc_" + platform @@ -89,6 +90,8 @@ def _syscall_test( name += "_" + network + "net" if fusefs: name += "_fuse" + if directfs: + name += "_directfs" # Apply all tags. if tags == None: @@ -147,6 +150,7 @@ def _syscall_test( "--container=" + str(container), "--one-sandbox=" + str(one_sandbox), "--iouring=" + str(iouring), + "--directfs=" + str(directfs), ] # Trace points are platform agnostic, so enable them for ptrace only. @@ -177,6 +181,7 @@ def syscall_test( add_host_connector = False, add_host_fifo = False, add_hostinet = False, + add_directfs = True, one_sandbox = True, iouring = False, allow_native = True, @@ -195,6 +200,7 @@ def syscall_test( add_host_connector: setup host threads to connect to bound UDS created by sandbox. add_host_fifo: setup FIFO files on the host. add_hostinet: add a hostinet test. + add_directfs: add a directfs test. one_sandbox: runs each unit test in a new sandbox instance. iouring: enable IO_URING support. allow_native: generate a native test variant. @@ -223,6 +229,8 @@ def syscall_test( ) for platform, platform_tags in all_platforms(): + # Add directfs to the default platform variant. + directfs = add_directfs and platform == default_platform _syscall_test( test = test, platform = platform, @@ -232,6 +240,7 @@ def syscall_test( add_host_fifo = add_host_fifo, tags = platform_tags + tags, iouring = iouring, + directfs = directfs, debug = debug, container = container, one_sandbox = one_sandbox, diff --git a/test/runner/main.go b/test/runner/main.go index 8a3f36a1a..d2396cf1d 100644 --- a/test/runner/main.go +++ b/test/runner/main.go @@ -55,6 +55,7 @@ var ( container = flag.Bool("container", false, "run tests in their own namespaces (user ns, network ns, etc), pretending to be root. Implicitly enabled if network=host, or if using network namespaces") setupContainerPath = flag.String("setup-container", "", "path to setup_container binary (for use with --container)") trace = flag.Bool("trace", false, "enables all trace points") + directfs = flag.Bool("directfs", false, "enables directfs (for all gofer mounts)") addHostUDS = flag.Bool("add-host-uds", false, "expose a tree of UDS to test communication with the host") addHostConnector = flag.Bool("add-host-connector", false, "create goroutines that connect to bound UDS that will be created by sandbox") @@ -268,6 +269,9 @@ func runRunsc(tc *gtest.TestCase, spec *specs.Spec) error { log.Infof("Enabling all trace points: %s", flag) args = append(args, flag) } + if *directfs { + args = append(args, "-directfs") + } testLogDir := "" if undeclaredOutputsDir, ok := unix.Getenv("TEST_UNDECLARED_OUTPUTS_DIR"); ok {