Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable running install_ltp and ltp_run in the same job #8329

Merged
merged 2 commits into from
Oct 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions lib/main_ltp.pm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ use 5.018;
# FIXME: Delete the "## no critic (Strict)" line and uncomment "use warnings;"
# use warnings;

our @EXPORT = 'load_kernel_tests';
our @EXPORT = qw(
load_kernel_tests
loadtest_from_runtest_file
);

sub loadtest {
my ($test, %args) = @_;
Expand Down Expand Up @@ -75,7 +78,7 @@ sub parse_runtest_file {

sub loadtest_from_runtest_file {
my $namelist = get_var('LTP_COMMAND_FILE');
my $path = get_var('ASSETDIR') . '/other';
my $path = shift || get_var('ASSETDIR') . '/other';
my $tag = get_ltp_tag();
my $cmd_pattern = get_var('LTP_COMMAND_PATTERN') || '.*';
my $cmd_exclude = get_var('LTP_COMMAND_EXCLUDE') || '$^';
Expand Down Expand Up @@ -144,10 +147,14 @@ sub load_kernel_tests {
loadtest 'update_kernel';
}
loadtest 'install_ltp';
if (get_var('LTP_INSTALL_REBOOT')) {
loadtest 'boot_ltp';
# If LTP_COMMAND_FILE is set, boot_ltp() and shutdown_ltp() will be added
# later by install_ltp task.
if (!get_var('LTP_COMMAND_FILE')) {
if (get_var('LTP_INSTALL_REBOOT')) {
loadtest 'boot_ltp';
}
shutdown_ltp();
}
shutdown_ltp();
}
elsif (get_var('LTP_COMMAND_FILE')) {
if (get_var('INSTALL_KOTD')) {
Expand Down
10 changes: 9 additions & 1 deletion tests/kernel/install_ltp.pm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use registration;
use utils;
use bootloader_setup qw(add_custom_grub_entries add_grub_cmdline_settings);
use main_common 'get_ltp_tag';
use main_ltp 'loadtest_from_runtest_file';
use power_action_utils 'power_action';
use repo_tools 'add_qa_head_repo';
use serial_terminal 'add_serial_console';
Expand Down Expand Up @@ -343,7 +344,14 @@ sub run {
add_custom_grub_entries if (is_sle('12+') || is_opensuse) && !is_jeos;
setup_network;
upload_runtest_files('/opt/ltp/runtest', $tag);
power_action('reboot', textmode => 1) if get_var('LTP_INSTALL_REBOOT');

if (get_var('LTP_COMMAND_FILE')) {
# This assumes that current working directory is the worker's pool dir
loadtest_from_runtest_file('assets_public');
}

power_action('reboot', textmode => 1) if get_var('LTP_INSTALL_REBOOT') ||
get_var('LTP_COMMAND_FILE');
}

sub post_fail_hook {
Expand Down
5 changes: 4 additions & 1 deletion ui-framework-documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -553,4 +553,7 @@ file (e.g. main.pm)
...
loadtest 'installation/create_new_user';
...
```
```

You can also call `loadtest` inside a running test to schedule additional
test modules, e.g. to install and run an external test suite in the same job.