]> git.lizzy.rs Git - rust.git/blobdiff - mk/tests.mk
librustc: Don't try to perform the magical
[rust.git] / mk / tests.mk
index 012ec0e862de5746ecb7e04ca6e4668f93b54c88..1989d6ef86797855d1f738fb2d2dfccb3f0dfb1f 100644 (file)
@@ -32,7 +32,7 @@ ifdef CHECK_IGNORED
   TESTARGS += --ignored
 endif
 
-TEST_BENCH = --bench
+TEST_BENCH =
 
 # Arguments to the cfail/rfail/rpass/bench tests
 ifdef CFG_VALGRIND
@@ -40,8 +40,8 @@ ifdef CFG_VALGRIND
   TEST_BENCH =
 endif
 
-ifdef NO_BENCH
-  TEST_BENCH =
+ifdef PLEASE_BENCH
+  TEST_BENCH = --bench
 endif
 
 # Arguments to the perf tests
@@ -91,7 +91,8 @@ endif
 define DEF_TARGET_COMMANDS
 
 ifdef CFG_UNIXY_$(1)
-  CFG_RUN_TEST_$(1)=$$(call CFG_RUN_$(1),,$$(CFG_VALGRIND) $$(1))
+  CFG_RUN_TEST_$(1)=$$(TARGET_RPATH_VAR$$(2)_T_$$(3)_H_$$(4)) \
+         $$(call CFG_RUN_$(1),,$$(CFG_VALGRIND) $$(1))
 endif
 
 ifdef CFG_WINDOWSY_$(1)
@@ -105,13 +106,13 @@ ifdef CFG_WINDOWSY_$(1)
                $$(if $$(findstring stage3,$$(1)), \
                     stage3/$$(CFG_LIBDIR_RELATIVE), \
                )))))/rustlib/$$(CFG_BUILD)/lib
-  CFG_RUN_TEST_$(1)=$$(call CFG_RUN_$(1),$$(call CFG_TESTLIB_$(1),$$(1),$$(3)),$$(1))
+  CFG_RUN_TEST_$(1)=$$(call CFG_RUN_$(1),$$(call CFG_TESTLIB_$(1),$$(1),$$(4)),$$(1))
 endif
 
 # Run the compiletest runner itself under valgrind
 ifdef CTEST_VALGRIND
 CFG_RUN_CTEST_$(1)=$$(RPATH_VAR$$(1)_T_$$(3)_H_$$(3)) \
-      $$(call CFG_RUN_TEST_$$(CFG_BUILD),$$(2),$$(3))
+      $$(call CFG_RUN_TEST_$$(CFG_BUILD),$$(3),$$(4))
 else
 CFG_RUN_CTEST_$(1)=$$(RPATH_VAR$$(1)_T_$$(3)_H_$$(3)) \
       $$(call CFG_RUN_$$(CFG_BUILD),$$(TLIB$$(1)_T_$$(3)_H_$$(3)),$$(2))
@@ -227,8 +228,8 @@ ALL_HS := $(wildcard $(S)src/rt/*.h \
                      $(S)src/rt/*/*.h \
                      $(S)src/rt/*/*/*.h \
                      $(S)src/rustllvm/*.h)
-ALL_HS := $(filter-out $(S)src/rt/vg/valgrind.h \
-                       $(S)src/rt/vg/memcheck.h \
+ALL_HS := $(filter-out $(S)src/rt/valgrind/valgrind.h \
+                       $(S)src/rt/valgrind/memcheck.h \
                        $(S)src/rt/msvc/typeof.h \
                        $(S)src/rt/msvc/stdint.h \
                        $(S)src/rt/msvc/inttypes.h \
@@ -240,6 +241,7 @@ ALL_HS := $(filter-out $(S)src/rt/vg/valgrind.h \
 tidy:
                @$(call E, check: formatting)
                $(Q)find $(S)src -name '*.r[sc]' \
+               | grep '^$(S)src/jemalloc' -v \
                | grep '^$(S)src/libuv' -v \
                | grep '^$(S)src/llvm' -v \
                | grep '^$(S)src/gyp' -v \
@@ -264,8 +266,9 @@ tidy:
                $(Q)find $(S)src -type f -perm +111 \
                    -not -name '*.rs' -and -not -name '*.py' \
                    -and -not -name '*.sh' \
-               | grep '^$(S)src/llvm' -v \
+               | grep '^$(S)src/jemalloc' -v \
                | grep '^$(S)src/libuv' -v \
+               | grep '^$(S)src/llvm' -v \
                | grep '^$(S)src/rt/hoedown' -v \
                | grep '^$(S)src/gyp' -v \
                | grep '^$(S)src/etc' -v \
@@ -370,10 +373,11 @@ $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): CFG_COMPILER_HOST_TRIPLE = $(2)
 $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)):                           \
                $$(CRATEFILE_$(4)) \
                $$(TESTDEP_$(1)_$(2)_$(3)_$(4))
-       @$$(call E, oxidize: $$@)
+       @$$(call E, rustc: $$@)
        $$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test   \
                -L "$$(RT_OUTPUT_DIR_$(2))"             \
-               -L "$$(LLVM_LIBDIR_$(2))"
+               -L "$$(LLVM_LIBDIR_$(2))"               \
+               $$(RUSTFLAGS_$(4))
 
 endef
 
@@ -389,7 +393,7 @@ check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4
 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
                $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
        @$$(call E, run: $$<)
-       $$(Q)$$(call CFG_RUN_TEST_$(2),$$<,$(2),$(3)) $$(TESTARGS) \
+       $$(Q)$$(call CFG_RUN_TEST_$(2),$$<,$(1),$(2),$(3)) $$(TESTARGS) \
            --logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
            $$(call CRATE_TEST_EXTRA_ARGS,$(1),$(2),$(3),$(4)) \
            && touch $$@
@@ -599,6 +603,7 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) :=                                              \
         --stage-id stage$(1)-$(2)                                                      \
         --target $(2)                                       \
         --host $(3)                                       \
+        --android-cross-path=$(CFG_ANDROID_CROSS_PATH)    \
         --adb-path=$(CFG_ADB)                          \
         --adb-test-dir=$(CFG_ADB_TEST_DIR)                  \
         --host-rustcflags "$(RUSTC_FLAGS_$(3)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(3))" \
@@ -790,13 +795,32 @@ else
 CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4))
 endif
 
+# (Issues #13732, #13983, #14000) The doc for the regex crate includes
+# uses of the `regex!` macro from the regex_macros crate.  There is
+# normally a dependence injected that makes the target's regex depend
+# upon the host's regex_macros (see #13845), but that dependency
+# injection is currently skipped for stage1 as a special case.
+#
+# Therefore, as a further special case, this conditional skips
+# attempting to run the doc tests for the regex crate atop stage1,
+# (since there is no regex_macros crate for the stage1 rustc to load).
+#
+# (Another approach for solving this would be to inject the desired
+# dependence for stage1 as well, by setting things up to generate a
+# regex_macros crate that was compatible with the stage1 rustc and
+# thus re-enable our ability to run this test.)
+ifeq (stage$(1)-crate-$(4),stage1-crate-regex)
+check-stage$(1)-T-$(2)-H-$(3)-doc-crate-$(4)-exec:
+       @$$(call E, skipping doc-crate-$(4) as it uses macros and cannot run at stage$(1))
+else
 check-stage$(1)-T-$(2)-H-$(3)-doc-crate-$(4)-exec: \
        $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4))
+endif
 
 ifeq ($(2),$$(CFG_BUILD))
 $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)): $$(CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4))
        @$$(call E, run doc-crate-$(4) [$(2)])
-       $$(Q)$$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --test \
+       $$(Q)$$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --test --cfg dox \
                $$(CRATEFILE_$(4)) --test-args "$$(TESTARGS)" && touch $$@
 else
 $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)):
@@ -948,7 +972,10 @@ $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
            "$$(CC_$(3)) $$(CFG_GCCISH_CFLAGS_$(3))" \
            $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
            "$$(TESTNAME)" \
-           "$$(RPATH_VAR$(1)_T_$(2)_H_$(3))"
+           $$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3)) \
+           "$$(LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3))" \
+           "$$(LD_LIBRARY_PATH_ENV_TARGETDIR$(1)_T_$(2)_H_$(3))" \
+           $(1)
        @touch $$@
 else
 # FIXME #11094 - The above rule doesn't work right for multiple targets