aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@linaro.org>2025-09-01 09:32:34 +0000
committerChristophe Lyon <christophe.lyon@linaro.org>2025-09-08 07:45:01 +0000
commit750346a763df2573ea4c8a8dde8cddced64f69a5 (patch)
treeccd030fef0a181431a8278479119b9b827689896 /contrib
parent71711f8ac3af615fec197e4eb71d0bee8ef44a23 (diff)
downloadgcc-master.zip
gcc-master.tar.gz
gcc-master.tar.bz2
compare_tests: Report non-unique test namesHEADtrunkmaster
Test "names" (the string after 'PASS:' or 'FAIL:' etc... is expected to be unique, otherwise this will confuse comparison scripts. This patch displays the lists of non-unique test names in the 'before' and in the 'now' results. contrib/ChangeLog: * compare_tests: Report non-unique test names.
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/compare_tests26
1 files changed, 25 insertions, 1 deletions
diff --git a/contrib/compare_tests b/contrib/compare_tests
index e09fc4f..152957b 100755
--- a/contrib/compare_tests
+++ b/contrib/compare_tests
@@ -41,6 +41,8 @@ tmp1=$TMPDIR/$tool-testing.$$a
tmp2=$TMPDIR/$tool-testing.$$b
now_s=$TMPDIR/$tool-testing.$$d
before_s=$TMPDIR/$tool-testing.$$e
+now_u=$TMPDIR/$tool-uniq.$$d
+before_u=$TMPDIR/$tool-uniq.$$e
lst1=$TMPDIR/$tool-lst1.$$
lst2=$TMPDIR/$tool-lst2.$$
lst3=$TMPDIR/$tool-lst3.$$
@@ -48,7 +50,7 @@ lst4=$TMPDIR/$tool-lst4.$$
lst5=$TMPDIR/$tool-lst5.$$
sum1=$TMPDIR/$tool-sum1.$$
sum2=$TMPDIR/$tool-sum2.$$
-tmps="$tmp1 $tmp2 $now_s $before_s $lst1 $lst2 $lst3 $lst4 $lst5 $sum1 $sum2"
+tmps="$tmp1 $tmp2 $now_s $before_s $now_u $before_u $lst1 $lst2 $lst3 $lst4 $lst5 $sum1 $sum2"
[ "$1" = "-strict" ] && strict=$1 && shift
[ "$1" = "-?" ] && usage
@@ -124,6 +126,28 @@ 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"
+
+same_uniq=" now"
+cmp -s "$before_u" "$now_u" && same_uniq=""
+
+if [ -s "$now_u" ]; then
+ echo "Non-unique test names$same_uniq: (Eeek!)"
+ cat "$now_u"
+ echo
+ exit_status=1
+fi
+
+if [ -s "$before_u" -a "x$same_uniq" != "x" ]; then
+ echo "Non-unique test names before: (Eeek!)"
+ cat "$before_u"
+ echo
+ exit_status=1
+fi
+
grep '^FAIL:' "$now_s" | sed 's/^[^:]*:[ ]//' >$tmp1
grep '^PASS' "$before_s" | sed 's/^[^:]*:[ ]//' | comm -12 $tmp1 - >$tmp2