From: Nathan Moinvaziri Date: Mon, 10 Oct 2022 01:41:50 +0000 (-0700) Subject: All overriding the emulator used by configure script with EMU_RUN. X-Git-Tag: 2.1.0-beta1~129 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=354be239442c765b6bd39f80a0933b854b034d90;p=thirdparty%2Fzlib-ng.git All overriding the emulator used by configure script with EMU_RUN. --- diff --git a/.github/workflows/configure.yml b/.github/workflows/configure.yml index cd787eb39..48651fa6c 100644 --- a/.github/workflows/configure.yml +++ b/.github/workflows/configure.yml @@ -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 diff --git a/configure b/configure index 5381ee65a..bb8d15c8e 100755 --- 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 diff --git a/test/Makefile.in b/test/Makefile.in index e10de00ba..d2658e7ce 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -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