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.
---
contrib/compare_tests | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/contrib/compare_tests b/contrib/compare_tests
index e09fc4f113a..152957bc324 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
--
2.34.1