From c8807478834a27315a6c3af68acf1016f81d79c5 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Mon, 5 Sep 2022 14:32:14 +0200 Subject: [PATCH] test: Wait for systemd-resolved to be ready on Ubuntu 22.04 for s390x On new Ubuntu 22.04 images, stopping systemd-resolved to get the dhclient script override resolv.conf doesn't work anymore. I originally used that hack to avoid introducing a delay which is needed when running it on TCG. Keep systemd-resolved running instead, and wait for it to be ready by retrying to resolve a domain a few times before installing packages, so that we don't add another ugly delay that might unnecessarily slow down things even further. Signed-off-by: Stefano Brivio --- test/distro/ubuntu | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/distro/ubuntu b/test/distro/ubuntu index 6666f38..5e67a46 100644 --- a/test/distro/ubuntu +++ b/test/distro/ubuntu @@ -54,6 +54,11 @@ hout INIT_MSG cat /tmp/init_msg check [ __INIT_MSG__ = "from_ns" ] endef +# With systemd-resolved and TCG, DNS might take a while to work +def dns_ready_wait +host r=10; while [ \${r} -gt 0 ]; do host ubuntu.com && break; sleep 5; r=\$((r - 1)); done +endef + # Start passt, set common variables hostb ./passt -P __PIDFILE__ & sleep 1 @@ -185,11 +190,10 @@ test Ubuntu 22.04 (Jammy Jellyfish), s390x host ./qrap 5 qemu-system-s390x -m 2048 -smp 2 -serial stdio -nodefaults -nographic __BASEPATH__/prepared-jammy-server-cloudimg-s390x.img -net socket,fd=5 -net nic,model=virtio -device virtio-rng-ccw -snapshot -host service systemd-resolved stop host export DEBIAN_FRONTEND=noninteractive host apt-get -y remove needrestart snapd host dhclient -4 -sleep 2 +dns_ready_wait host apt-get update host apt-get -y install make gcc socat