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 874611FF0BC for ; Wed, 02 Dec 2026 16:19:06 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 3B5CC21820; Wed, 02 Dec 2026 16:18:47 +0100 (CET) From: Jonas Theisen To: pve-devel@lists.proxmox.com Subject: [PATCH qemu-server v4 02/21] test: migration: allow checking for warnings and errors in the log Date: Wed, 2 Dec 2026 16:17:58 +0100 Message-ID: <20261202151831.414110-3-j.theisen@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261202151831.414110-1-j.theisen@proxmox.com> References: <20261202151831.414110-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: 1796224722283 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.058 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: PB625WRIQLMULDMWIGO3NSXRK7PHIEU2 X-Message-ID-Hash: PB625WRIQLMULDMWIGO3NSXRK7PHIEU2 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 of a migration that is expected to fail. Allow tests to also check for warnings, as the migration continues after them, and for the absence of other warnings or errors about a topic, as a migration that logs an unintended warning still succeeds. Checking for the absence of all other messages is not feasible, as every test migration logs 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