ktest: Add helper function to avoid duplicate code
Several places had the following code: get_grub_index; get_version; install; start_monitor; return monitor; Creating a function "start_monitor_and_boot()" replaces these mulitple uses with a single call. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
This commit is contained in:
parent
1990207d53
commit
ddf607e5f8
1 changed files with 20 additions and 26 deletions
|
@ -1096,6 +1096,23 @@ sub install {
|
||||||
do_post_install;
|
do_post_install;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub get_version {
|
||||||
|
# get the release name
|
||||||
|
doprint "$make kernelrelease ... ";
|
||||||
|
$version = `$make kernelrelease | tail -1`;
|
||||||
|
chomp($version);
|
||||||
|
doprint "$version\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub start_monitor_and_boot {
|
||||||
|
get_grub_index;
|
||||||
|
get_version;
|
||||||
|
install;
|
||||||
|
|
||||||
|
start_monitor;
|
||||||
|
return monitor;
|
||||||
|
}
|
||||||
|
|
||||||
sub check_buildlog {
|
sub check_buildlog {
|
||||||
my ($patch) = @_;
|
my ($patch) = @_;
|
||||||
|
|
||||||
|
@ -1307,14 +1324,6 @@ sub success {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub get_version {
|
|
||||||
# get the release name
|
|
||||||
doprint "$make kernelrelease ... ";
|
|
||||||
$version = `$make kernelrelease | tail -1`;
|
|
||||||
chomp($version);
|
|
||||||
doprint "$version\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
sub answer_bisect {
|
sub answer_bisect {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
doprint "Pass or fail? [p/f]";
|
doprint "Pass or fail? [p/f]";
|
||||||
|
@ -1479,12 +1488,7 @@ sub run_bisect_test {
|
||||||
dodie "Failed on build" if $failed;
|
dodie "Failed on build" if $failed;
|
||||||
|
|
||||||
# Now boot the box
|
# Now boot the box
|
||||||
get_grub_index;
|
start_monitor_and_boot or $failed = 1;
|
||||||
get_version;
|
|
||||||
install;
|
|
||||||
|
|
||||||
start_monitor;
|
|
||||||
monitor or $failed = 1;
|
|
||||||
|
|
||||||
if ($type ne "boot") {
|
if ($type ne "boot") {
|
||||||
if ($failed && $bisect_skip) {
|
if ($failed && $bisect_skip) {
|
||||||
|
@ -2115,14 +2119,9 @@ sub patchcheck {
|
||||||
|
|
||||||
next if ($type eq "build");
|
next if ($type eq "build");
|
||||||
|
|
||||||
get_grub_index;
|
|
||||||
get_version;
|
|
||||||
install;
|
|
||||||
|
|
||||||
my $failed = 0;
|
my $failed = 0;
|
||||||
|
|
||||||
start_monitor;
|
start_monitor_and_boot or $failed = 1;
|
||||||
monitor or $failed = 1;
|
|
||||||
|
|
||||||
if (!$failed && $type ne "boot"){
|
if (!$failed && $type ne "boot"){
|
||||||
do_run_test or $failed = 1;
|
do_run_test or $failed = 1;
|
||||||
|
@ -2393,13 +2392,8 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($test_type ne "build") {
|
if ($test_type ne "build") {
|
||||||
get_grub_index;
|
|
||||||
get_version;
|
|
||||||
install;
|
|
||||||
|
|
||||||
my $failed = 0;
|
my $failed = 0;
|
||||||
start_monitor;
|
start_monitor_and_boot or $failed = 1;
|
||||||
monitor or $failed = 1;;
|
|
||||||
|
|
||||||
if (!$failed && $test_type ne "boot" && defined($run_test)) {
|
if (!$failed && $test_type ne "boot" && defined($run_test)) {
|
||||||
do_run_test or $failed = 1;
|
do_run_test or $failed = 1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue