forked from os-autoinst/os-autoinst-distri-opensuse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_common.pm
3010 lines (2776 loc) · 113 KB
/
main_common.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# SUSE's openQA tests
#
# Copyright 2018-2021 SUSE LLC
# SPDX-License-Identifier: FSFAP
# Summary: Attempt to merge common parts of sle/main.pm and opensuse/main.pm
# Maintainer: qe-core@suse.de
package main_common;
use base Exporter;
use File::Basename;
use File::Find;
use Exporter;
use testapi qw(check_var get_var get_required_var set_var check_var_array get_var_array diag);
use autotest;
use utils;
use wicked::TestContext;
use Utils::Architectures;
use version_utils qw(:VERSION :BACKEND :SCENARIO is_community_jeos is_public_cloud);
use Utils::Backends;
use data_integrity_utils 'verify_checksum';
use bmwqemu ();
use lockapi 'barrier_create';
use Carp 'croak';
use strict;
use warnings;
our @EXPORT = qw(
any_desktop_is_applicable
bootencryptstep_is_applicable
boot_hdd_image
check_env
chromestep_is_applicable
chromiumstep_is_applicable
consolestep_is_applicable
default_desktop
gnomestep_is_applicable
guiupdates_is_applicable
have_scc_repos
init_main
installyaststep_is_applicable
installzdupstep_is_applicable
is_desktop
is_kernel_test
is_ltp_test
is_systemd_test
is_livesystem
is_memtest
is_memtest
is_repo_replacement_required
is_server
is_sles4sap
is_sles4sap_standard
is_updates_test_repo
is_updates_tests
is_migration_tests
kdestep_is_applicable
kdump_is_applicable
load_autoyast_clone_tests
load_autoyast_tests
load_ayinst_tests
load_bootloader_s390x
load_boot_tests
load_common_installation_steps_tests
load_common_opensuse_sle_tests
load_common_x11
load_consoletests
load_create_hdd_tests
load_extra_tests
load_extra_tests_prepare
load_inst_tests
load_iso_in_external_tests
load_jeos_tests
load_kernel_baremetal_tests
load_nfs_tests
load_nfv_master_tests
load_nfv_trafficgen_tests
load_public_cloud_patterns_validation_tests
load_transactional_role_tests
load_reboot_tests
load_rescuecd_tests
load_rollback_tests
load_applicationstests
load_mitigation_tests
load_vt_perf_tests
load_shutdown_tests
load_slepos_tests
load_sles4sap_tests
load_ha_cluster_tests
load_ssh_key_import_tests
load_svirt_boot_tests
load_svirt_vm_setup_tests
load_system_update_tests
loadtest
load_testdir
load_virtualization_tests
load_x11tests
load_hypervisor_tests
load_yast2_gui_tests
load_zdup_tests
logcurrentenv
map_incidents_to_repo
join_incidents_to_repo
need_clear_repos
noupdatestep_is_applicable
opensuse_welcome_applicable
remove_common_needles
remove_desktop_needles
replace_opensuse_repos_tests
rescuecdstep_is_applicable
set_defaults_for_username_and_password
set_mu_virt_vars
setup_env
snapper_is_applicable
ssh_key_import
unregister_needle_tags
updates_is_applicable
we_is_applicable
load_extra_tests_y2uitest_gui
load_extra_tests_kernel
load_wicked_create_hdd
load_jeos_openstack_tests
load_upstream_systemd_tests
);
sub init_main {
set_defaults_for_username_and_password();
setup_env();
check_env();
# We need to check image only for qemu backend, for svirt we validate image
# after it is copied to the hypervisor host.
if (is_qemu && data_integrity_is_applicable()) {
my $errors = verify_checksum();
set_var('CHECKSUM_FAILED', $errors) if $errors;
}
}
sub loadtest {
my ($test, %args) = @_;
autotest::loadtest('tests/' . ($test =~ /\.p[my]$/ ? $test : "$test.pm"), %args);
}
sub load_testdir {
my ($testsuite) = @_;
my $testdir = testapi::get_required_var('CASEDIR') . "/tests/$testsuite";
map { loadtest "$testsuite/" . basename($_, '.pm') } glob("$testdir/*.pm");
}
sub set_defaults_for_username_and_password {
if (get_var("LIVETEST")) {
$testapi::username = "root";
$testapi::password = '';
}
else {
if (get_var('FLAVOR', '') =~ /SAP/ or get_var('SLE_PRODUCT', '') =~ /sles4sap/) {
$testapi::username = "root"; #in sles4sap only root user created
}
else {
$testapi::username = "bernhard";
}
$testapi::password = "nots3cr3t";
}
$testapi::username = get_var("USERNAME") if get_var("USERNAME");
$testapi::password = get_var("PASSWORD") if defined get_var("PASSWORD");
if (get_var("LIVETEST") && (get_var("LIVECD") || get_var("PROMO"))) {
$testapi::username = "linux"; # LiveCD account
$testapi::password = "";
}
}
sub setup_env {
# Tests currently rely on INSTLANG=en_US, so set it by default
unless (get_var('INSTLANG')) {
set_var('INSTLANG', 'en_US');
}
set_var('LTP_KNOWN_ISSUES', 'https://raw.githubusercontent.com/openSUSE/kernel-qe/main/ltp_known_issues.yaml') if is_opensuse and !get_var('LTP_KNOWN_ISSUES');
# By default format DASD devices before installation
if (is_backend_s390x) {
# Format DASD before the installation by default
# Skip format dasd before origin system installation by autoyast in 'Upgrade on zVM'
# due to channel not activation issue. Need further investigation on it.
# Also do not format if activate existing partitions
my $format_dasd = get_var('S390_DISK') || get_var('UPGRADE') || get_var('ENCRYPT_ACTIVATE_EXISTING') ? 'never' : 'pre_install';
set_var('FORMAT_DASD', get_var('FORMAT_DASD', $format_dasd));
}
# This is for 12-sp5 project specific flavor Migration-from-SLE12-SP5-to-SLE15-SPx, this flavor belong 12sp5 test group but the real
# action is migration from 12-sp5 to 15-sp1, so we need change VERSION to 15-SP1 before the test case start
if (check_var('FLAVOR', 'Migration-from-SLE12-SP5-to-SLE15-SPx') || check_var('FLAVOR', 'Migration-from-SLE12-SP5-to-SLE15-SPx-Milestone')
|| check_var('FLAVOR', 'Regression-on-SLE15-SPx-migrated-from-SLE12-SP5') || check_var('UPGRADE_TARGET_RELEASED_VERSION', 1)) {
# Save the original target version, needed for testing upgrade from a beta version to a non-beta
# SLE12-SP5 to SLE15-SP1 for example
set_var('ORIGINAL_TARGET_VERSION', get_var('VERSION'));
set_var('VERSION', get_var('UPGRADE_TARGET_VERSION'));
}
}
sub data_integrity_is_applicable {
# Method is used to schedule disk interity check, always perform for xen and hyper-v
# no need for s390x, as use ftp url there. On qemu use variable to activate
# validation, set VALIDATE_CHECKSUM variable to true
return (grep { /^CHECKSUM_/ } keys %bmwqemu::vars) && get_var('VALIDATE_CHECKSUM');
}
sub any_desktop_is_applicable {
return get_var("DESKTOP") !~ /textmode/;
}
sub logcurrentenv {
for my $k (@_) {
my $e = get_var("$k");
next unless defined $e;
diag("usingenv $k=$e");
}
}
sub have_addn_repos {
return
!get_var("NET")
&& !get_var("EVERGREEN")
&& get_var("SUSEMIRROR")
&& !get_var("FLAVOR", '') =~ m/^Staging2?[\-]DVD$/;
}
sub is_livesystem {
return (check_var("FLAVOR", 'Rescue-CD') || get_var("LIVETEST"));
}
sub is_gnome_live {
return get_var('FLAVOR', '') =~ /GNOME-Live/;
}
sub is_kde_live {
return get_var('FLAVOR', '') =~ /KDE-Live/;
}
sub gnomestep_is_applicable {
return check_var("DESKTOP", "gnome");
}
sub kdestep_is_applicable {
return check_var("DESKTOP", "kde");
}
sub opensuse_welcome_applicable {
my $desktop = shift // get_var('DESKTOP', '');
# No libqt5-qtwebengine on ppc64/ppc64le and s390.
return 0 if get_var('ARCH') =~ /ppc64|s390/;
# openSUSE-welcome is expected to show up on openSUSE Tumbleweed and Leap 15.2 XFCE only
# starting with Leap 15.3 opensuse-welcome is enabled on supported DEs not just XFCE
return 0 unless is_tumbleweed || is_leap(">=15.3");
# since not all DEs honor xdg/autostart, we are filtering based on desktop environments
return 0 unless $desktop =~ /gnome|kde|lxde|lxqt|mate|xfce/;
return 1;
}
sub packagekit_available {
return !check_var('FLAVOR', 'Rescue-CD');
}
sub is_ltp_test {
return (get_var('INSTALL_LTP')
|| get_var('LTP_COMMAND_FILE')
|| get_var('LIBC_LIVEPATCH'));
}
sub is_publiccloud_ltp_test {
return (get_var('LTP_COMMAND_FILE') && is_public_cloud());
}
sub is_kernel_test {
# ignore ltp tests in publiccloud
return if is_publiccloud_ltp_test();
return is_ltp_test() ||
(get_var('QA_TEST_KLP_REPO')
|| get_var('INSTALL_KLP_PRODUCT')
|| get_var('INSTALL_KOTD')
|| get_var('VIRTIO_CONSOLE_TEST')
|| get_var('BLKTESTS')
|| get_var('TRINITY')
|| get_var('NUMA_IRQBALANCE')
|| get_var('TUNED'));
}
sub is_systemd_test {
return get_var('SYSTEMD_TESTSUITE');
}
sub replace_opensuse_repos_tests {
return if get_var('CLEAR_REPOS');
loadtest "update/zypper_clear_repos";
set_var('CLEAR_REPOS', 1);
loadtest "console/zypper_ar";
loadtest "console/zypper_ref";
}
sub is_updates_tests {
my $flavor = get_var('FLAVOR');
return 0 unless $flavor;
# Incidents might be also Incidents-Gnome or Incidents-Kernel
return $flavor =~ /-Updates/ || $flavor =~ /-Incidents/;
}
sub is_migration_tests {
my $flavor = get_var('FLAVOR');
return 0 unless $flavor;
return $flavor =~ /Migration/;
}
sub is_updates_test_repo {
# mru stands for Maintenance Released Updates and skips unreleased updates
return is_updates_tests && get_required_var('FLAVOR') !~ /-Minimal$/ && !check_var('FLAVOR', 'Container-Image-Updates');
}
sub is_repo_replacement_required {
return is_opensuse() # Is valid scenario only for openSUSE
&& !get_var('KEEP_ONLINE_REPOS') # Set variable no to replace variables
# Skip if there isn't a repo to use (e.g. Leap live tests)
&& (get_var('SUSEMIRROR') || (is_staging && get_var('ISO_1')))
&& !get_var('ZYPPER_ADD_REPOS') # Skip if manual repos are specified
&& !get_var('OFFLINE_SUT') # Do not run if SUT is offine
&& !get_var('ZDUP'); # Do not run on ZDUP as these tests handle repos on their own
}
sub is_memtest {
return get_var('MEMTEST');
}
sub is_desktop {
return get_var('FLAVOR', '') =~ /^Desktop/ || check_var('SLE_PRODUCT', 'sled');
}
sub is_desktop_module_selected {
# desktop applications module is selected if following variables have following values:
# ha require desktop applications on sle <15, so it's preselected
# same is true for sles4sap
return
get_var('ADDONS', '') =~ /all-packages|desktop|we/
|| get_var('ADDONURL', '') =~ /desktop|we/
|| (!is_sle('15+') && get_var('SCC_ADDONS', '') =~ /desktop|we|productivity|ha/)
|| (is_sle('15+') && get_var('SCC_ADDONS', '') =~ /desktop|we/)
|| is_sles4sap;
}
sub default_desktop {
return 'textmode' if (get_var('SYSTEM_ROLE') && !check_var('SYSTEM_ROLE', 'default'));
return if get_var('VERSION', '') lt '12';
return 'gnome' if get_var('VERSION', '') lt '15';
return 'gnome' if get_var('VERSION', '') =~ /^Jump/;
# with SLE 15 LeanOS only the default is textmode
return 'gnome' if get_var('BASE_VERSION', '') =~ /^12/;
return 'gnome' if is_desktop_module_selected;
# default system role for sles and sled
return 'textmode' if is_server || !get_var('SCC_REGISTER') || !check_var('SCC_REGISTER', 'installation');
# remaining cases are is_desktop and check_var('SCC_REGISTER', 'installation'), hence gnome
return 'gnome';
}
sub load_shutdown_tests {
return if is_openstack;
# Schedule cleanup before shutdown only in cases the HDD will be published
loadtest("shutdown/cleanup_before_shutdown") if get_var('PUBLISH_HDD_1');
loadtest "shutdown/shutdown";
}
sub load_svirt_boot_tests {
# Unless GRUB2 supports framebuffer on Xen PV (bsc#961638), grub2 tests
# has to be skipped there.
if (!(check_var('VIRSH_VMM_FAMILY', 'xen') && check_var('VIRSH_VMM_TYPE', 'linux'))) {
if (get_var("UEFI") || is_jeos) {
loadtest "installation/bootloader_uefi";
}
elsif (!get_var('NETBOOT')) {
loadtest "installation/bootloader";
}
}
}
sub load_svirt_vm_setup_tests {
return unless is_svirt;
set_bridged_networking;
if (check_var("VIRSH_VMM_FAMILY", "hyperv")) {
# Loading bootloader_hyperv here when UPGRADE is on (i.e. offline migration is underway)
# means loading it for the second time. Which might be apropriate if we want to reconfigure
# the VM, but currently we don't want to.
loadtest "installation/bootloader_hyperv" unless get_var('UPGRADE');
}
else {
loadtest "installation/bootloader_svirt" unless get_var('UPGRADE');
}
unless (is_installcheck || is_memtest || is_rescuesystem) {
load_svirt_boot_tests;
}
}
sub load_boot_tests {
if (get_var("ISO_MAXSIZE") && (!is_remote_backend() || is_svirt_except_s390x())) {
loadtest "installation/isosize";
}
if ((get_var("UEFI") || is_jeos()) && !is_svirt) {
loadtest "installation/data_integrity" if data_integrity_is_applicable;
loadtest "installation/bootloader_uefi";
}
elsif (is_svirt_except_s390x()) {
load_svirt_vm_setup_tests;
}
elsif (is_s390x && is_jeos) {
loadtest "installation/bootloader_start";
}
elsif (uses_qa_net_hardware() || get_var("PXEBOOT")) {
loadtest "boot/boot_from_pxe";
set_var("DELAYED_START", get_var("PXEBOOT"));
}
elsif (get_var("IPXE")) {
loadtest "installation/ipxe_install";
}
else {
loadtest "installation/data_integrity" if data_integrity_is_applicable;
loadtest "installation/bootloader" unless load_bootloader_s390x();
}
}
sub load_reboot_tests {
return if check_var("IPXE", "1");
# Special case: our disk and boot config is on the supportserver
# PXE reboot to be handled by module boot_to_desktop
if (get_var('USE_SUPPORT_SERVER') && get_var('USE_SUPPORT_SERVER_PXE_CUSTOMKERNEL')) {
loadtest "boot/boot_to_desktop";
return;
}
# there is encryption passphrase prompt which is handled in installation/boot_encrypt
if ((is_s390x && !get_var('ENCRYPT')) || uses_qa_net_hardware() || is_pvm) {
loadtest "boot/reconnect_mgmt_console";
}
if (installyaststep_is_applicable()) {
# test makes no sense on s390 because grub2 can't be captured
if (!(is_s390x or (check_var('VIRSH_VMM_FAMILY', 'xen') and check_var('VIRSH_VMM_TYPE', 'linux')))) {
# exclude this scenario for autoyast test with switched keyboard layaout. also exclude on ipmi as installation/first_boot will call wait_grub
loadtest "installation/grub_test" unless get_var('INSTALL_KEYBOARD_LAYOUT') || get_var('KEEP_GRUB_TIMEOUT') || is_ipmi;
if ((snapper_is_applicable()) && get_var("BOOT_TO_SNAPSHOT")) {
loadtest "installation/boot_into_snapshot";
}
}
if (get_var('ENCRYPT')) {
loadtest "installation/boot_encrypt";
# reconnect after installation/boot_encrypt
if (is_s390x) {
loadtest "boot/reconnect_mgmt_console";
}
}
# exclude this scenario for autoyast test with switched keyboard layaout
loadtest "installation/first_boot" unless get_var('INSTALL_KEYBOARD_LAYOUT');
loadtest "installation/opensuse_welcome" if opensuse_welcome_applicable();
if (is_aarch64 && !get_var('INSTALLONLY') && !get_var('LIVE_INSTALLATION') && !get_var('LIVE_UPGRADE')) {
loadtest "installation/system_workarounds";
}
}
if (get_var("DUALBOOT")) {
loadtest "installation/reboot_eject_cd";
loadtest "wsl/boot_windows";
}
}
sub load_rescuecd_tests {
if (rescuecdstep_is_applicable()) {
loadtest "rescuecd/rescuecd";
}
}
sub load_autoyast_clone_tests {
loadtest "console/system_prepare";
loadtest "console/consoletest_setup";
loadtest "console/yast2_clone_system";
loadtest "console/consoletest_finish";
}
sub load_zdup_tests {
loadtest 'installation/setup_zdup';
if (get_var("LOCK_PACKAGE")) {
loadtest "console/lock_package";
}
loadtest 'installation/install_service' if !is_desktop;
loadtest 'installation/zdup';
loadtest 'installation/post_zdup';
# Restrict version switch to sle until opensuse adopts it
loadtest "migration/version_switch_upgrade_target" if is_sle and get_var("UPGRADE_TARGET_VERSION");
if (get_var('ZDUP_IN_X')) {
loadtest 'x11/reboot_plasma5' if kdestep_is_applicable;
loadtest 'x11/reboot_gnome' if gnomestep_is_applicable;
} else {
loadtest 'boot/boot_to_desktop';
}
loadtest "installation/opensuse_welcome" if opensuse_welcome_applicable();
loadtest 'console/check_upgraded_service' if !is_desktop;
}
sub load_autoyast_tests {
# init boot in load_boot_tests
loadtest("autoyast/installation");
# library function like send_key or reboot will not work, therefore exiting earlier
return loadtest "locale/keymap_or_locale" if get_var('INSTALL_KEYBOARD_LAYOUT');
loadtest("autoyast/console");
loadtest("autoyast/login");
# Wicked is the default on Leap and SLE < 16 only
loadtest("autoyast/wicked") if (is_sle("<16") || is_leap("<16.0"));
loadtest('autoyast/' . get_var("AUTOYAST_VERIFY_MODULE")) if get_var("AUTOYAST_VERIFY_MODULE");
if (get_var("SUPPORT_SERVER_GENERATOR")) {
loadtest("support_server/configure");
}
else {
loadtest("autoyast/repos");
loadtest("autoyast/clone");
loadtest("autoyast/logs");
}
loadtest("autoyast/autoyast_reboot");
# next boot in load_reboot_tests
}
sub load_slepos_tests {
if (get_var("SLEPOS") =~ /^adminserver/) {
loadtest("boot/boot_to_desktop");
loadtest "slepos/prepare";
loadtest "slepos/zypper_add_repo";
loadtest "slepos/zypper_install_adminserver";
loadtest "slepos/run_posInitAdminserver";
loadtest "slepos/zypper_install_imageserver";
loadtest "slepos/use_smt_for_kiwi";
loadtest "slepos/build_images_kiwi";
loadtest "slepos/register_images";
loadtest "slepos/build_offline_image_kiwi";
loadtest "slepos/wait";
}
elsif (get_var("SLEPOS") =~ /^branchserver/) {
loadtest("boot/boot_to_desktop");
loadtest "slepos/prepare";
loadtest "slepos/zypper_add_repo";
loadtest "slepos/zypper_install_branchserver";
loadtest "slepos/run_posInitBranchserver";
loadtest "slepos/run_possyncimages";
loadtest "slepos/wait";
}
elsif (get_var("SLEPOS") =~ /^imageserver/) {
loadtest("boot/boot_to_desktop");
loadtest "slepos/prepare";
loadtest "slepos/zypper_add_repo";
loadtest "slepos/zypper_install_imageserver";
loadtest "slepos/use_smt_for_kiwi";
loadtest "slepos/build_images_kiwi";
}
elsif (get_var("SLEPOS") =~ /^terminal-online/) {
set_var("DELAYED_START", "1");
loadtest "slepos/boot_image";
}
elsif (get_var("SLEPOS") =~ /^terminal-offline/) {
loadtest "slepos/boot_image";
}
}
sub load_system_role_tests {
# This part is relevant only for openSUSE
if (is_opensuse) {
# Do not run on REMOTE_CONTROLLER, IPMI and on Hyper-V in GUI mode
if ((!get_var('BACKEND', 'ipmi') || !is_pvm) && !is_hyperv_in_gui && !get_var("LIVECD")) {
loadtest "installation/logpackages";
}
}
if (is_using_system_role) {
loadtest "installation/system_role";
}
elsif (is_opensuse) {
loadtest "installation/installer_desktopselection";
}
}
sub load_jeos_openstack_tests {
return unless is_openstack;
my $args = OpenQA::Test::RunArgs->new();
loadtest 'boot/boot_to_desktop';
if (get_var('JEOS_OPENSTACK_UPLOAD_IMG')) {
loadtest "publiccloud/upload_image";
return;
} else {
loadtest "jeos/prepare_openstack", run_args => $args;
}
if (get_var('LTP_COMMAND_FILE')) {
loadtest 'publiccloud/run_ltp';
return;
} else {
loadtest 'publiccloud/ssh_interactive_start', run_args => $args;
}
if (get_var('CI_VERIFICATION')) {
loadtest 'jeos/verify_cloudinit', run_args => $args;
loadtest("publiccloud/ssh_interactive_end", run_args => $args);
return;
}
loadtest "jeos/image_info";
loadtest "jeos/record_machine_id";
loadtest "console/system_prepare" if is_sle;
loadtest "console/force_scheduled_tasks";
loadtest "jeos/grub2_gfxmode";
loadtest "jeos/build_key";
loadtest "console/prjconf_excluded_rpms";
unless (get_var('CI_VERIFICATION')) {
loadtest "console/suseconnect_scc";
}
unless (get_var('CONTAINER_RUNTIMES')) {
loadtest "console/journal_check";
loadtest "microos/libzypp_config";
}
loadtest 'qa_automation/patch_and_reboot' if is_updates_tests;
replace_opensuse_repos_tests if is_repo_replacement_required;
main_containers::load_container_tests();
loadtest("publiccloud/ssh_interactive_end", run_args => $args);
}
sub load_jeos_tests {
if (is_community_jeos()) {
# Enable jeos-firstboot, due to boo#1020019
load_boot_tests();
loadtest "jeos/prepare_firstboot";
}
load_boot_tests() unless get_var('NO_CLOUD');
if (check_var('FIRST_BOOT_CONFIG', 'combustion')) {
loadtest 'microos/verify_setup';
loadtest 'microos/image_checks';
} elsif (check_var('FIRST_BOOT_CONFIG', 'cloud-init')) {
loadtest "installation/first_boot";
loadtest 'jeos/verify_cloudinit';
} else {
loadtest "jeos/firstrun";
if (get_var('POSTGRES_IP')) {
loadtest "jeos/image_info";
}
}
loadtest "jeos/record_machine_id";
loadtest "console/force_scheduled_tasks";
# this test case also disables grub timeout
loadtest "jeos/grub2_gfxmode" unless is_bootloader_sdboot;
unless (get_var('INSTALL_LTP') || get_var('SYSTEMD_TESTSUITE')) {
# jeos/diskusage as of now works only with BTRFS
loadtest "jeos/diskusage" if get_var('FILESYSTEM', 'btrfs') =~ /btrfs/;
loadtest "jeos/build_key";
loadtest "console/prjconf_excluded_rpms";
}
unless (get_var('CONTAINER_RUNTIMES')) {
loadtest "console/journal_check";
loadtest "microos/libzypp_config";
}
if (is_sle) {
loadtest "console/suseconnect_scc";
loadtest "jeos/efi_tid" if (get_var('UEFI') && is_sle('=12-sp5'));
}
loadtest 'qa_automation/patch_and_reboot' if is_updates_tests;
replace_opensuse_repos_tests if is_repo_replacement_required;
loadtest 'console/verify_efi_mok' if get_var 'CHECK_MOK_IMPORT';
# zypper_ref needs to run on jeos-containers. the is_sle is required otherwise is scheduled twice on o3
loadtest "console/zypper_ref" if (get_var('CONTAINER_RUNTIMES') && is_sle);
}
sub installzdupstep_is_applicable {
return !get_var("NOINSTALL") && !get_var("RESCUECD") && get_var("ZDUP");
}
sub snapper_is_applicable {
# run snapper tests on opensuse only for system_performance testsuite
return 0 if (is_opensuse && !get_var('SOFTFAIL_BSC1063638'));
# snapshots are only proposed by the installer if the available space is
# big enough
my $snapshots_available = get_var('FILESYSTEM', 'btrfs') =~ /btrfs/ && get_var("HDDSIZEGB", 10) > 10;
return (!get_var('LIVETEST') && $snapshots_available);
}
sub chromestep_is_applicable {
return is_opensuse && is_x86_64;
}
sub chromiumstep_is_applicable {
return chromestep_is_applicable() || (is_opensuse && is_aarch64);
}
sub installyaststep_is_applicable {
return !get_var("NOINSTALL") && !get_var("RESCUECD") && !get_var("ZDUP");
}
# kdump is not supported on aarch64 (bsc#990418), and Xen PV (feature not implemented)
sub kdump_is_applicable {
return !(is_aarch64 && is_sle('<15')) && !check_var('VIRSH_VMM_TYPE', 'linux');
}
sub consolestep_is_applicable {
return !get_var("INSTALLONLY") && !get_var("DUALBOOT") && !get_var("RESCUECD") && !is_gnome_next && !is_krypton_argon;
}
sub rescuecdstep_is_applicable {
return get_var("RESCUECD");
}
sub ssh_key_import {
return get_var("SSH_KEY_IMPORT") || get_var("SSH_KEY_DO_NOT_IMPORT");
}
sub we_is_applicable {
return
is_server()
&& (get_var("ADDONS", "") =~ /we/ or get_var("SCC_ADDONS", "") =~ /we/ or get_var("ADDONURL", "") =~ /we/)
&& get_var('MIGRATION_REMOVE_ADDONS', '') !~ /we/;
}
sub libreoffice_is_applicable {
# for opensuse libreoffice package has ExclusiveArch: aarch64 %{ix86} x86_64
# do not know for SLE (so assume built for all)
return 1 if (!is_opensuse);
return (is_x86_64
|| is_i686
|| is_i586
|| is_aarch64);
}
sub need_clear_repos {
return !get_var('ZDUP')
&& (!get_var('INSTALLONLY') || get_var('PUBLISH_HDD_1'))
&& !get_var('BOOT_TO_SNAPSHOT')
&& !get_var('LIVETEST')
&& !get_var('DUALBOOT')
&& (is_opensuse && !is_updates_tests)
&& !(is_jeos && !is_staging)
&& !(is_opensuse && check_var("FLAVOR", "CR-DVD"))
|| (is_sle && get_var("FLAVOR", '') =~ m/^Staging2?[\-]DVD$/ && get_var("SUSEMIRROR"));
}
sub have_scc_repos {
return check_var('SCC_REGISTER', 'console');
}
sub xfcestep_is_applicable {
return check_var("DESKTOP", "xfce");
}
sub lxdestep_is_applicable {
return check_var("DESKTOP", "lxde");
}
sub is_smt {
# Smt is replaced with rmt in SLE 15, see bsc#1061291
return (check_var('SMT_TEST', '1') && is_sle('<15'));
}
sub is_rmt {
return (check_var('RMT_TEST', '1') && is_sle('>=15'));
}
sub remove_common_needles {
my $no_skipto = get_var('SKIPTO') ? 0 : 1;
unregister_needle_tags("ENV-SKIPTO-$no_skipto");
remove_desktop_needles("lxde");
remove_desktop_needles("kde");
remove_desktop_needles("gnome");
remove_desktop_needles("xfce");
remove_desktop_needles("minimalx");
remove_desktop_needles("textmode");
unregister_needle_tags("ENV-VIDEOMODE-text") unless check_var("VIDEOMODE", "text");
unregister_needle_tags('ENV-ARCH-s390x') unless is_s390x;
# Only for container tests
unregister_needle_tags('ENV-UBUNTU-1') unless get_var('HDD_1', '') =~ /ubuntu/;
if (get_var("INSTLANG") && get_var("INSTLANG") ne "en_US") {
unregister_needle_tags("ENV-INSTLANG-en_US");
}
else { # english default
unregister_needle_tags("ENV-INSTLANG-de_DE");
}
}
sub remove_desktop_needles {
my $desktop = shift;
if (!check_var("DESKTOP", $desktop) && !check_var("FULL_DESKTOP", $desktop)) {
unregister_needle_tags("ENV-DESKTOP-$desktop");
}
}
sub map_incidents_to_repo {
my ($incidents, $templates) = @_;
my @maint_repos;
for my $i (keys %$incidents) {
next unless $incidents->{$i};
for my $j (split(/,/, $incidents->{$i})) {
if ($j) {
push @maint_repos, join($j, split('@INCIDENTNR@', $templates->{$i}));
}
}
}
my $ret = join(',', @maint_repos);
# do not start with ','
$ret =~ s/^,//s;
return $ret;
}
sub join_incidents_to_repo {
my ($incidents) = @_;
my @repos;
for my $k (keys %$incidents) {
next unless $incidents->{$k};
for my $i (split(/,/, $incidents->{$k})) {
if ($i) {
push @repos, $i;
}
}
}
return join(',', @repos);
}
our %valueranges = (
# LVM=>[0,1],
NOIMAGES => [0, 1],
USEIMAGES => [0, 1],
DOCRUN => [0, 1],
# BTRFS=>[0,1],
DESKTOP => [qw(kde gnome xfce lxde minimalx textmode serverro)],
# ROOTFS=>[qw(ext3 xfs jfs btrfs reiserfs)],
VIDEOMODE => ["", "text", "ssh-x"],
);
sub check_env {
for my $k (keys %valueranges) {
next unless get_var($k);
unless (grep { get_var($k) eq $_ } @{$valueranges{$k}}) {
die sprintf("%s must be one of %s\n", $k, join(',', @{$valueranges{$k}}));
}
}
my $mirror = get_var('SUSEMIRROR');
if ($mirror && $mirror =~ s{^(\w+)://}{}) { # strip & check proto
set_var('SUSEMIRROR', $mirror);
die "only http mirror URLs are currently supported but found '$1'." if $1 ne "http";
}
}
sub unregister_needle_tags {
my ($tag) = @_;
my @a = @{needle::tags($tag)};
for my $n (@a) { $n->unregister($tag); }
}
sub load_bootloader_s390x {
if (is_backend_s390x) {
loadtest "installation/bootloader_s390";
return 1;
}
if (is_s390x && is_svirt) {
loadtest "installation/bootloader_zkvm";
return 1;
}
return 0;
}
sub boot_hdd_image {
# On JeOS we don't need to load any test to boot, but to keep main.pm sane just return.
is_jeos() ? return 1 : get_required_var('BOOT_HDD_IMAGE');
if (is_svirt) {
if (check_var('VIRSH_VMM_FAMILY', 'hyperv')) {
loadtest 'installation/bootloader_hyperv';
}
else {
loadtest 'installation/bootloader_svirt' unless load_bootloader_s390x;
}
}
loadtest 'installation/bootloader' if is_pvm;
loadtest 'boot/boot_to_desktop';
}
sub load_common_installation_steps_tests {
loadtest 'installation/await_install';
unless (get_var('REMOTE_CONTROLLER') || is_hyperv_in_gui) {
loadtest "installation/add_serial_console" if is_vmware;
loadtest 'installation/logs_from_installation_system';
}
loadtest 'installation/reboot_after_installation';
}
sub load_ayinst_tests {
loadtest("autoyast/installation");
loadtest("autoyast/console");
loadtest("autoyast/login");
loadtest("autoyast/autoyast_reboot");
}
sub load_inst_tests {
# On SLE 15 dud addon screen is shown before product selection
if (get_var('DUD_ADDONS') && is_sle('15+')) {
loadtest "installation/dud_addon";
}
loadtest "installation/welcome";
if (get_var('DUD_ADDONS') && is_sle('<15')) {
loadtest "installation/dud_addon";
}
loadtest 'installation/network_configuration' if get_var('OFFLINE_SUT');
if (get_var('IBFT')) {
loadtest "installation/iscsi_configuration";
}
# specific case for mru-install-multipath-remote
if (get_var('WITHISCSI')) {
loadtest "installation/disk_activation_iscsi";
loadtest "installation/multipath";
}
if (is_s390x) {
if (is_backend_s390x) {
loadtest "installation/disk_activation";
}
elsif (is_sle('<12-SP2')) {
loadtest "installation/skip_disk_activation";
}
}
if (get_var('ENCRYPT_CANCEL_EXISTING') || get_var('ENCRYPT_ACTIVATE_EXISTING')) {
loadtest "installation/encrypted_volume_activation";
}
if (!is_sle('15-SP4+') && !get_var('WITHISCSI') && (get_var('MULTIPATH') or get_var('MULTIPATH_CONFIRM'))) {
loadtest "installation/multipath";
}
if (is_upgrade) {
loadtest "installation/upgrade_select";
if (check_var("UPGRADE", "LOW_SPACE")) {
loadtest "installation/disk_space_fill";
}
}
if (is_opensuse) {
# See https://github.com/yast/yast-packager/pull/385
loadtest "installation/online_repos";
loadtest "installation/setup_online_repos" if installwithaddonrepos_is_applicable;
loadtest "installation/installation_mode" if noupdatestep_is_applicable;
}
if (is_sle) {
loadtest 'installation/network_configuration' if get_var('NETWORK_CONFIGURATION');
loadtest "installation/scc_registration";
if (is_sle('15-SP4+') && !get_var('WITHISCSI') && (get_var('MULTIPATH') or get_var('MULTIPATH_CONFIRM'))) {
loadtest "installation/multipath";
}
if (is_sles4sap and is_sle('<15') and !is_upgrade()) {
loadtest "installation/sles4sap_product_installation_mode";
}
if (get_var('MAINT_TEST_REPO') and !get_var("USER_SPACE_TESTSUITES")) {
loadtest 'installation/add_update_test_repo';
}
loadtest "installation/addon_products_sle";
}
if (noupdatestep_is_applicable()) {
# Run system_role/desktop selection tests if using the new openSUSE installation flow
if (is_using_system_role_first_flow && requires_role_selection) {
load_system_role_tests;
}
if (is_sles4sap() and is_sle('15+') and check_var('SYSTEM_ROLE', 'default') and !is_upgrade()) {
loadtest "installation/sles4sap_product_installation_mode";
}
# MicroOS doesn't have a partitioning step
unless (is_microos) {
loadtest "installation/partitioning";
if (defined(get_var("RAIDLEVEL"))) {
loadtest "installation/partitioning_raid";
}
elsif (get_var('LVM')) {
load_lvm_tests();
}
elsif (check_var('LVM', 0) && get_var('ENCRYPT')) {
loadtest 'installation/partitioning/encrypt_no_lvm';
}
elsif (get_var('FULL_LVM_ENCRYPT')) {
loadtest 'installation/partitioning_full_lvm';
}
elsif (get_var('LVM_THIN_LV')) {
loadtest "installation/partitioning_lvm_thin_provisioning";
}
# For s390x there was no offering of separated home partition until SLE 15 See bsc#1072869
elsif (!(is_sle('<15') && is_s390x())) {
if (check_var("SEPARATE_HOME", 1)) {
loadtest "installation/partitioning/separate_home";
}
elsif (check_var("SEPARATE_HOME", 0)) {
loadtest "installation/partitioning/no_separate_home";
}
}
if (get_var("FILESYSTEM")) {
if (get_var('PARTITIONING_WARNINGS')) {