diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/e2e/BUILD | 2 | ||||
-rw-r--r-- | test/packetdrill/BUILD | 1 | ||||
-rw-r--r-- | test/packetimpact/tests/BUILD | 1 | ||||
-rw-r--r-- | test/runner/defs.bzl | 103 | ||||
-rw-r--r-- | test/syscalls/linux/32bit.cc | 8 | ||||
-rw-r--r-- | test/syscalls/linux/BUILD | 5 | ||||
-rw-r--r-- | test/syscalls/linux/proc_net_unix.cc | 81 |
7 files changed, 47 insertions, 154 deletions
diff --git a/test/e2e/BUILD b/test/e2e/BUILD index 3b3dadf04..1e9792b4f 100644 --- a/test/e2e/BUILD +++ b/test/e2e/BUILD @@ -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 = [ diff --git a/test/packetdrill/BUILD b/test/packetdrill/BUILD index 5d95516ee..de66cbe6d 100644 --- a/test/packetdrill/BUILD +++ b/test/packetdrill/BUILD @@ -41,6 +41,7 @@ packetdrill_test( test_suite( name = "all_tests", tags = [ + "local", "manual", "packetdrill", ], diff --git a/test/packetimpact/tests/BUILD b/test/packetimpact/tests/BUILD index 83ff70951..e015c1f0e 100644 --- a/test/packetimpact/tests/BUILD +++ b/test/packetimpact/tests/BUILD @@ -416,6 +416,7 @@ validate_all_tests() test_suite( name = "all_tests", tags = [ + "local", "manual", "packetimpact", ], diff --git a/test/runner/defs.bzl b/test/runner/defs.bzl index 314f050e5..2a0ef2cec 100644 --- a/test/runner/defs.bzl +++ b/test/runner/defs.bzl @@ -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,116 +148,82 @@ 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") - - 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 - ) - - for (platform, platform_tags) in platforms.items(): + 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 = platform, + platform = default_platform, use_tmpfs = use_tmpfs, add_uds_tree = add_uds_tree, - tags = platform_tags + tags, + tags = tags + platforms[default_platform], debug = debug, + vfs2 = False, **kwargs ) - if add_overlay: + if not fuse: + # Generate a native test if fuse is not required. _syscall_test( test = test, - platform = default_platform, - use_tmpfs = use_tmpfs, + platform = "native", + use_tmpfs = False, add_uds_tree = add_uds_tree, - tags = platforms[default_platform] + tags, + tags = tags, debug = debug, - 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") + for (platform, platform_tags) in platforms.items(): _syscall_test( test = test, - platform = default_platform, + platform = platform, use_tmpfs = use_tmpfs, add_uds_tree = add_uds_tree, - tags = platforms[default_platform] + overlay_vfs2_tags, + tags = platform_tags + tags, + fuse = fuse, + vfs2 = vfs2, debug = debug, - overlay = True, - vfs2 = True, **kwargs ) - if add_hostinet: + if add_overlay: _syscall_test( test = test, platform = default_platform, use_tmpfs = use_tmpfs, - network = "host", add_uds_tree = add_uds_tree, tags = platforms[default_platform] + tags, debug = debug, + fuse = fuse, + vfs2 = vfs2, + overlay = True, **kwargs ) - - if not use_tmpfs: - # Also test shared gofer access. + if add_hostinet: _syscall_test( test = test, platform = default_platform, use_tmpfs = use_tmpfs, + network = "host", add_uds_tree = add_uds_tree, tags = platforms[default_platform] + tags, debug = debug, - file_access = "shared", + fuse = fuse, + vfs2 = vfs2, **kwargs ) + if not use_tmpfs: + # Also test shared gofer access. _syscall_test( test = test, platform = default_platform, use_tmpfs = use_tmpfs, add_uds_tree = add_uds_tree, - tags = platforms[default_platform] + vfs2_tags, + tags = platforms[default_platform] + tags, debug = debug, file_access = "shared", - vfs2 = True, + fuse = fuse, + vfs2 = vfs2, **kwargs ) diff --git a/test/syscalls/linux/32bit.cc b/test/syscalls/linux/32bit.cc index 3c825477c..6080a59b7 100644 --- a/test/syscalls/linux/32bit.cc +++ b/test/syscalls/linux/32bit.cc @@ -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 diff --git a/test/syscalls/linux/BUILD b/test/syscalls/linux/BUILD index bc2c7c0e3..55f3fc4ae 100644 --- a/test/syscalls/linux/BUILD +++ b/test/syscalls/linux/BUILD @@ -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", diff --git a/test/syscalls/linux/proc_net_unix.cc b/test/syscalls/linux/proc_net_unix.cc index cf3371a43..f7ff65aad 100644 --- a/test/syscalls/linux/proc_net_unix.cc +++ b/test/syscalls/linux/proc_net_unix.cc @@ -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 |