tests: replace egrep with grep -E to avoid deprecation warning

https://lists.gnu.org/archive/html/info-gnu/2022-09/msg00001.html

Signed-off-by: Balint Tobik <btobik@redhat.com>
This commit is contained in:
Balint Tobik
2025-01-28 10:40:49 +01:00
parent 47140357c4
commit 1943a1c96d
5 changed files with 21 additions and 21 deletions

View File

@@ -286,7 +286,7 @@ show_procs()
local regex local regex
regex="(${pattern_list})" regex="(${pattern_list})"
ps -efww | egrep -i "$regex" || true ps -efww | grep -i -E "$regex" || true
} }
kill_tmux_sessions() kill_tmux_sessions()
@@ -961,7 +961,7 @@ get_addresses()
if [ $configured_hypervisor = "qemu" ]; then if [ $configured_hypervisor = "qemu" ]; then
addresses=$(ss -Hp --vsock |\ addresses=$(ss -Hp --vsock |\
egrep -v "\<socat\>" |\ grep -v -E "\<socat\>" |\
awk '$2 ~ /^ESTAB$/ {print $6}' |\ awk '$2 ~ /^ESTAB$/ {print $6}' |\
grep ":${EXPECTED_VSOCK_PORT}$") grep ":${EXPECTED_VSOCK_PORT}$")
elif [ $configured_hypervisor = "clh" ]; then elif [ $configured_hypervisor = "clh" ]; then
@@ -1166,7 +1166,7 @@ validate_agent()
# Regular expression that describes possible agent failures # Regular expression that describes possible agent failures
local regex="(slog::Fuse|Drain|Custom|serialization error|thread.*panicked|stack backtrace:)" local regex="(slog::Fuse|Drain|Custom|serialization error|thread.*panicked|stack backtrace:)"
egrep -q "$regex" "$log_file" && cat $log_file && die "Found agent error in log file: '$log_file'" grep -q -E "$regex" "$log_file" && cat $log_file && die "Found agent error in log file: '$log_file'"
local entry local entry
entry=$(get_shutdown_test_type_entry "$shutdown_test_type" || true) entry=$(get_shutdown_test_type_entry "$shutdown_test_type" || true)
@@ -1186,7 +1186,7 @@ validate_agent()
# The message the agent writes to stderr just before it exits. # The message the agent writes to stderr just before it exits.
local done_msg="\<shutdown complete\>" local done_msg="\<shutdown complete\>"
egrep -q "$done_msg" "$log_file" || (cat $log_file && die "missing agent shutdown message") grep -q -E "$done_msg" "$log_file" || (cat $log_file && die "missing agent shutdown message")
else else
# We can only check for the shutdown message if the agent debug # We can only check for the shutdown message if the agent debug
# logs are available. # logs are available.

View File

@@ -76,7 +76,7 @@ create_user_data() {
dnf_proxy="" dnf_proxy=""
service_proxy="" service_proxy=""
docker_user_proxy="{}" docker_user_proxy="{}"
environment=$(env | egrep "ghprb|WORKSPACE|KATA|GIT|JENKINS|_PROXY|_proxy" | \ environment=$(env | grep -E "ghprb|WORKSPACE|KATA|GIT|JENKINS|_PROXY|_proxy" | \
sed -e "s/'/'\"'\"'/g" \ sed -e "s/'/'\"'\"'/g" \
-e "s/\(^[[:alnum:]_]\+\)=/\1='/" \ -e "s/\(^[[:alnum:]_]\+\)=/\1='/" \
-e "s/$/'/" \ -e "s/$/'/" \

View File

@@ -638,7 +638,7 @@ errors=$(
signals=$( signals=$(
echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags | echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print $2 }' | awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print $2 }' |
egrep -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT|SIGMAX64)' | grep -v -E '(SIGSTKSIZE|SIGSTKSZ|SIGRT|SIGMAX64)' |
sort sort
) )
@@ -648,7 +648,7 @@ echo '#include <errno.h>' | $CC -x c - -E -dM $ccflags |
sort >_error.grep sort >_error.grep
echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags | echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print "^\t" $2 "[ \t]*=" }' | awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print "^\t" $2 "[ \t]*=" }' |
egrep -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT|SIGMAX64)' | grep -v -E '(SIGSTKSIZE|SIGSTKSZ|SIGRT|SIGMAX64)' |
sort >_signal.grep sort >_signal.grep
echo '// mkerrors.sh' "$@" echo '// mkerrors.sh' "$@"

View File

@@ -200,7 +200,7 @@ function grab_system() {
((anon*=1024)) ((anon*=1024))
# Mapped pages # Mapped pages
local mapped=$(egrep "^Mapped:" /proc/meminfo | awk '{print $2}') local mapped=$(grep -E "^Mapped:" /proc/meminfo | awk '{print $2}')
((mapped*=1024)) ((mapped*=1024))
# Cached # Cached

View File

@@ -429,7 +429,7 @@ static_check_license_headers()
info "Checking $desc" info "Checking $desc"
local missing=$(egrep \ local missing=$(grep \
--exclude=".git/*" \ --exclude=".git/*" \
--exclude=".gitignore" \ --exclude=".gitignore" \
--exclude=".dockerignore" \ --exclude=".dockerignore" \
@@ -475,7 +475,7 @@ static_check_license_headers()
--exclude="src/mem-agent/example/protocols/protos/google/protobuf/*.proto" \ --exclude="src/mem-agent/example/protocols/protos/google/protobuf/*.proto" \
--exclude="src/libs/*/test/texture/*" \ --exclude="src/libs/*/test/texture/*" \
--exclude="*.dic" \ --exclude="*.dic" \
-EL $extra_args "\<${pattern}\>" \ -EL $extra_args -E "\<${pattern}\>" \
$files || true) $files || true)
if [ -n "$missing" ]; then if [ -n "$missing" ]; then
@@ -783,7 +783,7 @@ static_check_docs()
local exclude_pattern local exclude_pattern
# Convert the list of files into an egrep(1) alternation pattern. # Convert the list of files into an grep(1) alternation pattern.
exclude_pattern=$(echo "${exclude_doc_regexs[@]}"|sed 's, ,|,g') exclude_pattern=$(echo "${exclude_doc_regexs[@]}"|sed 's, ,|,g')
# Every document in the repo (except a small handful of exceptions) # Every document in the repo (except a small handful of exceptions)
@@ -792,7 +792,7 @@ static_check_docs()
do do
# Check the ignore list for markdown files that do not need to # Check the ignore list for markdown files that do not need to
# be referenced by others. # be referenced by others.
echo "$doc"|egrep -q "(${exclude_pattern})" && continue echo "$doc"|grep -q -E "(${exclude_pattern})" && continue
grep -q "$doc" "$md_links" || die "Document $doc is not referenced" grep -q "$doc" "$md_links" || die "Document $doc is not referenced"
done done
@@ -827,7 +827,7 @@ static_check_docs()
if [ "$specific_branch" != "true" ] if [ "$specific_branch" != "true" ]
then then
# If the URL is new on this PR, it cannot be checked. # If the URL is new on this PR, it cannot be checked.
echo "$new_urls" | egrep -q "\<${url}\>" && \ echo "$new_urls" | grep -q -E "\<${url}\>" && \
info "ignoring new (but correct) URL: $url" && continue info "ignoring new (but correct) URL: $url" && continue
fi fi
@@ -925,12 +925,12 @@ static_check_eof()
[ "$file" == "Vagrantfile" ] && return [ "$file" == "Vagrantfile" ] && return
local invalid=$(cat "$file" |\ local invalid=$(cat "$file" |\
egrep -o '<<-* *\w*' |\ grep -o -E '<<-* *\w*' |\
sed -e 's/^<<-*//g' |\ sed -e 's/^<<-*//g' |\
tr -d ' ' |\ tr -d ' ' |\
sort -u |\ sort -u |\
egrep -v '^$' |\ grep -v -E '^$' |\
egrep -v "$anchor" || true) grep -v -E "$anchor" || true)
[ -z "$invalid" ] || die "Expected '$anchor' here anchor, in $file found: $invalid" [ -z "$invalid" ] || die "Expected '$anchor' here anchor, in $file found: $invalid"
} }
@@ -957,7 +957,7 @@ static_check_files()
then then
info "Checking all files in $branch branch" info "Checking all files in $branch branch"
files=$(git ls-files | egrep -v "/(.git|vendor|grpc-rs|target)/" || true) files=$(git ls-files | grep -v -E "/(.git|vendor|grpc-rs|target)/" || true)
else else
info "Checking local branch for changed files only" info "Checking local branch for changed files only"
@@ -979,7 +979,7 @@ static_check_files()
# Look for files containing the specified comment tags but # Look for files containing the specified comment tags but
# which do not include a github URL. # which do not include a github URL.
match=$(egrep -H "\<FIXME\>|\<TODO\>" "$file" |\ match=$(grep -H -E "\<FIXME\>|\<TODO\>" "$file" |\
grep -v "https://github.com/.*/issues/[0-9]" |\ grep -v "https://github.com/.*/issues/[0-9]" |\
cut -d: -f1 |\ cut -d: -f1 |\
sort -u || true) sort -u || true)