1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-11-25 07:13:09 +00:00

Add new testcases and methods for release identification.

This commit is contained in:
Lukas Ruzicka 2019-05-16 15:01:52 +02:00 committed by Adam Williamson
parent b31422d188
commit d06b30e8dc
63 changed files with 878 additions and 13 deletions

View File

@ -7,7 +7,7 @@ use Exporter;
use lockapi; use lockapi;
use testapi; use testapi;
our @EXPORT = qw/run_with_error_check type_safely type_very_safely desktop_vt boot_to_login_screen console_login console_switch_layout desktop_switch_layout console_loadkeys_us do_bootloader boot_decrypt check_release menu_launch_type start_cockpit repo_setup gnome_initial_setup anaconda_create_user check_desktop_clean download_modularity_tests quit_firefox advisory_get_installed_packages advisory_check_nonmatching_packages start_with_launcher quit_with_shortcut lo_dismiss_tip disable_firefox_studies select_rescue_mode copy_devcdrom_as_isofile bypass_1691487 get_release_number _assert_and_click click_unwanted_notifications/; our @EXPORT = qw/run_with_error_check type_safely type_very_safely desktop_vt boot_to_login_screen console_login console_switch_layout desktop_switch_layout console_loadkeys_us do_bootloader boot_decrypt check_release menu_launch_type start_cockpit repo_setup gnome_initial_setup anaconda_create_user check_desktop_clean download_modularity_tests quit_firefox advisory_get_installed_packages advisory_check_nonmatching_packages start_with_launcher quit_with_shortcut lo_dismiss_tip disable_firefox_studies select_rescue_mode copy_devcdrom_as_isofile bypass_1691487 get_release_number check_left_bar check_top_bar check_prerelease check_version spell_version_number _assert_and_click is_branched rec_log click_unwanted_notifications/;
sub run_with_error_check { sub run_with_error_check {
my ($func, $error_screen) = @_; my ($func, $error_screen) = @_;
@ -684,12 +684,12 @@ sub start_with_launcher {
# $launcher holds the launcher needle, but some of the apps are hidden in a submenu # $launcher holds the launcher needle, but some of the apps are hidden in a submenu
# so this must be handled first to find the launcher needle. # so this must be handled first to find the launcher needle.
my ($launcher,$submenu,$group) = @_; my ($launcher,$submenu,$group) = @_;
$submenu //= ''; $submenu //= '';
$group //= ''; $group //= '';
my $desktop = get_var('DESKTOP'); my $desktop = get_var('DESKTOP');
my $item_to_check = $submenu || $launcher; my $item_to_check = $submenu || $launcher;
# The following varies for different desktops. # The following varies for different desktops.
if ($desktop eq 'gnome') { if ($desktop eq 'gnome') {
@ -701,7 +701,7 @@ sub start_with_launcher {
assert_and_click 'overview_app_grid'; assert_and_click 'overview_app_grid';
wait_still_screen 5; wait_still_screen 5;
# Find the application launcher in the current menu page. # Find the application launcher in the current menu page.
# If it cannot be found there, hit PageDown to go to another page. # If it cannot be found there, hit PageDown to go to another page.
send_key_until_needlematch($item_to_check, 'pgdn', 5, 3); send_key_until_needlematch($item_to_check, 'pgdn', 5, 3);
@ -719,17 +719,17 @@ sub start_with_launcher {
# Click on the KDE launcher icon # Click on the KDE launcher icon
assert_and_click 'kde_menu_launcher'; assert_and_click 'kde_menu_launcher';
wait_still_screen 2; wait_still_screen 2;
# Select the appropriate submenu # Select the appropriate submenu
assert_and_click $submenu; assert_and_click $submenu;
wait_still_screen 2; wait_still_screen 2;
# Select the appropriate menu subgroup where real launchers # Select the appropriate menu subgroup where real launchers
# are placed, but only if requested # are placed, but only if requested
if ($group) { if ($group) {
send_key_until_needlematch($group, 'down', 20, 3); send_key_until_needlematch($group, 'down', 20, 3);
send_key 'ret'; send_key 'ret';
#assert_and_click $group; #assert_and_click $group;
wait_still_screen 2; wait_still_screen 2;
} }
@ -737,7 +737,7 @@ sub start_with_launcher {
send_key_until_needlematch($launcher, 'down', 40, 3); send_key_until_needlematch($launcher, 'down', 40, 3);
send_key 'ret'; send_key 'ret';
wait_still_screen 5; wait_still_screen 5;
} }
} }
@ -749,7 +749,6 @@ sub quit_with_shortcut {
} }
sub lo_dismiss_tip { sub lo_dismiss_tip {
# identify and close a 'tip of the day' window that shows on start # identify and close a 'tip of the day' window that shows on start
# of all LibreOffice apps. For the 'app startup' tests. # of all LibreOffice apps. For the 'app startup' tests.
@ -903,6 +902,82 @@ sub get_release_number {
my $rawrel = get_var("RAWREL", "Rawhide"); my $rawrel = get_var("RAWREL", "Rawhide");
return $rawrel if ($version eq "Rawhide"); return $rawrel if ($version eq "Rawhide");
return $version return $version
}
sub tell_source {
# This helper function identifies the Subvariant of the tested system.
# For the purposes of identification testing, we are only interested
# if the system is Workstation, Server, or something else, because,
# except Workstation and Server, there are no graphical differences
# between various spins and isos.
my $iso = get_var('SUBVARIANT');
if ($iso eq 'Workstation' or $iso eq 'Server') {
$iso = lc($iso);
}
elsif ($iso eq 'AtomicHost') {
$iso = 'atomic';
}
else {
$iso = 'generic';
}
return $iso;
}
sub check_left_bar {
# This method is used by identification tests to check whether the Anaconda
# bar on the left side of the screen corresponds with the correct version.
# It looks different for Server, Workstation and others.
my $source = tell_source;
assert_screen "leftbar_${source}";
}
sub check_top_bar {
# This method is used by identification tests to check whether the
# top bar in Anaconda corresponds with the correct version of the spin.
my $source = tell_source;
assert_screen "topbar_${source}";
}
sub check_prerelease {
# This method is used by identification tests to check if
# Anaconda shows the PRERELEASE info for Rawhide versions.
# As it seems, the rules for showing the PRERELEASE are not
# as simple as it may look like. It seems to me, that the PRERELEASE
# is shown on Rawhide intallations, which is pretty easy to test because
# the "VERSION" variable is Rawhide. On Final RC, the PRERELEASE should
# be turned off, while it should be present between before that.
# When Fedora is branched, the "VERSION" changes to the version number
# and this is not changed even with Final, so we cannot test that.
# Investigating the history, I noticed that all nightly builds have
# that prerelease turned on. And also, it is there on a Beta candidate.
# We can test for that.
my $beta = get_var('ISO');
my $nightly = get_var('BUILD');
my $version = get_var('VERSION');
# Let us see if the installed system is one that needs to have the prerelease
# note shown, default is NO.
my $prerelease = 0;
if ($beta =~ /Beta/ or $version eq "Rawhide") {
$prerelease = 1;
}
# If the image is a nightly build or test build, it is not clear whether
# the prerelease should be there or not, but according to what we decided
# this is not a big issue. This piece of code can be used later, when
# we decide differently.
elsif ($nightly =~ /\.[nt]\.\d+/) {
my $prerelease = 10;
}
# For all prerelease requiring ISOs, assert that prerelease is there.
if ($prerelease == 1) {
assert_screen "prerelease_note";
}
elsif ($prerelease == 0) {
# If the prerelease note is shown, where it should not be, die!
if (check_screen "prerelease_note") {
die "The PRERELEASE tag is shown, but it should NOT be.";
}
}
} }
sub _assert_and_click { sub _assert_and_click {
@ -925,6 +1000,69 @@ sub _assert_and_click {
} }
} }
sub check_version {
# This function checks if the correct version is display during installation
# in Anaconda, i.e. nonlive media showing Rawhide when Rawhide and version numbers
# when not Rawhide, while live media always showing version numbers.
my $version = lc(get_var('VERSION'));
if ($version eq 'rawhide' && get_var('LIVE')) {
$version = get_var('RAWREL');
}
assert_screen "version_${version}_ident";
}
sub spell_version_number {
my $version = shift;
my %ones = (
"0" => "Zero",
"1" => "One",
"2" => "Two",
"3" => "Three",
"4" => "Four",
"5" => "Five",
"6" => "Six",
"7" => "Seven",
"8" => "Eight",
"9" => "Nine",
);
my %tens = (
"2" => "Twenty",
"3" => "Thirty",
"4" => "Fourty",
"5" => "Fifty",
"6" => "Sixty",
"7" => "Seventy",
"8" => "Eighty",
"9" => "Ninety",
);
my $ten = substr($version, 0, 1);
my $one = substr($version, 1, 1);
my $speltnum = "";
if ($one eq "0") {
$speltnum = "$tens{$ten}";
}
else {
$speltnum = "$tens{$ten} $ones{$one}";
}
return $speltnum;
}
sub rec_log {
my ($line, $condition, $failref) = @_;
if ($condition) {
$line = "${line} - SUCCEEDED\n";
}
else {
push @$failref, $line;
$line = "${line} - FAILED\n";
}
my $file = "/tmp/os-release.log";
script_run "echo \"$line\" >> $file";
}
sub click_unwanted_notifications { sub click_unwanted_notifications {
# there are a few KDE tests where at some point we want to click # there are a few KDE tests where at some point we want to click
# on all visible 'update available' notifications (there can be # on all visible 'update available' notifications (there can be

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 838,
"ypos": 663,
"width": 163,
"height": 51,
"type": "match"
}
],
"properties": [],
"tags": [
"30_wallpaper"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 607 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 847,
"ypos": 722,
"width": 163,
"height": 38,
"type": "match"
}
],
"properties": [],
"tags": [
"30_wallpaper"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 604 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 838,
"ypos": 663,
"width": 163,
"height": 51,
"type": "match"
}
],
"properties": [],
"tags": [
"31_wallpaper"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 607 KiB

View File

@ -0,0 +1,16 @@
{
"area": [
{
"xpos": 847,
"ypos": 722,
"width": 163,
"height": 38,
"type": "match"
}
],
"properties": [],
"tags": [
"31_wallpaper",
"Rawhide_wallpaper"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 604 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"type": "match",
"height": 743,
"ypos": 15,
"width": 123,
"xpos": 16
}
],
"properties": [],
"tags": [
"leftbar_atomic"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"height": 723,
"width": 123,
"ypos": 4,
"xpos": 15,
"type": "match"
}
],
"properties": [],
"tags": [
"leftbar_generic"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

View File

@ -0,0 +1,15 @@
{
"properties": [],
"tags": [
"leftbar_generic"
],
"area": [
{
"xpos": 14,
"ypos": 15,
"width": 123,
"height": 728,
"type": "match"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

View File

@ -0,0 +1,15 @@
{
"properties": [],
"tags": [
"leftbar_server"
],
"area": [
{
"xpos": 9,
"ypos": 10,
"width": 134,
"height": 747,
"type": "match"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

View File

@ -0,0 +1,15 @@
{
"properties": [],
"tags": [
"leftbar_workstation"
],
"area": [
{
"xpos": 9,
"ypos": 44,
"width": 139,
"height": 701,
"type": "match"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

View File

@ -0,0 +1,15 @@
{
"properties": [],
"tags": [
"prerelease_note"
],
"area": [
{
"xpos": 740,
"ypos": 34,
"width": 159,
"height": 27,
"type": "match"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 780,
"ypos": 33,
"width": 159,
"height": 26,
"type": "match"
}
],
"properties": [],
"tags": [
"prerelease_note"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 738,
"ypos": 33,
"width": 159,
"height": 26,
"type": "match"
}
],
"properties": [],
"tags": [
"prerelease_note"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"width": 683,
"height": 32,
"ypos": 39,
"xpos": 104,
"type": "match"
}
],
"properties": [],
"tags": [
"topbar_generic"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 104,
"ypos": 39,
"width": 683,
"height": 32,
"type": "match"
}
],
"properties": [],
"tags": [
"topbar_atomic"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

View File

@ -0,0 +1,15 @@
{
"properties": [],
"tags": [
"topbar_generic"
],
"area": [
{
"xpos": 93,
"ypos": 49,
"width": 643,
"height": 34,
"type": "match"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

View File

@ -0,0 +1,15 @@
{
"properties": [],
"tags": [
"topbar_generic"
],
"area": [
{
"xpos": 105,
"ypos": 38,
"width": 683,
"height": 32,
"type": "match"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

View File

@ -0,0 +1,15 @@
{
"properties": [],
"tags": [
"topbar_server"
],
"area": [
{
"xpos": 106,
"ypos": 43,
"width": 625,
"height": 36,
"type": "match"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"width": 638,
"xpos": 92,
"type": "match",
"ypos": 37,
"height": 38
}
],
"properties": [],
"tags": [
"topbar_workstation"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

View File

@ -0,0 +1,15 @@
{
"properties": [],
"tags": [
"topbar_workstation"
],
"area": [
{
"xpos": 95,
"ypos": 69,
"width": 675,
"height": 38,
"type": "match"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 796,
"height": 31,
"width": 93,
"ypos": 39,
"type": "match"
}
],
"properties": [],
"tags": [
"version_29_ident"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 797,
"ypos": 12,
"width": 93,
"height": 31,
"type": "match"
}
],
"properties": [],
"tags": [
"version_29_ident"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 796,
"ypos": 40,
"width": 93,
"height": 32,
"type": "match"
}
],
"properties": [],
"tags": [
"version_30_ident"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 797,
"ypos": 39,
"width": 93,
"height": 32,
"type": "match"
}
],
"properties": [],
"tags": [
"version_30_ident"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 783,
"ypos": 40,
"width": 90,
"height": 20,
"type": "match"
}
],
"properties": [],
"tags": [
"version_31_ident"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 783,
"ypos": 41,
"width": 90,
"height": 18,
"type": "match"
}
],
"properties": [],
"tags": [
"version_31_ident"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 740,
"ypos": 14,
"width": 147,
"height": 16,
"type": "match"
}
],
"properties": [],
"tags": [
"version_rawhide_ident"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 740,
"ypos": 12,
"width": 148,
"height": 19,
"type": "match"
}
],
"properties": [],
"tags": [
"version_rawhide_ident"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

View File

@ -1,5 +1,6 @@
#!/usr/share/openqa/script/load_templates #!/usr/share/openqa/script/load_templates
# #
#
# Fedora Machines, Products, TestSuites and JobTemplates # Fedora Machines, Products, TestSuites and JobTemplates
# #
# use load_templates to load the file into the database # use load_templates to load the file into the database
@ -17,6 +18,17 @@
}, },
test_suite => { name => "install_default_upload" }, test_suite => { name => "install_default_upload" },
}, },
{
machine => { name => "64bit" },
prio => 50,
product => {
arch => "x86_64",
distri => "fedora",
flavor => "Workstation-live-iso",
version => "*",
},
test_suite => { name => "release_identification" },
},
{ {
machine => { name => "uefi" }, machine => { name => "uefi" },
prio => 11, prio => 11,
@ -72,6 +84,17 @@
}, },
test_suite => { name => "install_default_upload" }, test_suite => { name => "install_default_upload" },
}, },
{
machine => { name => "64bit" },
prio => 50,
product => {
arch => "x86_64",
distri => "fedora",
flavor => "Server-dvd-iso",
version => "*",
},
test_suite => { name => "release_identification" },
},
{ {
machine => { name => "uefi" }, machine => { name => "uefi" },
prio => 11, prio => 11,
@ -160,6 +183,17 @@
}, },
test_suite => { name => "install_default_upload" }, test_suite => { name => "install_default_upload" },
}, },
{
machine => { name => "64bit" },
prio => 50,
product => {
arch => "x86_64",
distri => "fedora",
flavor => "KDE-live-iso",
version => "*",
},
test_suite => { name => "release_identification" },
},
{ {
machine => { name => "uefi" }, machine => { name => "uefi" },
prio => 16, prio => 16,
@ -204,6 +238,17 @@
}, },
test_suite => { name => "install_default_upload" }, test_suite => { name => "install_default_upload" },
}, },
{
machine => { name => "64bit" },
prio => 50,
product => {
arch => "x86_64",
distri => "fedora",
flavor => "Silverblue-dvd_ostree-iso",
version => "*",
},
test_suite => { name => "release_identification" },
},
{ {
machine => { name => "uefi" }, machine => { name => "uefi" },
prio => 51, prio => 51,
@ -4120,6 +4165,7 @@
settings => [ settings => [
{ key => "PACKAGE_SET", value => "default" }, { key => "PACKAGE_SET", value => "default" },
{ key => "POSTINSTALL", value => "_collect_data" }, { key => "POSTINSTALL", value => "_collect_data" },
{ key => "IDENTIFICATION", value => "true" },
], ],
}, },
{ {
@ -5073,6 +5119,16 @@
{ key => "STARTSTOP", value => "true" }, { key => "STARTSTOP", value => "true" },
], ],
}, },
{
name => "release_identification",
settings => [
{ key => "START_AFTER_TEST", value => "install_default_upload" },
{ key => "BOOTFROM", value => "c" },
{ key => "HDD_1", value => "disk_%FLAVOR%_%MACHINE%.qcow2" },
{ key => "ENTRYPOINT", value => "text_login_gui fedora_release os_release" },
{ key => "USER_LOGIN", value => "false" },
],
},
{ {
name => "desktop_notifications_live", name => "desktop_notifications_live",
settings => [ settings => [

View File

@ -39,6 +39,8 @@ sub run {
# call do_bootloader with postinstall=0, the params, and the mutex # call do_bootloader with postinstall=0, the params, and the mutex
do_bootloader(postinstall=>0, params=>$params, mutex=>$mutex); do_bootloader(postinstall=>0, params=>$params, mutex=>$mutex);
# Read variables for identification tests (see further).
my $identification = get_var('IDENTIFICATION');
# proceed to installer # proceed to installer
if (get_var("KICKSTART")) { if (get_var("KICKSTART")) {
# wait for the bootloader *here* - in a test that inherits from # wait for the bootloader *here* - in a test that inherits from
@ -53,7 +55,8 @@ sub run {
type_string "2\n"; type_string "2\n";
# wait for text version of Anaconda main hub # wait for text version of Anaconda main hub
assert_screen "anaconda_main_hub_text", 300; assert_screen "anaconda_main_hub_text", 300;
} else { }
else {
# on lives, we have to explicitly launch anaconda # on lives, we have to explicitly launch anaconda
if (get_var('LIVE')) { if (get_var('LIVE')) {
_assert_and_click("live_start_anaconda_icon", timeout=>300); _assert_and_click("live_start_anaconda_icon", timeout=>300);
@ -85,6 +88,16 @@ sub run {
return; return;
} }
} }
# If we want to test self identification, in the test suite
# we set "identification" to "true".
# Here, we will watch for the graphical elements in Anaconda main hub.
my $branched = get_var('VERSION');
if ($identification eq 'true' or $branched ne "Rawhide") {
check_left_bar(); # See utils.pm
check_prerelease();
check_version();
}
# This is where we get to if we accepted fate above, *or* # This is where we get to if we accepted fate above, *or*
# didn't match anything: if the Rawhide warning didn't # didn't match anything: if the Rawhide warning didn't
# show by now it never will, so we'll just wait for the # show by now it never will, so we'll just wait for the
@ -94,7 +107,6 @@ sub run {
} }
} }
sub test_flags { sub test_flags {
return { fatal => 1 }; return { fatal => 1 };
} }

View File

@ -40,6 +40,12 @@ sub _set_root_password {
wait_screen_change { send_key "tab"; }; wait_screen_change { send_key "tab"; };
type_very_safely $root_password; type_very_safely $root_password;
} }
# Another screen to test identification on
my $identification = get_var('IDENTIFICATION');
if ($identification eq 'true') {
check_top_bar();
check_prerelease();
}
assert_and_click "anaconda_spoke_done"; assert_and_click "anaconda_spoke_done";
} }
} }
@ -73,6 +79,19 @@ sub run {
# more. So wait for screen to stop moving before we click. # more. So wait for screen to stop moving before we click.
wait_still_screen 2; wait_still_screen 2;
assert_and_click "anaconda_main_hub_begin_installation"; assert_and_click "anaconda_main_hub_begin_installation";
# If we want to test identification we will do it
# on several places in this procedure, such as
# on this screen and also on password creation screens
# etc.
my $identification = get_var('IDENTIFICATION');
my $branched = get_var('VERSION');
if ($identification eq 'true' or $branched ne "Rawhide") {
check_left_bar();
check_prerelease();
check_version();
}
unless ($rootuserdone) { unless ($rootuserdone) {
_do_root_and_user(); _do_root_and_user();
# With the slow typing - especially with SWITCHED_LAYOUT - we # With the slow typing - especially with SWITCHED_LAYOUT - we

View File

@ -84,6 +84,12 @@ sub run {
mouse_set(300, 800); mouse_set(300, 800);
# KDE can take ages to start up # KDE can take ages to start up
check_desktop_clean(tries=>40); check_desktop_clean(tries=>40);
# If we want to check that there is a correct wallpaper used, as a part
# of self identification test, we will do it here.
if (get_var('IDENTIFICATION') eq 'true') {
my $version = get_var('VERSION');
assert_screen "${version}_wallpaper";
}
} }
sub test_flags { sub test_flags {

View File

@ -2,9 +2,13 @@ use base "anacondatest";
use strict; use strict;
use testapi; use testapi;
use anaconda; use anaconda;
use utils;
sub run { sub run {
my $self = shift; my $self = shift;
# If we want to test graphics during installation, we need to
# call the test suite with an "IDENTIFICATION=true" variable.
my $identification = get_var('IDENTIFICATION');
# Anaconda hub # Anaconda hub
# Go to INSTALLATION DESTINATION and ensure one disk is selected. # Go to INSTALLATION DESTINATION and ensure one disk is selected.
select_disks(); select_disks();
@ -14,6 +18,13 @@ sub run {
if (get_var('TEST_UPDATES')){ if (get_var('TEST_UPDATES')){
assert_screen "anaconda_install_destination_updates", 30; assert_screen "anaconda_install_destination_updates", 30;
} }
# Here the self identification test code is placed.
my $branched = get_var('VERSION');
if ($identification eq 'true' or $branched ne "Rawhide") {
check_top_bar(); # See utils.pm
check_prerelease();
check_version();
}
assert_and_click "anaconda_spoke_done"; assert_and_click "anaconda_spoke_done";

59
tests/fedora_release.pm Normal file
View File

@ -0,0 +1,59 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This test checks that Fedora release is correctly described in /etc/fedora-release file.
# The content of the file should be: "Fedora release <version> (<version_words>)"
# where "version" is a number of the current Fedora version and "version_words" is the number
# quoted in words, such as 31 = Thirty One.
# Before branching, the parenthesis contain the word "Rawhide".
sub run {
# First, let us define some variables needed to run the program.
my $self = shift;
# The file to be checked
my $filename = '/etc/fedora-release';
# Version as defined in the RAWREL and VERSION variables. We need both values, because the release
# string can be a combination of those two.
my $version = get_var('VERSION');
my $raw_version = get_var('RAWREL');
# Read the content of the file to compare.
my $line = script_output('cat /etc/fedora-release');
chomp $line;
# Create a spelt form of the version number.
my $speltnum = "undefined";
if ($version eq "Rawhide") {
$speltnum = "Rawhide";
$version = $raw_version;
}
else {
$speltnum = spell_version_number($version);
}
# Create the ideal content of the release file
# and compare it with its real counterpart.
# Everything is ok, when that matches, otherwise
# the script fails.
my $releasenote = "Fedora release $version ($speltnum)";
my $log = "fedora-release.log";
if ($releasenote eq $line) {
rec_log $log, "The content in /etc/fedora-release should be $releasenote and is $line: PASSED";
upload_logs "/tmp/fedora-release.log", failok=> 1;
}
else {
rec_log $log, "The content in /etc/fedora-release should be $releasenote but is $line: FAILED";
upload_logs "/tmp/fedora-release.log", failok=> 1;
die "The content in /etc/fedora-release should be $releasenote but is $line.";
}
}
sub test_flags {
return {always_rollback => 1};
}
1;
# vim: set sw=4 et:

141
tests/os_release.pm Normal file
View File

@ -0,0 +1,141 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This test checks that the descriptions in /etc/os-release file are correct and that they
# match the current version.
sub strip_marks {
# Remove the quotation marks from the string:
my $string = shift;
$string=~ tr/"//d;
return $string;
}
sub run {
# First, let us define some variables needed to run the program.
my $self = shift;
# The file to be checked
my $filename = '/etc/os-release';
# Read the content of the file to compare. Let us parse the file
# and create a hash with those values, so that we can easily access
# them and assert them.
my $infile = script_output "cat /etc/os-release";
my @infile = split /\n/, $infile;
my %content = ();
foreach (@infile) {
chomp $_;
my ($key, $value) = split /=/, $_;
$content{$key} = $value;
}
# Now, we have all the data ready and we can start testing, first let us get
# correct variables to compare the system data with.
# First, we know the basic stuff
my $id = get_var("DISTRI"); # Should be "fedora"
my $name = ucfirst($id);
my $version_id = get_var("VERSION"); # Should be the version number or Rawhide.
my $target = lc($version_id);
if ($version_id eq "Rawhide") {
$version_id = get_var("RAWREL");
}
# the 'generic' os-release in fedora-release has no VARIANT or
# VARIANT_ID and the string used in values like VERSION, that in other
# cases is the VARIANT, is 'Rawhide' for Rawhide and the spelt version
# number for other releases. These are the values we'll see for an
# Everything image.
my $variant_id = "";
my $variant = "generic";
my $varstr = "Rawhide";
$varstr = spell_version_number($version_id) unless ($target eq 'rawhide');
# now replace the values with the correct ones if we are testing a
# subvariant that maps to a known variant
my $subvariant = get_var('SUBVARIANT');
my %variants = (
Server => ["server", "Server Edition"],
Workstation => ["workstation", "Workstation Edition"],
AtomicHost => ["atomic.host", "Atomic Host"],
CoreOS => ["coreos", "CoreOS"],
KDE => ["kde", "KDE Plasma"],
Silverblue => ["workstation", "Workstation Edition"],
);
if (exists($variants{$subvariant})) {
($variant_id, $variant) = @{$variants{$subvariant}};
$varstr = $variant;
}
my $version = "$version_id ($varstr)";
my $platform_id = "platform:f$version_id";
my $pretty = "$name $version_id ($varstr)";
#Now. we can start testing the real values from the installed system.
my @fails = ();
my $failref =\@fails;
# Test for name
rec_log "NAME should be $name and is $content{'NAME'}", $content{'NAME'} eq $name, $failref;
# Test for version.
my $strip = strip_marks($content{'VERSION'});
rec_log "VERSION should be $version and is $strip", $strip eq $version, $failref;
# Test for version_id
rec_log "VERSION_ID should be $version_id and is $content{'VERSION_ID'}", $content{'VERSION_ID'} eq $version_id, $failref;
# Test for platform_id
$strip = strip_marks($content{'PLATFORM_ID'});
rec_log "PLATFORM_ID should be $platform_id and is $strip", $strip eq $platform_id, $failref;
# Test for pretty name
$strip = strip_marks($content{'PRETTY_NAME'});
rec_log "PRETTY_NAME should be $pretty and is $strip", $strip eq $pretty, $failref;
# Test for RH Bugzilla Product
$strip = strip_marks($content{'REDHAT_BUGZILLA_PRODUCT'});
rec_log "REDHAT_BUGZILLA_PRODUCT should be $name and is $strip", $strip eq $name, $failref;
# Test for RH Bugzilla Product Version
rec_log "REDHAT_BUGZILLA_PRODUCT_VERSION should be $target and is $content{'REDHAT_BUGZILLA_PRODUCT_VERSION'}", $content{'REDHAT_BUGZILLA_PRODUCT_VERSION'} eq $target, $failref;
# Test for RH Support Product
$strip = strip_marks($content{'REDHAT_SUPPORT_PRODUCT'});
rec_log "REDHAT_SUPPORT_PRODUCT should be $name and is $strip", $strip eq $name, $failref;
# Test for RH Support Product Version
rec_log "REDHAT_SUPPORT_PRODUCT_VERSION should be $target and is $content{'REDHAT_SUPPORT_PRODUCT_VERSION'}", $content{'REDHAT_SUPPORT_PRODUCT_VERSION'} eq $target, $failref;
# Test for Variant but only in case of Server or Workstation
if ($variant ne "generic") {
$strip = strip_marks($content{'VARIANT'});
rec_log "VARIANT should be $variant and is $strip", $strip eq $variant, $failref;
# Test for VARIANT_ID
rec_log "VARIANT_ID should be $variant_id and is $content{'VARIANT_ID'}", $content{'VARIANT_ID'} eq $variant_id, $failref;
}
else {
print "VARIANT was not tested because the compose is not Workstation or Server Edition.\n";
print "VARIANT_ID was not tested because the compose is not Workstation or Server Edition.\n";
}
# Check for fails, count them, collect their messages and die if something was found.
my $failcount = scalar @fails;
script_run "echo \"There were $failcount failures in total.\" >> /tmp/os-release.log";
upload_logs "/tmp/os-release.log", failok=>1;
my $failmessages = "";
foreach my $fail (@fails) {
$failmessages .= "\n".$fail;
}
die $failmessages if ($failcount > 0);
}
sub test_flags {
return {always_rollback => 1};
}
1;
# vim: set sw=4 et:

17
tests/text_login_gui.pm Normal file
View File

@ -0,0 +1,17 @@
use base "installedtest";
use strict;
use testapi;
use utils;
sub run {
my $self = shift;
boot_to_login_screen(timeout => 300);
$self->root_console(tty=>3);
}
sub test_flags {
return { fatal => 1, milestone => 1 };
}
1;
# vim: set sw=4 et: