detect (rather than guessing) desktop vt
use 'ps' output for Xorg and Xwayland. We'd need some new openQA var to get this right by 'guessing', as it's vt1 for Workstation when running live - so long as autologin worked - but vt2 after install. We'd need a var or some other thing to detect which case we're running in. LIVE doesn't do it, it's set even when running a post-install test from a live image. So instead let's just do it a bit more cleverly. This also gives us a bit of insurance against changes in GDM, SDDM etc. behaviour, so long as Xwayland or Xorg is running (and we can add additional processes to the list, like gnome-shell, if needed/appropriate). We assume the *final* listed process - i.e. the most recently-started one - will be the desktop; this covers gdm's behaviour of starting up on vt1 then running the user session on vt2. We can make this function more complex and add args if we ever get to the point where we have multi- user tests running or anything (e.g. allow to pass a username and only look for that user's processes). Landing without review as this broke the live variant of the test on Workstation in production (kinda not sure why it worked in testing, or I didn't notice that it failed, but never mind). I've tested it on staging.
This commit is contained in:
parent
c962c21ed7
commit
ddc91efeff
@ -101,16 +101,6 @@ sub repo_setup {
|
|||||||
script_run "cat /etc/yum.repos.d/{fedora,fedora-rawhide}.repo";
|
script_run "cat /etc/yum.repos.d/{fedora,fedora-rawhide}.repo";
|
||||||
}
|
}
|
||||||
|
|
||||||
# switch to the desktop where the VT is
|
|
||||||
sub desktop_vt {
|
|
||||||
if (get_var("DESKTOP") eq 'gnome') {
|
|
||||||
send_key 'ctrl-alt-f2';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
send_key 'ctrl-alt-f1';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
||||||
# vim: set sw=4 et:
|
# vim: set sw=4 et:
|
||||||
|
@ -6,7 +6,7 @@ use base 'Exporter';
|
|||||||
use Exporter;
|
use Exporter;
|
||||||
|
|
||||||
use testapi;
|
use testapi;
|
||||||
our @EXPORT = qw/run_with_error_check check_type_string type_safely type_very_safely/;
|
our @EXPORT = qw/run_with_error_check check_type_string type_safely type_very_safely desktop_vt/;
|
||||||
|
|
||||||
sub run_with_error_check {
|
sub run_with_error_check {
|
||||||
my ($func, $error_screen) = @_;
|
my ($func, $error_screen) = @_;
|
||||||
@ -48,3 +48,17 @@ sub type_very_safely {
|
|||||||
check_type_string($string, size => 1, still => 5, max_interval => 1);
|
check_type_string($string, size => 1, still => 5, max_interval => 1);
|
||||||
wait_still_screen 5;
|
wait_still_screen 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Figure out what tty the desktop is on, switch to it. Assumes we're
|
||||||
|
# at a root console
|
||||||
|
sub desktop_vt {
|
||||||
|
# use ps to find the tty of Xwayland or Xorg
|
||||||
|
my $xout;
|
||||||
|
# don't fail test if we don't find any process, just guess tty1
|
||||||
|
eval { $xout = script_output 'ps -C Xwayland,Xorg -o tty --no-headers'; };
|
||||||
|
my $tty = 1; # default
|
||||||
|
while ($xout =~ /tty(\d)/g) {
|
||||||
|
$tty = $1; # most recent match is probably best
|
||||||
|
}
|
||||||
|
send_key "ctrl-alt-f${tty}";
|
||||||
|
}
|
||||||
|
@ -23,7 +23,7 @@ sub run {
|
|||||||
# just assume we're gonna win
|
# just assume we're gonna win
|
||||||
$self->root_console(tty=>3);
|
$self->root_console(tty=>3);
|
||||||
prepare_test_packages;
|
prepare_test_packages;
|
||||||
$self->desktop_vt();
|
desktop_vt;
|
||||||
# now, WE WAIT. this is just an unconditional wait - rather than
|
# now, WE WAIT. this is just an unconditional wait - rather than
|
||||||
# breaking if we see an update notification appear - so we catch
|
# breaking if we see an update notification appear - so we catch
|
||||||
# things that crash a few minutes after startup, etc.
|
# things that crash a few minutes after startup, etc.
|
||||||
|
@ -12,7 +12,7 @@ sub run {
|
|||||||
assert_script_run 'dnf config-manager --set-disabled updates-testing';
|
assert_script_run 'dnf config-manager --set-disabled updates-testing';
|
||||||
prepare_test_packages;
|
prepare_test_packages;
|
||||||
# get back to the desktop
|
# get back to the desktop
|
||||||
$self->desktop_vt();
|
desktop_vt;
|
||||||
# run the updater
|
# run the updater
|
||||||
if ($desktop eq 'kde') {
|
if ($desktop eq 'kde') {
|
||||||
# KDE team tells me the 'preferred' update method is the
|
# KDE team tells me the 'preferred' update method is the
|
||||||
|
Loading…
Reference in New Issue
Block a user