From 51cd40c774675a8ccf424b36ad8a1ce36ddc8632 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Tue, 7 Apr 2026 14:46:56 +0200 Subject: [PATCH] tests: Support runtime-rs QEMU cmdline format in attestation test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The k8s-confidential-attestation test extracts the QEMU command line from journal logs to compute the SNP launch measurement. It only matched the Go runtime's log format ("launching with: []"), but runtime-rs logs differently ("qemu args: "). Handle both formats so the test works with qemu-snp-runtime-rs. Made-with: Cursor Signed-off-by: Fabiano FidĂȘncio --- .../kubernetes/k8s-confidential-attestation.bats | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/integration/kubernetes/k8s-confidential-attestation.bats b/tests/integration/kubernetes/k8s-confidential-attestation.bats index 7ce61e822b..eeb536b3e2 100644 --- a/tests/integration/kubernetes/k8s-confidential-attestation.bats +++ b/tests/integration/kubernetes/k8s-confidential-attestation.bats @@ -146,15 +146,22 @@ setup() { kbs_set_cpu0_resource_policy # get measured artifacts from qemu command line of previous test + # Go runtime logs: "launching with: []" + # runtime-rs logs: "qemu args: " log_line=$(sudo journalctl -r -x -t kata | grep -m 1 'launching.*qemu.*with:' || true) - qemu_cmd=$(echo "$log_line" | sed 's/.*with: \[\(.*\)\]".*/\1/') + if [[ -n "$log_line" ]]; then + qemu_cmd=$(echo "$log_line" | sed 's/.*with: \[\(.*\)\]".*/\1/') + else + log_line=$(sudo journalctl -r -x -t kata | grep -m 1 'qemu args:' || true) + qemu_cmd=$(echo "$log_line" | sed 's/.*qemu args: //') + fi [[ -n "$qemu_cmd" ]] || { echo "Could not find QEMU command line"; return 1; } kernel_path=$(echo "$qemu_cmd" | grep -oP -- '-kernel \K[^ ]+') initrd_path=$(echo "$qemu_cmd" | grep -oP -- '-initrd \K[^ ]+' || true) firmware_path=$(echo "$qemu_cmd" | grep -oP -- '-bios \K[^ ]+') vcpu_count=$(echo "$qemu_cmd" | grep -oP -- '-smp \K\d+') - append=$(echo "$qemu_cmd" | sed -n 's/.*-append \(.*\) -bios.*/\1/p') + append=$(echo "$qemu_cmd" | grep -oP -- '-append \K.*?(?= -(smp|bios) )') # Remove escape backslashes for quotes from output for dm-mod.create parameters append="${append//\\\"/\"}"