From 39f46b8ca44ce7128e38cf33e0ddb2a9541aefd4 Mon Sep 17 00:00:00 2001 From: Aram Sargsyan Date: Tue, 10 Oct 2023 10:41:07 +0000 Subject: [PATCH] Make the statschannel system test portable The usage of the newline in the replacement part of the 'sed' call works in GNU systems, but not in OpenBSD. Use 'awk' instead. Also use the extended syntax of regular expressions for 'grep', which is similarly more portable across the supported systems. --- bin/tests/system/statschannel/tests.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/tests/system/statschannel/tests.sh b/bin/tests/system/statschannel/tests.sh index afe941e2da..b13e33022f 100644 --- a/bin/tests/system/statschannel/tests.sh +++ b/bin/tests/system/statschannel/tests.sh @@ -714,10 +714,10 @@ n=$((n + 1)) _wait_for_transfers() { getxfrins xml x$n || return 1 getxfrins json j$n || return 1 - # XML is encoded in one line, use sed to separate each transfer - count=$(sed 's/\(Zone Transfer Request\|First Data\|Receiving AXFR Data\)') + # XML is encoded in one line, use awk to separate each transfer with a newline + count=$(awk '{ gsub("(Zone Transfer Request|First Data|Receiving AXFR Data)') if [ $count != 3 ]; then return 1; fi - count=$(grep -c '"state":"\(Zone Transfer Request\|First Data\|Receiving AXFR Data\)"' xfrins.json.j$n) + count=$(grep -c -E '"state":"(Zone Transfer Request|First Data|Receiving AXFR Data)"' xfrins.json.j$n) if [ $count != 3 ]; then return 1; fi }