From 1943a1c96df3f48fc363356af58255d69609719b Mon Sep 17 00:00:00 2001 From: Balint Tobik Date: Tue, 28 Jan 2025 10:40:49 +0100 Subject: [PATCH] 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 --- .../functional/tracing/test-agent-shutdown.sh | 10 ++++----- .../functional/vfio/vfio_fedora_vm_wrapper.sh | 4 ++-- .../vendor/golang.org/x/sys/unix/mkerrors.sh | 4 ++-- tests/metrics/density/footprint_data.sh | 2 +- tests/static-checks.sh | 22 +++++++++---------- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/tests/functional/tracing/test-agent-shutdown.sh b/tests/functional/tracing/test-agent-shutdown.sh index 17c6dd95c4..dc77e5dd30 100755 --- a/tests/functional/tracing/test-agent-shutdown.sh +++ b/tests/functional/tracing/test-agent-shutdown.sh @@ -286,7 +286,7 @@ show_procs() local regex regex="(${pattern_list})" - ps -efww | egrep -i "$regex" || true + ps -efww | grep -i -E "$regex" || true } kill_tmux_sessions() @@ -612,7 +612,7 @@ cleanup() # Check that clh socket was deleted if [ $configured_hypervisor = "clh" ] && [ ! -z $clh_socket_path ]; then - [ -f $clh_socket_path ] && die "CLH socket path $clh_socket_path was not properly cleaned up" + [ -f $clh_socket_path ] && die "CLH socket path $clh_socket_path was not properly cleaned up" fi sudo systemctl restart containerd @@ -961,7 +961,7 @@ get_addresses() if [ $configured_hypervisor = "qemu" ]; then addresses=$(ss -Hp --vsock |\ - egrep -v "\" |\ + grep -v -E "\" |\ awk '$2 ~ /^ESTAB$/ {print $6}' |\ grep ":${EXPECTED_VSOCK_PORT}$") elif [ $configured_hypervisor = "clh" ]; then @@ -1166,7 +1166,7 @@ validate_agent() # Regular expression that describes possible agent failures 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 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. local done_msg="\" - 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 # We can only check for the shutdown message if the agent debug # logs are available. diff --git a/tests/functional/vfio/vfio_fedora_vm_wrapper.sh b/tests/functional/vfio/vfio_fedora_vm_wrapper.sh index 03931d7e2f..285683716e 100755 --- a/tests/functional/vfio/vfio_fedora_vm_wrapper.sh +++ b/tests/functional/vfio/vfio_fedora_vm_wrapper.sh @@ -76,7 +76,7 @@ create_user_data() { dnf_proxy="" service_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" \ -e "s/\(^[[:alnum:]_]\+\)=/\1='/" \ -e "s/$/'/" \ @@ -210,7 +210,7 @@ create_config_iso() { pull_fedora_cloud_image() { fedora_img="$1" fedora_version=38 - # Add a version to the image cache, otherwise the tests are going to + # Add a version to the image cache, otherwise the tests are going to # use always the same image without rebuilding it, regardless the version # set in fedora_version fedora_img_cache="${fedora_img}.cache.${fedora_version}" diff --git a/tests/metrics/cmd/checkmetrics/vendor/golang.org/x/sys/unix/mkerrors.sh b/tests/metrics/cmd/checkmetrics/vendor/golang.org/x/sys/unix/mkerrors.sh index ca50e4e14d..0671271cf8 100644 --- a/tests/metrics/cmd/checkmetrics/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/tests/metrics/cmd/checkmetrics/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -638,7 +638,7 @@ errors=$( signals=$( echo '#include ' | $CC -x c - -E -dM $ccflags | awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print $2 }' | - egrep -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT|SIGMAX64)' | + grep -v -E '(SIGSTKSIZE|SIGSTKSZ|SIGRT|SIGMAX64)' | sort ) @@ -648,7 +648,7 @@ echo '#include ' | $CC -x c - -E -dM $ccflags | sort >_error.grep echo '#include ' | $CC -x c - -E -dM $ccflags | 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 echo '// mkerrors.sh' "$@" diff --git a/tests/metrics/density/footprint_data.sh b/tests/metrics/density/footprint_data.sh index 925f2aca22..d282e647ad 100755 --- a/tests/metrics/density/footprint_data.sh +++ b/tests/metrics/density/footprint_data.sh @@ -200,7 +200,7 @@ function grab_system() { ((anon*=1024)) # Mapped pages - local mapped=$(egrep "^Mapped:" /proc/meminfo | awk '{print $2}') + local mapped=$(grep -E "^Mapped:" /proc/meminfo | awk '{print $2}') ((mapped*=1024)) # Cached diff --git a/tests/static-checks.sh b/tests/static-checks.sh index 3582736de6..a8c7b4e919 100755 --- a/tests/static-checks.sh +++ b/tests/static-checks.sh @@ -429,7 +429,7 @@ static_check_license_headers() info "Checking $desc" - local missing=$(egrep \ + local missing=$(grep \ --exclude=".git/*" \ --exclude=".gitignore" \ --exclude=".dockerignore" \ @@ -475,7 +475,7 @@ static_check_license_headers() --exclude="src/mem-agent/example/protocols/protos/google/protobuf/*.proto" \ --exclude="src/libs/*/test/texture/*" \ --exclude="*.dic" \ - -EL $extra_args "\<${pattern}\>" \ + -EL $extra_args -E "\<${pattern}\>" \ $files || true) if [ -n "$missing" ]; then @@ -783,7 +783,7 @@ static_check_docs() 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') # Every document in the repo (except a small handful of exceptions) @@ -792,7 +792,7 @@ static_check_docs() do # Check the ignore list for markdown files that do not need to # 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" done @@ -827,7 +827,7 @@ static_check_docs() if [ "$specific_branch" != "true" ] then # 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 fi @@ -925,12 +925,12 @@ static_check_eof() [ "$file" == "Vagrantfile" ] && return local invalid=$(cat "$file" |\ - egrep -o '<<-* *\w*' |\ + grep -o -E '<<-* *\w*' |\ sed -e 's/^<<-*//g' |\ tr -d ' ' |\ sort -u |\ - egrep -v '^$' |\ - egrep -v "$anchor" || true) + grep -v -E '^$' |\ + grep -v -E "$anchor" || true) [ -z "$invalid" ] || die "Expected '$anchor' here anchor, in $file found: $invalid" } @@ -957,7 +957,7 @@ static_check_files() then 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 info "Checking local branch for changed files only" @@ -979,7 +979,7 @@ static_check_files() # Look for files containing the specified comment tags but # which do not include a github URL. - match=$(egrep -H "\|\" "$file" |\ + match=$(grep -H -E "\|\" "$file" |\ grep -v "https://github.com/.*/issues/[0-9]" |\ cut -d: -f1 |\ sort -u || true) @@ -1294,7 +1294,7 @@ static_check_dockerfiles() linter_cmd+=" --ignore DL3041" # "DL3033 warning: Specify version with `yum install -y -`" linter_cmd+=" --ignore DL3033" - # "DL3018 warning: Pin versions in apk add. Instead of `apk add ` use `apk add =`" + # "DL3018 warning: Pin versions in apk add. Instead of `apk add ` use `apk add =`" linter_cmd+=" --ignore DL3018" # "DL3003 warning: Use WORKDIR to switch to a directory" # See https://github.com/hadolint/hadolint/issues/70