From: Pietro Monteiro Date: Sat, 31 Jan 2026 03:27:14 +0000 (-0500) Subject: compare_tests: Don't hardcode grep -E X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc7081e1dceac1fb0bc65b2b3c9ce1e1eb81515e;p=thirdparty%2Fgcc.git 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 --- diff --git a/contrib/compare_tests b/contrib/compare_tests index 8efd15e903f..d507eead908 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