diff --git a/Src/Generic/Test/TestErrorHandling.h b/Src/Generic/Test/TestErrorHandling.h index 2af92724c8..748b9b9b13 100644 --- a/Src/Generic/Test/TestErrorHandling.h +++ b/Src/Generic/Test/TestErrorHandling.h @@ -158,10 +158,9 @@ namespace TestGenericLib #endif } -#ifdef DEBUG void testNativeAssertThrowsExceptionWithoutContinuing() { -#if defined(WIN32) || defined(_M_X64) +#if (defined(WIN32) || defined(_M_X64)) && defined(DEBUG) bool fReachedAfterAssert = false; try { @@ -179,11 +178,8 @@ namespace TestGenericLib } unitpp::assert_true("Execution continued after native assert", !fReachedAfterAssert); -#else - // TODO-Linux: port #endif } -#endif public: TestErrorHandling(); diff --git a/Src/Generic/Test/testGeneric.cpp b/Src/Generic/Test/testGeneric.cpp index 5a4d06492f..39b0e73440 100644 --- a/Src/Generic/Test/testGeneric.cpp +++ b/Src/Generic/Test/testGeneric.cpp @@ -81,7 +81,7 @@ namespace unitpp else { g_previousAssertProc = SetAssertProc(ThrowingAssertProc); - ShowAssertMessageBox(0); // Disable assertion dialogs + ShowAssertMessageBox(0); } #endif #if defined(WIN32) || defined(WIN64) @@ -95,14 +95,15 @@ namespace unitpp { signal(SIGABRT, TerminateOnSigAbrt); + const bool fInjectTeardownAbort = IsEnvironmentSwitchEnabled("FW_TEST_INDUCE_TEARDOWN_ABORT"); #ifdef DEBUG const bool fInjectTeardownAssert = IsEnvironmentSwitchEnabled("FW_TEST_INDUCE_TEARDOWN_ASSERT"); - const bool fInjectTeardownAbort = IsEnvironmentSwitchEnabled("FW_TEST_INDUCE_TEARDOWN_ABORT"); if (fInjectTeardownAssert || fInjectTeardownAbort) RestorePreviousAssertProc(); if (fInjectTeardownAssert) AssertMsg(false, "Injected teardown assert for native test infrastructure validation"); +#endif if (fInjectTeardownAbort) { @@ -110,7 +111,6 @@ namespace unitpp _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT); abort(); } -#endif #if defined(WIN32) || defined(WIN64) ModuleEntry::DllMain(0, DLL_PROCESS_DETACH);