move logging in as a root into parent class

Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D440
This commit is contained in:
Garret Raziel 2015-07-15 07:00:47 +02:00
parent 2f20e8e103
commit 4abc1aecf2
4 changed files with 25 additions and 43 deletions

View file

@ -3,12 +3,14 @@ use base 'basetest';
use testapi;
sub post_fail_hook() {
sub login_as_root {
my $self = shift;
my $tty = shift || 1;
my $password = get_var("ROOT_PASSWORD", "weakpassword");
send_key "ctrl-alt-f2";
send_key "ctrl-alt-f$tty";
assert_screen "text_console_login", 20;
type_string "root";
send_key "ret";
assert_screen "console_password_required", 10;
@ -16,6 +18,19 @@ sub post_fail_hook() {
send_key "ret";
assert_screen "root_logged_in", 10;
}
sub boot_and_login {
my $self = shift;
wait_still_screen 10;
$self->login_as_root(3);
}
sub post_fail_hook {
my $self = shift;
$self->login_as_root(2);
# Upload all ABRT logs
type_string "cd /var/tmp/abrt && tar czvf abrt.tar.gz *";

View file

@ -2,23 +2,11 @@ use base "fedoralog";
use strict;
use testapi;
sub boot_and_login {
wait_still_screen 10;
my $password = get_var("ROOT_PASSWORD", "weakpassword");
send_key "ctrl-alt-f3";
assert_screen "text_console_login", 20;
type_string "root";
send_key "ret";
assert_screen "console_password_required", 10;
type_string $password;
send_key "ret";
assert_screen "root_logged_in", 10;
}
sub run {
boot_and_login();
my $self = shift;
$self->boot_and_login();
assert_screen "console_f22_installed";
}

View file

@ -2,23 +2,10 @@ use base "fedoralog";
use strict;
use testapi;
sub boot_and_login {
wait_still_screen 10;
my $password = get_var("ROOT_PASSWORD", "weakpassword");
send_key "ctrl-alt-f3";
assert_screen "text_console_login", 20;
type_string "root";
send_key "ret";
assert_screen "console_password_required", 10;
type_string $password;
send_key "ret";
assert_screen "root_logged_in", 10;
}
sub run {
boot_and_login();
my $self = shift;
$self->boot_and_login();
type_string 'yum -y update; echo $?';
send_key "ret";
@ -28,7 +15,7 @@ sub run {
type_string "reboot";
send_key "ret";
boot_and_login();
$self->boot_and_login();
type_string 'yum -y install fedup; echo $?';
send_key "ret";

View file

@ -28,15 +28,7 @@ sub run {
assert_screen "grub_fedup", 30;
send_key "ret";
my $counter = 0;
while (!check_screen ("text_console_login", 10) && $counter < 180) {
if (check_screen "tmp_failed_proc", 1) {
send_key "ctrl-alt-delete";
}
$counter++;
}
assert_screen "text_console_login", 10;
assert_screen "text_console_login", 6000;
}