https://gcc.gnu.org/g:fc7081e1dceac1fb0bc65b2b3c9ce1e1eb81515e
commit r16-7205-gfc7081e1dceac1fb0bc65b2b3c9ce1e1eb81515e Author: Pietro Monteiro <[email protected]> Date: Fri Jan 30 22:27:14 2026 -0500 compare_tests: Don't hardcode grep -E The non-unique test names report is broken on systems where 'grep -E' is not supported. Use egrep if a simple test for 'grep -E' fails. contrib/ChangeLog: * compare_tests: Use egrep if 'grep -E' is not supported. Signed-off-by: Pietro Monteiro <[email protected]> Diff: --- contrib/compare_tests | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/contrib/compare_tests b/contrib/compare_tests index 8efd15e903f1..d507eead9086 100755 --- a/contrib/compare_tests +++ b/contrib/compare_tests @@ -136,8 +136,14 @@ sort -t ':' $skip1 "$before" > "$before_s" # 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" +EGREP="grep -E" + +if ! echo PASS | $EGREP '^(PASS|FAIL)' >/dev/null 2>&1; then + EGREP="egrep" +fi + +$EGREP '^(PASS|XPASS|FAIL|XFAIL|UNRESOLVED|UNSUPPORTED|UNTESTED|ERROR):' "$now_s" | uniq -cd > "$now_u" +$EGREP '^(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="" @@ -151,7 +157,7 @@ fi if [ -s "$before_u" -a "x$same_uniq" != "x" ]; then echo "Changes to non-unique test names:" - diff -u "$before_u" "$now_u" | grep -E '^[-\\+] ' + diff -u "$before_u" "$now_u" | $EGREP '^[-\\+] ' echo exit_status=1 fi
