From 32aeabfc615568391bc51535710a0668873f8e92 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 7 Oct 2019 11:29:27 -0700 Subject: [PATCH] msvc unittests disable dialog on error or assert() failure Showing a dialog is really unhelpful in headless CI environments. _CrtSetReportMode also set _CRT_WARN Not clear what the default is. --- modules/libcom/src/misc/epicsUnitTest.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/libcom/src/misc/epicsUnitTest.c b/modules/libcom/src/misc/epicsUnitTest.c index 4ac18ea1c..0c827b0b3 100644 --- a/modules/libcom/src/misc/epicsUnitTest.c +++ b/modules/libcom/src/misc/epicsUnitTest.c @@ -16,6 +16,10 @@ #include #include +#ifdef _WIN32 +# include +#endif + #define epicsExportSharedSymbols #include "epicsThread.h" #include "epicsMutex.h" @@ -57,6 +61,14 @@ static epicsThreadOnceId onceFlag = EPICS_THREAD_ONCE_INIT; static void testOnce(void *dummy) { testLock = epicsMutexMustCreate(); perlHarness = (getenv("HARNESS_ACTIVE") != NULL); +#ifdef _WIN32 + _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE |_CRTDBG_MODE_DEBUG ); + _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR ); + _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE |_CRTDBG_MODE_DEBUG ); + _CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDERR ); + _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE |_CRTDBG_MODE_DEBUG ); + _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDERR ); +#endif } void testPlan(int plan) {