Factor platform tags.

PiperOrigin-RevId: 296519566
This commit is contained in:
Adin Scannell
2020-02-21 15:06:08 -08:00
committed by gVisor bot
parent 3733499952
commit 10aa4d3b34
3 changed files with 39 additions and 39 deletions
+19 -39
View File
@@ -1,6 +1,6 @@
"""Defines a rule for syscall test targets."""
load("//tools:defs.bzl", "loopback")
load("//tools:defs.bzl", "default_platform", "loopback", "platforms")
def _runner_test_impl(ctx):
# Generate a runner binary.
@@ -94,19 +94,6 @@ def _syscall_test(
# Disable off-host networking.
tags.append("requires-net:loopback")
# Add tag to prevent the tests from running in a Bazel sandbox.
# TODO(b/120560048): Make the tests run without this tag.
tags.append("no-sandbox")
# TODO(b/112165693): KVM tests are tagged "manual" to until the platform is
# more stable.
if platform == "kvm":
tags.append("manual")
tags.append("requires-kvm")
# TODO(b/112165693): Remove when tests pass reliably.
tags.append("notap")
runner_args = [
# Arguments are passed directly to runner binary.
"--platform=" + platform,
@@ -149,6 +136,8 @@ def syscall_test(
add_hostinet: add a hostinet test.
tags: starting test tags.
"""
if not tags:
tags = []
_syscall_test(
test = test,
@@ -160,35 +149,26 @@ def syscall_test(
tags = tags,
)
_syscall_test(
test = test,
shard_count = shard_count,
size = size,
platform = "kvm",
use_tmpfs = use_tmpfs,
add_uds_tree = add_uds_tree,
tags = tags,
)
_syscall_test(
test = test,
shard_count = shard_count,
size = size,
platform = "ptrace",
use_tmpfs = use_tmpfs,
add_uds_tree = add_uds_tree,
tags = tags,
)
for (platform, platform_tags) in platforms.items():
_syscall_test(
test = test,
shard_count = shard_count,
size = size,
platform = platform,
use_tmpfs = use_tmpfs,
add_uds_tree = add_uds_tree,
tags = platform_tags + tags,
)
if add_overlay:
_syscall_test(
test = test,
shard_count = shard_count,
size = size,
platform = "ptrace",
platform = default_platform,
use_tmpfs = False, # overlay is adding a writable tmpfs on top of root.
add_uds_tree = add_uds_tree,
tags = tags,
tags = platforms[default_platform] + tags,
overlay = True,
)
@@ -198,10 +178,10 @@ def syscall_test(
test = test,
shard_count = shard_count,
size = size,
platform = "ptrace",
platform = default_platform,
use_tmpfs = use_tmpfs,
add_uds_tree = add_uds_tree,
tags = tags,
tags = platforms[default_platform] + tags,
file_access = "shared",
)
@@ -210,9 +190,9 @@ def syscall_test(
test = test,
shard_count = shard_count,
size = size,
platform = "ptrace",
platform = default_platform,
use_tmpfs = use_tmpfs,
network = "host",
add_uds_tree = add_uds_tree,
tags = tags,
tags = platforms[default_platform] + tags,
)
+17
View File
@@ -0,0 +1,17 @@
"""List of platforms."""
# Platform to associated tags.
platforms = {
"ptrace": [
# TODO(b/120560048): Make the tests run without this tag.
"no-sandbox",
],
"kvm": [
"manual",
"local",
# TODO(b/120560048): Make the tests run without this tag.
"no-sandbox",
],
}
default_platform = "ptrace"
+3
View File
@@ -8,6 +8,7 @@ change for Google-internal and bazel-compatible rules.
load("//tools/go_stateify:defs.bzl", "go_stateify")
load("//tools/go_marshal:defs.bzl", "go_marshal", "marshal_deps", "marshal_test_deps")
load("//tools/bazeldefs:defs.bzl", _cc_binary = "cc_binary", _cc_flags_supplier = "cc_flags_supplier", _cc_library = "cc_library", _cc_proto_library = "cc_proto_library", _cc_test = "cc_test", _cc_toolchain = "cc_toolchain", _container_image = "container_image", _default_installer = "default_installer", _default_net_util = "default_net_util", _gbenchmark = "gbenchmark", _go_binary = "go_binary", _go_embed_data = "go_embed_data", _go_image = "go_image", _go_library = "go_library", _go_proto_library = "go_proto_library", _go_test = "go_test", _go_tool_library = "go_tool_library", _gtest = "gtest", _loopback = "loopback", _pkg_deb = "pkg_deb", _pkg_tar = "pkg_tar", _proto_library = "proto_library", _py_binary = "py_binary", _py_library = "py_library", _py_requirement = "py_requirement", _py_test = "py_test", _select_arch = "select_arch", _select_system = "select_system")
load("//tools/bazeldefs:platforms.bzl", _default_platform = "default_platform", _platforms = "platforms")
load("//tools/bazeldefs:tags.bzl", "go_suffixes")
# Delegate directly.
@@ -34,6 +35,8 @@ select_system = _select_system
loopback = _loopback
default_installer = _default_installer
default_net_util = _default_net_util
platforms = _platforms
default_platform = _default_platform
def go_binary(name, **kwargs):
"""Wraps the standard go_binary.