2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

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.
This commit is contained in:
Aram Sargsyan
2023-10-10 10:41:07 +00:00
committed by Arаm Sаrgsyаn
parent ba20c4fbe1
commit 39f46b8ca4

View File

@@ -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/<xfrin /\n<xfrin /g' xfrins.xml.x$n | grep -c '<state>\(Zone Transfer Request\|First Data\|Receiving AXFR Data\)</state>')
# XML is encoded in one line, use awk to separate each transfer with a newline
count=$(awk '{ gsub("<xfrin ", "\n<xfrin ") } 1' xfrins.xml.x$n | grep -c -E '<state>(Zone Transfer Request|First Data|Receiving AXFR Data)</state>')
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
}