Received: by 10.213.65.68 with SMTP id h4csp50451imn; Fri, 6 Apr 2018 15:24:06 -0700 (PDT) X-Google-Smtp-Source: AIpwx48lrGoVXkcwIarp9lOBMiVCxf5rmT5xyBSVdKEboJGf3Rj5HZRm/76EC0qFAuMogdwm0V/U X-Received: by 2002:a17:902:bb8c:: with SMTP id m12-v6mr11209906pls.119.1523053446577; Fri, 06 Apr 2018 15:24:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523053446; cv=none; d=google.com; s=arc-20160816; b=BrvsB+mhbw8A8Uw2ULVoRLUF+Xy5F6Xj8Ldcr2f35RBXIYzcJQ4yix9ALdhHXy+fyL s2CwiqR7J/gaqRlc3xQwgtIFsfFzzT8rDgstQ6o64+twOxN96GdyYzmf/Ybvh+OQJI4Y +jwAAsVtcODid4TW+TC5kqOoEI9pRsRujkKauEgyV1p6WrA7AY5Vol2p5ymhC5lPGKwr j3C0DPXlkod9DM8Y7w1hUFGaw1Zz5a163bD4+hNzlmmftqtggrzG+E1VbzKrkhOkT4R8 DYczJMePBtWR6a/oPF++OkKw4ozFKf59I9E3ufnBTxfC2y3HTVZhhV8cMS9yUAp45BJq a8UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=pRAjSM9GXgjmb3nMnsLs/I1n2jD6cpX1/ueahHXzYgc=; b=JEK2weA8RGdJR5WjWGJlSC127JQb4QR33WHJWAf2trNMNurMoNq+Lu/a388RGBG+Gj InDzrXhi0EpksqpCxYmyzPfRT+S8LJ/Wu1CpYnb+exbZ29v4pxUvPIDbAl0zyg91xXIf mh+rFtsoESljX+XUlSt5PDV6lhOaQkjZa2hip/OLAUXPjEmk3K5J7jQQHXxTjKgNpZGU nyoQHgJVf+y4wfNm9HnDyKCP9Yic1auFY0dE19eU7jaTREuDHrPpMUL5L9PSDJVL/7FO 2B0hTDYDnC4q4n0ENosf/oj2H5bM501hkfPssMGxN0Dqjr0M4HpVKl+hBxPQlbDowp6M sdpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=iaAWwk1R; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u9si8617061pfa.293.2018.04.06.15.23.29; Fri, 06 Apr 2018 15:24:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=iaAWwk1R; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752594AbeDFWRf (ORCPT + 99 others); Fri, 6 Apr 2018 18:17:35 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:35804 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752553AbeDFWRc (ORCPT ); Fri, 6 Apr 2018 18:17:32 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w36M53UH078250; Fri, 6 Apr 2018 22:17:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=pRAjSM9GXgjmb3nMnsLs/I1n2jD6cpX1/ueahHXzYgc=; b=iaAWwk1R26C5/kKudrmj9B5OVvanW3B9N6a0BqluvZjXjtIwGNvqDULxodv6VTKn25tP Ft5TO5nnV4wnVdn7NJTH7DoEUswqXts2krPo1KgZ0KEYPzXq6swWM3fruzoeT2F71ARk ExPX63D9llTo5g6k7YwgYkX2pMlCuNr+AbiNn+06rtWG0+B5Au4jS+rGg1PFA9fG9Hsq ct8WJ3MmeeGMYAD68JV60NN87ZDsr93em9bbBkjurkDDtNreHDrTAFD91YwYcKCPkKjM /r9sRLDyAVXjrbmoyoy+IaVAsdOhe6BH+Q1boOFME6ju99FkdEpVr7WIL/SnGXHgLVcs Aw== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2120.oracle.com with ESMTP id 2h5kc6ett0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 06 Apr 2018 22:17:28 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w36MHRPU029460 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 6 Apr 2018 22:17:28 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w36MHRoX010077; Fri, 6 Apr 2018 22:17:27 GMT Received: from titichen-linux.us.oracle.com (/10.211.54.111) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 06 Apr 2018 15:17:27 -0700 From: Tim Tianyang Chen To: rostedt@goodmis.org Cc: linux-kernel@vger.kernel.org, dhaval.giani@oracle.com, tim.tianyang.chen@alumni.upenn.edu, Tim Tianyang Chen Subject: [PATCH v3 3/4] ktest: use dodie for critical falures Date: Fri, 6 Apr 2018 15:17:04 -0700 Message-Id: <1523053025-12424-4-git-send-email-tianyang.chen@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1523053025-12424-1-git-send-email-tianyang.chen@oracle.com> References: <1523053025-12424-1-git-send-email-tianyang.chen@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8855 signatures=668698 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1804060222 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 (defined($patchcheck_end)) { $end = $patchcheck_end; } elsif ($cherry) { - die "PATCHCHECK_END must be defined with PATCHCHECK_CHERRY\n"; + dodie "PATCHCHECK_END must be defined with PATCHCHECK_CHERRY\n"; } # Get the true sha1's since we can use things like HEAD~3 @@ -3521,7 +3521,7 @@ sub patchcheck { doprint "\nProcessing commit \"$item\"\n\n"; run_command "git checkout $sha1" or - die "Failed to checkout $sha1"; + dodie "Failed to checkout $sha1"; # only clean on the first and last patch if ($item eq $list[0] || @@ -3612,7 +3612,7 @@ sub read_kconfig { } open(KIN, "$kconfig") - or die "Can't open $kconfig"; + or dodie "Can't open $kconfig"; while () { chomp; @@ -3771,7 +3771,7 @@ sub get_depends { $dep =~ s/^[^$valid]*[$valid]+//; } else { - die "this should never happen"; + dodie "this should never happen"; } } @@ -4032,7 +4032,7 @@ sub make_min_config { # update new ignore configs if (defined($ignore_config)) { open (OUT, ">$temp_config") - or die "Can't write to $temp_config"; + or dodie "Can't write to $temp_config"; foreach my $config (keys %save_configs) { print OUT "$save_configs{$config}\n"; } @@ -4060,7 +4060,7 @@ sub make_min_config { # Save off all the current mandatory configs open (OUT, ">$temp_config") - or die "Can't write to $temp_config"; + or dodie "Can't write to $temp_config"; foreach my $config (keys %keep_configs) { print OUT "$keep_configs{$config}\n"; } @@ -4300,11 +4300,11 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { $outputdir = set_test_option("OUTPUT_DIR", $i); $builddir = set_test_option("BUILD_DIR", $i); - chdir $builddir || die "can't change directory to $builddir"; + chdir $builddir || dodie "can't change directory to $builddir"; if (!-d $outputdir) { mkpath($outputdir) or - die "can't create $outputdir"; + dodie "can't create $outputdir"; } $make = "$makecmd O=$outputdir"; @@ -4341,7 +4341,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { if (!-d $tmpdir) { mkpath($tmpdir) or - die "can't create $tmpdir"; + dodie "can't create $tmpdir"; } $ENV{"SSH_USER"} = $ssh_user; @@ -4414,7 +4414,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { if (defined($checkout)) { run_command "git checkout $checkout" or - die "failed to checkout $checkout"; + dodie "failed to checkout $checkout"; } $no_reboot = 0; -- 1.8.3.1