parent
f05204e188
commit
0c2cf842fa
@ -1,33 +0,0 @@
|
||||
From 2cef27f5bfd2ff9c415b74b2299cbf44f80975f4 Mon Sep 17 00:00:00 2001
|
||||
From: Adam Williamson <awilliam@redhat.com>
|
||||
Date: Wed, 25 May 2022 14:46:08 -0700
|
||||
Subject: [PATCH 2/2] 18-qemu-options.t: drop some fragile and unnecessary
|
||||
asserts
|
||||
|
||||
It's really not our job to test exactly what qemu does when we
|
||||
call it with `-M ? -version`, and that behaviour seems to vary
|
||||
anyhow, so let's drop these.
|
||||
|
||||
https://progress.opensuse.org/issues/111602
|
||||
|
||||
Signed-off-by: Adam Williamson <awilliam@redhat.com>
|
||||
---
|
||||
t/18-qemu-options.t | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
diff --git a/t/18-qemu-options.t b/t/18-qemu-options.t
|
||||
index 4ef4a015..80fcd797 100755
|
||||
--- a/t/18-qemu-options.t
|
||||
+++ b/t/18-qemu-options.t
|
||||
@@ -74,8 +74,6 @@ subtest qemu_append_option => sub {
|
||||
run_isotovideo(@common_options, QEMU_APPEND => 'M ? -version');
|
||||
like($log, qr/-M \?/, '-M ? option added');
|
||||
like($log, qr/-version/, '-version option added');
|
||||
- like($log, qr/QEMU emulator version/, 'QEMU version printed');
|
||||
- unlike($log, qr/Supported machines are\:/, 'Supported machines not listed');
|
||||
unlike($log, qr/\: invalid option/, 'no invalid option detected');
|
||||
like($log, qr/QEMU terminated before QMP connection could be established/, 'connecting to QMP socket aborted');
|
||||
$ENV{QEMU_QMP_CONNECT_ATTEMPTS} = $qmp_connect_attempts;
|
||||
--
|
||||
2.36.1
|
||||
|
@ -1,169 +0,0 @@
|
||||
From 16ab03c44a445257110ad96de4c0222f4a7f6789 Mon Sep 17 00:00:00 2001
|
||||
From: Adam Williamson <awilliam@redhat.com>
|
||||
Date: Tue, 7 Jun 2022 09:12:09 -0700
|
||||
Subject: [PATCH] Fix perl 5.36 warnings on use of @_ in functions with
|
||||
signature
|
||||
|
||||
When running the test suite with perl 5.36 we get several warnings
|
||||
about use (explicit or implict) of `@_` in functions with
|
||||
signatures being 'experimental'.
|
||||
|
||||
These fixes were all suggested by tinita (thanks). In some cases
|
||||
we can just use the function arguments, in three cases that fill
|
||||
buffers we have to drop the signatures, as you cannot assign to
|
||||
`@_` without triggering the warning when using signatures, and we
|
||||
don't see an obvious way to have these functions do anything else.
|
||||
In console_proxy we also drop the signature; we considered calling
|
||||
`$AUTOLOAD` with the args instead, but @kraih thinks that will
|
||||
cause problems with stack traces.
|
||||
|
||||
Signed-off-by: Adam Williamson <awilliam@redhat.com>
|
||||
---
|
||||
backend/console_proxy.pm | 12 +++++++++---
|
||||
backend/svirt.pm | 2 +-
|
||||
consoles/serial_screen.pm | 5 ++++-
|
||||
consoles/ssh_screen.pm | 6 +++++-
|
||||
t/21-needle-downloader.t | 2 +-
|
||||
t/31-sshSerial.t | 7 ++++++-
|
||||
6 files changed, 26 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/backend/console_proxy.pm b/backend/console_proxy.pm
|
||||
index eea75a8c..01c30080 100644
|
||||
--- a/backend/console_proxy.pm
|
||||
+++ b/backend/console_proxy.pm
|
||||
@@ -24,18 +24,20 @@ sub DESTROY () { }
|
||||
# handles the attempt to invoke an undefined method on the proxy console object
|
||||
# using query_isotovideo() to invoke the method on the actual console object in
|
||||
# the right process
|
||||
-sub AUTOLOAD ($self, @args) {
|
||||
+sub AUTOLOAD { # no:style:signatures
|
||||
my $function = our $AUTOLOAD;
|
||||
|
||||
$function =~ s,.*::,,;
|
||||
|
||||
# allow symbolic references
|
||||
no strict 'refs';
|
||||
- *$AUTOLOAD = sub ($self, @args) {
|
||||
+ *$AUTOLOAD = sub { # no:style:signatures
|
||||
+ my $self = shift;
|
||||
+ my $args = \@_;
|
||||
my $wrapped_call = {
|
||||
console => $self->{console},
|
||||
function => $function,
|
||||
- args => \@args,
|
||||
+ args => $args,
|
||||
wantarray => wantarray,
|
||||
};
|
||||
|
||||
@@ -52,6 +54,10 @@ sub AUTOLOAD ($self, @args) {
|
||||
return wantarray ? @{$wrapped_retval->{result}} : $wrapped_retval->{result};
|
||||
};
|
||||
|
||||
+ # this is why we can't use a signature for this function, goto
|
||||
+ # implicitly uses @_ and that triggers a warning in a function
|
||||
+ # with a signature. We want to use goto to hide frames in stack
|
||||
+ # traces (per @kraih)
|
||||
goto &$AUTOLOAD;
|
||||
}
|
||||
|
||||
diff --git a/backend/svirt.pm b/backend/svirt.pm
|
||||
index 9726467b..52d8583d 100644
|
||||
--- a/backend/svirt.pm
|
||||
+++ b/backend/svirt.pm
|
||||
@@ -85,7 +85,7 @@ sub do_stop_vm ($self, @) {
|
||||
|
||||
# Log stdout and stderr and return them in a list (comped).
|
||||
sub scp_get ($self, $src, $dest) {
|
||||
- bmwqemu::log_call(@_);
|
||||
+ bmwqemu::log_call($self, $src, $dest);
|
||||
|
||||
my %credentials = $self->get_ssh_credentials(_is_hyperv ? 'hyperv' : 'default');
|
||||
my $ssh = $self->new_ssh_connection(%credentials);
|
||||
diff --git a/consoles/serial_screen.pm b/consoles/serial_screen.pm
|
||||
index d1b365ba..3db0433f 100644
|
||||
--- a/consoles/serial_screen.pm
|
||||
+++ b/consoles/serial_screen.pm
|
||||
@@ -122,7 +122,8 @@ An undefined timeout will cause to wait indefinitely. A timeout of 0 means to
|
||||
just read once.
|
||||
|
||||
=cut
|
||||
-sub do_read ($self, $, %args) {
|
||||
+sub do_read { # no:style:signatures
|
||||
+ my ($self, undef, %args) = @_;
|
||||
my $buffer = '';
|
||||
$args{timeout} //= undef; # wait till data is available
|
||||
$args{max_size} //= 2048;
|
||||
@@ -139,6 +140,8 @@ sub do_read ($self, $, %args) {
|
||||
$read = sysread($fd, $buffer, $args{max_size});
|
||||
croak "Failed to read from virtio/svirt serial console char device: $ERRNO" if !defined($read) && !($ERRNO{EAGAIN} || $ERRNO{EWOULDBLOCK});
|
||||
}
|
||||
+ # this is why we can't use a signature for this function,
|
||||
+ # assigning to @_ in a function with signature triggers a warning
|
||||
$_[1] = $buffer;
|
||||
return $read;
|
||||
}
|
||||
diff --git a/consoles/ssh_screen.pm b/consoles/ssh_screen.pm
|
||||
index b84c38fb..052308f5 100644
|
||||
--- a/consoles/ssh_screen.pm
|
||||
+++ b/consoles/ssh_screen.pm
|
||||
@@ -27,7 +27,8 @@ sub new ($class, @args) {
|
||||
return $self->SUPER::new($self->ssh_channel);
|
||||
}
|
||||
|
||||
-sub do_read ($self, $, %args) {
|
||||
+sub do_read { # no:style:signatures
|
||||
+ my ($self, undef, %args) = @_;
|
||||
my $buffer = '';
|
||||
$args{timeout} //= undef; # wait till data is available
|
||||
$args{max_size} //= 2048;
|
||||
@@ -37,6 +38,9 @@ sub do_read ($self, $, %args) {
|
||||
while (!$args{timeout} || (consoles::serial_screen::elapsed($stime) < $args{timeout})) {
|
||||
my $read = $self->ssh_channel->read($buffer, $args{max_size});
|
||||
if (defined($read)) {
|
||||
+ # this is why we can't use a signature for this function,
|
||||
+ # assigning to @_ in a function with signature triggers a
|
||||
+ # warning
|
||||
$_[1] = $buffer;
|
||||
print {$self->{loghandle}} $buffer if $self->{loghandle};
|
||||
return $read;
|
||||
diff --git a/t/21-needle-downloader.t b/t/21-needle-downloader.t
|
||||
index 38b1bda9..3a680bc1 100755
|
||||
--- a/t/21-needle-downloader.t
|
||||
+++ b/t/21-needle-downloader.t
|
||||
@@ -20,7 +20,7 @@ my $user_agent_mock = Test::MockModule->new('Mojo::UserAgent');
|
||||
my @queried_urls;
|
||||
$user_agent_mock->redefine(get => sub ($self, $url) {
|
||||
push(@queried_urls, $url);
|
||||
- return $user_agent_mock->original('get')->(@_);
|
||||
+ return $user_agent_mock->original('get')->($self, $url);
|
||||
});
|
||||
|
||||
# setup needle directory
|
||||
diff --git a/t/31-sshSerial.t b/t/31-sshSerial.t
|
||||
index f80bfaae..7e2ffdc6 100755
|
||||
--- a/t/31-sshSerial.t
|
||||
+++ b/t/31-sshSerial.t
|
||||
@@ -49,7 +49,9 @@ $mock_channel->mock(blocking => sub ($self, $arg = undef) {
|
||||
return $self->{blocking};
|
||||
});
|
||||
|
||||
-$mock_channel->mock(read => sub ($self, $, $size) {
|
||||
+$mock_channel->mock(read => sub { # no:style:signatures
|
||||
+ my ($self, undef, $size) = @_;
|
||||
+
|
||||
my $data = shift @{$self->{read_queue}};
|
||||
|
||||
if (!defined($data)) {
|
||||
@@ -62,6 +64,9 @@ $mock_channel->mock(read => sub ($self, $, $size) {
|
||||
$data = substr($data, 0, $size);
|
||||
}
|
||||
|
||||
+ # this is why we can't use a signature for this function,
|
||||
+ # assigning to @_ in a function with signature triggers a
|
||||
+ # warning
|
||||
$_[1] = $data;
|
||||
return length($data);
|
||||
});
|
||||
--
|
||||
2.36.1
|
||||
|
@ -1 +1 @@
|
||||
SHA512 (os-autoinst-8a7a14fa5175e3ce1dbd0f59c2c2ec2d73c572d6.tar.gz) = 4dc085f0cdef6e419b85818572c982e62c7c2ff1312f011efa6c1696b93735807cfff8893fc11004b47353bccb9bfca84e1c7de03d9b07949c66deef55512970
|
||||
SHA512 (os-autoinst-ddf414b8d83576d0f5373c15acd70ab2c3ea9fb8.tar.gz) = 973629123c6ba484113acc287afe2525e84a791fbc8aa01a8431fcd3cfa55bd2c7fce793f9c205a51cf26e212120b7f871c3a1236ab29e9c4f09fef974d54f26
|
||||
|
Loading…
Reference in new issue