On Mon, 1 Sept 2025 at 12:57, Richard Earnshaw (lists) <[email protected]> wrote: > > On 01/09/2025 10:59, Christophe Lyon wrote: > > 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 | 20 +++++++++++++++++++- > > 1 file changed, 19 insertions(+), 1 deletion(-) > > > > diff --git a/contrib/compare_tests b/contrib/compare_tests > > index e09fc4f113a..4aaf8557716 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,22 @@ fi > > sort -t ':' $skip1 "$now" > "$now_s" > > sort -t ':' $skip1 "$before" > "$before_s" > > > > +sed '/^$/d' "$before_s" | uniq -cd > "$before_u" > > +if [ -f "$before_u" ]; then > > + echo "Non-unique test names before:" > > + cat "$before_u" > > + echo > > + exit_status=1 > > +fi > > Do we really need this list? If it's the same as the 'now' list, then it > adds nothing, and if it's not the same, then there would likely be > differences elsewhere in the summary, so I'm not sure what this gives us. > If both are the same, indeed I can print only one. If they are different, then it helps understand confusing reports later in the summary: "oh, there are duplicate test names, let me be extra careful when looking at the results below"
> > + > > +sed '/^$/d' "$now_s" | uniq -cd > "$now_u" > > +if [ -f "$now_u" ]; then > > + echo "Non-unique test names now:" > > Perhaps this is worthy of an '(Eeek)' suffix to draw attention to the issue. > Sure I can do that > > + cat "$now_u" > > + echo > > + exit_status=1 > > +fi > > + > > grep '^FAIL:' "$now_s" | sed 's/^[^:]*:[ ]//' >$tmp1 > > grep '^PASS' "$before_s" | sed 's/^[^:]*:[ ]//' | comm -12 $tmp1 - >$tmp2 > > > Thanks, Christophe > R.
