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.
This commit is contained in:
Michael Davidsaver
2019-10-17 20:09:27 -07:00
parent 6903562915
commit 32aeabfc61
+12
View File
@@ -16,6 +16,10 @@
#include <stdio.h>
#include <stdlib.h>
#ifdef _WIN32
# include <crtdbg.h>
#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) {