mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Add syscall test dimension for --file_access=shared
PiperOrigin-RevId: 231856279 Change-Id: I175db87374890a62a3a3c2ddef727668ff854ce4
This commit is contained in:
committed by
Shentubot
parent
a497f5ed5f
commit
aec5b67c81
@@ -6,18 +6,22 @@ def syscall_test(test, shard_count = 5, size = "small", use_tmpfs = False):
|
||||
_syscall_test(test, shard_count, size, "native", False)
|
||||
_syscall_test(test, shard_count, size, "kvm", use_tmpfs)
|
||||
_syscall_test(test, shard_count, size, "ptrace", use_tmpfs)
|
||||
if not use_tmpfs:
|
||||
_syscall_test(test, shard_count, size, "ptrace", use_tmpfs, "shared")
|
||||
|
||||
def _syscall_test(test, shard_count, size, platform, use_tmpfs):
|
||||
def _syscall_test(test, shard_count, size, platform, use_tmpfs, file_access = "exclusive"):
|
||||
test_name = test.split(":")[1]
|
||||
|
||||
# Prepend "runsc" to non-native platform names.
|
||||
full_platform = platform if platform == "native" else "runsc_" + platform
|
||||
|
||||
name = test_name + "_" + full_platform
|
||||
if file_access == "shared":
|
||||
name += "_shared"
|
||||
|
||||
# Add the full_platform in a tag to make it easier to run all the tests on
|
||||
# a specific platform.
|
||||
tags = [full_platform]
|
||||
# Add the full_platform and file access in a tag to make it easier to run
|
||||
# all the tests on a specific flavor. Use --test_tag_filters=ptrace,file_shared.
|
||||
tags = [full_platform, "file_" + file_access]
|
||||
|
||||
# Add tag to prevent the tests from running in a Bazel sandbox.
|
||||
# TODO: Make the tests run without this tag.
|
||||
@@ -40,8 +44,7 @@ def _syscall_test(test, shard_count, size, platform, use_tmpfs):
|
||||
"--test-name=" + test_name,
|
||||
"--platform=" + platform,
|
||||
"--use-tmpfs=" + str(use_tmpfs),
|
||||
"--debug=false",
|
||||
"--strace=false",
|
||||
"--file-access=" + file_access,
|
||||
"--parallel=true",
|
||||
],
|
||||
size = size,
|
||||
|
||||
@@ -41,13 +41,14 @@ import (
|
||||
const testDir = "test/syscalls/linux"
|
||||
|
||||
var (
|
||||
testName = flag.String("test-name", "", "name of test binary to run")
|
||||
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")
|
||||
testName = flag.String("test-name", "", "name of test binary to run")
|
||||
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")
|
||||
fileAccess = flag.String("file-access", "exclusive", "mounts root in exclusive or shared mode")
|
||||
parallel = flag.Bool("parallel", false, "run tests in parallel")
|
||||
runscPath = flag.String("runsc", "", "path to runsc binary")
|
||||
)
|
||||
|
||||
// runTestCaseNative runs the test case directly on the host machine.
|
||||
@@ -158,6 +159,7 @@ func runTestCaseRunsc(testBin string, tc gtest.TestCase, t *testing.T) {
|
||||
args := []string{
|
||||
"-platform", *platform,
|
||||
"-root", rootDir,
|
||||
"-file-access", *fileAccess,
|
||||
"--network=none",
|
||||
"-log-format=text",
|
||||
"-TESTONLY-unsafe-nonroot=true",
|
||||
|
||||
Reference in New Issue
Block a user