From 586c102a3fecb7f4f61c71aa4e99e61ff83d168c Mon Sep 17 00:00:00 2001 From: Luca Bacci Date: Tue, 4 Feb 2025 11:33:15 +0100 Subject: [PATCH] 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. --- test/cairo-test-runner.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/cairo-test-runner.c b/test/cairo-test-runner.c index acbb53930..5fd2144a5 100644 --- a/test/cairo-test-runner.c +++ b/test/cairo-test-runner.c @@ -49,6 +49,10 @@ #define RUNNING_ON_VALGRIND 0 #endif +#ifdef _WIN32 +#include +#endif + #ifdef _MSC_VER #include #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);