TEST(TestCase2, DeathTest_WrongMessage) { // test ok but wrong message EXPECT_EXIT(errorExit("Actual message."), ExitedWithCode(EXIT_FAILURE), "Expected message.") << "EXPECT_EXIT with wrong message."; }
TEST(TestCase2, DeathTest_Fails) { // test fails with wrong return code EXPECT_EXIT(errorExit("Expected message."), ExitedWithCode(EXIT_SUCCESS), "Expected message.") << "EXPECT_EXIT with wrong exit status.";; }
TEST(EventRecord, RecordAfterDestroy) { ::testing::FLAGS_gtest_death_test_style = "threadsafe"; cudaError_t ret; cudaEvent_t event; cudaStream_t stream; ret = cudaEventCreate(&event); ASSERT_EQ(cudaSuccess, ret); ret = cudaEventDestroy(event); EXPECT_EQ(cudaSuccess, ret); ret = cudaStreamCreate(&stream); ASSERT_EQ(cudaSuccess, ret); #if CUDART_VERSION >= 5000 ret = cudaEventRecord(event); EXPECT_EQ(cudaErrorUnknown, ret); #else EXPECT_EXIT( cudaEventRecord(event, stream), ::testing::KilledBySignal(SIGSEGV), ""); #endif ret = cudaStreamDestroy(stream); EXPECT_EQ(cudaSuccess, ret); }
TEST(TestCase2, DeathTest_FailsToDie) { // test fails with wrong return code EXPECT_EXIT(errorNoExit("Expected message."), ExitedWithCode(EXIT_SUCCESS), "Expected message.") << "EXPECT_EXIT fails to die.";; }
TEST(RegisterVarDeathTest, RegisterFromNullHandle) { ::testing::FLAGS_gtest_death_test_style = "threadsafe"; EXPECT_EXIT( __cudaRegisterVar(NULL, (char*)&a, (char*)"a", "a", 0, 4, 0, 0), ::testing::KilledBySignal(SIGSEGV), ""); }
TEST( double_buffer_allocation_strategy_death_test, if_dependency_on_allocator_is_missing_an_assertion_is_triggered) { // Trying to avoid "[WARNING] /usr/src/gtest/src/gtest-death-test.cc:789:: // Death tests use fork(), which is unsafe particularly in a threaded context. // For this test, Google Test couldn't detect the number of threads." by // ::testing::FLAGS_gtest_death_test_style = "threadsafe"; // leads to the test failing under valgrind ::testing::FLAGS_gtest_death_test_style = "fast"; EXPECT_EXIT(mc::SwapperFactory(std::shared_ptr<mc::GraphicBufferAllocator>()), ::testing::KilledBySignal(SIGABRT), ".*"); }
TEST(tutorial_DeathTest, simpletest) { // Convention: test case name should end with "DeathTest" // DeathTests usually need to be run before other test int x = 90; // Reasons of death: // 1. Process exited with non-zero code // 2. Process was killed by a signal EXPECT_DEATH(function1(), "Bad thing happened"); EXPECT_EXIT(function2(), ::testing::ExitedWithCode(22), ""); // "" means I don't care about cerr message //EXPECT_EXIT(function2(), ::testing::KilledBySignal(SIGKILL), ".*"); // Not on Windows }
TEST(AppLoggerTest, basic) { EXPECT_EXIT(AppLoggerTest(), ::testing::ExitedWithCode(0), "Success"); }
TEST(BoostSinkAsyncTest, testUsingDefaults) { EXPECT_EXIT(BoostSinkAsyncTest(), ::testing::ExitedWithCode(0), "Success"); }
TEST(FooDeathTest, testLogLevelChangedInRuntime) { EXPECT_EXIT(TestLogLevelChangedInRuntime(), ::testing::ExitedWithCode(0), "Success");
TEST(FooDeathTest, testConsoleAndSyslogUdp) { EXPECT_EXIT(TestLogToSyslogViaUDP(), ::testing::ExitedWithCode(0), "Success");
TEST(FooDeathTest, estLogToSyslogViaPosixSpecialFormatter) { EXPECT_EXIT(TestLogToSyslogViaPosixSpecialFormatter(), ::testing::ExitedWithCode(0), "Success");
TEST(FooDeathTest, testConsoleAndFile) { EXPECT_EXIT(TestLogToConsoleAndFile(), ::testing::ExitedWithCode(0), "Success");
TEST(FooDeathTest, testUsingDefaults) { EXPECT_EXIT(TestLogUsingDefaults(), ::testing::ExitedWithCode(0), "Success");
TEST(FooDeathTest, testLoggingOverhead_SingleThreaded_Synchronisation) { EXPECT_EXIT(TestLoggingOverhead_SingleThreaded_Synchronisation(), ::testing::ExitedWithCode(0), "Success");
TEST(boostSeverityChannelLoggerTest, testUsingDefaults) { EXPECT_EXIT(BoostSeverityChannelLoggerTest(), ::testing::ExitedWithCode(0), "Success"); }
// We have to say "DeathTest" here so gtest knows to run this test (which exits) // in its own process. TEST(pthread_DeathTest, pthread_bug_37410) { // http://code.google.com/p/android/issues/detail?id=37410 ::testing::FLAGS_gtest_death_test_style = "threadsafe"; EXPECT_EXIT(TestBug37410(), ::testing::ExitedWithCode(0), ""); }