]> git.lizzy.rs Git - rust.git/blobdiff - mk/tests.mk
pass CXX to run-make
[rust.git] / mk / tests.mk
index bce5a52118bd89455cb740860d58613d99952c0b..b887f7b887f2a0b5a4d93a7556e2e063ebd797b0 100644 (file)
@@ -36,8 +36,6 @@ TEST_CRATES = $(TEST_TARGET_CRATES) $(TEST_HOST_CRATES)
 # Environment configuration
 ######################################################################
 
-TESTARGS :=
-
 # The arguments to all test runners
 ifdef TESTNAME
   TESTARGS += $(TESTNAME)
@@ -50,8 +48,6 @@ endif
 # Arguments to the cfail/rfail/rpass tests
 ifdef CFG_VALGRIND
   CTEST_RUNTOOL = --runtool "$(CFG_VALGRIND)"
-else
-  CTEST_RUNTOOL =
 endif
 
 CTEST_TESTARGS := $(TESTARGS)
@@ -147,11 +143,10 @@ else
 CFG_ADB_TEST_DIR=
 endif
 
-DOC_NAMES :=
 # $(1) - name of doc test
 # $(2) - file of the test
 define DOCTEST
-DOC_NAMES += $(1)
+DOC_NAMES := $$(DOC_NAMES) $(1)
 DOCFILE_$(1) := $(2)
 endef
 
@@ -303,14 +298,14 @@ check-stage$(1)-T-$(2)-H-$(3)-exec: \
        check-stage$(1)-T-$(2)-H-$(3)-rfail-exec \
        check-stage$(1)-T-$(2)-H-$(3)-cfail-exec \
        check-stage$(1)-T-$(2)-H-$(3)-pfail-exec \
-    check-stage$(1)-T-$(2)-H-$(3)-rpass-valgrind-exec \
-    check-stage$(1)-T-$(2)-H-$(3)-rpass-full-exec \
-    check-stage$(1)-T-$(2)-H-$(3)-rfail-full-exec \
+       check-stage$(1)-T-$(2)-H-$(3)-rpass-valgrind-exec \
+       check-stage$(1)-T-$(2)-H-$(3)-rpass-full-exec \
+       check-stage$(1)-T-$(2)-H-$(3)-rfail-full-exec \
        check-stage$(1)-T-$(2)-H-$(3)-cfail-full-exec \
        check-stage$(1)-T-$(2)-H-$(3)-rmake-exec \
        check-stage$(1)-T-$(2)-H-$(3)-rustdocck-exec \
-        check-stage$(1)-T-$(2)-H-$(3)-crates-exec \
-        check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec \
+       check-stage$(1)-T-$(2)-H-$(3)-crates-exec \
+       check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec \
        check-stage$(1)-T-$(2)-H-$(3)-debuginfo-gdb-exec \
        check-stage$(1)-T-$(2)-H-$(3)-debuginfo-lldb-exec \
        check-stage$(1)-T-$(2)-H-$(3)-codegen-exec \
@@ -367,7 +362,7 @@ define TEST_RUNNER
 # If NO_REBUILD is set then break the dependencies on everything but
 # the source files so we can test crates without rebuilding any of the
 # parent crates.
-ifndef NO_REBUILD
+ifeq ($(NO_REBUILD),)
 TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(SREQ$(1)_T_$(2)_H_$(3)) \
                            $$(foreach crate,$$(TARGET_CRATES), \
                                $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)) \
@@ -452,7 +447,7 @@ $(foreach host,$(CFG_HOST), \
     $(if $(findstring $(target),$(CFG_BUILD)), \
      $(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))), \
      $(if $(findstring android, $(target)), \
-      $(if $(findstring $(CFG_ADB_DEVICE_STATUS),true), \
+      $(if $(findstring $(CFG_ADB_DEVICE_STATUS),"true"), \
        $(eval $(call DEF_TEST_CRATE_RULES_android,$(stage),$(target),$(host),$(crate))), \
        $(eval $(call DEF_TEST_CRATE_RULES_null,$(stage),$(target),$(host),$(crate))) \
       ), \
@@ -678,8 +673,8 @@ CTEST_DEPS_debuginfo-lldb_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_LLDB_TESTS) \
 CTEST_DEPS_codegen_$(1)-T-$(2)-H-$(3) = $$(CODEGEN_TESTS)
 CTEST_DEPS_codegen-units_$(1)-T-$(2)-H-$(3) = $$(CODEGEN_UNITS_TESTS)
 CTEST_DEPS_rustdocck_$(1)-T-$(2)-H-$(3) = $$(RUSTDOCCK_TESTS) \
-        $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
-       $(S)src/etc/htmldocck.py
+               $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
+               $(S)src/etc/htmldocck.py
 
 endef
 
@@ -705,14 +700,14 @@ check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4
 # (Encoded as a separate variable because GNU make does not have a
 # good way to express OR on ifeq commands)
 
-ifdef CTEST_DISABLE_$(4)
+ifneq ($$(CTEST_DISABLE_$(4)),)
 # Test suite is disabled for all configured targets.
 CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4) := $$(CTEST_DISABLE_$(4))
 else
 # else, check if non-self-hosted target (i.e. target not-in hosts) ...
 ifeq ($$(findstring $(2),$$(CFG_HOST)),)
 # ... if so, then check if this test suite is disabled for non-selfhosts.
-ifdef CTEST_DISABLE_NONSELFHOST_$(4)
+ifneq ($$(CTEST_DISABLE_NONSELFHOST_$(4)),)
 # Test suite is disabled for this target.
 CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4) := $$(CTEST_DISABLE_NONSELFHOST_$(4))
 endif
@@ -720,7 +715,7 @@ endif
 # Neither DISABLE nor DISABLE_NONSELFHOST is set ==> okay, run the test.
 endif
 
-ifndef CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4)
+ifeq ($$(CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4)),)
 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
                $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
                 $$(CTEST_DEPS_$(4)_$(1)-T-$(2)-H-$(3))
@@ -829,7 +824,7 @@ check-stage$(1)-T-$(2)-H-$(3)-doc-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3)
 # If NO_REBUILD is set then break the dependencies on everything but
 # the source files so we can test documentation without rebuilding
 # rustdoc etc.
-ifndef NO_REBUILD
+ifeq ($(NO_REBUILD),)
 DOCTESTDEP_$(1)_$(2)_$(3)_$(4) = \
        $$(DOCFILE_$(4)) \
        $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
@@ -864,7 +859,7 @@ define DEF_CRATE_DOC_TEST
 # If NO_REBUILD is set then break the dependencies on everything but
 # the source files so we can test crate documentation without
 # rebuilding any of the parent crates.
-ifndef NO_REBUILD
+ifeq ($(NO_REBUILD),)
 CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4) = \
        $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
        $$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4)) \
@@ -897,6 +892,28 @@ $(foreach host,$(CFG_HOST), \
    $(foreach crate,$(TEST_DOC_CRATES), \
     $(eval $(call DEF_CRATE_DOC_TEST,$(stage),$(target),$(host),$(crate)))))))
 
+define DEF_DOC_TEST_ERROR_INDEX
+
+check-stage$(1)-T-$(2)-H-$(3)-doc-error-index-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-error-index)
+
+ifeq ($(2),$$(CFG_BUILD))
+$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-error-index): \
+               $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
+               doc/error-index.md
+       $$(Q)touch $$@.start_time
+       $$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --test doc/error-index.md
+       $$(Q)touch -r $$@.start_time $$@ && rm $$@.start_time
+else
+$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-error-index):
+       $$(Q)touch $$@
+endif
+endef
+
+$(foreach host,$(CFG_HOST), \
+ $(foreach target,$(CFG_TARGET), \
+  $(foreach stage,$(STAGES), \
+   $(eval $(call DEF_DOC_TEST_ERROR_INDEX,$(stage),$(target),$(host))))))
+
 ######################################################################
 # Shortcut rules
 ######################################################################
@@ -906,7 +923,7 @@ TEST_GROUPS = \
        $(foreach crate,$(TEST_CRATES),$(crate)) \
        $(foreach crate,$(TEST_DOC_CRATES),doc-crate-$(crate)) \
        rpass \
-    rpass-valgrind \
+       rpass-valgrind \
        rpass-full \
        rfail-full \
        cfail-full \
@@ -923,11 +940,12 @@ TEST_GROUPS = \
        $(foreach docname,$(DOC_NAMES),doc-$(docname)) \
        pretty \
        pretty-rpass \
-    pretty-rpass-valgrind \
+       pretty-rpass-valgrind \
        pretty-rpass-full \
        pretty-rfail-full \
        pretty-rfail \
-       pretty-pretty
+       pretty-pretty \
+       $(NULL)
 
 define DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST
 check-stage$(1)-T-$(2)-H-$(3): check-stage$(1)-T-$(2)-H-$(3)-exec
@@ -991,7 +1009,8 @@ define DEF_CHECK_DOC_FOR_STAGE
 check-stage$(1)-docs: $$(foreach docname,$$(DOC_NAMES), \
                        check-stage$(1)-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-doc-$$(docname)) \
                      $$(foreach crate,$$(TEST_DOC_CRATES), \
-                       check-stage$(1)-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-doc-crate-$$(crate))
+                       check-stage$(1)-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-doc-crate-$$(crate)) \
+                     check-stage$(1)-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-doc-error-index-exec
 endef
 
 $(foreach stage,$(STAGES), \
@@ -1052,7 +1071,9 @@ $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
            $$(S) \
            $(3) \
            "$$(LLVM_LIBDIR_RUSTFLAGS_$(3))" \
-           "$$(LLVM_ALL_COMPONENTS_$(3))"
+           "$$(LLVM_ALL_COMPONENTS_$(3))" \
+           "$$(LLVM_CXXFLAGS_$(3))" \
+           '$$(CXX_$(3))'
        @touch -r $$@.start_time $$@ && rm $$@.start_time
 else
 # FIXME #11094 - The above rule doesn't work right for multiple targets