mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Run internal tests in Cygwin (#1592)
This commit is contained in:
@@ -1,21 +1,5 @@
|
||||
/* SPDX-License-Identifier: MIT */
|
||||
|
||||
// For `execProg` (Windows is its special little snowflake again)
|
||||
#if !defined(_MSC_VER) && !defined(__MINGW32__)
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include <signal.h>
|
||||
#include <spawn.h>
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#define WIN32_LEAN_AND_MEAN // Include less from `windows.h` to avoid conflicts
|
||||
#include <windows.h>
|
||||
#include <errhandlingapi.h>
|
||||
#include <processthreadsapi.h>
|
||||
#undef max // This macro conflicts with `std::numeric_limits<...>::max()`
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
@@ -34,6 +18,22 @@
|
||||
|
||||
#include "gfx/rgba.hpp" // Reused from RGBGFX
|
||||
|
||||
// For `execProg` (Windows and POSIX spawn child processes differently)
|
||||
#if !defined(_MSC_VER) && !defined(__MINGW32__)
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include <signal.h>
|
||||
#include <spawn.h>
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#define WIN32_LEAN_AND_MEAN // Include less from `windows.h` to avoid conflicts
|
||||
#include <windows.h>
|
||||
#include <errhandlingapi.h>
|
||||
#include <processthreadsapi.h>
|
||||
#undef max // This macro conflicts with `std::numeric_limits<...>::max()`
|
||||
#endif
|
||||
|
||||
static uintmax_t nbErrors;
|
||||
|
||||
static void warning(char const *fmt, ...) {
|
||||
@@ -308,23 +308,13 @@ static char *execProg(char const *name, char * const *argv) {
|
||||
return strerror(err);
|
||||
}
|
||||
|
||||
siginfo_t info;
|
||||
if (waitid(P_PID, pid, &info, WEXITED) != 0) {
|
||||
if (int info; waitpid(pid, &info, 0) == -1 || !WIFEXITED(info)) {
|
||||
fatal("Error waiting for %s: %s", name, strerror(errno));
|
||||
} else if (info.si_code != CLD_EXITED) {
|
||||
assert(info.si_code == CLD_KILLED || info.si_code == CLD_DUMPED);
|
||||
fatal(
|
||||
"%s was terminated by signal %s%s\n\tThe command was: [%s]",
|
||||
name,
|
||||
strsignal(info.si_status),
|
||||
info.si_code == CLD_DUMPED ? " (core dumped)" : "",
|
||||
formatArgv()
|
||||
);
|
||||
} else if (info.si_status != 0) {
|
||||
} else if (int status = WEXITSTATUS(info); status != 0) {
|
||||
fatal(
|
||||
"%s returned with status %d\n\tThe command was: [%s]",
|
||||
name,
|
||||
info.si_status,
|
||||
status,
|
||||
formatArgv()
|
||||
);
|
||||
}
|
||||
@@ -359,26 +349,7 @@ static char *execProg(char const *name, char * const *argv) {
|
||||
|
||||
STARTUPINFOA startupInfo;
|
||||
GetStartupInfoA(&startupInfo);
|
||||
STARTUPINFOA childStartupInfo{
|
||||
sizeof(startupInfo),
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
nullptr,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
};
|
||||
STARTUPINFOA childStartupInfo = {sizeof(startupInfo)};
|
||||
|
||||
PROCESS_INFORMATION child;
|
||||
if (CreateProcessA(
|
||||
|
||||
Reference in New Issue
Block a user