From: Kyrylo Tkachov <[email protected]>

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.  Ok for trunk?

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]>
---
 gcc/Makefile.in | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index ce5894767fe..5c7cb98d22b 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)" 
\
-- 
2.50.1 (Apple Git-155)

Reply via email to