From 9a4bccb1db310452617ba1b423b1a9bb124711b8 Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Wed, 14 Oct 2020 10:56:27 -0700 Subject: [PATCH 1/3] Autodetect llvm regardless of architecture. --- Makefile | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 7b7f944c511..0ae99c57f47 100644 --- a/Makefile +++ b/Makefile @@ -13,21 +13,24 @@ compilers := ifeq ($(ARCH), x86_64) # In X64, Cranelift is enabled compilers += cranelift - # LLVM could be enabled if not in Windows ifneq ($(OS), Windows_NT) # Singlepass doesn't work yet on Windows compilers += singlepass - # Autodetect LLVM from llvm-config - ifneq (, $(shell which llvm-config)) - LLVM_VERSION := $(shell llvm-config --version) - # If findstring is not empty, then it have found the value - ifneq (, $(findstring 10,$(LLVM_VERSION))) - compilers += llvm - endif - else - ifneq (, $(shell which llvm-config-10)) - compilers += llvm - endif + endif +endif + +# LLVM could be enabled if not in Windows +ifneq ($(OS), Windows_NT) + # Autodetect LLVM from llvm-config + ifneq (, $(shell which llvm-config)) + LLVM_VERSION := $(shell llvm-config --version) + # If findstring is not empty, then it have found the value + ifneq (, $(findstring 10,$(LLVM_VERSION))) + compilers += llvm + endif + else + ifneq (, $(shell which llvm-config-10)) + compilers += llvm endif endif endif From a2c09d202effe9581a5ff283f7f18c831d6f3dff Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Fri, 23 Oct 2020 11:46:05 -0700 Subject: [PATCH 2/3] Autodetect which compiler-engine pairs should be tested with make test. This also means that `make singlepass-native` will test that again showing that it doesn't work, but `make test` will never run that rule. --- Makefile | 61 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 36 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index 960818817a9..4cc2d52c218 100644 --- a/Makefile +++ b/Makefile @@ -8,39 +8,51 @@ else UNAME_S := endif -# Which compilers we build. These have dependencies that may not on the system. +# Which compilers we build. These have dependencies that may not be on the system. compilers := cranelift -# Which engines we test. We always build all engines. -engines := jit +# In the form "$(compiler)-$(engine)" which compiler+engine combinations to test +# in `make test`. +test_compilers_engines := + +# Autodetect LLVM from llvm-config +ifneq (, $(shell which llvm-config)) + LLVM_VERSION := $(shell llvm-config --version) + # If findstring is not empty, then it have found the value + ifneq (, $(findstring 10,$(LLVM_VERSION))) + compilers += llvm + endif +else + ifneq (, $(shell which llvm-config-10)) + compilers += llvm + endif +endif ifeq ($(ARCH), x86_64) + test_compilers_engines += cranelift-jit + # LLVM could be enabled if not in Windows ifneq ($(OS), Windows_NT) - # Singlepass doesn't work yet on Windows + # Native engine doesn't work on Windows yet. + test_compilers_engines += cranelift-native + # Singlepass doesn't work yet on Windows. compilers += singlepass + # Singlepass doesn't work with the native engine. + test_compilers_engines += singlepass-jit + ifneq (, $(findstring llvm,$(compilers))) + test_compilers_engines += llvm-jit llvm-native + endif endif endif -# LLVM could be enabled if not in Windows -ifneq ($(OS), Windows_NT) - # Autodetect LLVM from llvm-config - ifneq (, $(shell which llvm-config)) - LLVM_VERSION := $(shell llvm-config --version) - # If findstring is not empty, then it have found the value - ifneq (, $(findstring 10,$(LLVM_VERSION))) - compilers += llvm - endif - else - ifneq (, $(shell which llvm-config-10)) - compilers += llvm - endif +ifeq ($(ARCH), aarch64) + test_compilers_engines += cranelift-jit + ifneq (, $(findstring llvm,$(compilers))) + test_compilers_engines += llvm-native endif - # Native engine doesn't work yet on Windows - engines += native endif compilers := $(filter-out ,$(compilers)) -engines := $(filter-out ,$(engines)) +test_compilers_engines := $(filter-out ,$(test_compilers_engines)) ifneq ($(OS), Windows_NT) bold := $(shell tput bold) @@ -104,9 +116,8 @@ build-capi-llvm: test: $(foreach compiler,$(compilers),test-$(compiler)) test-packages test-examples test-deprecated -# Singlepass and native engine don't work together, this rule does nothing. test-singlepass-native: - @: + cargo test --release $(compiler_features) --features "test-singlepass test-native" test-singlepass-jit: cargo test --release $(compiler_features) --features "test-singlepass test-jit" @@ -123,11 +134,11 @@ test-llvm-native: test-llvm-jit: cargo test --release $(compiler_features) --features "test-llvm test-jit" -test-singlepass: $(foreach engine,$(engines),test-singlepass-$(engine)) +test-singlepass: $(foreach singlepass_engine,$(filter singlepass-%,$(test_compilers_engines)),test-$(singlepass_engine)) -test-cranelift: $(foreach engine,$(engines),test-cranelift-$(engine)) +test-cranelift: $(foreach cranelift_engine,$(filter cranelift-%,$(test_compilers_engines)),test-$(cranelift_engine)) -test-llvm: $(foreach engine,$(engines),test-llvm-$(engine)) +test-llvm: $(foreach llvm_engine,$(filter llvm-%,$(test_compilers_engines)),test-$(llvm_engine)) test-packages: cargo test -p wasmer --release From a89729a0b0f2986372f9270f7530701862fea1aa Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Fri, 23 Oct 2020 11:54:54 -0700 Subject: [PATCH 3/3] Disable test-llvm-native on aarch64, multi_value_tests fail. --- Makefile | 3 --- 1 file changed, 3 deletions(-) diff --git a/Makefile b/Makefile index 4cc2d52c218..9d1e47714c5 100644 --- a/Makefile +++ b/Makefile @@ -46,9 +46,6 @@ endif ifeq ($(ARCH), aarch64) test_compilers_engines += cranelift-jit - ifneq (, $(findstring llvm,$(compilers))) - test_compilers_engines += llvm-native - endif endif compilers := $(filter-out ,$(compilers))