Skip to content

Commit

Permalink
Fix supportutils need a lot of time to finish
Browse files Browse the repository at this point in the history
We need to tune the supportconfig to make it comsume less time.
  • Loading branch information
hjluo committed Apr 21, 2022
1 parent e00f57b commit 652841e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 20 deletions.
25 changes: 11 additions & 14 deletions lib/upload_system_log.pm
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,19 @@ sub upload_supportconfig_log {
}
$args{options} //= '';
$args{timeout} //= 600;
script_run("supportconfig -t . -B $args{file_name}", $args{timeout});
#FOR S390X LPAR
if (is_s390x) {
script_run("tar zcvfP scc_$args{file_name}.tar.gz scc_supportconfig");
upload_asset("scc_$args{file_name}.tar.gz", 1, 1);
return;
}

my $file_name = $args{file_name};
assert_script_run("supportconfig -B $file_name", $args{timeout});
my $scc_tarball = "/var/log/scc_$file_name.txz";
my $nts_tarball = "/var/log/nts_$file_name.txz";

# bcc#1166774
if (script_run("test -d scc_$args{file_name}/") == 0) {
assert_script_run("tar zcvfP scc_$args{file_name}.tar.gz scc_$args{file_name}/");
upload_logs("scc_$args{file_name}.tar.gz");
} elsif (script_run("test -d nts_$args{file_name}/") == 0) {
assert_script_run("tar zcvfP nts_$args{file_name}.tar.gz nts_$args{file_name}/");
upload_logs("nts_$args{file_name}.tar.gz");
if (script_run("test -e $scc_tarball") == 0) {
upload_logs($scc_tarball);
} elsif (script_run("test -e $nts_tarball") == 0) {
upload_logs("$nts_tarball");
} else {
assert_script_run("ls ./");
assert_script_run("ls /var/log");
die("No supportconfig directory found!");
}
}
Expand Down
16 changes: 10 additions & 6 deletions tests/console/supportutils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Package: supportutils
# Summary: Test is files created by supportconfig are readable and contain some basic data.
# - Delete any previously existing supportconfig data
# - Run supportconfig -t . -B test
# - Run supportconfig -B test
# - Check for supportconfig contents
# - Cleanup supportconfig data
# Maintainer: Juraj Hura <[email protected]>
Expand All @@ -20,20 +20,24 @@ use upload_system_log 'upload_supportconfig_log';
sub run {
my $self = shift;
$self->select_serial_terminal;

select_console 'root-console';
my $options = get_var('SUPPORTCOFIG_OPTIONS', '');
assert_script_run "rm -rf nts_* scc_* ||:";
assert_script_run "rm -rf /var/log/nts_* /var/log/scc_* ||:";
upload_supportconfig_log(file_name => 'test', options => $options, timeout => 2000);

my $scc_file = '/var/log/scc_test.txz';
# bcc#1166774
if (script_run("test -d scc_test") == 0) {
assert_script_run "cd scc_test";
if (script_run("test -e $scc_file") == 0) {
assert_script_run "xz -dc $scc_file | tar -xf -";
assert_script_run 'cd scc_test';
} else {
assert_script_run "cd nts_test";
}

# Check few file whether expected content is there.
assert_script_run "diff <(awk '/\\/proc\\/cmdline/{getline; print}' boot.txt|head -n1) /proc/cmdline";
# we just compare the first line after /proc/cmdline in boot.txt
# with the content in /proc/cmdline.
assert_script_run(q(diff <(awk '/^# \/proc\/cmdline/{getline; print; exit}' boot.txt) /proc/cmdline));
assert_script_run "grep -q -f /etc/os-release basic-environment.txt";

assert_script_run "cd ..";
Expand Down

0 comments on commit 652841e

Please sign in to comment.