mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-04-12 20:46:39 +02:00
395 lines
13 KiB
Diff
395 lines
13 KiB
Diff
diff --git a/tests/Makefile b/tests/Makefile
|
|
index 1fe99d72..4199af3a 100644
|
|
--- a/tests/Makefile
|
|
+++ b/tests/Makefile
|
|
@@ -9,6 +9,7 @@ else
|
|
|
|
FAILED := $(shell mktemp -u /tmp/failed.XXXXXXXXX)
|
|
|
|
+# win32 tests:
|
|
MINGW32Q := $(shell which i686-w64-mingw32-gcc 1>/dev/null 2>/dev/null && echo 1)
|
|
MINGW64Q := $(shell which x86_64-w64-mingw32-gcc 1>/dev/null 2>/dev/null && echo 1)
|
|
WINEQ := $(shell which wine 1>/dev/null 2>/dev/null && echo 1)
|
|
@@ -16,42 +17,34 @@ WINEQ := $(shell which wine 1>/dev/null 2>/dev/null && echo 1)
|
|
ok:="\033[1;32mok\033[0m"
|
|
failed:="\033[1;31mfailed\033[0m"
|
|
|
|
-# 32-/64-bit test environment setup
|
|
-HAS_32CDEFS ?= $(call exists,-m32,sys/cdefs.h,exit)
|
|
-HAS_64CDEFS ?= $(call exists,-m64,sys/cdefs.h,exit)
|
|
+MACHINE ?= $(shell uname -m)
|
|
|
|
+# special case, test 64- and 32-bit both
|
|
+# (maximal testings under main development platform)
|
|
+ifeq ($(UNAME)-$(MACHINE),Linux-x86_64)
|
|
+HAS_32CDEFS ?= $(call exists,-m32,sys/cdefs.h,exit)
|
|
+HAS_64CDEFS ?= $(call exists,-m64,sys/cdefs.h,exit)
|
|
+ifeq ($(HAS_32CDEFS),1)
|
|
+DEV_MACHINE ?= 1
|
|
+endif
|
|
ifeq ($(HAS_64CDEFS),1)
|
|
-vm64 = printf "64 " && ./vm64 repl <$$F | diff - $$F.ok
|
|
-else
|
|
-vm64 = true
|
|
+DEV_MACHINE ?= 1
|
|
endif
|
|
-
|
|
-ifeq ($(HAS_32CDEFS),1)
|
|
-vm32 = printf "32 " && ./vm32 repl <$$F | diff - $$F.ok
|
|
else
|
|
-vm32 = true
|
|
+HAS_32CDEFS ?= 0
|
|
+HAS_64CDEFS ?= 0
|
|
endif
|
|
|
|
|
|
-vm32: src/olvm.c includes/ol/vm.h
|
|
- $(CC) src/olvm.c -o $@ \
|
|
- $(L) -m32 -DOLVM_FFI=0 \
|
|
- $(CFLAGS)
|
|
- @echo $(ok)
|
|
-vm64: src/olvm.c includes/ol/vm.h
|
|
- $(CC) src/olvm.c -o $@ \
|
|
- $(L) -m64 -DOLVM_FFI=0 \
|
|
- $(CFLAGS)
|
|
- @echo $(ok)
|
|
-
|
|
# -------------
|
|
# win
|
|
define winbuild
|
|
$(CC) src/olvm.c -o $1 \
|
|
- -DOLVM_FFI=1 -Iincludes/win32 -Iincludes \
|
|
+ -DHAS_DLOPEN=1 -DHAS_SOCKES=1 -DOLVM_FFI=1 \
|
|
+ -Iincludes/win32 -Iincludes \
|
|
extensions/ffi.c \
|
|
-std=gnu99 -fno-exceptions -lws2_32 \
|
|
- -DHAS_DLOPEN=1 -DHAS_SOCKES=1 $2
|
|
+ $2
|
|
endef
|
|
|
|
ifeq ($(MINGW32Q),1)
|
|
@@ -72,45 +65,45 @@ tmp/vm64r.exe: src/olvm.c
|
|
endif
|
|
|
|
|
|
-
|
|
-test32: $(wildcard tests/*.scm)
|
|
- @echo "-- test32 ----------"
|
|
- @rm -f $(FAILED)
|
|
- @$(CC) src/olvm.c $(CFLAGS) tests/vm.c -Iincludes -DOLVM_NOMAIN -o vm32d $(L) -m32
|
|
- @./vm32d
|
|
- @$(CC) src/olvm.c $(CFLAGS) tests/ffi.c -Iincludes \
|
|
- -DOLVM_FFI=1 -Iincludes extensions/ffi.c -o ffi32 $(L) -m32
|
|
- @for F in $^ ;do \
|
|
- printf "Testing $$F ... " ;\
|
|
- if OL_HOME=`pwd`/libraries ./ffi32 repl $$F >/dev/null; then\
|
|
- echo "Ok." ;\
|
|
- else \
|
|
- echo "\033[0;31mFailed!\033[0m" ;\
|
|
- touch $(FAILED) ;\
|
|
- fi ;\
|
|
- done
|
|
- @if [ -e $(FAILED) ] ;then rm -f $(FAILED); exit 1 ;fi
|
|
-
|
|
-test64: $(wildcard tests/*.scm)
|
|
- @echo "-- test64 ----------"
|
|
- @rm -f $(FAILED)
|
|
- @$(CC) src/olvm.c $(CFLAGS) tests/vm.c -Iincludes -DOLVM_NOMAIN -o vm64d $(L) -m64
|
|
- @./vm64d
|
|
- @$(CC) src/olvm.c $(CFLAGS) tests/ffi.c -Iincludes \
|
|
- -DOLVM_FFI=1 -Iincludes extensions/ffi.c -o ffi64 $(L) -m64
|
|
- @for F in $^ ;do \
|
|
- printf "Testing $$F ... " ;\
|
|
- if OL_HOME=`pwd`/libraries ./ffi64 repl $$F >/dev/null; then\
|
|
- echo "Ok." ;\
|
|
- else \
|
|
- echo "\033[0;31mFailed!\033[0m" ;\
|
|
- touch $(FAILED) ;\
|
|
- fi ;\
|
|
- done
|
|
- @if [ -e $(FAILED) ] ;then rm -f $(FAILED); exit 1 ;fi
|
|
-
|
|
-test: test64
|
|
- @echo "passed!"
|
|
+# # -=( test )=----------------------------------------
|
|
+# test32: $(wildcard tests/*.scm)
|
|
+# @echo "-- test32 ----------"
|
|
+# @rm -f $(FAILED)
|
|
+# @$(CC) src/olvm.c $(CFLAGS) tests/vm.c -Iincludes -DOLVM_NOMAIN -o vm32d $(L) -m32
|
|
+# @./vm32d
|
|
+# @$(CC) src/olvm.c $(CFLAGS) tests/ffi.c -Iincludes \
|
|
+# -DOLVM_FFI=1 -Iincludes extensions/ffi.c -o ffi32 $(L) -m32
|
|
+# @for F in $^ ;do \
|
|
+# printf "Testing $$F ... " ;\
|
|
+# if OL_HOME=`pwd`/libraries ./ffi32 repl $$F >/dev/null; then\
|
|
+# echo "Ok." ;\
|
|
+# else \
|
|
+# echo "\033[0;31mFailed!\033[0m" ;\
|
|
+# touch $(FAILED) ;\
|
|
+# fi ;\
|
|
+# done
|
|
+# @if [ -e $(FAILED) ] ;then rm -f $(FAILED); exit 1 ;fi
|
|
+
|
|
+# test64: $(wildcard tests/*.scm)
|
|
+# @echo "-- test64 ----------"
|
|
+# @rm -f $(FAILED)
|
|
+# @$(CC) src/olvm.c $(CFLAGS) tests/vm.c -Iincludes -DOLVM_NOMAIN -o vm64d $(L) -m64
|
|
+# @./vm64d
|
|
+# @$(CC) src/olvm.c $(CFLAGS) tests/ffi.c -Iincludes \
|
|
+# -DOLVM_FFI=1 -Iincludes extensions/ffi.c -o ffi64 $(L) -m64
|
|
+# @for F in $^ ;do \
|
|
+# printf "Testing $$F ... " ;\
|
|
+# if OL_HOME=`pwd`/libraries ./ffi64 repl $$F >/dev/null; then\
|
|
+# echo "Ok." ;\
|
|
+# else \
|
|
+# echo "\033[0;31mFailed!\033[0m" ;\
|
|
+# touch $(FAILED) ;\
|
|
+# fi ;\
|
|
+# done
|
|
+# @if [ -e $(FAILED) ] ;then rm -f $(FAILED); exit 1 ;fi
|
|
+
|
|
+# test: test64
|
|
+# @echo "passed!"
|
|
|
|
# -=( ffi )=----------------------------------------
|
|
test-ffi:
|
|
@@ -134,23 +127,24 @@ test-ffi-release: CFLAGS += $(CFLAGS_RELEASE)
|
|
test-ffi-release: affix=r
|
|
test-ffi-release: test-ffi
|
|
|
|
-# special case, maximal testings under main development platform
|
|
-ifeq ($(UNAME),Linux)
|
|
+ifeq ($(HAS_32CDEFS),1) # x86_64
|
|
test-ffi-debug-32: CFLAGS += -m32
|
|
test-ffi-debug-32: bits=32
|
|
test-ffi-debug-32: test-ffi-debug
|
|
-test-ffi-debug-64: CFLAGS += -m64
|
|
-test-ffi-debug-64: bits=64
|
|
-test-ffi-debug-64: test-ffi-debug
|
|
test-ffi-release-32: CFLAGS += -m32
|
|
test-ffi-release-32: bits=32
|
|
test-ffi-release-32: test-ffi-release
|
|
+endif
|
|
+ifeq ($(HAS_64CDEFS),1) # x86_64
|
|
+test-ffi-debug-64: CFLAGS += -m64
|
|
+test-ffi-debug-64: bits=64
|
|
+test-ffi-debug-64: test-ffi-debug
|
|
test-ffi-release-64: CFLAGS += -m64
|
|
test-ffi-release-64: bits=64
|
|
test-ffi-release-64: test-ffi-release
|
|
endif
|
|
|
|
-# -=( vm )=----------------------------------------
|
|
+# -=( vmi )=---------------------------------------
|
|
test-vmi:
|
|
$(CC) src/olvm.c $(CFLAGS) tests/vm.c -Iincludes -DOLVM_NOMAIN -o $(vmi)$(affix)$(bits) $(L)
|
|
@echo "$(vmi)$(affix)$(bits):"
|
|
@@ -164,22 +158,26 @@ test-vmi-release: CFLAGS += $(CFLAGS_RELEASE)
|
|
test-vmi-release: affix=r
|
|
test-vmi-release: test-vmi
|
|
|
|
-# special case, maximal testings under main development platform
|
|
-ifeq ($(UNAME),Linux)
|
|
+ifeq ($(HAS_32CDEFS),1) # x86_64
|
|
test-vmi-debug-32: CFLAGS += -m32
|
|
test-vmi-debug-32: bits=32
|
|
test-vmi-debug-32: test-vmi-debug
|
|
-test-vmi-debug-64: CFLAGS += -m64
|
|
-test-vmi-debug-64: bits=64
|
|
-test-vmi-debug-64: test-vmi-debug
|
|
test-vmi-release-32: CFLAGS += -m32
|
|
test-vmi-release-32: bits=32
|
|
test-vmi-release-32: test-vmi-release
|
|
+endif
|
|
+ifeq ($(HAS_64CDEFS),1) # x86_64
|
|
+test-vmi-debug-64: CFLAGS += -m64
|
|
+test-vmi-debug-64: bits=64
|
|
+test-vmi-debug-64: test-vmi-debug
|
|
test-vmi-release-64: CFLAGS += -m64
|
|
test-vmi-release-64: bits=64
|
|
test-vmi-release-64: test-vmi-release
|
|
endif
|
|
|
|
+
|
|
+# -=( vm )=----------------------------------------
|
|
+# binaries
|
|
vm-debug:
|
|
$(CC) src/olvm.c $(CFLAGS) \
|
|
-DOLVM_FFI=1 -Iincludes extensions/ffi.c -o $(vm)d$(bits) $(L) $(CFLAGS_DEBUG)
|
|
@@ -188,17 +186,25 @@ vm-release:
|
|
-DOLVM_FFI=1 -Iincludes extensions/ffi.c -o $(vm)r$(bits) $(L) $(CFLAGS_RELEASE)
|
|
vm=tmp/vm
|
|
|
|
-# special case, maximal testings under main development platform
|
|
-ifeq ($(UNAME),Linux)
|
|
+# vm-debug: CFLAGS += $(CFLAGS_DEBUG)
|
|
+# vm-debug: affix=d
|
|
+# vm-debug: vm-debug
|
|
+# vm-release: CFLAGS += $(CFLAGS_RELEASE)
|
|
+# vm-release: affix=r
|
|
+# vm-release: vm-release
|
|
+
|
|
+ifeq ($(HAS_32CDEFS),1) # x86_64
|
|
vm-debug-32: CFLAGS += -m32
|
|
vm-debug-32: bits=32
|
|
vm-debug-32: vm-debug
|
|
-vm-debug-64: CFLAGS += -m64
|
|
-vm-debug-64: bits=64
|
|
-vm-debug-64: vm-debug
|
|
vm-release-32: CFLAGS += -m32
|
|
vm-release-32: bits=32
|
|
vm-release-32: vm-release
|
|
+endif
|
|
+ifeq ($(HAS_64CDEFS),1) # x86_64
|
|
+vm-debug-64: CFLAGS += -m64
|
|
+vm-debug-64: bits=64
|
|
+vm-debug-64: vm-debug
|
|
vm-release-64: CFLAGS += -m64
|
|
vm-release-64: bits=64
|
|
vm-release-64: vm-release
|
|
@@ -206,8 +212,9 @@ endif
|
|
|
|
# -- binaries ---------------------
|
|
testing-binaries: includes/ol/vm.h
|
|
- @echo "Building test binaries:"
|
|
-ifeq ($(UNAME),Linux) # main development platform, try to do a maximal testings
|
|
+ @printf "Building test binaries:"
|
|
+ifeq ($(DEV_MACHINE),1) # main development platform, special case
|
|
+ @printf "\n"
|
|
ifeq ($(HAS_32CDEFS),1)
|
|
@printf " linux 32-bit debug and release versions... "
|
|
@$(MAKE) -s vm-debug-32
|
|
@@ -232,20 +239,20 @@ ifeq ($(MINGW64Q),1)
|
|
@$(MAKE) -s $(vm)64r.exe
|
|
@echo $(ok)
|
|
endif
|
|
- @echo "built."
|
|
-else
|
|
- @printf "Building test binaries (debug and release versions both)... "
|
|
+else # regular case
|
|
+ @printf " (debug and release versions both)... "
|
|
@$(MAKE) -s vm-debug
|
|
@$(MAKE) -s vm-release
|
|
- @echo "Built."
|
|
endif
|
|
+ @echo "built."
|
|
+ @printf "\n"
|
|
|
|
# -- embed --------------------------------------------------------
|
|
testing-embed: tests/embed.c src/olvm.c includes/ol/ol.h tmp/repl.c
|
|
@echo "embed testing"
|
|
@echo "----------------------------------------"
|
|
@printf "tests/embed.c ..."
|
|
-ifeq ($(UNAME),Linux) # main development platform, try to do a maximal testings
|
|
+ifeq ($(DEV_MACHINE),1) # main development platform, special case
|
|
ifeq ($(HAS_32CDEFS),1)
|
|
@printf ", debug-32: "
|
|
@$(CC) tests/embed.c src/olvm.c tmp/repl.c $(CFLAGS) $(L) -DOLVM_NOMAIN \
|
|
@@ -290,7 +297,7 @@ ifeq ($(HAS_64CDEFS),1)
|
|
touch $(FAILED) ;\
|
|
fi
|
|
endif
|
|
-else
|
|
+else # regular case
|
|
@printf ", debug: "
|
|
@$(CC) tests/embed.c src/olvm.c tmp/repl.c $(CFLAGS) $(L) -DOLVM_NOMAIN \
|
|
-DOLVM_FFI=1 extensions/ffi.c -o tmp/embedd \
|
|
@@ -315,11 +322,11 @@ endif
|
|
@echo "."
|
|
|
|
|
|
-# -- internal --------------------------------------
|
|
+# -- internal -------------------------------------
|
|
testing-internal:
|
|
@echo "Internal vm testing"
|
|
- @echo "---------------------------------------"
|
|
-ifeq ($(UNAME),Linux) # special case, try to do maximal testings under main development platform
|
|
+ @echo "----------------------------------------"
|
|
+ifeq ($(DEV_MACHINE),1) # main development platform, special case
|
|
ifeq ($(HAS_32CDEFS),1)
|
|
@$(MAKE) -s test-vmi-debug-32
|
|
@$(MAKE) -s test-vmi-release-32
|
|
@@ -328,16 +335,17 @@ ifeq ($(HAS_64CDEFS),1)
|
|
@$(MAKE) -s test-vmi-debug-64
|
|
@$(MAKE) -s test-vmi-release-64
|
|
endif
|
|
-else
|
|
+else # regular case
|
|
@$(MAKE) -s test-vmi-debug
|
|
@$(MAKE) -s test-vmi-release
|
|
endif
|
|
@echo " "
|
|
|
|
+# -- ffi ------------------------------------------
|
|
testing-ffi:
|
|
@echo "ffi testing"
|
|
@echo "----------------------------------------"
|
|
-ifeq ($(UNAME),Linux) # special case, try to do maximal testings under main development platform
|
|
+ifeq ($(DEV_MACHINE),1) # main development platform, special case
|
|
ifeq ($(HAS_32CDEFS),1)
|
|
@$(MAKE) -s test-ffi-debug-32
|
|
@$(MAKE) -s test-ffi-release-32
|
|
@@ -346,18 +354,17 @@ ifeq ($(HAS_64CDEFS),1)
|
|
@$(MAKE) -s test-ffi-debug-64
|
|
@$(MAKE) -s test-ffi-release-64
|
|
endif
|
|
-else
|
|
+else # regular case
|
|
@$(MAKE) -s test-ffi-debug
|
|
@$(MAKE) -s test-ffi-release
|
|
endif
|
|
@echo " "
|
|
|
|
-
|
|
-# -- scm -------
|
|
+# -- scm ------------------------------------------
|
|
define scmtestok
|
|
@if ([ -f $1 ]); then\
|
|
printf ", $2: ";\
|
|
- if ([ -f $^.in ] && $3 $1 repl --home=libraries $^ <$^.in 2>&1 || $3 $1 repl --home=libraries $^ 2>&1) | diff --strip-trailing-cr - $^.ok >/dev/null; then\
|
|
+ if ([ -f $^.in ] && $3 $1 repl --home=libraries $^ <$^.in 2>&1 || $3 $1 repl --home=libraries $^ 2>&1) | diff $4 - $^.ok >/dev/null; then\
|
|
printf $(ok) ;\
|
|
else \
|
|
printf $(failed);\
|
|
@@ -374,17 +381,17 @@ endef
|
|
$(call scmtestok,$(vm)r,release)
|
|
$(call scmtestok,$(vm)r32,release-32)
|
|
$(call scmtestok,$(vm)r64,release-64)
|
|
- $(call scmtestok,$(vm)32d.exe,win-debug-32,wine)
|
|
- $(call scmtestok,$(vm)32r.exe,win-release-32,wine)
|
|
- $(call scmtestok,$(vm)64d.exe,win-debug-64,wine)
|
|
- $(call scmtestok,$(vm)64r.exe,win-release-64,wine)
|
|
+ $(call scmtestok,$(vm)32d.exe,win-debug-32,wine,--strip-trailing-cr)
|
|
+ $(call scmtestok,$(vm)32r.exe,win-release-32,wine,--strip-trailing-cr)
|
|
+ $(call scmtestok,$(vm)64d.exe,win-debug-64,wine,--strip-trailing-cr)
|
|
+ $(call scmtestok,$(vm)64r.exe,win-release-64,wine,--strip-trailing-cr)
|
|
@printf ".\n"
|
|
|
|
-# -- bin -------
|
|
+# -- bin ------------------------------------------
|
|
define bintestok
|
|
@if ([ -f $1 ]); then\
|
|
printf ", $2: ";\
|
|
- if ([ -f $^.in ] && $3 $1 $^ --home=libraries <$^.in || $3 $1 $^ --home=libraries) | diff --strip-trailing-cr - $^.ok >/dev/null; then\
|
|
+ if ([ -f $^.in ] && $3 $1 $^ --home=libraries <$^.in || $3 $1 $^ --home=libraries) | diff $4 - $^.ok >/dev/null; then\
|
|
printf $(ok) ;\
|
|
else \
|
|
printf $(failed);\
|
|
@@ -401,13 +408,12 @@ endef
|
|
$(call bintestok,$(vm)r,release)
|
|
$(call bintestok,$(vm)r32,release-32)
|
|
$(call bintestok,$(vm)r64,release-64)
|
|
- $(call bintestok,$(vm)32d.exe,win-debug-32,wine)
|
|
- $(call bintestok,$(vm)32r.exe,win-release-32,wine)
|
|
- $(call bintestok,$(vm)64d.exe,win-debug-64,wine)
|
|
- $(call bintestok,$(vm)64r.exe,win-release-64,wine)
|
|
+ $(call bintestok,$(vm)32d.exe,win-debug-32,wine,--strip-trailing-cr)
|
|
+ $(call bintestok,$(vm)32r.exe,win-release-32,wine,--strip-trailing-cr)
|
|
+ $(call bintestok,$(vm)64d.exe,win-debug-64,wine,--strip-trailing-cr)
|
|
+ $(call bintestok,$(vm)64r.exe,win-release-64,wine,--strip-trailing-cr)
|
|
@printf ".\n"
|
|
|
|
-
|
|
# -------------------------------------------------
|
|
# -=( tests )=-------------------------------------
|
|
check: tests
|