]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
All overriding the emulator used by configure script with EMU_RUN.
authorNathan Moinvaziri <nathan@nathanm.com>
Mon, 10 Oct 2022 01:41:50 +0000 (18:41 -0700)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Mon, 5 Dec 2022 22:24:02 +0000 (23:24 +0100)
.github/workflows/configure.yml
configure
test/Makefile.in

index cd787eb3962810d9f3525a0d0af5eefb1f47604a..48651fa6cfec2d9b3551470d6e4bf1012625bfd2 100644 (file)
@@ -167,6 +167,7 @@ jobs:
             configure-prefix: emconfigure
             cflags: -static
             ldflags: -static
+            emu-run: node
 
           - name: macOS GCC Symbol Prefix
             os: macOS-latest
@@ -207,6 +208,7 @@ jobs:
         CFLAGS: ${{ matrix.cflags }}
         LDFLAGS: ${{ matrix.ldflags }}
         CHOST: ${{ matrix.chost }}
+        EMU_RUN: ${{ matrix.emu-run }}
         CI: true
 
     - name: Compile source code
index 5381ee65ac7eaae21fef8c31f5afd1acab0a664a..bb8d15c8ecc758a550c700a4700e3805cc0496e4 100755 (executable)
--- a/configure
+++ b/configure
@@ -2199,9 +2199,16 @@ if test "$CHOST" != "wasm32"; then
     TEST="${TEST} ghtests"
 fi
 
+# Determine emulator to use when running tests
+if test -z "$EMU_RUN" && test $QEMU_ARCH; then
+    EMU_RUN="qemu-$QEMU_ARCH -L /usr/${CHOST}/"
+fi
+if test -n "$EMU_RUN"; then
+    echo "Using cross-compile emulator: $EMU_RUN"
+fi
+
 # Generate Makefile in test dir
 mkdir -p test
-if test $QEMU_ARCH; then QEMU_RUN="qemu-$QEMU_ARCH -L /usr/${CHOST}/"; fi
 sed < $SRCDIR/test/Makefile.in "
 /^CC *=/s#=.*#=$CC#
 /^CFLAGS *=/s#=.*#=$CFLAGS#
@@ -2210,7 +2217,7 @@ sed < $SRCDIR/test/Makefile.in "
 /^alltests: */s#:.*#: $TEST#
 /^SRCDIR *=/s#=.*#=$SRCDIR/test#
 /^SRCTOP *=/s#=.*#=$SRCDIR#
-/^QEMU_RUN *=/s#=.*#=$QEMU_RUN#
+/^EMU_RUN *=/s#=.*#=$EMU_RUN#
 /^LIBNAME *=/s#=.*#=$LIBNAME#
 " > test/Makefile
 
index e10de00bad9f04fe36cdfaff56b1ec851f5c6a92..d2658e7ce4469a557fa54817e7aed48173db95c2 100644 (file)
@@ -10,16 +10,16 @@ SRCTOP=
 LIBNAME=
 TEST_LDFLAGS=-L.. ../$(LIBNAME).a
 
-QEMU_RUN=
-QEMU_VER:=$(shell command -v $(QEMU_RUN) --version 2> /dev/null)
+EMU_RUN=
 
 all: alltests
 
 alltests: #set by ../configure
 check_cross_dep:
-ifneq (,$(QEMU_RUN))
+ifneq (,$(findstring qemu,$(EMU_RUN)))
+QEMU_VER:=$(shell command -v $(EMU_RUN) --version 2> /dev/null)
 ifeq (,$(QEMU_VER))
-       $(error "You need QEMU to run tests on non-native platform")
+       $(error You need QEMU to run tests on non-native platform)
 endif
 endif
 
@@ -28,7 +28,7 @@ ALL_SRC_FILES := $(wildcard ../*)
 teststatic: check_cross_dep
        @TMPST=tmpst_$$$$; \
        HELLOST=tmphellost_$$$$; \
-       if echo hello world | ${QEMU_RUN} ../minigzip$(EXE) > $$HELLOST && ${QEMU_RUN} ../minigzip$(EXE) -d < $$HELLOST && ${QEMU_RUN} ../example$(EXE) $$TMPST; then \
+       if echo hello world | ${EMU_RUN} ../minigzip$(EXE) > $$HELLOST && ${EMU_RUN} ../minigzip$(EXE) -d < $$HELLOST && ${EMU_RUN} ../example$(EXE) $$TMPST; then \
          echo '                *** zlib test OK ***'; \
        else \
          echo '                *** zlib test FAILED ***'; exit 1; \
@@ -42,7 +42,7 @@ testshared: check_cross_dep
        SHLIB_PATH=`pwd`/..:$(SHLIB_PATH) ; export SHLIB_PATH; \
        TMPSH=tmpsh_$$$$; \
        HELLOSH=tmphellosh_$$$$; \
-       if echo hello world | ${QEMU_RUN} ../minigzipsh$(EXE) > $$HELLOSH && ${QEMU_RUN} ../minigzipsh$(EXE) -d < $$HELLOSH && ${QEMU_RUN} ../examplesh$(EXE) $$TMPSH; then \
+       if echo hello world | ${EMU_RUN} ../minigzipsh$(EXE) > $$HELLOSH && ${EMU_RUN} ../minigzipsh$(EXE) -d < $$HELLOSH && ${EMU_RUN} ../examplesh$(EXE) $$TMPSH; then \
          echo '                *** zlib shared test OK ***'; \
        else \
          echo '                *** zlib shared test FAILED ***'; exit 1; \
@@ -54,25 +54,25 @@ ghtests: testGH-361 testGH-364 testGH-751 testGH-1235
 
 .PHONY: testGH-361
 testGH-361:
-       $(QEMU_RUN) ../minigzip$(EXE) -4 <$(SRCDIR)/GH-361/test.txt >/dev/null
+       $(EMU_RUN) ../minigzip$(EXE) -4 <$(SRCDIR)/GH-361/test.txt >/dev/null
 
 switchlevels$(EXE): $(SRCDIR)/switchlevels.c
        $(CC) $(CFLAGS) -I.. -I$(SRCTOP) -o $@ $< $(TEST_LDFLAGS)
 
 .PHONY: testGH-364
 testGH-364: switchlevels$(EXE)
-       $(QEMU_RUN) ./switchlevels$(EXE) 1 5 9 3 <$(SRCDIR)/GH-364/test.bin >/dev/null
+       $(EMU_RUN) ./switchlevels$(EXE) 1 5 9 3 <$(SRCDIR)/GH-364/test.bin >/dev/null
 
 .PHONY: testGH-751
 testGH-751:
-       $(QEMU_RUN) ../minigzip$(EXE) <$(SRCDIR)/GH-751/test.txt | $(QEMU_RUN) ../minigzip$(EXE) -d >/dev/null
+       $(EMU_RUN) ../minigzip$(EXE) <$(SRCDIR)/GH-751/test.txt | $(EMU_RUN) ../minigzip$(EXE) -d >/dev/null
 
 gh1235$(EXE): $(SRCDIR)/gh1235.c
        $(CC) $(CFLAGS) -I.. -I$(SRCTOP) -o $@ $< $(TEST_LDFLAGS)
 
 .PHONY: testGH-1235
 testGH-1235: gh1235$(EXE)
-       $(QEMU_RUN) ./gh1235$(EXE)
+       $(EMU_RUN) ./gh1235$(EXE)
 
 clean:
        rm -f *.o *.gcda *.gcno *.gcov