[gcc r17-3368] testsuite: do not leave a truncated summary behind
Kyrylo Tkachov via Gcc-cvs <[email protected]>
| Newsgroups | gmane.comp.gcc.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://gcc.gnu.org/g:655d60b569339be88665ef5c6dcb1c01d5cbda39 commit r17-3368-g655d60b569339be88665ef5c6dcb1c01d5cbda39 Author: Kyrylo Tkachov <[email protected]> Date: Thu Aug 13 17:38:39 2026 +0200 testsuite: do not leave a truncated summary behind The parallel check targets merge the per-instance summaries with dg-extract-results.sh $sums > $(TESTSUITEDIR)/$*/$*.sum which has two problems. The redirection truncates the summary before the merge runs, so if the merge fails the tree is left with an empty one. And the exit status is not looked at, so make check still succeeds. The merge fails exactly when a runtest instance did not write a summary, because the loop above names that file to the merge regardless. An instance that died therefore does not just lose its own results, it discards the results of every other instance too, and reports success while doing it. Merge only from the instances that produced a summary, say plainly which ones did not, and build the merged files under a temporary name so that a failure leaves the previous ones alone. A failed merge is now an error. The warning matters on its own: losing an instance silently loses a slice of the testsuite from the summary that comparisons are run against, and nothing in the output says so. Bootstrapped on aarch64-none-linux-gnu. gcc/ChangeLog: * Makefile.in ($(lang_checks_parallelized)): Only merge summaries from instances that produced one, and warn about the others. Write the merged files through a temporary and fail if the merge fails. Signed-off-by: Kyrylo Tkachov <[email protected]> Diff: --- gcc/Makefile.in | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/gcc/Makefile.in b/gcc/Makefile.in index ce5894767fea..5c7cb98d22b0 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -4794,19 +4794,28 @@ $(lang_checks_parallelized): check-% : site.exp EXPECT=$(EXPECT) \ check-parallel-$* \ $(patsubst %,check-parallel-$*_%, $(check_p_subdirs)); \ - sums= ; logs= ; \ + sums= ; logs= ; lost= ; \ for dir in $(TESTSUITEDIR)/$* \ $(patsubst %,$(TESTSUITEDIR)/$*%,$(check_p_subdirs));\ do \ if [ -d $$dir ]; then \ - mv -f $$dir/$*.sum $$dir/$*.sum.sep; mv -f $$dir/$*.log $$dir/$*.log.sep; \ - sums="$$sums $$dir/$*.sum.sep"; logs="$$logs $$dir/$*.log.sep"; \ + if [ -f $$dir/$*.sum ]; then \ + mv -f $$dir/$*.sum $$dir/$*.sum.sep; mv -f $$dir/$*.log $$dir/$*.log.sep; \ + sums="$$sums $$dir/$*.sum.sep"; logs="$$logs $$dir/$*.log.sep"; \ + else \ + lost="$$lost $$dir"; \ + fi; \ fi; \ done; \ + if [ -n "$$lost" ]; then \ + echo "warning: $*: these runtest instances produced no results:$$lost" >&2; \ + fi; \ $(SHELL) $(srcdir)/../contrib/dg-extract-results.sh $$sums \ - > $(TESTSUITEDIR)/$*/$*.sum; \ + > $(TESTSUITEDIR)/$*/$*.sum.tmp || exit 1; \ $(SHELL) $(srcdir)/../contrib/dg-extract-results.sh -L $$logs \ - > $(TESTSUITEDIR)/$*/$*.log; \ + > $(TESTSUITEDIR)/$*/$*.log.tmp || exit 1; \ + mv -f $(TESTSUITEDIR)/$*/$*.sum.tmp $(TESTSUITEDIR)/$*/$*.sum; \ + mv -f $(TESTSUITEDIR)/$*/$*.log.tmp $(TESTSUITEDIR)/$*/$*.log; \ rm -rf $(TESTSUITEDIR)/$*-parallel || true; \ else \ $(MAKE) TESTSUITEDIR="$(TESTSUITEDIR)" RUNTESTFLAGS="$(RUNTESTFLAGS)" \