@@ -370,8 +370,6 @@ $(foreach host,$(CFG_HOST), \
370370define DEF_TEST_CRATE_RULES
371371check-stage$(1 ) -T-$(2 ) -H-$(3 ) -$(4 ) -exec: $$(call TEST_OK_FILE,$(1 ) ,$(2 ) ,$(3 ) ,$(4 ) )
372372
373- check-stage$(1 ) -T-$(2 ) -H-$(3 ) -$(4 ) -exec: $$(call TEST_OK_FILE,$(1 ) ,$(2 ) ,$(3 ) ,$(4 ) )
374-
375373$$(call TEST_OK_FILE,$(1 ) ,$(2 ) ,$(3 ) ,$(4 ) ) : \
376374 $(3 ) /stage$(1 ) /test/$(4 ) test-$(2 )$$(X_$(2 ) )
377375 @$$(call E, run: $$< )
@@ -503,6 +501,10 @@ CTEST_BUILD_BASE_codegen = codegen
503501CTEST_MODE_codegen = codegen
504502CTEST_RUNTOOL_codegen = $(CTEST_RUNTOOL )
505503
504+ # CTEST_DISABLE_$(TEST_GROUP), if set, will cause the test group to be
505+ # disabled and the associated message to be printed as a warning
506+ # during attempts to run those tests.
507+
506508ifeq ($(CFG_GDB ) ,)
507509CTEST_DISABLE_debuginfo = "no gdb found"
508510endif
@@ -515,6 +517,14 @@ ifeq ($(CFG_OSTYPE),apple-darwin)
515517CTEST_DISABLE_debuginfo = "gdb on darwing needs root"
516518endif
517519
520+ # CTEST_DISABLE_NONSELFHOST_$(TEST_GROUP), if set, will cause that
521+ # test group to be disabled *unless* the target is able to build a
522+ # compiler (i.e. when the target triple is in the set of of host
523+ # triples). The associated message will be printed as a warning
524+ # during attempts to run those tests.
525+
526+ CTEST_DISABLE_NONSELFHOST_rpass-full = "run-pass-full suite is unavailable when cross-compiling."
527+
518528define DEF_CTEST_VARS
519529
520530# All the per-stage build rules you might want to call from the
@@ -560,7 +570,7 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
560570 $$(CTEST_TESTARGS )
561571
562572CTEST_DEPS_rpass_$(1 ) -T-$(2 ) -H-$(3 ) = $$(RPASS_TESTS )
563- CTEST_DEPS_rpass_full_ $(1 ) -T-$(2 ) -H-$(3 ) = $$(RPASS_FULL_TESTS ) $$(TLIBRUSTC_DEFAULT $(1 ) _T_$(2 ) _H_$(3 ) )
573+ CTEST_DEPS_rpass-full_ $(1 ) -T-$(2 ) -H-$(3 ) = $$(RPASS_FULL_TESTS ) $$(CSREQ $(1 ) _T_$(2 ) _H_$(3 ) )
564574CTEST_DEPS_rfail_$(1 ) -T-$(2 ) -H-$(3 ) = $$(RFAIL_TESTS )
565575CTEST_DEPS_cfail_$(1 ) -T-$(2 ) -H-$(3 ) = $$(CFAIL_TESTS )
566576CTEST_DEPS_bench_$(1 ) -T-$(2 ) -H-$(3 ) = $$(BENCH_TESTS )
@@ -587,8 +597,28 @@ CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4) := \
587597
588598check-stage$(1 ) -T-$(2 ) -H-$(3 ) -$(4 ) -exec: $$(call TEST_OK_FILE,$(1 ) ,$(2 ) ,$(3 ) ,$(4 ) )
589599
590- ifeq ($$(CTEST_DISABLE_$(4 ) ) ,)
600+ # CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4)
601+ # Goal: leave this variable as empty string if we should run the test.
602+ # Otherwise, set it to the reason we are not running the test.
603+ # (Encoded as a separate variable because GNU make does not have a
604+ # good way to express OR on ifeq commands)
591605
606+ ifneq ($$(CTEST_DISABLE_$(4 ) ) ,)
607+ # Test suite is disabled for all configured targets.
608+ CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4) := $$(CTEST_DISABLE_$(4 ) )
609+ else
610+ # else, check if non-self-hosted target (i.e. target not-in hosts) ...
611+ ifeq ($$(findstring $(2 ) ,$$(CFG_HOST ) ) ,)
612+ # ... if so, then check if this test suite is disabled for non-selfhosts.
613+ ifneq ($$(CTEST_DISABLE_NONSELFHOST_$(4 ) ) ,)
614+ # Test suite is disabled for this target.
615+ CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4) := $$(CTEST_DISABLE_NONSELFHOST_$(4 ) )
616+ endif
617+ endif
618+ # Neither DISABLE nor DISABLE_NONSELFHOST is set ==> okay, run the test.
619+ endif
620+
621+ ifeq ($$(CTEST_DONT_RUN_$(1 ) -T-$(2 ) -H-$(3 ) -$(4 ) ) ,)
592622$$(call TEST_OK_FILE,$(1 ) ,$(2 ) ,$(3 ) ,$(4 ) ) : \
593623 $$(TEST_SREQ$(1 ) _T_$(2 ) _H_$(3 ) ) \
594624 $$(CTEST_DEPS_$(4)_$(1)-T-$(2)-H-$(3))
@@ -600,11 +630,9 @@ $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
600630
601631else
602632
603- $$(call TEST_OK_FILE,$(1 ) ,$(2 ) ,$(3 ) ,$(4 ) ) : \
604- $$(TEST_SREQ$(1 ) _T_$(2 ) _H_$(3 ) ) \
605- $$(CTEST_DEPS_$(4)_$(1)-T-$(2)-H-$(3))
633+ $$(call TEST_OK_FILE,$(1 ) ,$(2 ) ,$(3 ) ,$(4 ) ) :
606634 @$$(call E, run $(4 ) [$(2 ) ]: $$< )
607- @$$(call E, warning: tests disabled: $$(CTEST_DISABLE_ $(4)))
635+ @$$(call E, warning: tests disabled: $$(CTEST_DONT_RUN_ $( 1 ) -T- $( 2 ) -H- $( 3 ) - $(4 ) ) )
608636 touch $$@
609637
610638endif
0 commit comments