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:
37
.github/workflows/testing.yml
vendored
37
.github/workflows/testing.yml
vendored
@@ -320,3 +320,40 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
test/run-tests.sh
|
test/run-tests.sh
|
||||||
|
|
||||||
|
cygwin:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
bits: [32, 64]
|
||||||
|
include:
|
||||||
|
- bits: 32
|
||||||
|
arch: x86
|
||||||
|
- bits: 64
|
||||||
|
arch: x86_64
|
||||||
|
fail-fast: false
|
||||||
|
runs-on: windows-2019
|
||||||
|
timeout-minutes: 30
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup Cygwin
|
||||||
|
uses: cygwin/cygwin-install-action@v4
|
||||||
|
with:
|
||||||
|
platform: ${{ matrix.arch }}
|
||||||
|
packages: >-
|
||||||
|
bison
|
||||||
|
gcc-g++
|
||||||
|
git
|
||||||
|
libpng-devel
|
||||||
|
make
|
||||||
|
pkg-config
|
||||||
|
- name: Build & install using Make
|
||||||
|
shell: C:\cygwin\bin\env.exe CYGWIN_NOWINPATH=1 CHERE_INVOKING=1 C:\cygwin\bin\bash.exe -o igncr '{0}'
|
||||||
|
run: | # Cygwin does not support `make develop` sanitizers ASan or UBSan
|
||||||
|
make -kj Q=
|
||||||
|
make install -j Q=
|
||||||
|
- name: Run tests
|
||||||
|
shell: C:\cygwin\bin\env.exe CYGWIN_NOWINPATH=1 CHERE_INVOKING=1 C:\cygwin\bin\bash.exe -o igncr '{0}'
|
||||||
|
run: | # Allow asm/test.sh to run `git describe` for the version test
|
||||||
|
git config --global --add safe.directory '*'
|
||||||
|
test/run-tests.sh --only-internal
|
||||||
|
|||||||
@@ -1,21 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* 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 <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@@ -34,6 +18,22 @@
|
|||||||
|
|
||||||
#include "gfx/rgba.hpp" // Reused from RGBGFX
|
#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 uintmax_t nbErrors;
|
||||||
|
|
||||||
static void warning(char const *fmt, ...) {
|
static void warning(char const *fmt, ...) {
|
||||||
@@ -308,23 +308,13 @@ static char *execProg(char const *name, char * const *argv) {
|
|||||||
return strerror(err);
|
return strerror(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
siginfo_t info;
|
if (int info; waitpid(pid, &info, 0) == -1 || !WIFEXITED(info)) {
|
||||||
if (waitid(P_PID, pid, &info, WEXITED) != 0) {
|
|
||||||
fatal("Error waiting for %s: %s", name, strerror(errno));
|
fatal("Error waiting for %s: %s", name, strerror(errno));
|
||||||
} else if (info.si_code != CLD_EXITED) {
|
} else if (int status = WEXITSTATUS(info); status != 0) {
|
||||||
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) {
|
|
||||||
fatal(
|
fatal(
|
||||||
"%s returned with status %d\n\tThe command was: [%s]",
|
"%s returned with status %d\n\tThe command was: [%s]",
|
||||||
name,
|
name,
|
||||||
info.si_status,
|
status,
|
||||||
formatArgv()
|
formatArgv()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -359,26 +349,7 @@ static char *execProg(char const *name, char * const *argv) {
|
|||||||
|
|
||||||
STARTUPINFOA startupInfo;
|
STARTUPINFOA startupInfo;
|
||||||
GetStartupInfoA(&startupInfo);
|
GetStartupInfoA(&startupInfo);
|
||||||
STARTUPINFOA childStartupInfo{
|
STARTUPINFOA childStartupInfo = {sizeof(startupInfo)};
|
||||||
sizeof(startupInfo),
|
|
||||||
nullptr,
|
|
||||||
nullptr,
|
|
||||||
nullptr,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
nullptr,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
};
|
|
||||||
|
|
||||||
PROCESS_INFORMATION child;
|
PROCESS_INFORMATION child;
|
||||||
if (CreateProcessA(
|
if (CreateProcessA(
|
||||||
|
|||||||
@@ -8,11 +8,13 @@ usage() {
|
|||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " -h, --help show this help message"
|
echo " -h, --help show this help message"
|
||||||
echo " --only-free skip tests that build nonfree codebases"
|
echo " --only-free skip tests that build nonfree codebases"
|
||||||
|
echo " --only-internal skip tests that build external codebases"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Parse options in pure Bash because macOS `getopt` is stuck
|
# Parse options in pure Bash because macOS `getopt` is stuck
|
||||||
# in what util-linux `getopt` calls `GETOPT_COMPATIBLE` mode
|
# in what util-linux `getopt` calls `GETOPT_COMPATIBLE` mode
|
||||||
nonfree=true
|
nonfree=true
|
||||||
|
external=true
|
||||||
FETCH_TEST_DEPS="fetch-test-deps.sh"
|
FETCH_TEST_DEPS="fetch-test-deps.sh"
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@@ -24,6 +26,9 @@ while [[ $# -gt 0 ]]; do
|
|||||||
nonfree=false
|
nonfree=false
|
||||||
FETCH_TEST_DEPS="fetch-test-deps.sh --only-free"
|
FETCH_TEST_DEPS="fetch-test-deps.sh --only-free"
|
||||||
;;
|
;;
|
||||||
|
--only-internal)
|
||||||
|
external=false
|
||||||
|
;;
|
||||||
--)
|
--)
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
@@ -49,6 +54,10 @@ for dir in asm link fix gfx; do
|
|||||||
popd
|
popd
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if ! "$external"; then
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
# Test some significant external projects that use RGBDS
|
# Test some significant external projects that use RGBDS
|
||||||
# When adding new ones, don't forget to add them to the .gitignore!
|
# When adding new ones, don't forget to add them to the .gitignore!
|
||||||
# When updating subprojects, change the commit being checked out, and set the `shallow-since`
|
# When updating subprojects, change the commit being checked out, and set the `shallow-since`
|
||||||
|
|||||||
Reference in New Issue
Block a user