From 243dfbdacd3695a7a3156ac2cb927033d8a54681 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Sep 03 2019 23:19:08 +0000 Subject: 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 --- diff --git a/lib/utils.pm b/lib/utils.pm index 70ac81c..0e28db2 100644 --- a/lib/utils.pm +++ b/lib/utils.pm @@ -39,10 +39,12 @@ sub type_very_safely { # 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 + # 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; # 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 while ($xout =~ /tty(\d)/g) { $tty = $1; # most recent match is probably best