shithub: rgbds

Download patch

ref: 159efe12578bd2063713d27af81c8e0e5b2cb108
parent: 3cfe7800c7dd02eb17f76b81e2659701ceb49c93
author: ISSOtm <[email protected]>
date: Thu May 5 14:51:36 EDT 2022

Transfer test programs as well for cross-testing

--- a/.github/workflows/testing.yml
+++ b/.github/workflows/testing.yml
@@ -51,7 +51,7 @@
           mkdir bins
           cp rgb{asm,link,fix,gfx} bins
       - name: Upload binaries
-        uses: actions/upload-artifact@v1
+        uses: actions/upload-artifact@v3
         with:
           name: rgbds-canary-${{ matrix.os }}-${{ matrix.cc }}-${{ matrix.buildsys }}
           path: bins
@@ -134,7 +134,7 @@
           mkdir bins
           cp install_dir/bin/{rgbasm.exe,rgblink.exe,rgbfix.exe,rgbgfx.exe,zlib1.dll,libpng16.dll} bins
       - name: Upload Windows binaries
-        uses: actions/upload-artifact@v1
+        uses: actions/upload-artifact@v3
         with:
           name: rgbds-canary-win${{ matrix.bits }}
           path: bins
@@ -186,11 +186,20 @@
           cp /usr/${{ matrix.triplet }}/lib/zlib1.dll bins
           cp /usr/${{ matrix.triplet }}/bin/libpng16-16.dll bins
           if [ ${{ matrix.bits }} -eq 32 ]; then cp /usr/lib/gcc/${{ matrix.triplet }}/7.3-win32/lib{gcc_s_sjlj-1,stdc++-6}.dll bins; fi
+          mv test/gfx/randtilegen{,.exe}
+          mv test/gfx/rgbgfx_test{,.exe}
       - name: Upload Windows binaries
-        uses: actions/upload-artifact@v1
+        uses: actions/upload-artifact@v3
         with:
           name: rgbds-canary-mingw-win${{ matrix.bits }}
           path: bins
+      - name: Upload Windows test binaries
+        uses: actions/upload-artifact@v3
+        with:
+          name: testing-programs-mingw-win${{ matrix.bits }}
+          path: |
+            test/gfx/randtilegen.exe
+            test/gfx/rgbgfx_test.exe
 
   windows-xtesting:
     needs: windows-xbuild
@@ -202,14 +211,20 @@
     steps:
       - uses: actions/checkout@v2
       - name: Retrieve binaries
-        uses: actions/download-artifact@v1
+        uses: actions/download-artifact@v3
         with:
           name: rgbds-canary-mingw-win${{ matrix.bits }}
           path: bins
+      - name: Retrieve test binaries
+        uses: actions/download-artifact@v3
+        with:
+          name: testing-programs-mingw-win${{ matrix.bits }}
+          path: test/gfx
       - name: Extract binaries
         shell: bash
         run: |
           cp bins/* .
+          cp bins/*.dll test/gfx
       - name: Run tests
         shell: bash
         run: |
--- a/Makefile
+++ b/Makefile
@@ -254,11 +254,13 @@
 # install instructions instead.
 
 mingw32:
-	$Q${MAKE} CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ \
+	$Q${MAKE} all test/gfx/randtilegen test/gfx/rgbgfx_test \
+		CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ \
 		BISON=bison PKG_CONFIG=i686-w64-mingw32-pkg-config -j
 
 mingw64:
-	$Q${MAKE} CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ \
+	$Q${MAKE} all test/gfx/randtilegen test/gfx/rgbgfx_test \
+		CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ \
 		BISON=bison PKG_CONFIG=x86_64-w64-mingw32-pkg-config -j
 
 wine-shim:
--- a/test/gfx/rgbgfx_test.cpp
+++ b/test/gfx/rgbgfx_test.cpp
@@ -1,6 +1,6 @@
 
 // For `execProg` (Windows is its special little snowflake again)
-#ifndef _MSC_VER
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
 	#include <sys/stat.h>
 	#include <sys/wait.h>
 
@@ -280,7 +280,7 @@
 };
 
 static char *execProg(char const *name, char * const *argv) {
-#ifndef _MSC_VER
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
 	pid_t pid;
 	int err = posix_spawn(&pid, argv[0], nullptr, nullptr, argv, nullptr);
 	if (err != 0) {
@@ -298,7 +298,7 @@
 		fatal("%s returned with status %d", name, info.si_status);
 	}
 
-#else /* defined(_MSC_VER) */
+#else /* defined(_MSC_VER) || defined(__MINGW32__) */
 
 	auto winStrerror = [](DWORD errnum) {
 		LPTSTR buf;