Project

General

Profile

Actions

action #25702

closed

add option in tty console to change key

Added by coolo about 7 years ago. Updated over 6 years ago.

Status:
Resolved
Priority:
High
Assignee:
Category:
Feature requests
Target version:
Start date:
2017-10-01
Due date:
% Done:

0%

Estimated time:

Description

Right now we have to choose the tty key for e.g. 'x11' in the distribution. But with modern distributions, the X session is a bit more flexible than that, so we need
to support setting the tty out of the tests.

E.g. by means of console('x11')->set_tty(2);

As this would require us checking if 'x11' is a tty console, we can also do a more generic approach to reset args.

console('x11')->set_arg(tty => 7) - which would change the arg dict

Actions #1

Updated by coolo about 7 years ago

  • Priority changed from Normal to Low
  • Target version set to Ready
Actions #2

Updated by coolo almost 7 years ago

  • Priority changed from Low to High

we need this now for upgrade tests as GNOME moved ttys.

Actions #3

Updated by qmsu almost 7 years ago

This api is really required during migration tests, i.e. SLE 12-sp3 -> 15, we need switch consoles several times in the test process as following:

  • openQA test triggered migration from sle12-sp3 hdd image by sle 15 installer will initialize consoles as root-console at 6 and x11-console at 2
  • switch version to sle 12-sp3 to patch the system ---- 1st console tty switch required: x11 from 2 to 7
  • when system patched, reboot to do upgrade
  • after upgrade, boot to sle 15 and run some gui tests ---- 2nd console tty switch required: x11 from 7 to 2
  • rollback to sle 12-sp3 from btrfs snapshot ---- 3rd console tty switch required: x11 from 2 to 7
Actions #4

Updated by okurz almost 7 years ago

Doesn't the same approach as in https://github.com/os-autoinst/os-autoinst-distri-opensuse/blob/master/tests/x11/start_wayland_plasma5.pm help?

console('x11')->{args}->{tty} = 3;
Actions #5

Updated by coolo almost 7 years ago

I don't consider that an API

Actions #6

Updated by qmsu almost 7 years ago

coolo wrote:

I don't consider that an API

Yeah, not API, but a method of ttyConsole class. Whatever, just need a way to change the console tty during test.

Actions #7

Updated by qmsu almost 7 years ago

okurz wrote:

Doesn't the same approach as in https://github.com/os-autoinst/os-autoinst-distri-opensuse/blob/master/tests/x11/start_wayland_plasma5.pm help?

console('x11')->{args}->{tty} = 3;

No, seems the method above never work as expected. console('x11') returns a console_proxy object, which is not the real console object. So "console('x11')->{args}->{tty} = 2;" only adds an attribution to the console_proxy object, but won't affect the real tty console object.

Actually I tried it at the beginning, even before I used "$testapi::distri->{consoles}->{'x11'}->{args}->{tty} = 2;", which disn't work neither, just as coolo said in IRC:
your tests run in a different process than the actual key pressing

Actions #8

Updated by coolo almost 7 years ago

  • Target version changed from Ready to Current Sprint

this one should be pretty simple

Actions #9

Updated by mkittler almost 7 years ago

  • Assignee set to mkittler

I haven't done much with the backend previously so I'll take this "pretty simple" task dive into the backend's code base. Let's see whether it is actually pretty simple and how to test it.

Actions #10

Updated by mkittler almost 7 years ago

  • Status changed from New to In Progress

PR: https://github.com/os-autoinst/os-autoinst/pull/933

If this works, it was 'pretty simple' indeed. However, figuring out why this works (in contrast to just writing console('x11')->{args}->{tty} = 3;) wasn't that easy. Hence the verbose comments in the PR/change.

No, seems the method above never work as expected. console('x11') returns a console_proxy object, which is not the real console object. So "console('x11')->{args}->{tty} = 2;" only adds an attribution to the console_proxy object, but won't affect the real tty console object.

Yes, so you really have to pass the values through an API function. Perl's magic AUTOLOAD function name is then triggered so the value is passed correctly via RPC.

BTW, I had fun reading the official documentation about AUTOLOAD:

The fully qualified name of the original subroutine magically appears in the global $AUTOLOAD variable of the same package as the AUTOLOAD routine. The name is not passed as an ordinary argument because, er, well, just because, that's why.

Perl ist echt die Spaßpartei unter den Programmiersprachen.

Actions #11

Updated by mkittler over 6 years ago

  • Status changed from In Progress to Feedback

The change has been merged.

I also created a PR for fixing the tests mentioned in the previous comments: https://github.com/os-autoinst/os-autoinst-distri-opensuse/pull/4672

@qmsu Maybe you would like to test it.

Actions #12

Updated by szarate over 6 years ago

  • Status changed from Feedback to Resolved
Actions #13

Updated by szarate over 6 years ago

  • Target version changed from Current Sprint to Done
Actions #14

Updated by qmsu over 6 years ago

@mkittler, Has your change for this ticket been deployed on o.s.d? If so, I would like to test it in SLE15 migration testing. Thanks.

Actions #15

Updated by okurz over 6 years ago

yes, it's deployed

Actions #16

Updated by qmsu over 6 years ago

Great, thanks for the confirmation. Then I can try to change the console tty during migration testing, i.e. SLE 12-SP3 -> 15.

Actions

Also available in: Atom PDF