summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2023-01-17 20:59:21 +0100
committerJoel Rosdahl <joel@rosdahl.net>2023-01-17 20:59:21 +0100
commitdebf622f16227c5a5a8824f4b15bcde4b9159c97 (patch)
tree4a77e35cafa394203ba471b18068cf1a2bae426b
parentdefb83cc6641b7356c1426c0ba782ac735748917 (diff)
downloadccache-debf622f16227c5a5a8824f4b15bcde4b9159c97.tar.gz
test: Use grep -E/-F instead of obsolescent egrep/fgrep
-rwxr-xr-xtest/run12
-rw-r--r--test/suites/base.bash4
-rw-r--r--test/suites/color_diagnostics.bash4
-rw-r--r--test/suites/direct.bash2
-rw-r--r--test/suites/remote_redis.bash2
-rw-r--r--test/suites/remote_redis_unix.bash2
6 files changed, 13 insertions, 13 deletions
diff --git a/test/run b/test/run
index 5dc123ff..43a57312 100755
--- 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
}
diff --git a/test/suites/base.bash b/test/suites/base.bash
index 2d14c958..2bb8d349 100644
--- a/test/suites/base.bash
+++ b/test/suites/base.bash
@@ -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
diff --git a/test/suites/color_diagnostics.bash b/test/suites/color_diagnostics.bash
index 8295eb1c..53a9c2bb 100644
--- a/test/suites/color_diagnostics.bash
+++ b/test/suites/color_diagnostics.bash
@@ -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() {
diff --git a/test/suites/direct.bash b/test/suites/direct.bash
index 8a227d0b..e297d688 100644
--- a/test/suites/direct.bash
+++ b/test/suites/direct.bash
@@ -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
diff --git a/test/suites/remote_redis.bash b/test/suites/remote_redis.bash
index 84351a05..dfe93d3a 100644
--- a/test/suites/remote_redis.bash
+++ b/test/suites/remote_redis.bash
@@ -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
diff --git a/test/suites/remote_redis_unix.bash b/test/suites/remote_redis_unix.bash
index 601e17c5..1d709b55 100644
--- a/test/suites/remote_redis_unix.bash
+++ b/test/suites/remote_redis_unix.bash
@@ -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