Skip to content

Commit 4edf7b8

Browse files
committed
Fix android problems with newly fixed rpass-full variable definition.
First, documented the existing `CTEST_DISABLE_$(TEST_GROUP)` pattern for conditionally disabling tests based on missing host features. Added variant of above, `CTEST_DISABLE_NONSELFHOST_$(TEST_GROUP)`, which is only queried in contexts where the target is not on the CFG_HOST list (which I interpret as the list of targets that our host can compatibly emulate; e.g. the example that i686 and x86_64 can in theory run each others' tests). Driveby fix: Remove redundant copy of check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec dependency declaration.
1 parent 3cbd98e commit 4edf7b8

File tree

1 file changed

+35
-7
lines changed

1 file changed

+35
-7
lines changed

mk/tests.mk

+35-7
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,6 @@ $(foreach host,$(CFG_HOST), \
370370
define DEF_TEST_CRATE_RULES
371371
check-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
503501
CTEST_MODE_codegen = codegen
504502
CTEST_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+
506508
ifeq ($(CFG_GDB),)
507509
CTEST_DISABLE_debuginfo = "no gdb found"
508510
endif
@@ -515,6 +517,14 @@ ifeq ($(CFG_OSTYPE),apple-darwin)
515517
CTEST_DISABLE_debuginfo = "gdb on darwing needs root"
516518
endif
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+
518528
define DEF_CTEST_VARS
519529

520530
# All the per-stage build rules you might want to call from the
@@ -587,8 +597,28 @@ CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4) := \
587597

588598
check-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

601631
else
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

610638
endif

0 commit comments

Comments
 (0)