Test runner: Add some Win32-specific implementations

Disable error message boxes in tests, enable termination on heap
corruption, and check if running under a debugger.
This commit is contained in:
Luca Bacci 2025-02-04 11:33:15 +01:00
parent bc84f415bb
commit 586c102a3f

View file

@ -49,6 +49,10 @@
#define RUNNING_ON_VALGRIND 0
#endif
#ifdef _WIN32
#include <windows.h>
#endif
#ifdef _MSC_VER
#include <crtdbg.h>
#endif
@ -169,6 +173,8 @@ is_running_under_debugger (void)
{
return TRUE;
}
#elif defined (_WIN32)
return IsDebuggerPresent () != 0;
#endif
if (RUNNING_ON_VALGRIND)
@ -740,6 +746,14 @@ main (int argc, char **argv)
int len;
char *cairo_tests_env;
#ifdef _WIN32
SetErrorMode (SEM_FAILCRITICALERRORS |
SEM_NOGPFAULTERRORBOX |
SEM_NOOPENFILEERRORBOX);
HeapSetInformation (NULL, HeapEnableTerminationOnCorruption, NULL, 0);
#endif
#ifdef _MSC_VER
/* We don't want an assert dialog, we want stderr */
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);