lib/susedistribution.pm

SUSEDISTRIBUTION

SYNOPSIS

Base class implementation of distribution class necessary for testapi

new

Class constructor

handle_password_prompt

Types the password in a password prompt

init

TODO needs to be documented

init_cmd

TODO needs to be documented

init_desktop_runner

Starts the desktop runner for x11_start_program

x11_start_program

x11_start_program($program [, timeout => $timeout ] [, no_wait => 0|1 ] [, valid => 0|1 [, target_match => $target_match ] [, match_timeout => $match_timeout ] [, match_no_wait => 0|1 ] [, match_typed => 0|1 ]]);

Start the program $program in an X11 session using the desktop-runner and looking for a target screen to match.

The timeout for check_screen for desktop-runner can be configured with optional $timeout. Specify no_wait to skip the wait_still_screen after the typing of $program. Overwrite valid with a false value to exit after desktop-runner executed without checking for the result. valid=1 is especially useful when the used desktop-runner has an auto-completion feature which can cause high load while typing potentially causing the subsequent ret to fail. By default x11_start_program looks for a screen tagged with the value of $program with assert_screen after executing the command to launch $program. The tag(s) can be customized with the parameter $target_match. $match_timeout can be specified to configure the timeout on that internal assert_screen. Specify match_no_wait to forward the no_wait option to the internal assert_screen. If user wants to assert that command was typed correctly in the desktop-runner she can pass needle tag using match_typed parameter. This will check typed text and retry once in case of typos or unexpected results (see poo#25972).

The combination of no_wait with valid and target_match is the preferred solution for the most efficient approach by saving time within tests.

In case of KDE plasma krunner provides a suggestion list which can take a bit of time to be computed therefore the logic is slightly different there, for example longer waiting time, looking for the computed suggestions list before accepting and a default timeout for the target match of 90 seconds versus just using the default of assert_screen itself. For other desktop environments we keep the old check for the runner border.

This method is overwriting the base method in os-autoinst.

ensure_installed

Ensure that a package is installed

script_sudo

Execute the given command as sudo

set_standard_prompt

set_standard_prompt([$user] [[, os_type] [, skip_set_standard_prompt]])

$user and os_type affect prompt sign. skip_set_standard_prompt options skip the entire routine.

become_root

Log in as root in the current console

init_consoles

Initialize the consoles needed during our tests

ensure_user

Make sure the right user is logged in, e.g. when using remote shells

hyperv_console_switch

hyperv_console_switch($console, $nr)

On Hyper-V console switch from one console to another is not possible with the general 'Ctrl-Alt-Fx' binding as the combination is lost somewhere in VNC-to-RDP translation. For VT-to-VT switch we use 'Alt-Fx' binding, however this is not enough for X11-to-VT switch, which requires the missing 'Ctrl'. However, in X11 we can use `chvt` command to do the switch for us.

This is expected to be executed either from activate_console(), or from console_selected(), test variable CONSOLE_JUST_ACTIVATED works as a mutually exclusive lock.

Requires console name, an actual VT number nr is optional.

console_nr

console_nr($console)

Return console VT number with regards to it's name.

prompt_for_user

prompt_for_user($username)

Returns the shell prompt that should be set for the given username

get_console_info

get_console_info($console)

Returns a triplet describing the console: Session privilege level (root/user), username, console type.

activate_console

activate_console($console [, [ensure_tty_selected => 0|1] [, skip_set_standard_prompt => 0|1] [, skip_setterm => 0|1] [, timeout => $timeout]])

Callback whenever a console is selected for the first time. Accepts arguments provided to select_console().

skip_set_standard_prompt and skip_setterm arguments skip respective routines, e.g. if you want select_console() without addition console setup. Then, at some point, you should set it on your own.

Option ensure_tty_selected ensures TTY is selected.

timeout is set on the internal assert_screen call and can be set to configure a timeout value different than default.

console_selected

console_selected($console [, await_console => $await_console] [, tags => $tags ] [, ignore => $ignore ] [, timeout => $timeout ]);

Overrides select_console callback from testapi. Waits for console by calling assert_screen on tags, by default the name of the selected console.

await_console is set to 1 by default. Can be set to 0 to skip the check for the console. Call for example select_console('root-console', await_console = 0)> if there should be no checking for the console to be shown. Useful when the check should or must be test module specific.

ignore can be overridden to not check on certain consoles. By default the known uncheckable consoles are already ignored.

timeout is set on the internal assert_screen call and can be set to configure a timeout value different than default.