From: Aram Sargsyan Date: Tue, 10 Oct 2023 10:41:07 +0000 (+0000) Subject: Make the statschannel system test portable X-Git-Tag: v9.19.18~48^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=39f46b8ca44ce7128e38cf33e0ddb2a9541aefd4;p=thirdparty%2Fbind9.git 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. --- diff --git a/bin/tests/system/statschannel/tests.sh b/bin/tests/system/statschannel/tests.sh index afe941e2da5..b13e33022f1 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 }