From: Benjamin Drung Date: Fri, 23 Jan 2026 17:17:53 +0000 (+0100) Subject: refactor(test): move check_qemu_log to test-functions X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=450a09a04250a727b615be3e0891d36e5330a812;p=thirdparty%2Fdracut-ng.git refactor(test): move check_qemu_log to test-functions Move `check_log` to `test/test-functions`, name it `check_qemu_log`, and do not require to specify the success message (which will be the same for all tests). --- diff --git a/test/TEST-31-LIVENET/test.sh b/test/TEST-31-LIVENET/test.sh index 739bc19be..886c5b0db 100755 --- a/test/TEST-31-LIVENET/test.sh +++ b/test/TEST-31-LIVENET/test.sh @@ -37,16 +37,6 @@ start_webserver() { echo "$port" } -check_log() { - local msg="$1" - local logfile="$2" - - if ! grep -q "${msg}" "${logfile}"; then - echo >&2 "E: Message '${msg}' not found in QEMU log output '${logfile}'." - return 1 - fi -} - client_run() { local test_name="$1" local append="$2" @@ -57,7 +47,7 @@ client_run() { -netdev "user,id=lan0,net=10.0.2.0/24,dhcpstart=10.0.2.15" \ -append "$append $TEST_KERNEL_CMDLINE" \ -initrd "$TESTDIR/initramfs.testing" | tee "$TESTDIR/qemu.log" - check_log '^All OK' "$TESTDIR/qemu.log" + check_qemu_log "$TESTDIR/qemu.log" client_test_end } diff --git a/test/test-functions b/test/test-functions index ff453e315..34481c467 100644 --- a/test/test-functions +++ b/test/test-functions @@ -84,6 +84,16 @@ call_dracut() { "$DRACUT" "$@" } +# Check QEMU logs for success marker +check_qemu_log() { + local logfile="$1" + + if ! grep -q "^All OK" "${logfile}"; then + echo >&2 "E: Message 'All OK' not found in QEMU log output '${logfile}'." + return 1 + fi +} + # Log the start of a client test. client_test_start() { local test_name="$1"