lib/version_utils.pm

VERSION_UTILS

SYNOPSIS

Contains all the functions related to version checking

is_jeos

Returns true if called on jeos

is_vmware

Returns true if called on vmware

is_krypton_argon

Returns true if called on krypton or argon

is_gnome_next

Returns true if called on Gnome-Live

is_installcheck

Returns true if 'INSTALLCHECK' is set

is_rescuesystem

Returns true if called on a rescue system

is_virtualization_server

Returns true if called on a virtualization server

is_livecd

Returns true if executed on a live cd

check_version

Usage: check_version('>15.0', get_var('VERSION'), '\d{2}') Query format: [= > < >= <=] version [+] (Example: <=12-sp3 =12-sp1 <4.0 >=15 3.0+) Check against: product version to check against - probably get_var('VERSION') Regex format: checks query version format (Example: /\d{2}\.\d/)#

is_microos

Check if distribution is openSUSE MicroOS with optional filter: Media type: DVD (iso) or VMX (all disk images) Version: Tumbleweed | 15.2 (Leap) Flavor: DVD | MS-HyperV | XEN | KVM-and-Xen | ..

is_leap_micro

Check if distribution is openSUSE Leap Micro

is_sle_micro

Check if distribution is SUSE Linux Enterprise Micro

is_micro

Check if distribution is any of MicroOS, Leap Micro or SL-Micro

is_alp

Check if distribution is ALP

is_selfinstall

Check if SLEM is in flavor of self installable iso

is_tumbleweed

Returns true if called on tumbleweed

is_slowroll

Returns true if called on slowroll

is_leap

Check if distribution is Leap with optional filter for: Version: <=42.2 =15.0 >15.0 >=42.3 15.0+

is_opensuse

Returns true if called on opensuse

is_sle

Check if distribution is SLE with optional filter for: Version: <=12-sp3 =12-sp1 >11-sp1 >=15 15+ (>=15 and 15+ are equivalent)

is_transactional

Returns true if called on a transactional server

is_sles4migration

Returns true if called in a migration scenario

is_sles4sap

Returns true if called in a SAP test

is_sles4sap_standard

Returns true if called in an SAP standard test

is_rt

Returns true if called on a real time system

is_hpc

Returns true if called in an HPC test

is_released

Returns true if called on a released build

is_staging

Returns true if called in staging

is_storage_ng

Returns true if storage_ng is used

is_upgrade

Returns true in upgrade scenarios

is_sle12_hdd_in_upgrade

Returns true if called in SLES12 upgrade scenario

is_desktop_installed

Returns true if a desktop is installed

is_system_upgrading

#TODO this should be documented

is_pre15

Returns if system is older than SLE or Leap 15

is_aarch64_uefi_boot_hdd

Returns true if system is aarch64 with uefi and shall boot an hdd image

is_server

Returns true if executed on a server pattern, SLES4SAP or SLES4MIGRATION

install_this_version

Returns true if INSTALL_TO_OTHERS is not set

install_to_other_at_least

Check the real version of the test machine is at least some value, rather than the VERSION variable It is for version checking for tests with variable "INSTALL_TO_OTHERS".

is_using_system_role

system_role selection during installation was added as a new feature since sles12sp2 so system_role.pm should be loaded for all tests that actually install to versions over sles12sp2 no matter with or without INSTALL_TO_OTHERS tag On SLE 15 SP0 we unconditionally have system roles screen SLE 15 SP1: * Has system roles only if more than one is available, meaning either registered or with all packages DVD; * RT Product has only one (minimal) role. On microos, leap 15.1+, TW we have it instead of desktop selection screen

is_using_system_role_first_flow

On leap 15.0 we have desktop selection first, and everywhere, where we have system roles

requires_role_selection

If there is only one role, there is no selection offered

has_product_selection

has_product_selection;

Identify cases when Installer has to show Product Selection screen.

Starting with SLE 15, all products are distributed using one medium, and Product to install has to be chosen explicitly.

Though, there are some exceptions (like s390x on Sle15 SP0) when there is only one Product, so that License agreement is shown directly, skipping the Product selection step. Also, Product Selection screen is not shown during upgrade. on SLE 15+, zVM preparation test shouldn't show Product Selection screen.

Returns true (1) if Product Selection step has to be shown for the certain configuration, otherwise returns false (0).

has_license_on_welcome_screen

has_license_on_welcome_screen;

Identify cases when License Agreement has to be shown on Welcome screen and should be accepted there.

Returns true (1) if License Agreement has to be shown on Welcome screen for the certain configuration, otherwise returns false (0).

has_license_to_accept

Returns true if the system has a license that needs to be accepted

uses_qa_net_hardware

Returns true if the SUT uses qa net hardware

get_os_release

Get SLE release version, service pack and distribution name info from any running sles os without any dependencies It parses the info from /etc/os-release file, which can reside in any physical host or virtual machine The file can also be placed anywhere as long as it can be reached somehow by its absolute file path, which should be passed in as the second argument os_release_file, for example, "/etc/os-release" At the same time, connection method to the entity in which the file reside should be passed in as the first argument go_to_target, for example, "ssh root at name or ip address" or "way to download the file" For use only on locahost, no argument needs to be specified

check_os_release

Identify running os without any dependencies parsing the /etc/os-release.

distri_name - The expected distribution name to compare.
line - The line we'll be parsing and checking.
go_to_target - Command connecting to the SUT
os_release_file - The full path to the Operating system identification file. Default to /etc/os-release.

Returns 1 (true) if the ID_LIKE variable contains distri_name.

verify_os_version

Returns 1 (true) if os release version matches the one passed as arguement. If no arguements are given, the function will compare the os release version in /etc/os-release file with "VERSION" var.

is_public_cloud

Returns true if PUBLIC_CLOUD is set to 1

is_openstack

Returns true if the tests loads Cloud image in OpenStack environment NO_CLOUD variable is set in order to test the image in QEMU

is_leap_migration

Returns true if called in a leap to sle migration scenario

is_tunneled

Returns true if TUNNELED is set to 1

is_bootloader_grub2

Returns true if the SUT uses GRUB2 as bootloader

is_bootloader_sdboot

Returns true if the SUT uses systemd-boot as bootloader

is_plasma6

Returns true if the SUT uses Plasma 6.

has_test_issues

Returns true if test issues are present (i.e. is update tests are present)

package_version_cmp

Compare two SUSE-style version strings. Returns an integer that is less than, equal to, or greater than zero if the first argument is less than, equal to, or greater than the second one, respectively.

is_quarterly_iso

Returns true if called in quarterly iso testing

get_version_id

get_version_id(dst_machine => 'machine')

Get SLES version from VERSION_ID in /etc/os-release. This subroutine also supports performing query on remote machine if dst_machine is given specific ip address or fqdn text of the remote machine. If dst_machine is given it will run on the remote as root. To run it as another user, dst_machine can be also specified as [user@]hostname.

The default location that contains VERSION_ID is file /etc/os-release if nothing else is passed in to argument verid_file.

is_community_jeos

Returns true for tests using the images built by the "JeOS" package on OBS