lkml.org 
[lkml]   [2018]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/3] Ktest: use dodie for critical falures
On Fri, 15 Dec 2017 15:20:10 -0800
Tim Tianyang Chen <tianyang.chen@oracle.com> wrote:

> 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

I would say you don't need it for parsing the config either. It doesn't
make sense, as you wouldn't have the mailto defined yet.


> @@ -4132,7 +4132,7 @@ if ($#ARGV == 0) {
> if (! -f $ktest_config) {
> $newconfig = 1;
> get_test_case;
> - open(OUT, ">$ktest_config") or die "Can not create $ktest_config";
> + open(OUT, ">$ktest_config") or dodie "Can not create $ktest_config";

Here, no config was specified, and so no configs either.


> print OUT << "EOF"
> # Generated by ktest.pl
> #
> @@ -4167,7 +4167,7 @@ if (defined($opt{"LOG_FILE"})) {
> my @new_configs = keys %entered_configs;
> if ($#new_configs >= 0) {
> print "\nAppending entered in configs to $ktest_config\n";
> - open(OUT, ">>$ktest_config") or die "Can not append to $ktest_config";
> + open(OUT, ">>$ktest_config") or dodie "Can not append to $ktest_config";

Here too.


-- Steve


> foreach my $config (@new_configs) {
> print OUT "$config = $entered_configs{$config}\n";
> $opt{$config} = process_variables($entered_configs{$config});

\
 
 \ /
  Last update: 2018-03-21 16:16    [W:0.130 / U:0.324 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site