Implement run-built-tests=no for make xcheck, always build xtests

Previously, the second occurrence of the xtests target
expected all xtests to run (as the result of specifying
$(xtests)), but these tests have not been run due to
the the first xtests target is set up for run-built-tests=no:
it only runs tests in $(xtests-special).  Consequently,
xtests are reported as UNSUPPORTED with “make xcheck
run-built-tests=no”.  The xtests were not built, either.

After this change always, xtests are built regardless
of the $(run-built-tests) variable (except for xtests listed
in $(tests-unsupported)).  To fix the UNSUPPORTED issue,
introduce xtests-expected and use that manage test
expectations in the second xtests target.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
Florian Weimer 2024-09-19 15:40:05 +02:00
parent 83fd4149ff
commit d5a3ca4061

17
Rules
View File

@ -143,8 +143,9 @@ endif
others: $(py-const) others: $(py-const)
ifeq ($(run-built-tests),no) ifeq ($(run-built-tests),no)
# The $(xtests) dependency ensures that xtests are always built.
tests: $(addprefix $(objpfx),$(filter-out $(tests-unsupported), \ tests: $(addprefix $(objpfx),$(filter-out $(tests-unsupported), \
$(tests) $(tests-internal) \ $(tests) $(tests-internal) $(xtests) \
$(tests-container) \ $(tests-container) \
$(tests-mcheck:%=%-mcheck) \ $(tests-mcheck:%=%-mcheck) \
$(tests-malloc-check:%=%-malloc-check) \ $(tests-malloc-check:%=%-malloc-check) \
@ -153,8 +154,10 @@ tests: $(addprefix $(objpfx),$(filter-out $(tests-unsupported), \
$(test-srcs)) $(tests-special) \ $(test-srcs)) $(tests-special) \
$(tests-printers-programs) $(tests-printers-programs)
xtests: tests $(xtests-special) xtests: tests $(xtests-special)
else else # $(run-built-tests) != no
# The $(xtests) dependency ensures that xtests are always built.
tests: $(tests:%=$(objpfx)%.out) $(tests-internal:%=$(objpfx)%.out) \ tests: $(tests:%=$(objpfx)%.out) $(tests-internal:%=$(objpfx)%.out) \
$(addprefix $(objpfx),$(filter-out $(tests-unsupported), $(xtests))) \
$(tests-container:%=$(objpfx)%.out) \ $(tests-container:%=$(objpfx)%.out) \
$(tests-mcheck:%=$(objpfx)%-mcheck.out) \ $(tests-mcheck:%=$(objpfx)%-mcheck.out) \
$(tests-malloc-check:%=$(objpfx)%-malloc-check.out) \ $(tests-malloc-check:%=$(objpfx)%-malloc-check.out) \
@ -162,26 +165,28 @@ tests: $(tests:%=$(objpfx)%.out) $(tests-internal:%=$(objpfx)%.out) \
$(tests-malloc-hugetlb2:%=$(objpfx)%-malloc-hugetlb2.out) \ $(tests-malloc-hugetlb2:%=$(objpfx)%-malloc-hugetlb2.out) \
$(tests-special) $(tests-printers-out) $(tests-special) $(tests-printers-out)
xtests: tests $(xtests:%=$(objpfx)%.out) $(xtests-special) xtests: tests $(xtests:%=$(objpfx)%.out) $(xtests-special)
endif endif # $(run-built-tests) != no
tests-special-notdir = $(patsubst $(objpfx)%, %, $(tests-special)) tests-special-notdir = $(patsubst $(objpfx)%, %, $(tests-special))
xtests-special-notdir = $(patsubst $(objpfx)%, %, $(xtests-special)) xtests-special-notdir = $(patsubst $(objpfx)%, %, $(xtests-special))
ifeq ($(run-built-tests),no) ifeq ($(run-built-tests),no)
tests-expected = tests-expected =
else xtests-expected =
else # $(run-built-tests) != no
tests-expected = $(tests) $(tests-internal) $(tests-printers) \ tests-expected = $(tests) $(tests-internal) $(tests-printers) \
$(tests-container) $(tests-malloc-check:%=%-malloc-check) \ $(tests-container) $(tests-malloc-check:%=%-malloc-check) \
$(tests-malloc-hugetlb1:%=%-malloc-hugetlb1) \ $(tests-malloc-hugetlb1:%=%-malloc-hugetlb1) \
$(tests-malloc-hugetlb2:%=%-malloc-hugetlb2) \ $(tests-malloc-hugetlb2:%=%-malloc-hugetlb2) \
$(tests-mcheck:%=%-mcheck) $(tests-mcheck:%=%-mcheck)
endif xtests-expected = $(xtests)
endif # $(run-built-tests) != no
tests: tests:
$(..)scripts/merge-test-results.sh -s $(objpfx) $(subdir) \ $(..)scripts/merge-test-results.sh -s $(objpfx) $(subdir) \
$(sort $(tests-expected) $(tests-special-notdir:.out=)) \ $(sort $(tests-expected) $(tests-special-notdir:.out=)) \
> $(objpfx)subdir-tests.sum > $(objpfx)subdir-tests.sum
xtests: xtests:
$(..)scripts/merge-test-results.sh -s $(objpfx) $(subdir) \ $(..)scripts/merge-test-results.sh -s $(objpfx) $(subdir) \
$(sort $(xtests) $(xtests-special-notdir:.out=)) \ $(sort $(xtests-expected) $(xtests-special-notdir:.out=)) \
> $(objpfx)subdir-xtests.sum > $(objpfx)subdir-xtests.sum
ifeq ($(build-programs),yes) ifeq ($(build-programs),yes)