23 #include <gtest/gtest.h>
27 struct TestingMacrosFixture :
public ::testing::Test
29 TestingMacrosFixture() =
default;
36 ::testing::AssertionFailure() :
37 ::testing::AssertionSuccess();
44 ::testing::AssertionFailure() :
45 ::testing::AssertionSuccess();
49 static void sig_term_handler(
int)
51 std::cout <<
"Received sigterm." << std::endl;
61 TEST(ForkAndRun, succeeding_client_and_service_result_in_correct_return_value)
68 ASSERT_FALSE(ClientFailed(result));
69 ASSERT_FALSE(ServiceFailed(result));
72 TEST(ForkAndRun, succeeding_client_and_failing_service_result_in_correct_return_value)
79 EXPECT_FALSE(ClientFailed(result));
80 EXPECT_TRUE(ServiceFailed(result));
83 TEST(ForkAndRun, failing_client_and_failing_service_result_in_correct_return_value)
90 EXPECT_TRUE(ClientFailed(result));
91 EXPECT_TRUE(ServiceFailed(result));
94 TEST(ForkAndRun, throwing_client_is_reported_as_failing)
101 EXPECT_TRUE(ClientFailed(result));
102 EXPECT_FALSE(ServiceFailed(result));
105 TEST(ForkAndRun, exiting_with_failure_client_is_reported_as_failing)
112 EXPECT_TRUE(ClientFailed(result));
113 EXPECT_FALSE(ServiceFailed(result));
116 TEST(ForkAndRun, aborting_client_is_reported_as_failing)
123 EXPECT_TRUE(ClientFailed(result));
124 EXPECT_FALSE(ServiceFailed(result));
149 #include <core/posix/backtrace.h>
151 TEST(BacktraceSymbolDemangling, demangling_a_cpp_symbol_works)
153 const char* ref =
"tests/fork_and_run_test(_ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS0_12UnitTestImplEbEET0_PT_MS4_FS3_vEPKc+0x4b) [0x4591f8]";
154 const char* ref_demangled =
"bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*)";
157 EXPECT_TRUE(symbol->is_cxx());
158 EXPECT_EQ(ref, symbol->raw());
159 EXPECT_EQ(ref_demangled, symbol->demangled());