]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
test: Use grep -E/-F instead of obsolescent egrep/fgrep
authorJoel Rosdahl <joel@rosdahl.net>
Tue, 17 Jan 2023 19:59:21 +0000 (20:59 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Tue, 17 Jan 2023 19:59:21 +0000 (20:59 +0100)
test/run
test/suites/base.bash
test/suites/color_diagnostics.bash
test/suites/direct.bash
test/suites/remote_redis.bash
test/suites/remote_redis_unix.bash

index 5dc123ff4028c41101f03a13d000a7f09b334b97..43a573125952f18ce076d559687369cdf163a37d 100755 (executable)
--- a/test/run
+++ b/test/run
@@ -3,7 +3,7 @@
 # A simple test suite for ccache.
 #
 # Copyright (C) 2002-2007 Andrew Tridgell
-# Copyright (C) 2009-2022 Joel Rosdahl and other contributors
+# Copyright (C) 2009-2023 Joel Rosdahl and other contributors
 #
 # See doc/AUTHORS.adoc for a complete list of contributors.
 #
@@ -161,11 +161,11 @@ objdump_cmd() {
 
 objdump_grep_cmd() {
     if $HOST_OS_APPLE; then
-        fgrep -q "\"$1\""
+        grep -Fq "\"$1\""
     elif $HOST_OS_WINDOWS || $HOST_OS_CYGWIN; then
-        fgrep -q "$1"
+        grep -Fq "$1"
     else
-        fgrep -q ": $1"
+        grep -Fq ": $1"
     fi
 }
 
@@ -324,7 +324,7 @@ expect_contains() {
     if [ ! -e "$file" ]; then
         test_failed_internal "$file not found"
     fi
-    if ! fgrep -q -- "$string" "$file"; then
+    if ! grep -Fq -- "$string" "$file"; then
         test_failed_internal "File $file does not contain \"$string\"\nActual content: $(cat $file)"
     fi
 }
@@ -336,7 +336,7 @@ expect_not_contains() {
     if [ ! -e "$file" ]; then
         test_failed_internal "$file not found"
     fi
-    if fgrep -q -- "$string" "$file"; then
+    if grep -Fq -- "$string" "$file"; then
         test_failed_internal "File $file contains \"$string\"\nActual content: $(cat $file)"
     fi
 }
index 2d14c958826daf06e78cf1cb3de9aacccb1bbb90..2bb8d349ab7f4f96a8d200a818d2e9bae713bca6 100644 (file)
@@ -545,7 +545,7 @@ fi
     TEST "Directory is not hashed if using -gz"
 
     $COMPILER -E test1.c -gz >preprocessed.i 2>/dev/null
-    if [ -s preprocessed.i ] && ! fgrep -q $PWD preprocessed.i; then
+    if [ -s preprocessed.i ] && ! grep -Fq $PWD preprocessed.i; then
         mkdir dir1 dir2
         cp test1.c dir1
         cp test1.c dir2
@@ -572,7 +572,7 @@ fi
     if [ $? -eq 0 ]; then
         # run test only if -gz=zlib is supported
         $COMPILER -E test1.c -gz=zlib >preprocessed.i 2>/dev/null
-        if [ "$exit_code" == "0" ] && [ -s preprocessed.i ] && ! fgrep -q $PWD preprocessed.i; then
+        if [ "$exit_code" == "0" ] && [ -s preprocessed.i ] && ! grep -Fq $PWD preprocessed.i; then
             mkdir dir1 dir2
             cp test1.c dir1
             cp test1.c dir2
index 8295eb1c47138dcc65969945ec569b5eb90962de..53a9c2bb58c34f18b14d6daad3e119e25a1e77bd 100644 (file)
@@ -40,8 +40,8 @@ SUITE_color_diagnostics_SETUP() {
 
 color_diagnostics_expect_color() {
     expect_contains "${1:?}" $'\033['
-    expect_contains <(fgrep 'Wreturn-type' "$1") $'\033['
-    expect_contains <(fgrep 'from preprocessor' "$1") $'\033['
+    expect_contains <(grep -F 'Wreturn-type' "$1") $'\033['
+    expect_contains <(grep -F 'from preprocessor' "$1") $'\033['
 }
 
 color_diagnostics_expect_no_color() {
index 8a227d0b6b5c104418a5d236987ffd9e0f4126ef..e297d688af10fa9f3f734df8e50356c381a32f3d 100644 (file)
@@ -1204,7 +1204,7 @@ EOF
 
     manifest=`find $CCACHE_DIR -name '*M'`
     if [ -n "$manifest" ]; then
-        data="`$CCACHE --inspect $manifest | egrep '/dev/(stdout|tty|sda|hda'`"
+        data="`$CCACHE --inspect $manifest | grep -E '/dev/(stdout|tty|sda|hda'`"
         if [ -n "$data" ]; then
             test_failed "$manifest contained troublesome file(s): $data"
         fi
index 84351a0571873f669bf45b47d38f91d3aa033663..dfe93d3acf764e99f0d32f129e26010786f1928a 100644 (file)
@@ -1,5 +1,5 @@
 SUITE_remote_redis_PROBE() {
-    if ! $CCACHE --version | fgrep -q -- redis-storage &> /dev/null; then
+    if ! $CCACHE --version | grep -Fq -- redis-storage &> /dev/null; then
         echo "redis-storage not available"
         return
     fi
index 601e17c5c2d1f2c4a30ed677dd7cbb0343144622..1d709b55998e305cfe28b0eda4ca89d4ddd3fec3 100644 (file)
@@ -1,5 +1,5 @@
 SUITE_remote_redis_unix_PROBE() {
-    if ! $CCACHE --version | fgrep -q -- redis-storage &> /dev/null; then
+    if ! $CCACHE --version | grep -Fq -- redis-storage &> /dev/null; then
         echo "redis-storage not available"
         return
     fi