desktop_vt: hackaround 'tty?' problem on F31

On F31 update tests, desktop_vt is broken because the 'ps -C'
command is showing 'tty?' as the tty on which Xwayland/Xorg is
running. Let's try using loginctl as a workaround for this.
This ordering of commands should ensure the ps -C output takes
precedence when it's correct.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2019-09-03 16:19:08 -07:00
parent 6d68b2c6fa
commit 243dfbdacd

View File

@ -39,10 +39,12 @@ sub type_very_safely {
# Figure out what tty the desktop is on, switch to it. Assumes we're # Figure out what tty the desktop is on, switch to it. Assumes we're
# at a root console # at a root console
sub desktop_vt { sub desktop_vt {
# use ps to find the tty of Xwayland or Xorg # use loginctl or ps to find the tty of test's session (loginctl)
# or Xwayland or Xorg (ps); as of 2019-09 on F31 update tests
# ps -C is giving 'tty?', so adding loginctl works around that
my $xout; my $xout;
# don't fail test if we don't find any process, just guess tty1 # 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'; }; eval { $xout = script_output ' loginctl | grep test; ps -C Xwayland,Xorg -o tty --no-headers'; };
my $tty = 1; # default my $tty = 1; # default
while ($xout =~ /tty(\d)/g) { while ($xout =~ /tty(\d)/g) {
$tty = $1; # most recent match is probably best $tty = $1; # most recent match is probably best