[PATCH v3 3/4] ktest: use dodie for critical falures
Users should get emails when the script dies because of a critical failure. Critical failures are defined as any errors that could abnormally terminate the script. In order to add email support, this patch converts all die() to dodie() except: * when '-v' is used as an option to get the version of the script. * in Sig-Int handeler because it's not a fatal error to cancel the script. * errors happen during parsing config Suggested-by: Dhaval GianiSigned-off-by: Tim Tianyang Chen --- tools/testing/ktest/ktest.pl | 54 ++-- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index b0db4a6d3e97..21cdb8152ef6 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl @@ -1502,7 +1502,7 @@ sub exec_console { close($pts); exec $console or - die "Can't open console $console"; + dodie "Can't open console $console"; } sub open_console { @@ -1650,7 +1650,7 @@ sub save_logs { if (!-d $dir) { mkpath($dir) or - die "can't create $dir"; + dodie "can't create $dir"; } my %files = ( @@ -1663,7 +1663,7 @@ sub save_logs { while (my ($name, $source) = each(%files)) { if (-f "$source") { cp "$source", "$dir/$name" or - die "failed to copy $source"; + dodie "failed to copy $source"; } } @@ -1837,7 +1837,7 @@ sub get_grub2_index { $ssh_grub =~ s,\$SSH_COMMAND,cat $grub_file,g; open(IN, "$ssh_grub |") - or die "unable to get $grub_file"; + or dodie "unable to get $grub_file"; my $found = 0; @@ -1852,7 +1852,7 @@ sub get_grub2_index { } close(IN); -die "Could not find '$grub_menu' in $grub_file on $machine" +dodie "Could not find '$grub_menu' in $grub_file on $machine" if (!$found); doprint "$grub_number\n"; $last_grub_menu = $grub_menu; @@ -1880,7 +1880,7 @@ sub get_grub_index { $ssh_grub =~ s,\$SSH_COMMAND,cat /boot/grub/menu.lst,g; open(IN, "$ssh_grub |") - or die "unable to get menu.lst"; + or dodie "unable to get menu.lst"; my $found = 0; @@ -1895,7 +1895,7 @@ sub get_grub_index { } close(IN); -die "Could not find '$grub_menu' in /boot/grub/menu on $machine" +dodie "Could not find '$grub_menu' in /boot/grub/menu on $machine" if (!$found); doprint "$grub_number\n"; $last_grub_menu = $grub_menu; @@ -2008,7 +2008,7 @@ sub monitor { my $full_line = ""; open(DMESG, "> $dmesg") or - die "unable to write to $dmesg"; + dodie "unable to write to $dmesg"; reboot_to; @@ -2887,7 +2887,7 @@ sub run_bisect { sub update_bisect_replay { my $tmp_log = "$tmpdir/ktest_bisect_log"; run_command "git bisect log > $tmp_log" or - die "can't create bisect log"; + dodie "can't create bisect log"; return $tmp_log; } @@ -2896,9 +2896,9 @@ sub bisect { my $result; -die "BISECT_GOOD[$i] not defined\n"if (!defined($bisect_good)); -die "BISECT_BAD[$i] not defined\n" if (!defined($bisect_bad)); -die "BISECT_TYPE[$i] not defined\n"if (!defined($bisect_type)); +dodie "BISECT_GOOD[$i] not defined\n" if (!defined($bisect_good)); +dodie "BISECT_BAD[$i] not defined\n" if (!defined($bisect_bad)); +dodie "BISECT_TYPE[$i] not defined\n" if (!defined($bisect_type)); my $good = $bisect_good; my $bad = $bisect_bad; @@ -2961,7 +2961,7 @@ sub bisect { if ($check ne "good") { doprint "TESTING BISECT BAD [$bad]\n"; run_command "git checkout $bad" or - die "Failed to checkout $bad"; + dodie "Failed to checkout $bad"; $result = run_bisect $type; @@ -2973,7 +2973,7 @@ sub bisect { if ($check ne "bad") { doprint "TESTING BISECT GOOD [$good]\n"; run_command "git checkout $good" or - die "Failed to checkout $good"; + dodie "Failed to checkout $good"; $result = run_bisect $type; @@ -2984,7 +2984,7 @@ sub bisect { # checkout where we started run_command "git checkout $head" or - die "Failed to checkout $head"; + dodie "Failed to checkout $head"; } run_command "git bisect start$start_files" or @@ -3441,9 +3441,9 @@ sub patchcheck_reboot { sub patchcheck { my ($i) = @_; -die "PATCHCHECK_START[$i] not defined\n" +dodie "PATCHCHECK_START[$i] not defined\n" if (!defined($patchcheck_start)); -die "PATCHCHECK_TYPE[$i] not defined\n" +dodie "PATCHCHECK_TYPE[$i] not defined\n" if (!defined($patchcheck_type)); my $start = $patchcheck_start; @@ -3457,7
[PATCH v3 3/4] ktest: use dodie for critical falures
Users should get emails when the script dies because of a critical failure. Critical failures are defined as any errors that could abnormally terminate the script. In order to add email support, this patch converts all die() to dodie() except: * when '-v' is used as an option to get the version of the script. * in Sig-Int handeler because it's not a fatal error to cancel the script. * errors happen during parsing config Suggested-by: Dhaval Giani Signed-off-by: Tim Tianyang Chen --- tools/testing/ktest/ktest.pl | 54 ++-- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index b0db4a6d3e97..21cdb8152ef6 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl @@ -1502,7 +1502,7 @@ sub exec_console { close($pts); exec $console or - die "Can't open console $console"; + dodie "Can't open console $console"; } sub open_console { @@ -1650,7 +1650,7 @@ sub save_logs { if (!-d $dir) { mkpath($dir) or - die "can't create $dir"; + dodie "can't create $dir"; } my %files = ( @@ -1663,7 +1663,7 @@ sub save_logs { while (my ($name, $source) = each(%files)) { if (-f "$source") { cp "$source", "$dir/$name" or - die "failed to copy $source"; + dodie "failed to copy $source"; } } @@ -1837,7 +1837,7 @@ sub get_grub2_index { $ssh_grub =~ s,\$SSH_COMMAND,cat $grub_file,g; open(IN, "$ssh_grub |") - or die "unable to get $grub_file"; + or dodie "unable to get $grub_file"; my $found = 0; @@ -1852,7 +1852,7 @@ sub get_grub2_index { } close(IN); -die "Could not find '$grub_menu' in $grub_file on $machine" +dodie "Could not find '$grub_menu' in $grub_file on $machine" if (!$found); doprint "$grub_number\n"; $last_grub_menu = $grub_menu; @@ -1880,7 +1880,7 @@ sub get_grub_index { $ssh_grub =~ s,\$SSH_COMMAND,cat /boot/grub/menu.lst,g; open(IN, "$ssh_grub |") - or die "unable to get menu.lst"; + or dodie "unable to get menu.lst"; my $found = 0; @@ -1895,7 +1895,7 @@ sub get_grub_index { } close(IN); -die "Could not find '$grub_menu' in /boot/grub/menu on $machine" +dodie "Could not find '$grub_menu' in /boot/grub/menu on $machine" if (!$found); doprint "$grub_number\n"; $last_grub_menu = $grub_menu; @@ -2008,7 +2008,7 @@ sub monitor { my $full_line = ""; open(DMESG, "> $dmesg") or - die "unable to write to $dmesg"; + dodie "unable to write to $dmesg"; reboot_to; @@ -2887,7 +2887,7 @@ sub run_bisect { sub update_bisect_replay { my $tmp_log = "$tmpdir/ktest_bisect_log"; run_command "git bisect log > $tmp_log" or - die "can't create bisect log"; + dodie "can't create bisect log"; return $tmp_log; } @@ -2896,9 +2896,9 @@ sub bisect { my $result; -die "BISECT_GOOD[$i] not defined\n"if (!defined($bisect_good)); -die "BISECT_BAD[$i] not defined\n" if (!defined($bisect_bad)); -die "BISECT_TYPE[$i] not defined\n"if (!defined($bisect_type)); +dodie "BISECT_GOOD[$i] not defined\n" if (!defined($bisect_good)); +dodie "BISECT_BAD[$i] not defined\n" if (!defined($bisect_bad)); +dodie "BISECT_TYPE[$i] not defined\n" if (!defined($bisect_type)); my $good = $bisect_good; my $bad = $bisect_bad; @@ -2961,7 +2961,7 @@ sub bisect { if ($check ne "good") { doprint "TESTING BISECT BAD [$bad]\n"; run_command "git checkout $bad" or - die "Failed to checkout $bad"; + dodie "Failed to checkout $bad"; $result = run_bisect $type; @@ -2973,7 +2973,7 @@ sub bisect { if ($check ne "bad") { doprint "TESTING BISECT GOOD [$good]\n"; run_command "git checkout $good" or - die "Failed to checkout $good"; + dodie "Failed to checkout $good"; $result = run_bisect $type; @@ -2984,7 +2984,7 @@ sub bisect { # checkout where we started run_command "git checkout $head" or - die "Failed to checkout $head"; + dodie "Failed to checkout $head"; } run_command "git bisect start$start_files" or @@ -3441,9 +3441,9 @@ sub patchcheck_reboot { sub patchcheck { my ($i) = @_; -die "PATCHCHECK_START[$i] not defined\n" +dodie "PATCHCHECK_START[$i] not defined\n" if (!defined($patchcheck_start)); -die "PATCHCHECK_TYPE[$i] not defined\n" +dodie "PATCHCHECK_TYPE[$i] not defined\n" if (!defined($patchcheck_type)); my $start = $patchcheck_start; @@ -3457,7 +3457,7 @@ sub patchcheck { if
[PATCH v3 3/4] Ktest: use dodie for critical falures
Users should get emails when the script dies because of a critical failure. Critical failures are defined as any errors that could abnormally terminate the script. In order to add email support, this patch converts all die() to dodie() except: * when '-v' is used as an option to get the version of the script. * in Sig-Int handeler because it's not a fatal error to cancel the script. * errors happen during parsing config Suggested-by: Dhaval GianiSigned-off-by: Tim Tianyang Chen --- Changes since v2: revert a change for opening and appending the config file Changes since v1: revert changes for errors happen during config parsing --- ktest.pl | 54 +++--- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/ktest.pl b/ktest.pl index 8be12ee27d34..03514a06844c 100755 --- a/ktest.pl +++ b/ktest.pl @@ -1502,7 +1502,7 @@ sub exec_console { close($pts); exec $console or - die "Can't open console $console"; + dodie "Can't open console $console"; } sub open_console { @@ -1650,7 +1650,7 @@ sub save_logs { if (!-d $dir) { mkpath($dir) or - die "can't create $dir"; + dodie "can't create $dir"; } my %files = ( @@ -1663,7 +1663,7 @@ sub save_logs { while (my ($name, $source) = each(%files)) { if (-f "$source") { cp "$source", "$dir/$name" or - die "failed to copy $source"; + dodie "failed to copy $source"; } } @@ -1837,7 +1837,7 @@ sub get_grub2_index { $ssh_grub =~ s,\$SSH_COMMAND,cat $grub_file,g; open(IN, "$ssh_grub |") - or die "unable to get $grub_file"; + or dodie "unable to get $grub_file"; my $found = 0; @@ -1852,7 +1852,7 @@ sub get_grub2_index { } close(IN); -die "Could not find '$grub_menu' in $grub_file on $machine" +dodie "Could not find '$grub_menu' in $grub_file on $machine" if (!$found); doprint "$grub_number\n"; $last_grub_menu = $grub_menu; @@ -1880,7 +1880,7 @@ sub get_grub_index { $ssh_grub =~ s,\$SSH_COMMAND,cat /boot/grub/menu.lst,g; open(IN, "$ssh_grub |") - or die "unable to get menu.lst"; + or dodie "unable to get menu.lst"; my $found = 0; @@ -1895,7 +1895,7 @@ sub get_grub_index { } close(IN); -die "Could not find '$grub_menu' in /boot/grub/menu on $machine" +dodie "Could not find '$grub_menu' in /boot/grub/menu on $machine" if (!$found); doprint "$grub_number\n"; $last_grub_menu = $grub_menu; @@ -2008,7 +2008,7 @@ sub monitor { my $full_line = ""; open(DMESG, "> $dmesg") or - die "unable to write to $dmesg"; + dodie "unable to write to $dmesg"; reboot_to; @@ -2887,7 +2887,7 @@ sub run_bisect { sub update_bisect_replay { my $tmp_log = "$tmpdir/ktest_bisect_log"; run_command "git bisect log > $tmp_log" or - die "can't create bisect log"; + dodie "can't create bisect log"; return $tmp_log; } @@ -2896,9 +2896,9 @@ sub bisect { my $result; -die "BISECT_GOOD[$i] not defined\n"if (!defined($bisect_good)); -die "BISECT_BAD[$i] not defined\n" if (!defined($bisect_bad)); -die "BISECT_TYPE[$i] not defined\n"if (!defined($bisect_type)); +dodie "BISECT_GOOD[$i] not defined\n" if (!defined($bisect_good)); +dodie "BISECT_BAD[$i] not defined\n" if (!defined($bisect_bad)); +dodie "BISECT_TYPE[$i] not defined\n" if (!defined($bisect_type)); my $good = $bisect_good; my $bad = $bisect_bad; @@ -2961,7 +2961,7 @@ sub bisect { if ($check ne "good") { doprint "TESTING BISECT BAD [$bad]\n"; run_command "git checkout $bad" or - die "Failed to checkout $bad"; + dodie "Failed to checkout $bad"; $result = run_bisect $type; @@ -2973,7 +2973,7 @@ sub bisect { if ($check ne "bad") { doprint "TESTING BISECT GOOD [$good]\n"; run_command "git checkout $good" or - die "Failed to checkout $good"; + dodie "Failed to checkout $good"; $result = run_bisect $type; @@ -2984,7 +2984,7 @@ sub bisect { # checkout where we started run_command "git checkout $head" or - die "Failed to checkout $head"; + dodie "Failed to checkout $head"; } run_command "git bisect start$start_files" or @@ -3441,9 +3441,9 @@ sub patchcheck_reboot { sub patchcheck { my ($i) = @_; -die "PATCHCHECK_START[$i] not defined\n" +dodie "PATCHCHECK_START[$i] not defined\n" if (!defined($patchcheck_start)); -die "PATCHCHECK_TYPE[$i] not defined\n" +dodie "PATCHCHECK_TYPE[$i] not defined\n"
[PATCH v3 3/4] Ktest: use dodie for critical falures
Users should get emails when the script dies because of a critical failure. Critical failures are defined as any errors that could abnormally terminate the script. In order to add email support, this patch converts all die() to dodie() except: * when '-v' is used as an option to get the version of the script. * in Sig-Int handeler because it's not a fatal error to cancel the script. * errors happen during parsing config Suggested-by: Dhaval Giani Signed-off-by: Tim Tianyang Chen --- Changes since v2: revert a change for opening and appending the config file Changes since v1: revert changes for errors happen during config parsing --- ktest.pl | 54 +++--- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/ktest.pl b/ktest.pl index 8be12ee27d34..03514a06844c 100755 --- a/ktest.pl +++ b/ktest.pl @@ -1502,7 +1502,7 @@ sub exec_console { close($pts); exec $console or - die "Can't open console $console"; + dodie "Can't open console $console"; } sub open_console { @@ -1650,7 +1650,7 @@ sub save_logs { if (!-d $dir) { mkpath($dir) or - die "can't create $dir"; + dodie "can't create $dir"; } my %files = ( @@ -1663,7 +1663,7 @@ sub save_logs { while (my ($name, $source) = each(%files)) { if (-f "$source") { cp "$source", "$dir/$name" or - die "failed to copy $source"; + dodie "failed to copy $source"; } } @@ -1837,7 +1837,7 @@ sub get_grub2_index { $ssh_grub =~ s,\$SSH_COMMAND,cat $grub_file,g; open(IN, "$ssh_grub |") - or die "unable to get $grub_file"; + or dodie "unable to get $grub_file"; my $found = 0; @@ -1852,7 +1852,7 @@ sub get_grub2_index { } close(IN); -die "Could not find '$grub_menu' in $grub_file on $machine" +dodie "Could not find '$grub_menu' in $grub_file on $machine" if (!$found); doprint "$grub_number\n"; $last_grub_menu = $grub_menu; @@ -1880,7 +1880,7 @@ sub get_grub_index { $ssh_grub =~ s,\$SSH_COMMAND,cat /boot/grub/menu.lst,g; open(IN, "$ssh_grub |") - or die "unable to get menu.lst"; + or dodie "unable to get menu.lst"; my $found = 0; @@ -1895,7 +1895,7 @@ sub get_grub_index { } close(IN); -die "Could not find '$grub_menu' in /boot/grub/menu on $machine" +dodie "Could not find '$grub_menu' in /boot/grub/menu on $machine" if (!$found); doprint "$grub_number\n"; $last_grub_menu = $grub_menu; @@ -2008,7 +2008,7 @@ sub monitor { my $full_line = ""; open(DMESG, "> $dmesg") or - die "unable to write to $dmesg"; + dodie "unable to write to $dmesg"; reboot_to; @@ -2887,7 +2887,7 @@ sub run_bisect { sub update_bisect_replay { my $tmp_log = "$tmpdir/ktest_bisect_log"; run_command "git bisect log > $tmp_log" or - die "can't create bisect log"; + dodie "can't create bisect log"; return $tmp_log; } @@ -2896,9 +2896,9 @@ sub bisect { my $result; -die "BISECT_GOOD[$i] not defined\n"if (!defined($bisect_good)); -die "BISECT_BAD[$i] not defined\n" if (!defined($bisect_bad)); -die "BISECT_TYPE[$i] not defined\n"if (!defined($bisect_type)); +dodie "BISECT_GOOD[$i] not defined\n" if (!defined($bisect_good)); +dodie "BISECT_BAD[$i] not defined\n" if (!defined($bisect_bad)); +dodie "BISECT_TYPE[$i] not defined\n" if (!defined($bisect_type)); my $good = $bisect_good; my $bad = $bisect_bad; @@ -2961,7 +2961,7 @@ sub bisect { if ($check ne "good") { doprint "TESTING BISECT BAD [$bad]\n"; run_command "git checkout $bad" or - die "Failed to checkout $bad"; + dodie "Failed to checkout $bad"; $result = run_bisect $type; @@ -2973,7 +2973,7 @@ sub bisect { if ($check ne "bad") { doprint "TESTING BISECT GOOD [$good]\n"; run_command "git checkout $good" or - die "Failed to checkout $good"; + dodie "Failed to checkout $good"; $result = run_bisect $type; @@ -2984,7 +2984,7 @@ sub bisect { # checkout where we started run_command "git checkout $head" or - die "Failed to checkout $head"; + dodie "Failed to checkout $head"; } run_command "git bisect start$start_files" or @@ -3441,9 +3441,9 @@ sub patchcheck_reboot { sub patchcheck { my ($i) = @_; -die "PATCHCHECK_START[$i] not defined\n" +dodie "PATCHCHECK_START[$i] not defined\n" if (!defined($patchcheck_start)); -die "PATCHCHECK_TYPE[$i] not defined\n" +dodie "PATCHCHECK_TYPE[$i] not defined\n" if (!defined($patchcheck_type)); my $start