diff --git a/.gitignore b/.gitignore index 1e92e88fb77fa..bbd6142d49a37 100644 --- a/.gitignore +++ b/.gitignore @@ -81,6 +81,9 @@ Makefile Makefile.fragments Makefile.objects +# Do not ignore non-generated Makefile +!tests/integration/Makefile + # Directories for shared object files generated by `./configure` libs/ modules/ diff --git a/tests/integration/Makefile b/tests/integration/Makefile new file mode 100644 index 0000000000000..ca071c2a99cfd --- /dev/null +++ b/tests/integration/Makefile @@ -0,0 +1,38 @@ +# The goal of this Makefile is to be a single entry point for non-phpt tests. + +PHP ?= $(CURDIR)/../../sapi/cli/php +# "Windows NT", "Linux", "FreeBSD", "Darwin", ... +OS ?= $(shell $(PHP) -r "echo php_uname('s');") + +INT_SIZE ?= $(shell $(PHP) -r "echo PHP_INT_SIZE;") +ifndef CPU + CPU ?= $(shell $(PHP) -r "echo php_uname('m');") +ifeq ($(filter $(CPU),AMD64 amd64),$(CPU)) + CPU := x86_64 +else ifeq ($(filter $(CPU),i386 i686),$(CPU)) + CPU := x86 +endif +ifeq ($(CPU)_$(INT_SIZE),x86_64_4) + CPU := x86 +endif +endif # ifndef CPU + +ZTS ?= $(shell $(PHP) -r "echo (int)PHP_ZTS;") +ASAN ?= 0 +MSAN ?= 0 + +all: print-env test + +print-env: + @echo "PHP: $(PHP)" + @echo "OS: $(OS)" + @echo "ZTS: $(ZTS)" + @echo "ASAN: $(ASAN)" + @echo "MSAN: $(MSAN)" + +test: +ifeq ($(filter $(OS),Linux Darwin FreeBSD),$(OS)) +ifeq ($(ZTS),1) + $(MAKE) -f Makefile.tls PHP=$(PHP) OS=$(OS) ZTS=$(ZTS) ASAN=$(ASAN) MSAN=$(MSAN) CPU=$(CPU) +endif +endif diff --git a/tests/integration/Makefile.tls b/tests/integration/Makefile.tls new file mode 100644 index 0000000000000..707743931ac6c --- /dev/null +++ b/tests/integration/Makefile.tls @@ -0,0 +1,19 @@ + +TESTDIR:=$(CURDIR)/../../ext/opcache/jit/tls/testing + +ifeq ($(OS),Darwin) + TLSC := $(CURDIR)/../../ext/opcache/jit/tls/zend_jit_tls_darwin.c +else ifeq ($(CPU),x86_64) + TLSC := $(CURDIR)/../../ext/opcache/jit/tls/zend_jit_tls_x86_64.c +else ifeq ($(CPU),x86) + TLSC := $(CURDIR)/../../ext/opcache/jit/tls/zend_jit_tls_x86.c +else ifeq ($(CPU),aarch64) + TLSC := $(CURDIR)/../../ext/opcache/jit/tls/zend_jit_tls_aarch64.c +endif + +ifeq ($(CPU),x86) + MACHINE:=-m32 +endif + +test: + TLSC=$(TLSC) MACHINE=$(MACHINE) $(CURDIR)/../../ext/opcache/jit/tls/testing/test.sh