summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2023-05-08 13:43:03 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2023-05-09 08:11:10 +0200
commit711169905e75617eabf3934273aa37dac02c6458 (patch)
treed4829ecb9a55c23910d774e43ce6041c69da09a6 /test
parente11c9ba7bf4195c1c2bd9e00c98123ee3670ba1c (diff)
downloadsystemd-711169905e75617eabf3934273aa37dac02c6458.tar.gz
test: use sed and grep instead of perl
This gets rid of the all-but-one remaining uses of perl. I tested the new code on my machine, so I'm fairly confident that it works as expected. install_iscsi() has one majestic perl invocation, but we can't get rid of it easily: it extends the code of tgt-admin to print some list of files. Obviously this only works because tgt-admin is written in perl, and perl will be installed if tgt-admin is installed. install_iscsi() is used in TEST-64-UDEV-STORAGE conditionally if tgtadm is installed, so this can stay as is.
Diffstat (limited to 'test')
-rw-r--r--test/test-functions29
1 files changed, 13 insertions, 16 deletions
diff --git a/test/test-functions b/test/test-functions
index cef2a780d4..2d303f4799 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -818,19 +818,19 @@ install_valgrind() {
exit 1
fi
- local valgrind_bins valgrind_libs valgrind_dbg_and_supp
+ local valgrind_bins valgrind_libs valgrind_supp
- readarray -t valgrind_bins < <(strace -e execve valgrind /bin/true 2>&1 >/dev/null | perl -lne 'print $1 if /^execve\("([^"]+)"/')
+ readarray -t valgrind_bins < <(strace -e execve valgrind /bin/true 2>&1 >/dev/null |
+ sed -r -n 's/execve\("([^"]*)".*/\1/p')
image_install "${valgrind_bins[@]}"
- readarray -t valgrind_libs < <(LD_DEBUG=files valgrind /bin/true 2>&1 >/dev/null | perl -lne 'print $1 if m{calling init: (/.*vgpreload_.*)}')
+ readarray -t valgrind_libs < <(LD_DEBUG=files valgrind /bin/true 2>&1 >/dev/null |
+ sed -r -n 's|.*calling init: (/.*vgpreload_.*)|\1|p')
image_install "${valgrind_libs[@]}"
- readarray -t valgrind_dbg_and_supp < <(
- strace -e open valgrind /bin/true 2>&1 >/dev/null |
- perl -lne 'if (my ($fname) = /^open\("([^"]+).*= (?!-)\d+/) { print $fname if $fname =~ /debug|\.supp$/ }'
- )
- image_install "${valgrind_dbg_and_supp[@]}"
+ readarray -t valgrind_supp < <(strace -e open valgrind /bin/true 2>&1 >/dev/null |
+ sed -r -n 's,open\("([^"]*(/debug[^"]*|\.supp))".*= [0-9].*,\1,p')
+ image_install "${valgrind_supp[@]}"
}
create_valgrind_wrapper() {
@@ -1455,16 +1455,13 @@ check_asan_reports() {
ret=$((ret+1))
fi
+ # May 08 13:23:31 H testleak[2907148]: SUMMARY: AddressSanitizer: 4 byte(s) leaked in 1 allocation(s).
pids="$(
- "$JOURNALCTL" -D "$root/var/log/journal" | perl -alne '
- BEGIN {
- %services_to_ignore = (
- "dbus-daemon" => undef,
- "dbus-broker-launch" => undef,
- );
- }
- print $2 if /\s(\S*)\[(\d+)\]:\s*SUMMARY:\s+\w+Sanitizer/ && !exists $services_to_ignore{$1}'
+ "$JOURNALCTL" -D "$root/var/log/journal" --grep 'SUMMARY: .*Sanitizer:' |
+ grep -v -E 'dbus-daemon|dbus-broker-launch' |
+ sed -r -n 's/.* .+\[([0-9]+)\]: SUMMARY:.*/\1/p'
)"
+
if [[ -n "$pids" ]]; then
ret=$((ret+1))
for pid in $pids; do