Hide Windows fault message box on Windows during make test

This commit is contained in:
Dmitry Stogov 2023-03-07 10:54:46 +03:00
parent 24f58e7759
commit e88b6ab92d
2 changed files with 12 additions and 1 deletions

View File

@ -50,14 +50,20 @@ function run_test($build_dir, $test, $name, $code, $expect, $args) {
} else {
$cmd = "$build_dir\\ir $input $args --no-abort-fault >$output 2>&1";
}
$ret = @system($cmd);
$ret = @system($cmd, $result_code);
if ($ret === false) {
return false;
}
if ($result_code) {
}
$out = @file_get_contents($output);
if ($out === false) {
return false;
}
if ($result_code) {
$out = "\nExit Code = $result_code\n";
file_put_contents($output, $out);
}
$out = trim($out);
$out = str_replace("\r", "", $out);
if ($out !== $expect) {

View File

@ -9,6 +9,10 @@
#include <stdlib.h>
#include <string.h>
#ifdef _WIN32
# include <windows.h>
#endif
static void help(const char *cmd)
{
printf(
@ -370,6 +374,7 @@ int main(int argc, char **argv)
#ifdef _WIN32
if (!abort_fault) {
_set_abort_behavior(0, _WRITE_ABORT_MSG|_CALL_REPORTFAULT);
SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOGPFAULTERRORBOX);
}
#endif