https://gcc.gnu.org/g:21d4a0b08a6883763ccdf9ce1d1ff1dedd6240a2

commit r16-3745-g21d4a0b08a6883763ccdf9ce1d1ff1dedd6240a2
Author: Christophe Lyon <christophe.l...@linaro.org>
Date:   Wed Sep 10 09:41:28 2025 +0000

    compare_tests: Improve non-unique tests report
    
    If the results include several configurations (schedule of
    variations), do not report summary lines as duplicates.  Indeed with
    several configurations, it's likely that the results contain the same
    
       # of expected passes            XXXXX
    
    The patch just keeps lines starting with test state prefix to avoid
    this problem.
    
    contrib/ChangeLog:
    
            * compare_tests: Improve non-unique tests report when testing
            several configurations.

Diff:
---
 contrib/compare_tests | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/contrib/compare_tests b/contrib/compare_tests
index 152957bc3247..8efd15e903f1 100755
--- a/contrib/compare_tests
+++ b/contrib/compare_tests
@@ -126,10 +126,18 @@ fi
 sort -t ':' $skip1 "$now" > "$now_s"
 sort -t ':' $skip1 "$before" > "$before_s"
 
-# Report non-unique test names, but print the two lists only if they
-# are different.
-sed '/^$/d' "$now_s"    | uniq -cd > "$now_u"
-sed '/^$/d' "$before_s" | uniq -cd > "$before_u"
+# Report non-unique test names and print the diff between the two
+# lists if they are different.
+#
+# If the results include several configurations (schedule of
+# variations), we report duplicates several times with different
+# target/tool prefixes because at this stage we do not know if the
+# target and/or tool prefix was inserted.
+# If we used the input files (so generally several times the same
+# results in one section per target), we would incorreclty detect
+# duplicates (as many as targets)
+grep -E '^(PASS|XPASS|FAIL|XFAIL|UNRESOLVED|UNSUPPORTED|UNTESTED|ERROR):' 
"$now_s"    | uniq -cd > "$now_u"
+grep -E '^(PASS|XPASS|FAIL|XFAIL|UNRESOLVED|UNSUPPORTED|UNTESTED|ERROR):' 
"$before_s" | uniq -cd > "$before_u"
 
 same_uniq=" now"
 cmp -s "$before_u" "$now_u" && same_uniq=""
@@ -142,8 +150,8 @@ if [ -s "$now_u" ]; then
 fi
 
 if [ -s "$before_u" -a "x$same_uniq" != "x" ]; then
-    echo "Non-unique test names before: (Eeek!)"
-    cat "$before_u"
+    echo "Changes to non-unique test names:"
+    diff -u "$before_u" "$now_u" | grep -E '^[-\\+] '
     echo
     exit_status=1
 fi

Reply via email to