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.

Signed-off-by: Pietro Monteiro <[email protected]>
---
 contrib/compare_tests | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

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

base-commit: b129ff0880c6d10e0379b46889d01255ee8d1f82
-- 
2.43.0

Reply via email to