diff --git a/Makefile b/Makefile index 3ba4ae736..27f3cd94b 100644 --- a/Makefile +++ b/Makefile @@ -142,6 +142,10 @@ direct_tests: $(DIRECT_TESTS:%=direct_%_test) build_genrule_test: build_buck_test build_genrule_print: build_buck_print +# the waf test and the make test run the same `make` command +build_waf_test: build_make_test +build_waf_print: build_make_print + .PHONY: print_direct_tests print_direct_tests: $(DIRECT_TESTS:%=direct_%_print) diff --git a/infer/tests/base.make b/infer/tests/base.make index 6121ab872..45538f4ad 100644 --- a/infer/tests/base.make +++ b/infer/tests/base.make @@ -7,6 +7,11 @@ ROOT_DIR = $(TESTS_DIR)/../.. +# The relative path from infer/tests/ to the directory containing the current Makefile. This is +# computed in a hacky way and might not always be a relative path, so only use this for cosmetic +# reasons. +TEST_REL_DIR = $(patsubst $(abspath $(TESTS_DIR))/%,%,$(abspath $(CURDIR))) + include $(ROOT_DIR)/Makefile.config default: compile @@ -25,7 +30,8 @@ print: issues.exp.test$(TEST_SUFFIX) .PHONY: test test: issues.exp.test$(TEST_SUFFIX) - diff -u issues.exp issues.exp.test$(TEST_SUFFIX) + @cd $(TESTS_DIR) && \ + diff -u $(TEST_REL_DIR)/issues.exp $(TEST_REL_DIR)/issues.exp.test$(TEST_SUFFIX) .PHONY: clean clean: diff --git a/infer/tests/build_systems/fail_on_issue/Makefile b/infer/tests/build_systems/fail_on_issue/Makefile index 921a37f60..a20ec747a 100644 --- a/infer/tests/build_systems/fail_on_issue/Makefile +++ b/infer/tests/build_systems/fail_on_issue/Makefile @@ -22,6 +22,9 @@ ROOT_DIR = $(TESTS_DIR)/../.. include $(ROOT_DIR)/Makefile.config +# see base.make +TEST_REL_DIR = $(patsubst $(abspath $(TESTS_DIR))/%,%,$(abspath $(CURDIR))) + default: compile issues.exp.test: $(CLANG_DEPS) $(SOURCES) @@ -37,7 +40,8 @@ print: issues.exp.test .PHONY: test test: issues.exp.test - diff -u issues.exp issues.exp.test + @cd $(TESTS_DIR) && \ + diff -u $(TEST_REL_DIR)/issues.exp $(TEST_REL_DIR)/issues.exp.test .PHONY: clean clean: diff --git a/infer/tests/build_systems/utf8_in_pwd/Makefile b/infer/tests/build_systems/utf8_in_pwd/Makefile index 992e932d6..7a211208d 100644 --- a/infer/tests/build_systems/utf8_in_pwd/Makefile +++ b/infer/tests/build_systems/utf8_in_pwd/Makefile @@ -15,6 +15,9 @@ ROOT_DIR = $(TESTS_DIR)/../.. include $(TESTS_DIR)/java.make include $(ROOT_DIR)/Makefile.config +# see base.make +TEST_REL_DIR = $(patsubst $(abspath $(TESTS_DIR))/%,%,$(abspath $(CURDIR))) + UTF8_DIR = $(shell printf '../codetoanalyze/utf8_\u03B9n_pwd') CMAKE_DIR = $(UTF8_DIR)/cmake @@ -102,7 +105,8 @@ print: issues.exp.test .PHONY: test test: issues.exp.test - diff -u issues.exp issues.exp.test + @cd $(TESTS_DIR) && \ + diff -u $(TEST_REL_DIR)/issues.exp $(TEST_REL_DIR)/issues.exp.test .PHONY: clean clean: diff --git a/infer/tests/codetoanalyze/java/crashcontext/Makefile b/infer/tests/codetoanalyze/java/crashcontext/Makefile index d340531b3..8d6e785eb 100644 --- a/infer/tests/codetoanalyze/java/crashcontext/Makefile +++ b/infer/tests/codetoanalyze/java/crashcontext/Makefile @@ -8,6 +8,9 @@ TESTS_DIR = ../../.. include $(TESTS_DIR)/java.make +# see base.make +TEST_REL_DIR = $(patsubst $(abspath $(TESTS_DIR))/%,%,$(abspath $(CURDIR))) + ANALYZER = crashcontext SOURCES = $(wildcard *.java) @@ -43,7 +46,8 @@ print: issues.exp.test .PHONY: test test: issues.exp.test - diff -u issues.exp issues.exp.test + @cd $(TESTS_DIR) && \ + diff -u $(TEST_REL_DIR)/issues.exp $(TEST_REL_DIR)/issues.exp.test .PHONY: clean clean: