diff options
author | Satoru Takeuchi <satoru.takeuchi@gmail.com> | 2014-03-09 10:32:04 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2014-04-23 23:18:12 -0400 |
commit | 5269faad27f8ed8df1c7ba520a8de628fd248362 (patch) | |
tree | 8790b7cad1bc93b9c16d6d9d9b2e2b2dd0f776f7 /tools/testing/ktest/ktest.pl | |
parent | f983a2bc9d355fb04932b38fee2533114c204cce (diff) |
ktest: Some cleanup for improving readability
Some cleanup for improving readability as follows.
- Initialize $ktest_config at its definition.
- Put parentheses around the `config-file' argument in the usage message
because it's a optional one.
- Rename get_ktest_config{,s} to more descriptive get_mandatory_config{,s}.
Link: http://lkml.kernel.org/r/87fvmr30kb.wl%satoru.takeuchi@gmail.com
Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'tools/testing/ktest/ktest.pl')
-rwxr-xr-x | tools/testing/ktest/ktest.pl | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index f731ef69aed2..c34f0dedad2d 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl | |||
@@ -72,7 +72,7 @@ my %default = ( | |||
72 | "IGNORE_UNUSED" => 0, | 72 | "IGNORE_UNUSED" => 0, |
73 | ); | 73 | ); |
74 | 74 | ||
75 | my $ktest_config; | 75 | my $ktest_config = "ktest.conf"; |
76 | my $version; | 76 | my $version; |
77 | my $have_version = 0; | 77 | my $have_version = 0; |
78 | my $machine; | 78 | my $machine; |
@@ -521,7 +521,7 @@ sub read_ync { | |||
521 | return read_prompt 1, $prompt; | 521 | return read_prompt 1, $prompt; |
522 | } | 522 | } |
523 | 523 | ||
524 | sub get_ktest_config { | 524 | sub get_mandatory_config { |
525 | my ($config) = @_; | 525 | my ($config) = @_; |
526 | my $ans; | 526 | my $ans; |
527 | 527 | ||
@@ -552,29 +552,29 @@ sub get_ktest_config { | |||
552 | } | 552 | } |
553 | } | 553 | } |
554 | 554 | ||
555 | sub get_ktest_configs { | 555 | sub get_mandatory_configs { |
556 | get_ktest_config("MACHINE"); | 556 | get_mandatory_config("MACHINE"); |
557 | get_ktest_config("BUILD_DIR"); | 557 | get_mandatory_config("BUILD_DIR"); |
558 | get_ktest_config("OUTPUT_DIR"); | 558 | get_mandatory_config("OUTPUT_DIR"); |
559 | 559 | ||
560 | if ($newconfig) { | 560 | if ($newconfig) { |
561 | get_ktest_config("BUILD_OPTIONS"); | 561 | get_mandatory_config("BUILD_OPTIONS"); |
562 | } | 562 | } |
563 | 563 | ||
564 | # options required for other than just building a kernel | 564 | # options required for other than just building a kernel |
565 | if (!$buildonly) { | 565 | if (!$buildonly) { |
566 | get_ktest_config("POWER_CYCLE"); | 566 | get_mandatory_config("POWER_CYCLE"); |
567 | get_ktest_config("CONSOLE"); | 567 | get_mandatory_config("CONSOLE"); |
568 | } | 568 | } |
569 | 569 | ||
570 | # options required for install and more | 570 | # options required for install and more |
571 | if ($buildonly != 1) { | 571 | if ($buildonly != 1) { |
572 | get_ktest_config("SSH_USER"); | 572 | get_mandatory_config("SSH_USER"); |
573 | get_ktest_config("BUILD_TARGET"); | 573 | get_mandatory_config("BUILD_TARGET"); |
574 | get_ktest_config("TARGET_IMAGE"); | 574 | get_mandatory_config("TARGET_IMAGE"); |
575 | } | 575 | } |
576 | 576 | ||
577 | get_ktest_config("LOCALVERSION"); | 577 | get_mandatory_config("LOCALVERSION"); |
578 | 578 | ||
579 | return if ($buildonly); | 579 | return if ($buildonly); |
580 | 580 | ||
@@ -582,7 +582,7 @@ sub get_ktest_configs { | |||
582 | 582 | ||
583 | if (!defined($rtype)) { | 583 | if (!defined($rtype)) { |
584 | if (!defined($opt{"GRUB_MENU"})) { | 584 | if (!defined($opt{"GRUB_MENU"})) { |
585 | get_ktest_config("REBOOT_TYPE"); | 585 | get_mandatory_config("REBOOT_TYPE"); |
586 | $rtype = $entered_configs{"REBOOT_TYPE"}; | 586 | $rtype = $entered_configs{"REBOOT_TYPE"}; |
587 | } else { | 587 | } else { |
588 | $rtype = "grub"; | 588 | $rtype = "grub"; |
@@ -590,16 +590,16 @@ sub get_ktest_configs { | |||
590 | } | 590 | } |
591 | 591 | ||
592 | if ($rtype eq "grub") { | 592 | if ($rtype eq "grub") { |
593 | get_ktest_config("GRUB_MENU"); | 593 | get_mandatory_config("GRUB_MENU"); |
594 | } | 594 | } |
595 | 595 | ||
596 | if ($rtype eq "grub2") { | 596 | if ($rtype eq "grub2") { |
597 | get_ktest_config("GRUB_MENU"); | 597 | get_mandatory_config("GRUB_MENU"); |
598 | get_ktest_config("GRUB_FILE"); | 598 | get_mandatory_config("GRUB_FILE"); |
599 | } | 599 | } |
600 | 600 | ||
601 | if ($rtype eq "syslinux") { | 601 | if ($rtype eq "syslinux") { |
602 | get_ktest_config("SYSLINUX_LABEL"); | 602 | get_mandatory_config("SYSLINUX_LABEL"); |
603 | } | 603 | } |
604 | } | 604 | } |
605 | 605 | ||
@@ -1089,7 +1089,7 @@ sub read_config { | |||
1089 | $test_case = __read_config $config, \$test_num; | 1089 | $test_case = __read_config $config, \$test_num; |
1090 | 1090 | ||
1091 | # make sure we have all mandatory configs | 1091 | # make sure we have all mandatory configs |
1092 | get_ktest_configs; | 1092 | get_mandatory_configs; |
1093 | 1093 | ||
1094 | # was a test specified? | 1094 | # was a test specified? |
1095 | if (!$test_case) { | 1095 | if (!$test_case) { |
@@ -3858,7 +3858,7 @@ sub make_warnings_file { | |||
3858 | success $i; | 3858 | success $i; |
3859 | } | 3859 | } |
3860 | 3860 | ||
3861 | $#ARGV < 1 or die "ktest.pl version: $VERSION\n usage: ktest.pl config-file\n"; | 3861 | $#ARGV < 1 or die "ktest.pl version: $VERSION\n usage: ktest.pl [config-file]\n"; |
3862 | 3862 | ||
3863 | if ($#ARGV == 0) { | 3863 | if ($#ARGV == 0) { |
3864 | $ktest_config = $ARGV[0]; | 3864 | $ktest_config = $ARGV[0]; |
@@ -3868,8 +3868,6 @@ if ($#ARGV == 0) { | |||
3868 | exit 0; | 3868 | exit 0; |
3869 | } | 3869 | } |
3870 | } | 3870 | } |
3871 | } else { | ||
3872 | $ktest_config = "ktest.conf"; | ||
3873 | } | 3871 | } |
3874 | 3872 | ||
3875 | if (! -f $ktest_config) { | 3873 | if (! -f $ktest_config) { |