Skip to content

Commit 5269faa

Browse files
satoru-takeuchirostedt
authored andcommitted
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>
1 parent f983a2b commit 5269faa

1 file changed

Lines changed: 20 additions & 22 deletions

File tree

‎tools/testing/ktest/ktest.pl‎

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"IGNORE_UNUSED" => 0,
7373
);
7474

75-
my $ktest_config;
75+
my $ktest_config = "ktest.conf";
7676
my $version;
7777
my $have_version = 0;
7878
my $machine;
@@ -521,7 +521,7 @@ sub read_ync {
521521
return read_prompt 1, $prompt;
522522
}
523523

524-
sub get_ktest_config {
524+
sub get_mandatory_config {
525525
my ($config) = @_;
526526
my $ans;
527527

@@ -552,54 +552,54 @@ sub get_ktest_config {
552552
}
553553
}
554554

555-
sub get_ktest_configs {
556-
get_ktest_config("MACHINE");
557-
get_ktest_config("BUILD_DIR");
558-
get_ktest_config("OUTPUT_DIR");
555+
sub get_mandatory_configs {
556+
get_mandatory_config("MACHINE");
557+
get_mandatory_config("BUILD_DIR");
558+
get_mandatory_config("OUTPUT_DIR");
559559

560560
if ($newconfig) {
561-
get_ktest_config("BUILD_OPTIONS");
561+
get_mandatory_config("BUILD_OPTIONS");
562562
}
563563

564564
# options required for other than just building a kernel
565565
if (!$buildonly) {
566-
get_ktest_config("POWER_CYCLE");
567-
get_ktest_config("CONSOLE");
566+
get_mandatory_config("POWER_CYCLE");
567+
get_mandatory_config("CONSOLE");
568568
}
569569

570570
# options required for install and more
571571
if ($buildonly != 1) {
572-
get_ktest_config("SSH_USER");
573-
get_ktest_config("BUILD_TARGET");
574-
get_ktest_config("TARGET_IMAGE");
572+
get_mandatory_config("SSH_USER");
573+
get_mandatory_config("BUILD_TARGET");
574+
get_mandatory_config("TARGET_IMAGE");
575575
}
576576

577-
get_ktest_config("LOCALVERSION");
577+
get_mandatory_config("LOCALVERSION");
578578

579579
return if ($buildonly);
580580

581581
my $rtype = $opt{"REBOOT_TYPE"};
582582

583583
if (!defined($rtype)) {
584584
if (!defined($opt{"GRUB_MENU"})) {
585-
get_ktest_config("REBOOT_TYPE");
585+
get_mandatory_config("REBOOT_TYPE");
586586
$rtype = $entered_configs{"REBOOT_TYPE"};
587587
} else {
588588
$rtype = "grub";
589589
}
590590
}
591591

592592
if ($rtype eq "grub") {
593-
get_ktest_config("GRUB_MENU");
593+
get_mandatory_config("GRUB_MENU");
594594
}
595595

596596
if ($rtype eq "grub2") {
597-
get_ktest_config("GRUB_MENU");
598-
get_ktest_config("GRUB_FILE");
597+
get_mandatory_config("GRUB_MENU");
598+
get_mandatory_config("GRUB_FILE");
599599
}
600600

601601
if ($rtype eq "syslinux") {
602-
get_ktest_config("SYSLINUX_LABEL");
602+
get_mandatory_config("SYSLINUX_LABEL");
603603
}
604604
}
605605

@@ -1089,7 +1089,7 @@ sub read_config {
10891089
$test_case = __read_config $config, \$test_num;
10901090

10911091
# make sure we have all mandatory configs
1092-
get_ktest_configs;
1092+
get_mandatory_configs;
10931093

10941094
# was a test specified?
10951095
if (!$test_case) {
@@ -3858,7 +3858,7 @@ sub make_warnings_file {
38583858
success $i;
38593859
}
38603860

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";
38623862

38633863
if ($#ARGV == 0) {
38643864
$ktest_config = $ARGV[0];
@@ -3868,8 +3868,6 @@ sub make_warnings_file {
38683868
exit 0;
38693869
}
38703870
}
3871-
} else {
3872-
$ktest_config = "ktest.conf";
38733871
}
38743872

38753873
if (! -f $ktest_config) {

0 commit comments

Comments
 (0)