mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-05-02 12:06:53 +02:00
Merge branch 'barch/windows_no_popups' into 'main'
Prevent gtest tests from popping up dialog boxes See merge request GNOME/glib!2400
This commit is contained in:
commit
2f53c8ed64
@ -35,6 +35,7 @@
|
|||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
|
#include <crtdbg.h>
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
@ -1597,6 +1598,25 @@ void
|
|||||||
mutable_test_config_vars.test_undefined = FALSE;
|
mutable_test_config_vars.test_undefined = FALSE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef G_OS_WIN32
|
||||||
|
// don't open a window for errors (like the "abort() was called one")
|
||||||
|
_CrtSetReportMode (_CRT_ERROR, _CRTDBG_MODE_FILE);
|
||||||
|
_CrtSetReportFile (_CRT_ERROR, _CRTDBG_FILE_STDERR);
|
||||||
|
// while gtest tests tend to use g_assert and friends
|
||||||
|
// if they do use the C standard assert macro we want to
|
||||||
|
// output a message to stderr, not open a popup window
|
||||||
|
_CrtSetReportMode (_CRT_ASSERT, _CRTDBG_MODE_FILE);
|
||||||
|
_CrtSetReportFile (_CRT_ASSERT, _CRTDBG_FILE_STDERR);
|
||||||
|
// in release mode abort() will pop up a windows error
|
||||||
|
// reporting dialog, let's prevent that. Only msvcrxx and
|
||||||
|
// the UCRT have this function, but there's no great way to
|
||||||
|
// detect msvcrxx (that I know of) so only call this when using
|
||||||
|
// the UCRT
|
||||||
|
#ifdef _UCRT
|
||||||
|
_set_abort_behavior (0, _CALL_REPORTFAULT);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
va_start (args, argv);
|
va_start (args, argv);
|
||||||
while ((option = va_arg (args, char *)))
|
while ((option = va_arg (args, char *)))
|
||||||
{
|
{
|
||||||
|
@ -3160,8 +3160,13 @@ g_check_setuid (void)
|
|||||||
void
|
void
|
||||||
g_abort (void)
|
g_abort (void)
|
||||||
{
|
{
|
||||||
/* One call to break the debugger */
|
/* One call to break the debugger
|
||||||
DebugBreak ();
|
* We check if a debugger is actually attached to
|
||||||
|
* avoid a windows error reporting popup window
|
||||||
|
* when run in a test harness / on CI
|
||||||
|
*/
|
||||||
|
if (IsDebuggerPresent ())
|
||||||
|
DebugBreak ();
|
||||||
/* One call in case CRT changes its abort() behaviour */
|
/* One call in case CRT changes its abort() behaviour */
|
||||||
abort ();
|
abort ();
|
||||||
/* And one call to bind them all and terminate the program for sure */
|
/* And one call to bind them all and terminate the program for sure */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user