-
Notifications
You must be signed in to change notification settings - Fork 283
/
Copy pathmr_test_lib.pm
74 lines (65 loc) · 2.63 KB
/
mr_test_lib.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
# Copyright 2022 SUSE LLC
# SPDX-License-Identifier: GPL-2.0-or-later
#
# Summary: Base module for saptune "mr_test" test cases.
# It dynamically generates test modules according to 'MR_TEST'
# and runs these modules by script 'mr_test_run.pm'.
# E.g., MR_TEST="1410736,S4HANA-APP+DB,solutions"
# Maintainer: llzhao <[email protected]>
# Tags: jsc#TEAM-6726
package mr_test_lib;
use strict;
use warnings;
use testapi;
use utils;
use autotest;
use base 'consoletest';
use LTP::TestInfo 'testinfo';
use mr_test_run qw(get_notes get_solutions);
our @EXPORT = qw(
load_mr_tests
);
# Load test case automatically.
# - "$test": the test scritpt/module to be run;
# - "%args": the arguments of "$test".
sub loadtest_mr_test {
my ($test, %args) = @_;
autotest::loadtest("$test.pm", %args);
}
# Load mr_test according to 'Settings': 'MR_TEST'.
# - "$test_list": test case list got from 'MR_TEST'.
sub load_mr_tests {
my ($test_list, $args) = @_;
my $i = 1;
my $note_solution = '';
# The main script which dynamically generates test modules (*.pm) according to 'MR_TEST' value
my $script = 'tests/sles4sap/saptune/mr_test_run';
my $tinfo = testinfo({}, test => $script);
for my $test (split(/,/, $test_list)) {
$note_solution = '';
if (grep { /^${test}$/ } mr_test_run::get_solutions()) {
$note_solution = 'solution_';
}
elsif (grep { /^${test}$/ } mr_test_run::get_notes()) {
$note_solution = 'note_';
}
$tinfo = testinfo({}, test => $test);
loadtest_mr_test("$script", name => $i . '_saptune_' . $note_solution . $test, run_args => $tinfo);
$i++;
}
# Load 'ssh_interactive_end.pm' here instead of adding to 'schedule/sles4sap/sles4sap_gnome_saptune.yaml'
# otherwise 'ssh_interactive_end.pm' will be started to run before 'load_mr_tests' finished.
# Paste the messages which are cut out from openQA log file FYI for a better understanding:
# [debug] ||| starting mr_test tests/sles4sap/saptune/mr_test.pm
# [debug] ||| finished mr_test sles4sap/saptune
# [debug] scheduling 1_saptune_notes .../mr_test_run.pm
# [debug] ||| starting ssh_interactive_end tests/publiccloud/ssh_interactive_end.pm
# [debug] ||| finished ssh_interactive_end publiccloud
# [debug] ||| starting 1_saptune_notes .../mr_test_run.pm
# [debug] ||| finished 1_saptune_notes lib
if (get_var('PUBLIC_CLOUD_SLES4SAP')) {
loadtest_mr_test('tests/publiccloud/ssh_interactive_end', run_args => $args);
loadtest_mr_test('tests/sles4sap/publiccloud/qesap_cleanup', run_args => $args);
}
}
1;