[pve-devel] [PATCH qemu-server 4/12] test: chomp all trailing newlines from errors and warnings
Daniel Herzig
d.herzig at proxmox.com
Fri Oct 25 17:02:35 CEST 2024
Ease EXPECT_ERROR and EXPECT_WARN string matching with errors/warnings
that have more than one trailing newline.
Signed-off-by: Daniel Herzig <d.herzig at proxmox.com>
---
test/run_config2command_tests.pl | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/test/run_config2command_tests.pl b/test/run_config2command_tests.pl
index 8c525f09..2911483e 100755
--- a/test/run_config2command_tests.pl
+++ b/test/run_config2command_tests.pl
@@ -426,7 +426,9 @@ sub diff($$) {
$SIG{__WARN__} = sub {
my $warning = shift;
- chomp $warning;
+ while ((chomp($warning))) {
+ chomp($warning);
+ }
if (my $warn_expect = $current_test->{expect_warning}) {
if ($warn_expect ne $warning) {
fail($current_test->{testname});
@@ -461,7 +463,9 @@ sub do_test($) {
note("did NOT get any error, but expected error: $err_expect");
return;
}
- chomp $err;
+ while ((chomp($err))) {
+ chomp($err);
+ }
if ($err ne $err_expect) {
fail("$testname");
note("error does not match expected error: '$err' !~ '$err_expect'");
--
2.39.5
More information about the pve-devel
mailing list