From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 719C31FF0B7 for ; Mon, 30 Nov 2026 19:10:34 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 440A5216B6; Mon, 30 Nov 2026 19:10:24 +0100 (CET) From: Jonas Theisen To: pve-devel@lists.proxmox.com Subject: [PATCH qemu-server v3 02/18] test: migration: allow checking for warnings and errors in the log Date: Mon, 30 Nov 2026 19:09:34 +0100 Message-ID: <20261130181007.596064-3-j.theisen@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261130181007.596064-1-j.theisen@proxmox.com> References: <20261130181007.596064-1-j.theisen@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1796062220328 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.065 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: EDYDS2AVQ6TIJCPMCMGP4Q26PWG66W6Q X-Message-ID-Hash: EDYDS2AVQ6TIJCPMCMGP4Q26PWG66W6Q X-MailFrom: j.theisen@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: So far, the log is only checked for the error message of a migration that is expected to fail. Allow tests to also check that a migration logs certain warnings, as the migration continues in these cases and the result alone does not show whether the warning was issued. Also allow tests to check that no other warnings or errors about a certain topic are logged, as a migration that logs an unintended warning still succeeds. Checking for the absence of all other messages is not feasible, as every migration in the tests logs some unrelated warnings, for example that conntrack state migration is not supported. Signed-off-by: Jonas Theisen --- src/test/run_qemu_migrate_tests.pl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/test/run_qemu_migrate_tests.pl b/src/test/run_qemu_migrate_tests.pl index 1936812e..d22c64c1 100755 --- a/src/test/run_qemu_migrate_tests.pl +++ b/src/test/run_qemu_migrate_tests.pl @@ -534,6 +534,10 @@ my $tests = [ # to be made if the migration gets far enough # expect_die - expect the migration call to fail, and an error message # matching the specified text in the log + # expect_log - list of texts that each must be present in a warning or + # error message in the log + # unexpected_log - list of texts that no warning or error message in the log + # may contain, unless it matches expect_die or expect_log # expected - hash consisting of: # source_volids - hash of volids expected on the source # target_volids - hash of volids expected on the target @@ -1942,6 +1946,21 @@ foreach my $test (@{$tests}) { note("mocked migrate call failed, but it was not expected - check log"); } + my @messages = grep { m/^(?:err|warn):/ } split(/\n/, file_get_contents("${run_dir}/log")); + my $expect_log = $test->{expect_log} // []; + for my $text ($expect_log->@*) { + next if grep { m/\Q${text}\E/ } @messages; + fail($name); + note("expected message '$text' is not present in log"); + } + my @expected_texts = ($expect_log->@*, grep { defined } $expect_die); + for my $message (@messages) { + next if grep { $message =~ m/\Q$_\E/ } @expected_texts; + my ($text) = grep { $message =~ m/\Q$_\E/ } ($test->{unexpected_log} // [])->@* or next; + fail($name); + note("unexpected message containing '$text' in log: $message"); + } + my $expected_calls = decode_json(file_get_contents("${run_dir}/expected_calls")); foreach my $call (keys %{$expected_calls}) { fail($name); -- 2.47.3