diff options
Diffstat (limited to 'abseil-cpp/absl/debugging/failure_signal_handler_test.cc')
-rw-r--r-- | abseil-cpp/absl/debugging/failure_signal_handler_test.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/abseil-cpp/absl/debugging/failure_signal_handler_test.cc b/abseil-cpp/absl/debugging/failure_signal_handler_test.cc index d8283b2..72816a3 100644 --- a/abseil-cpp/absl/debugging/failure_signal_handler_test.cc +++ b/abseil-cpp/absl/debugging/failure_signal_handler_test.cc @@ -22,11 +22,12 @@ #include <cstring> #include <fstream> -#include "gtest/gtest.h" #include "gmock/gmock.h" +#include "gtest/gtest.h" #include "absl/base/internal/raw_logging.h" #include "absl/debugging/stacktrace.h" #include "absl/debugging/symbolize.h" +#include "absl/log/check.h" #include "absl/strings/match.h" #include "absl/strings/str_cat.h" @@ -87,7 +88,7 @@ std::string GetTmpDir() { // This function runs in a fork()ed process on most systems. void InstallHandlerWithWriteToFileAndRaise(const char* file, int signo) { error_file = fopen(file, "w"); - ABSL_RAW_CHECK(error_file != nullptr, "Failed create error_file"); + CHECK_NE(error_file, nullptr) << "Failed create error_file"; absl::FailureSignalHandlerOptions options; options.writerfn = WriteToErrorFile; absl::InstallFailureSignalHandler(options); @@ -122,6 +123,12 @@ TEST_P(FailureSignalHandlerDeathTest, AbslFatalSignalsWithWriterFn) { "*** ", absl::debugging_internal::FailureSignalToString(signo), " received at "))); + // On platforms where it is possible to get the current CPU, the + // CPU number is also logged. Check that it is present in output. +#if defined(__linux__) + EXPECT_THAT(error_line, testing::HasSubstr(" on cpu ")); +#endif + if (absl::debugging_internal::StackTraceWorksForTest()) { std::getline(error_output, error_line); EXPECT_THAT(error_line, StartsWith("PC: ")); |