lkml.org 
[lkml]   [2018]   [Apr]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3 1/4] Ktest: add email support
From
Date
> I just fixed them up and pulled them in myself. ;-)
>
> I also added the following on top of them (and testing this, live while
> testing ftrace patches and other builds).
Thanks Steve!
> diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
> index 30a4c053f98b..837fa75cbb47 100755
> --- a/tools/testing/ktest/ktest.pl
> +++ b/tools/testing/ktest/ktest.pl
> @@ -23,7 +23,7 @@ my %evals;
>
> #default opts
> my %default = (
> - "MAILER" => "sendmail", # default mailer
> + "MAILER" => "sendmail", # default mailer
Noticed this when I sent the new version.

> "EMAIL_ON_ERROR" => 1,
> "EMAIL_WHEN_FINISHED" => 1,
> "EMAIL_WHEN_CANCELED" => 0,
> @@ -218,6 +218,7 @@ my $dirname = $FindBin::Bin;
>
> my $mailto;
> my $mailer;
> +my $mail_exec;
> my $email_on_error;
> my $email_when_finished;
> my $email_when_started;
> @@ -1431,7 +1433,14 @@ sub do_not_reboot {
> ($test_type eq "config_bisect" && $opt{"CONFIG_BISECT_TYPE[$i]"} eq "build");
> }
>
> +my $in_die = 0;
> +
> sub dodie {
> +
> + # avoid recusion
> + return if ($in_die);
> + $in_die = 1;
> +
> doprint "CRITICAL FAILURE... ", @_, "\n";
Good idea.
>
> my $i = $iteration;
> @@ -4126,21 +4135,31 @@ sub set_test_option {
>
> sub _mailx_send {
> my ($subject, $message) = @_;
> - system("$mailer -s \'$subject\' $mailto <<< \'$message\'");
> +
> + if (!defined($mail_exec)) {
> + $mail_exec = $mailer;
> + }
> + run_command "$mail_exec -s \'$subject\' $mailto <<< \'$message\'";
> }
>
> sub _sendmail_send {
> my ($subject, $message) = @_;
> - system("echo -e \"Subject: $subject\n\n$message\" | sendmail -t $mailto");
> +
> + if (!defined($mail_exec)) {
> + $mail_exec = "/usr/sbin/sendmail";
> + }
> + run_command "echo \'Subject: $subject\n\n$message\' | $mail_exec -t $mailto";
> }
>
Not sure if I understand why $mail_exec is necessary. Doesn't $mailer
already have a default? Wouldn't people just use $mailer to define the
executable they want to use? What if the $mailx_exec specified doesn't
use '-t' option?

Thanks,
Tim

\
 
 \ /
  Last update: 2018-04-07 01:12    [W:0.113 / U:1.992 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site