parent
0f66268ecb
commit
79367643af
@ -1,48 +0,0 @@
|
||||
From 2d6e71e8d2d6f61f109566ff3148d3b1aa50c68c Mon Sep 17 00:00:00 2001
|
||||
From: Adam Williamson <awilliam@redhat.com>
|
||||
Date: Tue, 20 Aug 2019 15:39:04 -0700
|
||||
Subject: [PATCH] Allow special value 'once' for PXEBOOT, to PXE boot...once
|
||||
|
||||
For a PXE install test, we want to boot PXE just the *first*
|
||||
time, then revert to default boot order (much like we boot
|
||||
once=d by default for optical media installs). This allows the
|
||||
special value 'once' for the PXEBOOT var to request this.
|
||||
|
||||
Signed-off-by: Adam Williamson <awilliam@redhat.com>
|
||||
---
|
||||
backend/qemu.pm | 5 ++++-
|
||||
doc/backend_vars.asciidoc | 2 +-
|
||||
2 files changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/backend/qemu.pm b/backend/qemu.pm
|
||||
index ca576dd2..024e7a9a 100644
|
||||
--- a/backend/qemu.pm
|
||||
+++ b/backend/qemu.pm
|
||||
@@ -792,7 +792,10 @@ sub start_qemu {
|
||||
}
|
||||
|
||||
if ($arch_supports_boot_order) {
|
||||
- if ($vars->{PXEBOOT}) {
|
||||
+ if ($vars->{PXEBOOT} eq 'once') {
|
||||
+ sp("boot", "once=n");
|
||||
+ }
|
||||
+ elsif ($vars->{PXEBOOT}) {
|
||||
sp("boot", "n");
|
||||
}
|
||||
elsif ($vars->{BOOTFROM}) {
|
||||
diff --git a/doc/backend_vars.asciidoc b/doc/backend_vars.asciidoc
|
||||
index cd8b9345..746e74e0 100644
|
||||
--- a/doc/backend_vars.asciidoc
|
||||
+++ b/doc/backend_vars.asciidoc
|
||||
@@ -78,7 +78,7 @@ OFW;boolean;0;QEMU Open Firmware is in use
|
||||
QEMU_OVERRIDE_VIDEO_DEVICE_AARCH64;boolean;undef;If set, for aarch64 systems use VGA as video adapter
|
||||
QEMU_DISABLE_SNAPSHOTS;boolean;undef;If set, disable snapshots in case the worker has slow disks to avoid save_vm calls failing due to timeouts (See https://bugzilla.suse.com/show_bug.cgi?id=1035453[bsc#1035453])
|
||||
PATHCNT;integer;2;Number of paths in MULTIPATH scenario
|
||||
-PXEBOOT;boolean;0;Boot VM from network
|
||||
+PXEBOOT;boolean or 'once';0;Boot VM from network, on every boot or only once if set to 'once'
|
||||
QEMU;QEMU binary filename;undef;Filename of QEMU binary to use
|
||||
QEMUCPU;see qemu -cpu ?;undef;CPU to emulate
|
||||
QEMUCPUS;integer;1;Number of CPUs to assign to VM
|
||||
--
|
||||
2.23.0.rc2
|
||||
|
@ -1,107 +0,0 @@
|
||||
From 0ab60ea381f3aeea5426e4a6aed5db7453216045 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
|
||||
Date: Sat, 31 Aug 2019 13:01:49 +0200
|
||||
Subject: [PATCH] Factor out click functionality from assert_and_click
|
||||
|
||||
There are two cases where the fixed combination of assert_screen with
|
||||
the click functionality is problematic:
|
||||
|
||||
1. Multiple needles, where only some need/support clicking. This is
|
||||
typically solved with a combination of assert_screen + match_has_tag +
|
||||
assert_and_click. This is wasteful, as it checks twice for the same
|
||||
needle.
|
||||
|
||||
2. Repeated assert_and_click due to lost events. As it is impossible to
|
||||
know if an event was lost or just handled late, the repeated
|
||||
assert_and_click may encounter the just changed screen contents.
|
||||
|
||||
Splitting the click allows to do it conditionally, i.e. for (1.), just
|
||||
replacing the assert_and_click by click_lastmatch, and for (2.), by using
|
||||
something like:
|
||||
```
|
||||
assert_and_click(needle);
|
||||
while(1) {
|
||||
assert_screen([needle, after]);
|
||||
last if match_has_tag(after);
|
||||
click_lastmatch;
|
||||
}
|
||||
```
|
||||
For a sequence of clicks, the "after" can specify the coordinates for
|
||||
the next click.
|
||||
---
|
||||
OpenQA/Isotovideo/Interface.pm | 2 +-
|
||||
testapi.pm | 33 +++++++++++++++++++++++++++++----
|
||||
2 files changed, 30 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/OpenQA/Isotovideo/Interface.pm b/OpenQA/Isotovideo/Interface.pm
|
||||
index 2bed4988..8ec5e37c 100644
|
||||
--- a/OpenQA/Isotovideo/Interface.pm
|
||||
+++ b/OpenQA/Isotovideo/Interface.pm
|
||||
@@ -22,7 +22,7 @@ use warnings;
|
||||
# -> increment on every change of such APIs
|
||||
# -> never move that variable to another place (when refactoring)
|
||||
# because it may be accessed by the tests itself
|
||||
-our $version = 16;
|
||||
+our $version = 17;
|
||||
|
||||
# major version of the (web socket) API relevant to the developer mode
|
||||
# -> increment when making non-backward compatible changes to that API
|
||||
diff --git a/testapi.pm b/testapi.pm
|
||||
index b6b60e98..a7c0da5b 100755
|
||||
--- a/testapi.pm
|
||||
+++ b/testapi.pm
|
||||
@@ -47,7 +47,7 @@ our @EXPORT = qw($realname $username $password $serialdev %cmd %vars
|
||||
|
||||
assert_screen check_screen assert_and_dclick save_screenshot
|
||||
assert_and_click mouse_hide mouse_set mouse_click
|
||||
- mouse_dclick mouse_tclick match_has_tag
|
||||
+ mouse_dclick mouse_tclick match_has_tag click_lastmatch
|
||||
|
||||
assert_script_run script_run assert_script_sudo script_sudo
|
||||
script_output validate_script_output
|
||||
@@ -482,14 +482,39 @@ Throws C<FailedNeedle> exception if C<$timeout> timeout is hit. Default timeout
|
||||
|
||||
sub assert_and_click {
|
||||
my ($mustmatch, %args) = @_;
|
||||
- $args{timeout} //= $bmwqemu::default_timeout;
|
||||
+ $args{timeout} //= $bmwqemu::default_timeout;
|
||||
+
|
||||
+ $last_matched_needle = assert_screen($mustmatch, $args{timeout});
|
||||
+ bmwqemu::log_call(mustmatch => $mustmatch, %args);
|
||||
+
|
||||
+ my %click_args = map { $_ => $args{$_} } qw(button dclick mousehide);
|
||||
+ return click_lastmatch(%click_args);
|
||||
+}
|
||||
+
|
||||
+=head2 click_lastmatch
|
||||
+
|
||||
+ click_lastmatch([, button => $button] [, clicktime => $clicktime ] [, dclick => 1 ] [, mousehide => 1 ]);
|
||||
+
|
||||
+Click C<$button> at the "click_point" position as defined in the needle JSON file
|
||||
+of the last matched needle, or - if the JSON has not explicit "click_point" -
|
||||
+in the middle of the last match area. If C<$dclick> is set, do double click
|
||||
+instead. Supported values for C<$button> are C<'left'> and C<'right'>, C<'left'>
|
||||
+is the default. If C<$mousehide> is true then always move mouse to the 'hidden'
|
||||
+position after clicking to prevent to disturb the area where user wants to
|
||||
+assert/click in second step, otherwise move the mouse back to its previous
|
||||
+position.
|
||||
+
|
||||
+=cut
|
||||
+
|
||||
+sub click_lastmatch {
|
||||
+ my %args = @_;
|
||||
$args{button} //= 'left';
|
||||
$args{dclick} //= 0;
|
||||
$args{mousehide} //= 0;
|
||||
|
||||
- $last_matched_needle = assert_screen($mustmatch, $args{timeout});
|
||||
+ return unless $last_matched_needle;
|
||||
+
|
||||
my $old_mouse_coords = query_isotovideo('backend_get_last_mouse_set');
|
||||
- bmwqemu::log_call(mustmatch => $mustmatch, %args);
|
||||
|
||||
# determine click coordinates from the last area which has those explicitly specified
|
||||
my $relevant_area;
|
||||
--
|
||||
2.23.0
|
||||
|
@ -1,61 +0,0 @@
|
||||
From 66138b4e5f308cb0a9e93faa8aebf893a30f35ec Mon Sep 17 00:00:00 2001
|
||||
From: Adam Williamson <awilliam@redhat.com>
|
||||
Date: Fri, 5 Jul 2019 15:06:55 -0700
|
||||
Subject: [PATCH] VNC: reverse key order when sending key up events
|
||||
|
||||
When map_and_send_key maps an input to multiple key presses -
|
||||
e.g. a ':' requires a press of shift and a press of ';', or
|
||||
when dealing with any input like "ctrl-t" - it gets an array,
|
||||
sends a 'down' event for each key in the array, then sends an
|
||||
'up' event for each key in the array. So for our ctrl-t example
|
||||
it does this:
|
||||
|
||||
ctrl down
|
||||
t down
|
||||
ctrl up
|
||||
t up
|
||||
|
||||
This is a bit odd and not how humans normally type. Humans
|
||||
would normally hold the modifier key, press and release any
|
||||
modified keys they want to press, then release the modifier.
|
||||
I've run into one issue previously where this caused a problem,
|
||||
which was ultimately fixed in qemu so that os-autoinst's unusual
|
||||
key event order worked OK. Now I've run into another:
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1727388
|
||||
|
||||
All the details of that bug are still not worked out, but today
|
||||
I *did* work out that changing this key press order avoids that
|
||||
bug. By simply reversing the array for the key up events, so we
|
||||
do this instead:
|
||||
|
||||
ctrl down
|
||||
t down
|
||||
t up
|
||||
ctrl up
|
||||
|
||||
The bug stops happening. Since it's triggered two bugs now, and
|
||||
as I said it does not map to how humans type, I think we should
|
||||
really go ahead and change this.
|
||||
|
||||
Signed-off-by: Adam Williamson <awilliam@redhat.com>
|
||||
---
|
||||
consoles/VNC.pm | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/consoles/VNC.pm b/consoles/VNC.pm
|
||||
index 8eaefe0a..2dfc7a38 100644
|
||||
--- a/consoles/VNC.pm
|
||||
+++ b/consoles/VNC.pm
|
||||
@@ -759,7 +759,7 @@ sub map_and_send_key {
|
||||
}
|
||||
usleep(2_000);
|
||||
if (!defined $down_flag || $down_flag == 0) {
|
||||
- for my $key (@events) {
|
||||
+ for my $key (reverse @events) {
|
||||
$self->send_key_event_up($key);
|
||||
}
|
||||
}
|
||||
--
|
||||
2.22.0
|
||||
|
@ -1,166 +0,0 @@
|
||||
From f4be85471d4b9a555233f3cfc6ddaa9eb4b49a13 Mon Sep 17 00:00:00 2001
|
||||
From: Tina Mueller <tina.mueller@suse.com>
|
||||
Date: Wed, 14 Aug 2019 18:58:22 +0200
|
||||
Subject: [PATCH] Improve result display of validate_script_output
|
||||
|
||||
See also https://progress.opensuse.org/issues/54548
|
||||
|
||||
Before the output showed:
|
||||
|
||||
# wait_serial expected: (whatever the output was)
|
||||
|
||||
# Result:
|
||||
(whatever the output was)
|
||||
|
||||
"wait_serial" is wrong here, and it showed the actual output twice.
|
||||
|
||||
Now it shows:
|
||||
|
||||
validate_script_output got:
|
||||
(whatever the output was)
|
||||
|
||||
Check function (deparsed code):
|
||||
{
|
||||
package your::test::package;
|
||||
/some.*regex/;
|
||||
}
|
||||
|
||||
* Also validate_script_output() can now take a simple regular expression qr/foo/
|
||||
instead of a coderef.
|
||||
|
||||
* Add explicit return statement to make current behaviour transparent
|
||||
---
|
||||
cpanfile | 1 +
|
||||
dist/rpm/os-autoinst.spec | 2 +-
|
||||
t/03-testapi.t | 7 +++++
|
||||
testapi.pm | 55 ++++++++++++++++++++++++++++++---------
|
||||
4 files changed, 52 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/cpanfile b/cpanfile
|
||||
index 4b8e68592..da23f89d4 100644
|
||||
--- a/cpanfile
|
||||
+++ b/cpanfile
|
||||
@@ -1,3 +1,4 @@
|
||||
+requires 'B::Deparse';
|
||||
requires 'Carp';
|
||||
requires 'Carp::Always';
|
||||
requires 'Class::Accessor::Fast';
|
||||
diff --git a/t/03-testapi.t b/t/03-testapi.t
|
||||
index e893c1ddc..63aab9aca 100755
|
||||
--- a/t/03-testapi.t
|
||||
+++ b/t/03-testapi.t
|
||||
@@ -489,6 +489,7 @@ subtest 'validate_script_output' => sub {
|
||||
my $mock_testapi = Test::MockModule->new('testapi');
|
||||
$mock_testapi->mock(script_output => sub { return 'output'; });
|
||||
ok(!validate_script_output('script', sub { m/output/ }), 'validating output with default timeout');
|
||||
+ ok(!validate_script_output('script', qr/output/), 'validating output with regex and default timeout');
|
||||
ok(!validate_script_output('script', sub { m/output/ }, 30), 'specifying timeout');
|
||||
like(
|
||||
exception {
|
||||
@@ -496,6 +497,12 @@ subtest 'validate_script_output' => sub {
|
||||
},
|
||||
qr/output not validating/
|
||||
);
|
||||
+ like(
|
||||
+ exception {
|
||||
+ validate_script_output('script', ['Invalid parameter']);
|
||||
+ },
|
||||
+ qr/coderef or regexp/
|
||||
+ );
|
||||
};
|
||||
|
||||
subtest 'wait_still_screen' => sub {
|
||||
diff --git a/testapi.pm b/testapi.pm
|
||||
index 1b36c73cc..b5bdb4abc 100755
|
||||
--- a/testapi.pm
|
||||
+++ b/testapi.pm
|
||||
@@ -33,7 +33,8 @@ use OpenQA::Isotovideo::NeedleDownloader;
|
||||
use Digest::MD5 'md5_base64';
|
||||
use Carp qw(cluck croak);
|
||||
use MIME::Base64 'decode_base64';
|
||||
-use Scalar::Util 'looks_like_number';
|
||||
+use Scalar::Util qw(looks_like_number reftype);
|
||||
+use B::Deparse;
|
||||
|
||||
require bmwqemu;
|
||||
use constant OPENQA_LIBPATH => '/usr/share/openqa/lib';
|
||||
@@ -1117,20 +1118,23 @@ sub get_test_data {
|
||||
|
||||
=head2 validate_script_output
|
||||
|
||||
- validate_script_output($script, $code [, timeout => $timeout] [,quiet => $quiet])
|
||||
+ validate_script_output($script, $code | $regexp [, timeout => $timeout] [,quiet => $quiet])
|
||||
|
||||
Deprecated mode
|
||||
|
||||
validate_script_output($script, $code, [$wait])
|
||||
|
||||
-Wrapper around script_output, that runs a callback on the output. Use it as
|
||||
+Wrapper around script_output, that runs a callback on the output, or
|
||||
+alternatively matches a regular expression. Use it as
|
||||
|
||||
- validate_script_output "cat /etc/hosts", sub { m/127.*localhost/ }
|
||||
+ validate_script_output "cat /etc/hosts", sub { m/127.*localhost/ };
|
||||
+ validate_script_output "cat /etc/hosts", qr/127.*localhost/;
|
||||
+ validate_script_output "cat /etc/hosts", sub { $_ !~ m/987.*somehost/ };
|
||||
|
||||
=cut
|
||||
|
||||
sub validate_script_output {
|
||||
- my ($script, $code) = splice(@_, 0, 2);
|
||||
+ my ($script, $check) = splice(@_, 0, 2);
|
||||
my %args = compat_args(
|
||||
{
|
||||
timeout => 30,
|
||||
@@ -1140,17 +1144,44 @@ sub validate_script_output {
|
||||
my $output = script_output($script, %args);
|
||||
my $res = 'ok';
|
||||
|
||||
- # set $_ so the callbacks can be simpler code
|
||||
- $_ = $output;
|
||||
- if (!$code->()) {
|
||||
- $res = 'fail';
|
||||
- bmwqemu::diag("output does not pass the code block:\n$output");
|
||||
+ my $message = '';
|
||||
+ if (reftype $check eq 'CODE') {
|
||||
+ # set $_ so the callbacks can be simpler code
|
||||
+ $_ = $output;
|
||||
+ if (!$check->()) {
|
||||
+ $res = 'fail';
|
||||
+ bmwqemu::diag("output does not pass the code block:\n$output");
|
||||
+ }
|
||||
+ my $deparse = B::Deparse->new("-p");
|
||||
+ # avoid "use strict; use warnings" in the output to make it shorter
|
||||
+ $deparse->ambient_pragmas(warnings => [], strict => "all");
|
||||
+
|
||||
+ my $body = $deparse->coderef2text($check);
|
||||
+
|
||||
+ $message = sprintf
|
||||
+ "validate_script_output got:\n%s\n\nCheck function (deparsed code):\n%s",
|
||||
+ $output, $body;
|
||||
+ }
|
||||
+ elsif (reftype $check eq 'REGEXP') {
|
||||
+ if ($output !~ $check) {
|
||||
+ $res = 'fail';
|
||||
+ bmwqemu::diag("output does not match the regex:\n$output");
|
||||
+ }
|
||||
+ $message = sprintf
|
||||
+ "validate_script_output got:\n%s\n\nRegular expression:\n%s",
|
||||
+ $output, $check;
|
||||
+ }
|
||||
+ else {
|
||||
+ croak "Invalid use of validate_script_output(), second arg must be a coderef or regexp";
|
||||
}
|
||||
- # abusing the function
|
||||
- $autotest::current_test->record_serialresult($output, $res, $output) unless ($args{quiet});
|
||||
+ $autotest::current_test->record_resultfile(
|
||||
+ 'validate_script_output', $message,
|
||||
+ result => $res,
|
||||
+ );
|
||||
if ($res eq 'fail') {
|
||||
croak "output not validating";
|
||||
}
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
=head2 become_root
|
@ -1 +1 @@
|
||||
SHA512 (os-autoinst-3391d604ae36c0db0cda1d38f170137aef486a0c.tar.gz) = 934667774fbdb06b89e760ae907a9000e00d5ecfe67346c9c6a6510d8fad8cd911e92b839a6b83e6eaa23c8fe8a736765243d339edc693cb08804501d61fb962
|
||||
SHA512 (os-autoinst-447dab862096c5fb871fe06f61c3e5249ec0d5c1.tar.gz) = d4031440eaa56aa3b820b75e22228c5ddf332f4be290f5cbc3f02ea4396ad7666f07f9c3342e4d662331a847979eb2f4d00ea024ea919b8ee23f66a7973322a1
|
||||
|
Loading…
Reference in new issue