Skip to content

Commit 9e6fa13

Browse files
fpolica91Copilot
andauthored
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Fabricio <fabriciopolicarpo0@gmail.com>
1 parent 640805d commit 9e6fa13

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

test/test-disable-dhcp.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,15 @@ echo >&2 "===== QEMU BEGIN ====="
4444
-nographic 2>&1 | tee serial.log
4545
echo >&2 "===== QEMU FINISH ====="
4646

47-
if grep -q "net0-ip=${GATEWAY%.*}." serial.log; then
47+
if ! grep -q "dhcp-failed-as-expected" serial.log; then
4848
echo >&2 "ERROR: guest obtained a DHCP lease, but DHCP should be disabled"
4949
exit 1
5050
fi
5151

52+
if grep -Eq "net0-ip=[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" serial.log; then
53+
echo >&2 "ERROR: guest has an IPv4 address despite DHCP being disabled"
54+
exit 1
55+
fi
56+
5257
echo >&2 "OK: guest obtained no DHCP lease (DHCP disabled as expected)"
5358
rm -f serial.log

0 commit comments

Comments
 (0)