mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Clean test tags.
PiperOrigin-RevId: 369505182
This commit is contained in:
committed by
gVisor bot
parent
bf1e14cf8a
commit
8192cccda6
@@ -71,9 +71,6 @@ steps:
|
||||
parallelism: 20
|
||||
|
||||
# Integration tests.
|
||||
- <<: *common
|
||||
label: ":parachute: FUSE tests"
|
||||
command: make fuse-tests
|
||||
- <<: *common
|
||||
label: ":docker: Docker tests"
|
||||
command: make docker-tests
|
||||
|
||||
@@ -180,10 +180,6 @@ smoke-tests: ## Runs a simple smoke test after build runsc.
|
||||
@$(call run,//runsc,--alsologtostderr --network none --debug --TESTONLY-unsafe-nonroot=true --rootless do true)
|
||||
.PHONY: smoke-tests
|
||||
|
||||
fuse-tests:
|
||||
@$(call test,--build_tag_filters=fuse --test_tag_filters=fuse $(PARTITIONS) test/fuse/...)
|
||||
.PHONY: fuse-tests
|
||||
|
||||
nogo-tests:
|
||||
@$(call test,--build_tag_filters=nogo --test_tag_filters=nogo //:all pkg/... tools/...)
|
||||
.PHONY: nogo-tests
|
||||
@@ -209,15 +205,19 @@ network-tests: ## Run all networking integration tests.
|
||||
network-tests: iptables-tests packetdrill-tests packetimpact-tests
|
||||
.PHONY: network-tests
|
||||
|
||||
# The set of system call targets.
|
||||
SYSCALL_TARGETS := test/syscalls/... test/fuse/...
|
||||
|
||||
syscall-%-tests:
|
||||
@$(call test,--build_tag_filters=runsc_$* --test_tag_filters=runsc_$* $(PARTITIONS) test/syscalls/...)
|
||||
@$(call test,--test_tag_filters=runsc_$* $(PARTITIONS) test/syscalls/...)
|
||||
|
||||
syscall-native-tests:
|
||||
@$(call test,--build_tag_filters=native --test_tag_filters=native $(PARTITIONS) test/syscalls/...)
|
||||
@$(call test,--test_tag_filters=native $(PARTITIONS) test/syscalls/...)
|
||||
.PHONY: syscall-native-tests
|
||||
|
||||
syscall-tests: ## Run all system call tests.
|
||||
@$(call test,$(PARTITIONS) test/syscalls/...)
|
||||
@$(call test,$(PARTITIONS) $(SYSCALL_TARGETS))
|
||||
.PHONY: syscall-tests
|
||||
|
||||
%-runtime-tests: load-runtimes_% $(RUNTIME_BIN)
|
||||
@$(call install_runtime,$(RUNTIME),) # Ensure flags are cleared.
|
||||
|
||||
@@ -36,8 +36,8 @@ go_test(
|
||||
tags = [
|
||||
# Requires docker and runsc to be configured before test runs.
|
||||
# Also requires the test to be run as root.
|
||||
"manual",
|
||||
"local",
|
||||
"manual",
|
||||
],
|
||||
visibility = ["//:sandbox"],
|
||||
)
|
||||
|
||||
@@ -50,5 +50,4 @@ sh_test(
|
||||
srcs = ["version_test.sh"],
|
||||
args = ["$(location :runsc)"],
|
||||
data = [":runsc"],
|
||||
tags = ["noguitar"],
|
||||
)
|
||||
|
||||
@@ -51,9 +51,7 @@ go_test(
|
||||
],
|
||||
library = ":container",
|
||||
shard_count = more_shards,
|
||||
tags = [
|
||||
"requires-kvm",
|
||||
],
|
||||
tags = ["requires-kvm"],
|
||||
deps = [
|
||||
"//pkg/abi/linux",
|
||||
"//pkg/bits",
|
||||
|
||||
+1
-1
@@ -12,8 +12,8 @@ go_test(
|
||||
library = ":integration",
|
||||
tags = [
|
||||
# Requires docker and runsc to be configured before the test runs.
|
||||
"manual",
|
||||
"local",
|
||||
"manual",
|
||||
],
|
||||
visibility = ["//:sandbox"],
|
||||
deps = [
|
||||
|
||||
@@ -41,6 +41,7 @@ packetdrill_test(
|
||||
test_suite(
|
||||
name = "all_tests",
|
||||
tags = [
|
||||
"local",
|
||||
"manual",
|
||||
"packetdrill",
|
||||
],
|
||||
|
||||
@@ -416,6 +416,7 @@ validate_all_tests()
|
||||
test_suite(
|
||||
name = "all_tests",
|
||||
tags = [
|
||||
"local",
|
||||
"manual",
|
||||
"packetimpact",
|
||||
],
|
||||
|
||||
+33
-76
@@ -85,18 +85,9 @@ def _syscall_test(
|
||||
|
||||
# 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 = list(tags)
|
||||
tags += [full_platform, "file_" + file_access]
|
||||
|
||||
# Hash this target into one of 15 buckets. This can be used to
|
||||
# randomly split targets between different workflows.
|
||||
hash15 = hash(native.package_name() + name) % 15
|
||||
tags.append("hash15:" + str(hash15))
|
||||
|
||||
# TODO(b/139838000): Tests using hostinet must be disabled on Guitar until
|
||||
# we figure out how to request ipv4 sockets on Guitar machines.
|
||||
if network == "host":
|
||||
tags.append("noguitar")
|
||||
|
||||
# Disable off-host networking.
|
||||
tags.append("requires-net:loopback")
|
||||
tags.append("requires-net:ipv4")
|
||||
@@ -157,43 +148,31 @@ def syscall_test(
|
||||
if not tags:
|
||||
tags = []
|
||||
|
||||
vfs2_tags = list(tags)
|
||||
if vfs2:
|
||||
# Add tag to easily run VFS2 tests with --test_tag_filters=vfs2
|
||||
vfs2_tags.append("vfs2")
|
||||
if fuse:
|
||||
vfs2_tags.append("fuse")
|
||||
if vfs2 and not fuse:
|
||||
# Generate a vfs1 plain test. Most testing will now be
|
||||
# biased towards vfs2, with only a single vfs1 case.
|
||||
_syscall_test(
|
||||
test = test,
|
||||
platform = default_platform,
|
||||
use_tmpfs = use_tmpfs,
|
||||
add_uds_tree = add_uds_tree,
|
||||
tags = tags + platforms[default_platform],
|
||||
debug = debug,
|
||||
vfs2 = False,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
else:
|
||||
# Don't automatically run tests tests not yet passing.
|
||||
vfs2_tags.append("manual")
|
||||
vfs2_tags.append("noguitar")
|
||||
vfs2_tags.append("notap")
|
||||
|
||||
_syscall_test(
|
||||
test = test,
|
||||
platform = default_platform,
|
||||
use_tmpfs = use_tmpfs,
|
||||
add_uds_tree = add_uds_tree,
|
||||
tags = platforms[default_platform] + vfs2_tags,
|
||||
debug = debug,
|
||||
vfs2 = True,
|
||||
fuse = fuse,
|
||||
**kwargs
|
||||
)
|
||||
if fuse:
|
||||
# Only generate *_vfs2_fuse target if fuse parameter is enabled.
|
||||
return
|
||||
|
||||
_syscall_test(
|
||||
test = test,
|
||||
platform = "native",
|
||||
use_tmpfs = False,
|
||||
add_uds_tree = add_uds_tree,
|
||||
tags = list(tags),
|
||||
debug = debug,
|
||||
**kwargs
|
||||
)
|
||||
if not fuse:
|
||||
# Generate a native test if fuse is not required.
|
||||
_syscall_test(
|
||||
test = test,
|
||||
platform = "native",
|
||||
use_tmpfs = False,
|
||||
add_uds_tree = add_uds_tree,
|
||||
tags = tags,
|
||||
debug = debug,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
for (platform, platform_tags) in platforms.items():
|
||||
_syscall_test(
|
||||
@@ -202,6 +181,8 @@ def syscall_test(
|
||||
use_tmpfs = use_tmpfs,
|
||||
add_uds_tree = add_uds_tree,
|
||||
tags = platform_tags + tags,
|
||||
fuse = fuse,
|
||||
vfs2 = vfs2,
|
||||
debug = debug,
|
||||
**kwargs
|
||||
)
|
||||
@@ -214,27 +195,11 @@ def syscall_test(
|
||||
add_uds_tree = add_uds_tree,
|
||||
tags = platforms[default_platform] + tags,
|
||||
debug = debug,
|
||||
fuse = fuse,
|
||||
vfs2 = vfs2,
|
||||
overlay = True,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
# TODO(gvisor.dev/issue/4407): Remove tags to enable VFS2 overlay tests.
|
||||
overlay_vfs2_tags = list(vfs2_tags)
|
||||
overlay_vfs2_tags.append("manual")
|
||||
overlay_vfs2_tags.append("noguitar")
|
||||
overlay_vfs2_tags.append("notap")
|
||||
_syscall_test(
|
||||
test = test,
|
||||
platform = default_platform,
|
||||
use_tmpfs = use_tmpfs,
|
||||
add_uds_tree = add_uds_tree,
|
||||
tags = platforms[default_platform] + overlay_vfs2_tags,
|
||||
debug = debug,
|
||||
overlay = True,
|
||||
vfs2 = True,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
if add_hostinet:
|
||||
_syscall_test(
|
||||
test = test,
|
||||
@@ -244,9 +209,10 @@ def syscall_test(
|
||||
add_uds_tree = add_uds_tree,
|
||||
tags = platforms[default_platform] + tags,
|
||||
debug = debug,
|
||||
fuse = fuse,
|
||||
vfs2 = vfs2,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
if not use_tmpfs:
|
||||
# Also test shared gofer access.
|
||||
_syscall_test(
|
||||
@@ -257,16 +223,7 @@ def syscall_test(
|
||||
tags = platforms[default_platform] + tags,
|
||||
debug = debug,
|
||||
file_access = "shared",
|
||||
**kwargs
|
||||
)
|
||||
_syscall_test(
|
||||
test = test,
|
||||
platform = default_platform,
|
||||
use_tmpfs = use_tmpfs,
|
||||
add_uds_tree = add_uds_tree,
|
||||
tags = platforms[default_platform] + vfs2_tags,
|
||||
debug = debug,
|
||||
file_access = "shared",
|
||||
vfs2 = True,
|
||||
fuse = fuse,
|
||||
vfs2 = vfs2,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
@@ -22,15 +22,13 @@
|
||||
#include "test/util/posix_error.h"
|
||||
#include "test/util/test_util.h"
|
||||
|
||||
#ifndef __x86_64__
|
||||
#error "This test is x86-64 specific."
|
||||
#endif
|
||||
|
||||
namespace gvisor {
|
||||
namespace testing {
|
||||
|
||||
namespace {
|
||||
|
||||
#ifdef __x86_64__
|
||||
|
||||
constexpr char kInt3 = '\xcc';
|
||||
constexpr char kInt80[2] = {'\xcd', '\x80'};
|
||||
constexpr char kSyscall[2] = {'\x0f', '\x05'};
|
||||
@@ -244,5 +242,7 @@ TEST(Call32Bit, Disallowed) {
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace testing
|
||||
} // namespace gvisor
|
||||
|
||||
@@ -212,10 +212,7 @@ cc_binary(
|
||||
cc_binary(
|
||||
name = "32bit_test",
|
||||
testonly = 1,
|
||||
srcs = select_arch(
|
||||
amd64 = ["32bit.cc"],
|
||||
arm64 = [],
|
||||
),
|
||||
srcs = ["32bit.cc"],
|
||||
linkstatic = 1,
|
||||
deps = [
|
||||
"@com_google_absl//absl/base:core_headers",
|
||||
|
||||
@@ -201,15 +201,8 @@ TEST(ProcNetUnix, Exists) {
|
||||
const std::string content =
|
||||
ASSERT_NO_ERRNO_AND_VALUE(GetContents("/proc/net/unix"));
|
||||
const std::string header_line = StrCat(kProcNetUnixHeader, "\n");
|
||||
if (IsRunningOnGvisor()) {
|
||||
// Should be just the header since we don't have any unix domain sockets
|
||||
// yet.
|
||||
EXPECT_EQ(content, header_line);
|
||||
} else {
|
||||
// However, on a general linux machine, we could have abitrary sockets on
|
||||
// the system, so just check the header.
|
||||
EXPECT_THAT(content, ::testing::StartsWith(header_line));
|
||||
}
|
||||
// We could have abitrary sockets on the system, so just check the header.
|
||||
EXPECT_THAT(content, ::testing::StartsWith(header_line));
|
||||
}
|
||||
|
||||
TEST(ProcNetUnix, FilesystemBindAcceptConnect) {
|
||||
@@ -223,9 +216,6 @@ TEST(ProcNetUnix, FilesystemBindAcceptConnect) {
|
||||
|
||||
std::vector<UnixEntry> entries =
|
||||
ASSERT_NO_ERRNO_AND_VALUE(ProcNetUnixEntries());
|
||||
if (IsRunningOnGvisor()) {
|
||||
EXPECT_EQ(entries.size(), 2);
|
||||
}
|
||||
|
||||
// The server-side socket's path is listed in the socket entry...
|
||||
UnixEntry s1;
|
||||
@@ -247,9 +237,6 @@ TEST(ProcNetUnix, AbstractBindAcceptConnect) {
|
||||
|
||||
std::vector<UnixEntry> entries =
|
||||
ASSERT_NO_ERRNO_AND_VALUE(ProcNetUnixEntries());
|
||||
if (IsRunningOnGvisor()) {
|
||||
EXPECT_EQ(entries.size(), 2);
|
||||
}
|
||||
|
||||
// The server-side socket's path is listed in the socket entry...
|
||||
UnixEntry s1;
|
||||
@@ -261,20 +248,12 @@ TEST(ProcNetUnix, AbstractBindAcceptConnect) {
|
||||
}
|
||||
|
||||
TEST(ProcNetUnix, SocketPair) {
|
||||
// Under gvisor, ensure a socketpair() syscall creates exactly 2 new
|
||||
// entries. We have no way to verify this under Linux, as we have no control
|
||||
// over socket creation on a general Linux machine.
|
||||
SKIP_IF(!IsRunningOnGvisor());
|
||||
|
||||
std::vector<UnixEntry> entries =
|
||||
ASSERT_NO_ERRNO_AND_VALUE(ProcNetUnixEntries());
|
||||
ASSERT_EQ(entries.size(), 0);
|
||||
|
||||
auto sockets =
|
||||
ASSERT_NO_ERRNO_AND_VALUE(UnixDomainSocketPair(SOCK_STREAM).Create());
|
||||
|
||||
entries = ASSERT_NO_ERRNO_AND_VALUE(ProcNetUnixEntries());
|
||||
EXPECT_EQ(entries.size(), 2);
|
||||
std::vector<UnixEntry> entries =
|
||||
ASSERT_NO_ERRNO_AND_VALUE(ProcNetUnixEntries());
|
||||
EXPECT_GE(entries.size(), 2);
|
||||
}
|
||||
|
||||
TEST(ProcNetUnix, StreamSocketStateUnconnectedOnBind) {
|
||||
@@ -368,25 +347,12 @@ TEST(ProcNetUnix, DgramSocketStateDisconnectingOnBind) {
|
||||
auto sockets = ASSERT_NO_ERRNO_AND_VALUE(
|
||||
AbstractUnboundUnixDomainSocketPair(SOCK_DGRAM).Create());
|
||||
|
||||
std::vector<UnixEntry> entries =
|
||||
ASSERT_NO_ERRNO_AND_VALUE(ProcNetUnixEntries());
|
||||
|
||||
// On gVisor, the only two UDS on the system are the ones we just created and
|
||||
// we rely on this to locate the test socket entries in the remainder of the
|
||||
// test. On a generic Linux system, we have no easy way to locate the
|
||||
// corresponding entries, as they don't have an address yet.
|
||||
if (IsRunningOnGvisor()) {
|
||||
ASSERT_EQ(entries.size(), 2);
|
||||
for (const auto& e : entries) {
|
||||
ASSERT_EQ(e.state, SS_DISCONNECTING);
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT_THAT(bind(sockets->first_fd(), sockets->first_addr(),
|
||||
sockets->first_addr_size()),
|
||||
SyscallSucceeds());
|
||||
|
||||
entries = ASSERT_NO_ERRNO_AND_VALUE(ProcNetUnixEntries());
|
||||
std::vector<UnixEntry> entries =
|
||||
ASSERT_NO_ERRNO_AND_VALUE(ProcNetUnixEntries());
|
||||
const std::string address = ExtractPath(sockets->first_addr());
|
||||
UnixEntry bind_entry;
|
||||
ASSERT_TRUE(FindByPath(entries, &bind_entry, address));
|
||||
@@ -397,25 +363,12 @@ TEST(ProcNetUnix, DgramSocketStateConnectingOnConnect) {
|
||||
auto sockets = ASSERT_NO_ERRNO_AND_VALUE(
|
||||
AbstractUnboundUnixDomainSocketPair(SOCK_DGRAM).Create());
|
||||
|
||||
std::vector<UnixEntry> entries =
|
||||
ASSERT_NO_ERRNO_AND_VALUE(ProcNetUnixEntries());
|
||||
|
||||
// On gVisor, the only two UDS on the system are the ones we just created and
|
||||
// we rely on this to locate the test socket entries in the remainder of the
|
||||
// test. On a generic Linux system, we have no easy way to locate the
|
||||
// corresponding entries, as they don't have an address yet.
|
||||
if (IsRunningOnGvisor()) {
|
||||
ASSERT_EQ(entries.size(), 2);
|
||||
for (const auto& e : entries) {
|
||||
ASSERT_EQ(e.state, SS_DISCONNECTING);
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT_THAT(bind(sockets->first_fd(), sockets->first_addr(),
|
||||
sockets->first_addr_size()),
|
||||
SyscallSucceeds());
|
||||
|
||||
entries = ASSERT_NO_ERRNO_AND_VALUE(ProcNetUnixEntries());
|
||||
std::vector<UnixEntry> entries =
|
||||
ASSERT_NO_ERRNO_AND_VALUE(ProcNetUnixEntries());
|
||||
const std::string address = ExtractPath(sockets->first_addr());
|
||||
UnixEntry bind_entry;
|
||||
ASSERT_TRUE(FindByPath(entries, &bind_entry, address));
|
||||
@@ -423,22 +376,6 @@ TEST(ProcNetUnix, DgramSocketStateConnectingOnConnect) {
|
||||
ASSERT_THAT(connect(sockets->second_fd(), sockets->first_addr(),
|
||||
sockets->first_addr_size()),
|
||||
SyscallSucceeds());
|
||||
|
||||
entries = ASSERT_NO_ERRNO_AND_VALUE(ProcNetUnixEntries());
|
||||
|
||||
// Once again, we have no easy way to identify the connecting socket as it has
|
||||
// no listed address. We can only identify the entry as the "non-bind socket
|
||||
// entry" on gVisor, where we're guaranteed to have only the two entries we
|
||||
// create during this test.
|
||||
if (IsRunningOnGvisor()) {
|
||||
ASSERT_EQ(entries.size(), 2);
|
||||
UnixEntry connect_entry;
|
||||
ASSERT_TRUE(
|
||||
FindBy(entries, &connect_entry, [bind_entry](const UnixEntry& e) {
|
||||
return e.inode != bind_entry.inode;
|
||||
}));
|
||||
EXPECT_EQ(connect_entry.state, SS_CONNECTING);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -132,7 +132,7 @@ def go_context(ctx, goos = None, goarch = None, std = False):
|
||||
runfiles = depset([go_ctx.go] + go_ctx.sdk.srcs + go_ctx.sdk.tools + go_ctx.stdlib.libs),
|
||||
goos = go_ctx.sdk.goos,
|
||||
goarch = go_ctx.sdk.goarch,
|
||||
tags = go_ctx.tags,
|
||||
gotags = go_ctx.tags,
|
||||
)
|
||||
|
||||
def select_goarch():
|
||||
|
||||
@@ -12,5 +12,6 @@ go_library(
|
||||
deps = [
|
||||
"@com_google_cloud_go_bigquery//:go_default_library",
|
||||
"@org_golang_google_api//option:go_default_library",
|
||||
"@org_golang_x_oauth2//:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -119,6 +119,14 @@ func NewBenchmark(name string, iters int) *Benchmark {
|
||||
}
|
||||
}
|
||||
|
||||
// NewBenchmarkWithMetric creates a new sending to BigQuery, initialized with a
|
||||
// single iteration and single metric.
|
||||
func NewBenchmarkWithMetric(name, metric, unit string, value float64) *Benchmark {
|
||||
b := NewBenchmark(name, 1)
|
||||
b.AddMetric(metric, unit, value)
|
||||
return b
|
||||
}
|
||||
|
||||
// NewSuite initializes a new Suite.
|
||||
func NewSuite(name string, official bool) *Suite {
|
||||
return &Suite{
|
||||
|
||||
+2
-2
@@ -120,7 +120,7 @@ def _nogo_stdlib_impl(ctx):
|
||||
Srcs = [f.path for f in go_ctx.stdlib_srcs],
|
||||
GOOS = go_ctx.goos,
|
||||
GOARCH = go_ctx.goarch,
|
||||
Tags = go_ctx.tags,
|
||||
Tags = go_ctx.gotags,
|
||||
)
|
||||
config_file = ctx.actions.declare_file(ctx.label.name + ".cfg")
|
||||
ctx.actions.write(config_file, config.to_json())
|
||||
@@ -286,7 +286,7 @@ def _nogo_aspect_impl(target, ctx):
|
||||
NonGoFiles = [src.path for src in srcs if not src.path.endswith(".go")],
|
||||
GOOS = go_ctx.goos,
|
||||
GOARCH = go_ctx.goarch,
|
||||
Tags = go_ctx.tags,
|
||||
Tags = go_ctx.gotags,
|
||||
FactMap = fact_map,
|
||||
ImportMap = import_map,
|
||||
StdlibFacts = stdlib_facts.path,
|
||||
|
||||
+2
-2
@@ -14,7 +14,7 @@ docker_image(
|
||||
tags = [
|
||||
"local",
|
||||
"manual",
|
||||
"nosandbox",
|
||||
"no-sandbox",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -69,7 +69,7 @@ genrule(
|
||||
tags = [
|
||||
"local",
|
||||
"manual",
|
||||
"nosandbox",
|
||||
"no-sandbox",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user