diff --git a/Makefile b/Makefile index a58e935bc..fcc652096 100644 --- a/Makefile +++ b/Makefile @@ -227,7 +227,7 @@ network-tests: iptables-tests packetdrill-tests packetimpact-tests .PHONY: network-tests syscall-tests: $(RUNTIME_BIN) ## Run all system call tests. - @$(call test,--test_env=RUNTIME=$(RUNTIME_BIN) $(PARTITIONS) test/syscalls/...) + @$(call test,--test_env=RUNTIME=$(RUNTIME_BIN) --cxxopt=-Werror $(PARTITIONS) test/syscalls/...) .PHONY: syscall-tests packetimpact-tests: diff --git a/WORKSPACE b/WORKSPACE index 1461c05e2..96017d128 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -29,11 +29,11 @@ bazel_skylib_workspace() # Load license rules. http_archive( name = "rules_license", + sha256 = "6157e1e68378532d0241ecd15d3c45f6e5cfd98fc10846045509fb2a7cc9e381", urls = [ "https://github.com/bazelbuild/rules_license/releases/download/0.0.4/rules_license-0.0.4.tar.gz", "https://mirror.bazel.build/github.com/bazelbuild/rules_license/releases/download/0.0.4/rules_license-0.0.4.tar.gz", ], - sha256 = "6157e1e68378532d0241ecd15d3c45f6e5cfd98fc10846045509fb2a7cc9e381", ) # Load go bazel rules and gazelle. @@ -1430,10 +1430,10 @@ http_archive( name = "com_github_grpc_grpc", patch_args = ["-p1"], patches = ["//tools:grpc_extra_deps.patch"], - sha256 = "b55696fb249669744de3e71acc54a9382bea0dce7cd5ba379b356b12b82d4229", - strip_prefix = "grpc-1.51.1", + sha256 = "ec125d7fdb77ecc25b01050a0d5d32616594834d3fe163b016768e2ae42a2df6", + strip_prefix = "grpc-1.52.1", urls = [ - "https://github.com/grpc/grpc/archive/v1.51.1.tar.gz", + "https://github.com/grpc/grpc/archive/v1.52.1.tar.gz", ], ) @@ -1457,11 +1457,11 @@ http_archive( http_archive( name = "com_google_benchmark", - sha256 = "3c6a165b6ecc948967a1ead710d4a181d7b0fbcaa183ef7ea84604994966221a", - strip_prefix = "benchmark-1.5.0", + sha256 = "6430e4092653380d9dc4ccb45a1e2dc9259d581f4866dc0759713126056bc1d7", + strip_prefix = "benchmark-1.7.1", urls = [ - "https://mirror.bazel.build/github.com/google/benchmark/archive/v1.5.0.tar.gz", - "https://github.com/google/benchmark/archive/v1.5.0.tar.gz", + "https://mirror.bazel.build/github.com/google/benchmark/archive/v1.7.1.tar.gz", + "https://github.com/google/benchmark/archive/v1.7.1.tar.gz", ], ) diff --git a/examples/seccheck/BUILD b/examples/seccheck/BUILD index 557154522..9db11222f 100644 --- a/examples/seccheck/BUILD +++ b/examples/seccheck/BUILD @@ -8,6 +8,14 @@ package( cc_binary( name = "server_cc", srcs = ["server.cc"], + # gcc reports the false warning: + # examples/seccheck/server.cc:147:19: error: 'buf' may be used uninitialized + # More details are here: + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101831 + copts = [ + "-Wno-maybe-uninitialized", + "-Wno-unknown-warning-option", + ], visibility = ["//:sandbox"], deps = [ # any_cc_proto placeholder, diff --git a/examples/seccheck/server.cc b/examples/seccheck/server.cc index 0b491e93a..7ac859907 100644 --- a/examples/seccheck/server.cc +++ b/examples/seccheck/server.cc @@ -204,7 +204,7 @@ bool handshake(int client_fd) { if (bytes < 0) { printf("Error receiving handshake message: %d\n", errno); return false; - } else if (bytes == buf.size()) { + } else if (bytes == (int)buf.size()) { // Protect against the handshake becoming larger than the buffer allocated // for it. printf("handshake message too big\n"); diff --git a/test/syscalls/linux/BUILD b/test/syscalls/linux/BUILD index e9d69d308..21d81ef0c 100644 --- a/test/syscalls/linux/BUILD +++ b/test/syscalls/linux/BUILD @@ -1661,6 +1661,9 @@ cc_binary( name = "poll_test", testonly = 1, srcs = ["poll.cc"], + copts = [ + "-Wno-unknown-warning-option", + ], linkstatic = 1, deps = [ ":base_poll_test", @@ -4077,6 +4080,9 @@ cc_binary( name = "uidgid_test", testonly = 1, srcs = ["uidgid.cc"], + copts = [ + "-Wno-unknown-warning-option", + ], linkstatic = 1, deps = [ "//test/util:capability_util", diff --git a/test/syscalls/linux/cgroup.cc b/test/syscalls/linux/cgroup.cc index ee2de49e9..351e5b626 100644 --- a/test/syscalls/linux/cgroup.cc +++ b/test/syscalls/linux/cgroup.cc @@ -18,6 +18,7 @@ #include #include #include +#include #include "gtest/gtest.h" #include "absl/container/flat_hash_map.h" @@ -857,17 +858,17 @@ PosixErrorOr> ParseBitmap(std::string s) { for (const std::string_view& t : absl::StrSplit(s, ',')) { std::vector parts = absl::StrSplit(t, absl::MaxSplits('-', 2)); if (parts.size() == 2) { - ASSIGN_OR_RETURN_ERRNO(int64_t start, Atoi(parts[0])); - ASSIGN_OR_RETURN_ERRNO(int64_t end, Atoi(parts[1])); + ASSIGN_OR_RETURN_ERRNO(uint64_t start, Atoi(parts[0])); + ASSIGN_OR_RETURN_ERRNO(uint64_t end, Atoi(parts[1])); // Note: start and end are indices into bitmap. if (end >= bitmap.size()) { bitmap.resize(end + 1, false); } - for (int i = start; i <= end; ++i) { + for (uint64_t i = start; i <= end; ++i) { bitmap[i] = true; } } else { // parts.size() == 1, 0 not possible. - ASSIGN_OR_RETURN_ERRNO(int64_t i, Atoi(parts[0])); + ASSIGN_OR_RETURN_ERRNO(uint64_t i, Atoi(parts[0])); if (i >= bitmap.size()) { bitmap.resize(i + 1, false); } diff --git a/test/syscalls/linux/chroot.cc b/test/syscalls/linux/chroot.cc index c186a3ab6..e9462338f 100644 --- a/test/syscalls/linux/chroot.cc +++ b/test/syscalls/linux/chroot.cc @@ -178,7 +178,7 @@ TEST(ChrootTest, CreatesNewRoot) { // getcwd should return "/". TEST_CHECK_SUCCESS(syscall(__NR_getcwd, buf, sizeof(buf))); - TEST_CHECK_SUCCESS(strcmp(buf, "/") == 0); + TEST_PCHECK(strcmp(buf, "/") == 0); // Statting '.', '..', '/', and '/..' all return the same dev and inode. struct stat statbuf_dot; diff --git a/test/syscalls/linux/fork.cc b/test/syscalls/linux/fork.cc index 853f6231a..e3180d309 100644 --- a/test/syscalls/linux/fork.cc +++ b/test/syscalls/linux/fork.cc @@ -362,7 +362,7 @@ TEST_F(ForkTest, SigAltStack) { MaybeSave(); TEST_CHECK((oss.ss_flags & SS_DISABLE) == 0); - TEST_CHECK(oss.ss_size == SIGSTKSZ); + TEST_CHECK(oss.ss_size == (size_t)SIGSTKSZ); TEST_CHECK(oss.ss_sp == stack.ss_sp); Exit(0); diff --git a/test/syscalls/linux/futex.cc b/test/syscalls/linux/futex.cc index 3f108b7d7..9540a944c 100644 --- a/test/syscalls/linux/futex.cc +++ b/test/syscalls/linux/futex.cc @@ -694,7 +694,7 @@ TEST_P(PrivateAndSharedFutexTest, PIWaiters) { // Wait until the thread blocks on the futex, setting the waiters bit. auto start = absl::Now(); - while (a.load() != (FUTEX_WAITERS | gettid())) { + while (a.load() != (int)(gettid() | FUTEX_WAITERS)) { ASSERT_LT(absl::Now() - start, absl::Seconds(5)); absl::SleepFor(absl::Milliseconds(100)); } diff --git a/test/syscalls/linux/mount.cc b/test/syscalls/linux/mount.cc index ea34c3477..21e5b7585 100644 --- a/test/syscalls/linux/mount.cc +++ b/test/syscalls/linux/mount.cc @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -1042,7 +1043,7 @@ TEST(MountTest, SetMountPropagationOfStackedMounts) { std::vector mounts = ASSERT_NO_ERRNO_AND_VALUE(ProcSelfMountInfoEntries()); - int parent_mount_id; + uint64_t parent_mount_id; for (const auto& e : mounts) { if (e.mount_point == dir.path()) { parent_mount_id = e.id; diff --git a/test/syscalls/linux/pipe_external.cc b/test/syscalls/linux/pipe_external.cc index 4ce85c3cc..54cb93622 100644 --- a/test/syscalls/linux/pipe_external.cc +++ b/test/syscalls/linux/pipe_external.cc @@ -85,7 +85,7 @@ TEST_P(HostPipeTest, Write) { ssize_t length = 0; while (length < 1024 * 1024) { char buf[1024]; - for (int i = 0; i < sizeof(buf); ++i) { + for (unsigned int i = 0; i < sizeof(buf); ++i) { buf[i] = i + lastValue; } diff --git a/test/syscalls/linux/pivot_root.cc b/test/syscalls/linux/pivot_root.cc index d7a5c10e6..fe5651910 100644 --- a/test/syscalls/linux/pivot_root.cc +++ b/test/syscalls/linux/pivot_root.cc @@ -107,7 +107,7 @@ TEST(PivotRootTest, CreatesNewRoot) { TEST_CHECK_SUCCESS(stat(file_in_new_root_new_path.c_str(), &statbuf)); // getcwd should return "/". TEST_CHECK_SUCCESS(syscall(__NR_getcwd, buf, sizeof(buf))); - TEST_CHECK_SUCCESS(strcmp(buf, "/") == 0); + TEST_PCHECK(strcmp(buf, "/") == 0); // Statting '.', '..', '/', and '/..' all return the same dev and inode. struct stat statbuf_dot; TEST_CHECK_SUCCESS(stat(".", &statbuf_dot)); diff --git a/test/syscalls/linux/poll.cc b/test/syscalls/linux/poll.cc index ccd084244..8f17f2d9f 100644 --- a/test/syscalls/linux/poll.cc +++ b/test/syscalls/linux/poll.cc @@ -41,6 +41,9 @@ class PollTest : public BasePollTest { void TearDown() override { BasePollTest::TearDown(); } }; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wnonnull" +#pragma GCC diagnostic ignored "-Wstringop-overflow" TEST_F(PollTest, InvalidFds) { // fds is invalid because it's null, but we tell ppoll the length is non-zero. EXPECT_THAT(poll(nullptr, 1, 1), SyscallFailsWithErrno(EFAULT)); @@ -63,6 +66,7 @@ TEST_F(PollTest, NegativeTimeout) { EXPECT_THAT(poll(nullptr, 0, -1), SyscallFailsWithErrno(EINTR)); EXPECT_TRUE(TimerFired()); } +#pragma GCC diagnostic pop void NonBlockingReadableTest(int16_t mask) { // Create a pipe. diff --git a/test/syscalls/linux/proc.cc b/test/syscalls/linux/proc.cc index 1fde07a45..ada832135 100644 --- a/test/syscalls/linux/proc.cc +++ b/test/syscalls/linux/proc.cc @@ -1255,7 +1255,7 @@ TEST(ProcCpuinfo, RequiredFieldsArePresent) { // Check that the usual fields are there. We don't really care about the // contents. - for (const std::string& field : required_fields) { + for (const char* field : required_fields) { EXPECT_THAT(proc_cpuinfo, HasSubstr(field)); } } diff --git a/test/syscalls/linux/process_vm_read_write.cc b/test/syscalls/linux/process_vm_read_write.cc index 094e200c6..c0b4d10c2 100644 --- a/test/syscalls/linux/process_vm_read_write.cc +++ b/test/syscalls/linux/process_vm_read_write.cc @@ -52,7 +52,7 @@ class TestIovecs { TestIovecs(std::vector& data) { data_ = std::vector(data.size()); initial_ = std::vector(data.size()); - for (int i = 0; i < data.size(); ++i) { + for (size_t i = 0; i < data.size(); ++i) { data_[i] = data[i]; initial_[i] = data[i]; struct iovec iov; @@ -87,7 +87,7 @@ class TestIovecs { std::vector marshal() { std::vector ret(iovecs_.size()); - for (int i = 0; i < iovecs_.size(); ++i) { + for (size_t i = 0; i < iovecs_.size(); ++i) { ret[i] = &iovecs_[i]; } return ret; @@ -111,7 +111,7 @@ struct ProcessVMTestCase { using ProcessVMTest = ::testing::TestWithParam; bool ProcessVMCallsNotSupported() { - struct iovec iov; + struct iovec iov = {}; // Flags should be 0. ssize_t ret = process_vm_readv(0, &iov, 1, &iov, 1, 10); if (ret != 0 && errno == ENOSYS) return true; @@ -245,7 +245,7 @@ INSTANTIATE_TEST_SUITE_P( TEST(ProcessVMInvalidTest, NonZeroFlags) { SKIP_IF(ProcessVMCallsNotSupported()); - struct iovec iov; + struct iovec iov = {}; // Flags should be 0. EXPECT_THAT(process_vm_readv(0, &iov, 1, &iov, 1, 10), SyscallFailsWithErrno(EINVAL)); @@ -255,7 +255,7 @@ TEST(ProcessVMInvalidTest, NonZeroFlags) { TEST(ProcessVMInvalidTest, NullLocalIovec) { SKIP_IF(ProcessVMCallsNotSupported()); - struct iovec iov; + struct iovec iov = {}; pid_t child = fork(); if (child == 0) { while (true) { diff --git a/test/syscalls/linux/readv.cc b/test/syscalls/linux/readv.cc index 5ce61beb2..02e44a1c6 100644 --- a/test/syscalls/linux/readv.cc +++ b/test/syscalls/linux/readv.cc @@ -104,16 +104,21 @@ TEST_F(ReadvTest, BadFileDescriptor) { iov[0].iov_base = buffer; iov[0].iov_len = 1024; - ASSERT_THAT(readv(-1, iov, 1024), SyscallFailsWithErrno(EBADF)); + ASSERT_THAT(readv(-1, iov, 1), SyscallFailsWithErrno(EBADF)); } - TEST_F(ReadvTest, BadIovecsPointer_File) { + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wnonnull" ASSERT_THAT(readv(test_file_fd_.get(), nullptr, 1), SyscallFailsWithErrno(EFAULT)); + #pragma GCC diagnostic pop } TEST_F(ReadvTest, BadIovecsPointer_Pipe) { + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wnonnull" ASSERT_THAT(readv(test_pipe_[0], nullptr, 1), SyscallFailsWithErrno(EFAULT)); + #pragma GCC diagnostic pop } TEST_F(ReadvTest, BadIovecBase_File) { diff --git a/test/syscalls/linux/readv_socket.cc b/test/syscalls/linux/readv_socket.cc index dd6fb7008..1ebcaef5e 100644 --- a/test/syscalls/linux/readv_socket.cc +++ b/test/syscalls/linux/readv_socket.cc @@ -139,13 +139,19 @@ TEST_F(ReadvSocketTest, ReadIovecsCompletelyFilled_DgramSocket) { } TEST_F(ReadvSocketTest, BadIovecsPointer_StreamSocket) { + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wnonnull" ASSERT_THAT(readv(test_unix_stream_socket_[0], nullptr, 1), SyscallFailsWithErrno(EFAULT)); + #pragma GCC diagnostic pop } TEST_F(ReadvSocketTest, BadIovecsPointer_DgramSocket) { + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wnonnull" ASSERT_THAT(readv(test_unix_dgram_socket_[0], nullptr, 1), SyscallFailsWithErrno(EFAULT)); + #pragma GCC diagnostic pop } TEST_F(ReadvSocketTest, BadIovecBase_StreamSocket) { diff --git a/test/syscalls/linux/sigstop.cc b/test/syscalls/linux/sigstop.cc index cafb6bff9..c4edb14f7 100644 --- a/test/syscalls/linux/sigstop.cc +++ b/test/syscalls/linux/sigstop.cc @@ -128,8 +128,8 @@ TEST(SigstopTest, RestartSyscall) { pid_t pid; constexpr absl::Duration kStopDelay = absl::Seconds(5); constexpr absl::Duration kStartupDelay = absl::Seconds(5); - constexpr uint64_t kSleepDelay = 15; - constexpr uint64_t kErrorDelay = 3; + constexpr int64_t kSleepDelay = 15; + constexpr int64_t kErrorDelay = 3; const DisableSave ds; // Timing-related. diff --git a/test/syscalls/linux/socket_generic_stress.cc b/test/syscalls/linux/socket_generic_stress.cc index 51901a3a0..95825c838 100644 --- a/test/syscalls/linux/socket_generic_stress.cc +++ b/test/syscalls/linux/socket_generic_stress.cc @@ -220,7 +220,7 @@ TEST_P(DataTransferStressTest, BigDataTransfer) { const std::string chunk = "Though this upload be but little, it is fierce."; std::string big_string; - while (big_string.size() < 31 << kShift) { + while (big_string.size() < size_t(31 << kShift)) { big_string += chunk; } absl::string_view data = big_string; diff --git a/test/syscalls/linux/tcp_socket.cc b/test/syscalls/linux/tcp_socket.cc index 050ac3e60..a812209b8 100644 --- a/test/syscalls/linux/tcp_socket.cc +++ b/test/syscalls/linux/tcp_socket.cc @@ -761,7 +761,7 @@ TEST_P(TcpSocketTest, TcpInq) { TEST_P(TcpSocketTest, Tiocinq) { char buf[1024]; - size_t size = sizeof(buf); + int size = sizeof(buf); ASSERT_THAT(RetryEINTR(write)(connected_.get(), buf, size), SyscallSucceedsWithValue(size)); diff --git a/test/syscalls/linux/uidgid.cc b/test/syscalls/linux/uidgid.cc index d95a3e010..a419705a6 100644 --- a/test/syscalls/linux/uidgid.cc +++ b/test/syscalls/linux/uidgid.cc @@ -76,7 +76,10 @@ TEST(UidGidTest, Getgroups) { // "EINVAL: size is less than the number of supplementary group IDs, but is // not zero." + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstringop-overflow=" EXPECT_THAT(getgroups(-1, nullptr), SyscallFailsWithErrno(EINVAL)); + #pragma GCC diagnostic pop // Testing for EFAULT requires actually having groups, which isn't guaranteed // here; see the setgroups test below. diff --git a/test/syscalls/linux/xattr.cc b/test/syscalls/linux/xattr.cc index 317b1c117..75533222b 100644 --- a/test/syscalls/linux/xattr.cc +++ b/test/syscalls/linux/xattr.cc @@ -254,7 +254,7 @@ TEST_F(XattrTest, SetXattrZeroSize) { EXPECT_THAT(setxattr(path, name, &val, 0, /*flags=*/0), SyscallSucceeds()); char buf = '-'; - EXPECT_THAT(getxattr(path, name, &buf, XATTR_SIZE_MAX), + EXPECT_THAT(getxattr(path, name, &buf, 1), SyscallSucceedsWithValue(0)); EXPECT_EQ(buf, '-'); } @@ -277,8 +277,11 @@ TEST_F(XattrTest, SetXattrSizeTooLarge) { TEST_F(XattrTest, SetXattrNullValueAndNonzeroSize) { const char* path = test_file_name_.c_str(); const char name[] = "user.test"; + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wnonnull" EXPECT_THAT(setxattr(path, name, nullptr, 1, /*flags=*/0), SyscallFailsWithErrno(EFAULT)); + #pragma GCC diagnostic pop EXPECT_THAT(getxattr(path, name, nullptr, 0), SyscallFailsWithErrno(ENODATA)); } @@ -441,8 +444,11 @@ TEST_F(XattrTest, GetXattrNullValue) { size_t size = sizeof(val); EXPECT_THAT(setxattr(path, name, &val, size, /*flags=*/0), SyscallSucceeds()); + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wnonnull" EXPECT_THAT(getxattr(path, name, nullptr, size), SyscallFailsWithErrno(EFAULT)); + #pragma GCC diagnostic pop } TEST_F(XattrTest, GetXattrNullValueAndZeroSize) { @@ -453,7 +459,10 @@ TEST_F(XattrTest, GetXattrNullValueAndZeroSize) { // Set value with zero size. EXPECT_THAT(setxattr(path, name, &val, 0, /*flags=*/0), SyscallSucceeds()); // Get value with nonzero size. + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wnonnull" EXPECT_THAT(getxattr(path, name, nullptr, size), SyscallSucceedsWithValue(0)); + #pragma GCC diagnostic pop // Set value with nonzero size. EXPECT_THAT(setxattr(path, name, &val, size, /*flags=*/0), SyscallSucceeds()); @@ -503,8 +512,11 @@ TEST_F(XattrTest, ListXattrNoXattrs) { // ListXattr should succeed if there are no attributes, even if the buffer // passed in is a nullptr. + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wnonnull" EXPECT_THAT(listxattr(path, nullptr, sizeof(list)), SyscallSucceedsWithValue(0)); + #pragma GCC diagnostic pop } TEST_F(XattrTest, ListXattrNullBuffer) { @@ -512,8 +524,11 @@ TEST_F(XattrTest, ListXattrNullBuffer) { const char name[] = "user.test"; EXPECT_THAT(setxattr(path, name, nullptr, 0, /*flags=*/0), SyscallSucceeds()); + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wnonnull" EXPECT_THAT(listxattr(path, nullptr, sizeof(name)), SyscallFailsWithErrno(EFAULT)); + #pragma GCC diagnostic pop } TEST_F(XattrTest, ListXattrSizeTooSmall) { diff --git a/test/util/platform_util.cc b/test/util/platform_util.cc index 840d8652a..8e4cbb9de 100644 --- a/test/util/platform_util.cc +++ b/test/util/platform_util.cc @@ -37,6 +37,7 @@ PlatformSupport PlatformSupport32Bit() { } std::cerr << "GVISOR_PLATFORM_SUPPORT variable undefined" << std::endl; TEST_CHECK(false); + __builtin_unreachable(); } PlatformSupport PlatformSupportAlignmentCheck() { @@ -58,6 +59,7 @@ PlatformSupport PlatformSupportAlignmentCheck() { } std::cerr << "GVISOR_PLATFORM_SUPPORT variable undefined" << std::endl; TEST_CHECK(false); + __builtin_unreachable(); } PlatformSupport PlatformSupportMultiProcess() { @@ -77,6 +79,7 @@ PlatformSupport PlatformSupportMultiProcess() { } std::cerr << "GVISOR_PLATFORM_SUPPORT variable undefined" << std::endl; TEST_CHECK(false); + __builtin_unreachable(); } PlatformSupport PlatformSupportInt3() { @@ -95,6 +98,7 @@ PlatformSupport PlatformSupportInt3() { } std::cerr << "GVISOR_PLATFORM_SUPPORT variable undefined" << std::endl; TEST_CHECK(false); + __builtin_unreachable(); } PlatformSupport PlatformSupportVsyscall() { @@ -113,6 +117,7 @@ PlatformSupport PlatformSupportVsyscall() { } std::cerr << "GVISOR_PLATFORM_SUPPORT variable undefined" << std::endl; TEST_CHECK(false); + __builtin_unreachable(); } } // namespace testing diff --git a/test/util/test_util_impl.cc b/test/util/test_util_impl.cc index 6b6826898..704402f14 100644 --- a/test/util/test_util_impl.cc +++ b/test/util/test_util_impl.cc @@ -21,8 +21,9 @@ #include "test/util/logging.h" extern bool FLAGS_gtest_list_tests; +namespace benchmark { extern bool FLAGS_benchmark_list_tests; -extern std::string FLAGS_benchmark_filter; +} namespace gvisor { namespace testing { @@ -44,7 +45,7 @@ int RunAllTests() { if (::testing::FLAGS_gtest_list_tests) { return RUN_ALL_TESTS(); } - if (FLAGS_benchmark_list_tests) { + if (::benchmark::FLAGS_benchmark_list_tests) { benchmark::RunSpecifiedBenchmarks(); return 0; }