Commit 12d4cddd authored by John 'Warthog9' Hawley (VMware)'s avatar John 'Warthog9' Hawley (VMware) Committed by Steven Rostedt (VMware)

ktest: Fixing indentation to match expected pattern

This is a followup to "ktest: Adding editor hints to improve
consistency" to actually adjust the existing indentation to match
the, now, expected pattern (first column 4 spaces, 2nd tab, 3rd
tab + 4 spaces, etc).  This should, at least help, keep things
consistent going forward now.
Signed-off-by: default avatarJohn 'Warthog9' Hawley (VMware) <warthog9@eaglescrag.net>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent becdd17b
...@@ -760,7 +760,7 @@ sub process_variables { ...@@ -760,7 +760,7 @@ sub process_variables {
# remove the space added in the beginning # remove the space added in the beginning
$retval =~ s/ //; $retval =~ s/ //;
return "$retval" return "$retval";
} }
sub set_value { sub set_value {
...@@ -1095,7 +1095,7 @@ sub __read_config { ...@@ -1095,7 +1095,7 @@ sub __read_config {
} }
} }
} }
if ( ! -r $file ) { if ( ! -r $file ) {
die "$name: $.: Can't read file $file\n$_"; die "$name: $.: Can't read file $file\n$_";
} }
...@@ -1186,13 +1186,13 @@ sub __read_config { ...@@ -1186,13 +1186,13 @@ sub __read_config {
} }
sub get_test_case { sub get_test_case {
print "What test case would you like to run?\n"; print "What test case would you like to run?\n";
print " (build, install or boot)\n"; print " (build, install or boot)\n";
print " Other tests are available but require editing ktest.conf\n"; print " Other tests are available but require editing ktest.conf\n";
print " (see tools/testing/ktest/sample.conf)\n"; print " (see tools/testing/ktest/sample.conf)\n";
my $ans = <STDIN>; my $ans = <STDIN>;
chomp $ans; chomp $ans;
$default{"TEST_TYPE"} = $ans; $default{"TEST_TYPE"} = $ans;
} }
sub read_config { sub read_config {
...@@ -1519,13 +1519,13 @@ sub dodie { ...@@ -1519,13 +1519,13 @@ sub dodie {
close O; close O;
close L; close L;
} }
send_email("KTEST: critical failure for test $i [$name]", send_email("KTEST: critical failure for test $i [$name]",
"Your test started at $script_start_time has failed with:\n@_\n", $log_file); "Your test started at $script_start_time has failed with:\n@_\n", $log_file);
} }
if ($monitor_cnt) { if ($monitor_cnt) {
# restore terminal settings # restore terminal settings
system("stty $stty_orig"); system("stty $stty_orig");
} }
if (defined($post_test)) { if (defined($post_test)) {
...@@ -1709,81 +1709,81 @@ sub wait_for_monitor { ...@@ -1709,81 +1709,81 @@ sub wait_for_monitor {
} }
sub save_logs { sub save_logs {
my ($result, $basedir) = @_; my ($result, $basedir) = @_;
my @t = localtime; my @t = localtime;
my $date = sprintf "%04d%02d%02d%02d%02d%02d", my $date = sprintf "%04d%02d%02d%02d%02d%02d",
1900+$t[5],$t[4],$t[3],$t[2],$t[1],$t[0]; 1900+$t[5],$t[4],$t[3],$t[2],$t[1],$t[0];
my $type = $build_type; my $type = $build_type;
if ($type =~ /useconfig/) { if ($type =~ /useconfig/) {
$type = "useconfig"; $type = "useconfig";
} }
my $dir = "$machine-$test_type-$type-$result-$date"; my $dir = "$machine-$test_type-$type-$result-$date";
$dir = "$basedir/$dir"; $dir = "$basedir/$dir";
if (!-d $dir) { if (!-d $dir) {
mkpath($dir) or mkpath($dir) or
dodie "can't create $dir"; dodie "can't create $dir";
} }
my %files = ( my %files = (
"config" => $output_config, "config" => $output_config,
"buildlog" => $buildlog, "buildlog" => $buildlog,
"dmesg" => $dmesg, "dmesg" => $dmesg,
"testlog" => $testlog, "testlog" => $testlog,
); );
while (my ($name, $source) = each(%files)) { while (my ($name, $source) = each(%files)) {
if (-f "$source") { if (-f "$source") {
cp "$source", "$dir/$name" or cp "$source", "$dir/$name" or
dodie "failed to copy $source"; dodie "failed to copy $source";
}
} }
}
doprint "*** Saved info to $dir ***\n"; doprint "*** Saved info to $dir ***\n";
} }
sub fail { sub fail {
if ($die_on_failure) { if ($die_on_failure) {
dodie @_; dodie @_;
} }
doprint "FAILED\n"; doprint "FAILED\n";
my $i = $iteration; my $i = $iteration;
# no need to reboot for just building. # no need to reboot for just building.
if (!do_not_reboot) { if (!do_not_reboot) {
doprint "REBOOTING\n"; doprint "REBOOTING\n";
reboot_to_good $sleep_time; reboot_to_good $sleep_time;
} }
my $name = ""; my $name = "";
if (defined($test_name)) { if (defined($test_name)) {
$name = " ($test_name)"; $name = " ($test_name)";
} }
print_times; print_times;
doprint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"; doprint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
doprint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"; doprint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
doprint "KTEST RESULT: TEST $i$name Failed: ", @_, "\n"; doprint "KTEST RESULT: TEST $i$name Failed: ", @_, "\n";
doprint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"; doprint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
doprint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"; doprint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
if (defined($store_failures)) { if (defined($store_failures)) {
save_logs "fail", $store_failures; save_logs "fail", $store_failures;
} }
if (defined($post_test)) { if (defined($post_test)) {
run_command $post_test; run_command $post_test;
} }
return 1; return 1;
} }
sub run_command { sub run_command {
...@@ -1969,9 +1969,9 @@ sub get_grub_index { ...@@ -1969,9 +1969,9 @@ sub get_grub_index {
$target = '^menuentry.*' . $grub_menu_qt; $target = '^menuentry.*' . $grub_menu_qt;
$skip = '^menuentry\s|^submenu\s'; $skip = '^menuentry\s|^submenu\s';
} elsif ($reboot_type eq "grub2bls") { } elsif ($reboot_type eq "grub2bls") {
$command = $grub_bls_get; $command = $grub_bls_get;
$target = '^title=.*' . $grub_menu_qt; $target = '^title=.*' . $grub_menu_qt;
$skip = '^title='; $skip = '^title=';
} else { } else {
return; return;
} }
...@@ -2394,7 +2394,7 @@ sub check_buildlog { ...@@ -2394,7 +2394,7 @@ sub check_buildlog {
while (<IN>) { while (<IN>) {
if (/$check_build_re/) { if (/$check_build_re/) {
my $warning = process_warning_line $_; my $warning = process_warning_line $_;
$warnings_list{$warning} = 1; $warnings_list{$warning} = 1;
} }
} }
...@@ -2659,7 +2659,7 @@ sub success { ...@@ -2659,7 +2659,7 @@ sub success {
doprint "*******************************************\n"; doprint "*******************************************\n";
if (defined($store_successes)) { if (defined($store_successes)) {
save_logs "success", $store_successes; save_logs "success", $store_successes;
} }
if ($i != $opt{"NUM_TESTS"} && !do_not_reboot) { if ($i != $opt{"NUM_TESTS"} && !do_not_reboot) {
...@@ -3246,13 +3246,13 @@ sub run_config_bisect { ...@@ -3246,13 +3246,13 @@ sub run_config_bisect {
$ret = run_config_bisect_test $config_bisect_type; $ret = run_config_bisect_test $config_bisect_type;
if ($ret) { if ($ret) {
doprint "NEW GOOD CONFIG ($pass)\n"; doprint "NEW GOOD CONFIG ($pass)\n";
system("cp $output_config $tmpdir/good_config.tmp.$pass"); system("cp $output_config $tmpdir/good_config.tmp.$pass");
$pass++; $pass++;
# Return 3 for good config # Return 3 for good config
return 3; return 3;
} else { } else {
doprint "NEW BAD CONFIG ($pass)\n"; doprint "NEW BAD CONFIG ($pass)\n";
system("cp $output_config $tmpdir/bad_config.tmp.$pass"); system("cp $output_config $tmpdir/bad_config.tmp.$pass");
$pass++; $pass++;
# Return 4 for bad config # Return 4 for bad config
...@@ -3371,7 +3371,7 @@ sub config_bisect { ...@@ -3371,7 +3371,7 @@ sub config_bisect {
} while ($ret == 3 || $ret == 4); } while ($ret == 3 || $ret == 4);
if ($ret == 2) { if ($ret == 2) {
config_bisect_end "$good_config.tmp", "$bad_config.tmp"; config_bisect_end "$good_config.tmp", "$bad_config.tmp";
} }
return $ret if ($ret < 0); return $ret if ($ret < 0);
...@@ -3551,7 +3551,6 @@ sub read_kconfig { ...@@ -3551,7 +3551,6 @@ sub read_kconfig {
my $cont = 0; my $cont = 0;
my $line; my $line;
if (! -f $kconfig) { if (! -f $kconfig) {
doprint "file $kconfig does not exist, skipping\n"; doprint "file $kconfig does not exist, skipping\n";
return; return;
...@@ -3660,7 +3659,7 @@ sub read_depends { ...@@ -3660,7 +3659,7 @@ sub read_depends {
if (! -f $kconfig && $arch =~ /\d$/) { if (! -f $kconfig && $arch =~ /\d$/) {
my $orig = $arch; my $orig = $arch;
# some subarchs have numbers, truncate them # some subarchs have numbers, truncate them
$arch =~ s/\d*$//; $arch =~ s/\d*$//;
$kconfig = "$builddir/arch/$arch/Kconfig"; $kconfig = "$builddir/arch/$arch/Kconfig";
if (! -f $kconfig) { if (! -f $kconfig) {
...@@ -3855,7 +3854,7 @@ sub make_min_config { ...@@ -3855,7 +3854,7 @@ sub make_min_config {
foreach my $config (@config_keys) { foreach my $config (@config_keys) {
my $kconfig = chomp_config $config; my $kconfig = chomp_config $config;
if (!defined $depcount{$kconfig}) { if (!defined $depcount{$kconfig}) {
$depcount{$kconfig} = 0; $depcount{$kconfig} = 0;
} }
} }
...@@ -3957,13 +3956,13 @@ sub make_min_config { ...@@ -3957,13 +3956,13 @@ sub make_min_config {
my $failed = 0; my $failed = 0;
build "oldconfig" or $failed = 1; build "oldconfig" or $failed = 1;
if (!$failed) { if (!$failed) {
start_monitor_and_install or $failed = 1; start_monitor_and_install or $failed = 1;
if ($type eq "test" && !$failed) { if ($type eq "test" && !$failed) {
do_run_test or $failed = 1; do_run_test or $failed = 1;
} }
end_monitor; end_monitor;
} }
$in_bisect = 0; $in_bisect = 0;
...@@ -4277,8 +4276,8 @@ sub send_email { ...@@ -4277,8 +4276,8 @@ sub send_email {
sub cancel_test { sub cancel_test {
if ($email_when_canceled) { if ($email_when_canceled) {
my $name = get_test_name; my $name = get_test_name;
send_email("KTEST: Your [$name] test was cancelled", send_email("KTEST: Your [$name] test was cancelled",
"Your test started at $script_start_time was cancelled: sig int"); "Your test started at $script_start_time was cancelled: sig int");
} }
die "\nCaught Sig Int, test interrupted: $!\n" die "\nCaught Sig Int, test interrupted: $!\n"
} }
...@@ -4326,15 +4325,15 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { ...@@ -4326,15 +4325,15 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
# The first test may override the PRE_KTEST option # The first test may override the PRE_KTEST option
if ($i == 1) { if ($i == 1) {
if (defined($pre_ktest)) { if (defined($pre_ktest)) {
doprint "\n"; doprint "\n";
run_command $pre_ktest; run_command $pre_ktest;
} }
if ($email_when_started) { if ($email_when_started) {
my $name = get_test_name; my $name = get_test_name;
send_email("KTEST: Your [$name] test was started", send_email("KTEST: Your [$name] test was started",
"Your test was started on $script_start_time"); "Your test was started on $script_start_time");
} }
} }
# Any test can override the POST_KTEST option # Any test can override the POST_KTEST option
...@@ -4506,12 +4505,11 @@ if ($opt{"POWEROFF_ON_SUCCESS"}) { ...@@ -4506,12 +4505,11 @@ if ($opt{"POWEROFF_ON_SUCCESS"}) {
run_command $switch_to_good; run_command $switch_to_good;
} }
doprint "\n $successes of $opt{NUM_TESTS} tests were successful\n\n"; doprint "\n $successes of $opt{NUM_TESTS} tests were successful\n\n";
if ($email_when_finished) { if ($email_when_finished) {
send_email("KTEST: Your test has finished!", send_email("KTEST: Your test has finished!",
"$successes of $opt{NUM_TESTS} tests started at $script_start_time were successful!"); "$successes of $opt{NUM_TESTS} tests started at $script_start_time were successful!");
} }
if (defined($opt{"LOG_FILE"})) { if (defined($opt{"LOG_FILE"})) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment