From nobody Tue Apr 7 04:18:39 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF4A53E0C48 for ; Mon, 16 Mar 2026 18:40:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773686453; cv=none; b=uc4NJ4ME2SJDkY9+MTVY0lFrYCzu9UDMbpVLoHHjZH5zsk/iFApez5PkOOos6PStnnLVw/L/m2F+TVHzpIP+WplLywtfvguNVhLHSOCcHI1pArI816M2PGLPpV7cMw4GyTgkERCjoYOdmFNTMbYIrNJlU437WzSgAufpQs2GT3w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773686453; c=relaxed/simple; bh=npn5yCqDMSOsKuKAbRBrbWNTJ++bqhBqf3BU2qEe2fU=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=iWz4jq8yt4pmHWwGYuDNNJJ/ZksrjiYJ5PCr1gRmdlMvESYVw1D+IAAx9BtPoLY4GoFS4SE50kX2Dgwqr4NxEqWKBYRuBKxiOCrGCKchTxlknEAuCiMF9A/TOTn24ktx25NUDLuLp4PwX7+cNelqU9pjeOMEjkfrJgcCOhDNLVQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oZy58dt6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oZy58dt6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8423FC2BCB8; Mon, 16 Mar 2026 18:40:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773686452; bh=npn5yCqDMSOsKuKAbRBrbWNTJ++bqhBqf3BU2qEe2fU=; h=Date:From:To:Cc:Subject:References:From; b=oZy58dt6d/rd3KchJ8EnGuMJbtepsLw3nUxChTyanpHPwOjUB2IPeNYwaYAhhzfZQ UIbHTGETAtxTmI8QPffRnakp/6WawaGGq8/aK1GGbErMh/aTF/2ozoNefcDZiP5q9s pGN/PZJMOnNrsTZc6XFXNjRm5TJoyWDERZPUJgdKIu02nCtH0+Urx8z3xKlrZKCCKx bfWIN0wPRM/vUGxM1keiTVkd1I97z1qwE7ifX9SEESMVoYaMAvPjCshFS2ncTfsh+h ykBGhdmTm0XKuRSCCVsNdLqNPK4lBWOI4mc3lpEGX/atYWmZVad0eeHuAoSRxm0Xeh Be5GL6z550RCQ== Received: from rostedt by gandalf with local (Exim 4.99.1) (envelope-from ) id 1w2CsO-0000000854t-3TaV; Mon, 16 Mar 2026 14:41:16 -0400 Message-ID: <20260316184116.695990593@kernel.org> User-Agent: quilt/0.69 Date: Mon, 16 Mar 2026 14:40:40 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: "John Warthog9 Hawley" , =?UTF-8?q?Ricardo=20B.=20Marli=C3=A8re?= , John Hawley , Andrea Righi , Marcos Paulo de Souza , Matthieu Baerts , Fernando Fernandez Mancera , Pedro Falcato Subject: [for-next][PATCH 7/9] ktest: Add PRE_KTEST_DIE for PRE_KTEST failures References: <20260316184033.927944169@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: =3D?UTF-8?q?Ricardo=3D20B=3D2E=3D20Marli=3DC3=3DA8re?=3D PRE_KTEST runs before the first test, but its return status is currently ignored. A failing setup hook can leave the rest of the run executing in a partially initialized environment. Add PRE_KTEST_DIE so PRE_KTEST can fail the run in the same way PRE_BUILD_DIE and PRE_TEST_DIE already can. Keep the default behavior unchanged when the new option is not set. Cc: John Hawley Cc: Andrea Righi Cc: Marcos Paulo de Souza Cc: Matthieu Baerts Cc: Fernando Fernandez Mancera Cc: Pedro Falcato Link: https://patch.msgid.link/20260307-ktest-fixes-v1-7-565d412f4925@suse.= com Signed-off-by: Ricardo B. Marli=C3=A8re Signed-off-by: Steven Rostedt --- tools/testing/ktest/ktest.pl | 8 +++++++- tools/testing/ktest/sample.conf | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index bd2e2311884c..b018b937e028 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl @@ -101,6 +101,7 @@ my $build_type; my $build_options; my $final_post_ktest; my $pre_ktest; +my $pre_ktest_die; my $post_ktest; my $pre_test; my $pre_test_die; @@ -283,6 +284,7 @@ my %option_map =3D ( "BUILD_DIR" =3D> \$builddir, "TEST_TYPE" =3D> \$test_type, "PRE_KTEST" =3D> \$pre_ktest, + "PRE_KTEST_DIE" =3D> \$pre_ktest_die, "POST_KTEST" =3D> \$post_ktest, "PRE_TEST" =3D> \$pre_test, "PRE_TEST_DIE" =3D> \$pre_test_die, @@ -4506,7 +4508,11 @@ for (my $i =3D 1; $i <=3D $opt{"NUM_TESTS"}; $i++) { if ($i =3D=3D 1) { if (defined($pre_ktest)) { doprint "\n"; - run_command $pre_ktest; + my $ret =3D run_command $pre_ktest; + if (!$ret && defined($pre_ktest_die) && + $pre_ktest_die) { + dodie "failed to pre_ktest\n"; + } } if ($email_when_started) { my $name =3D get_test_name; diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.c= onf index 9c4c449a8f3e..b6e439ef511b 100644 --- a/tools/testing/ktest/sample.conf +++ b/tools/testing/ktest/sample.conf @@ -494,6 +494,12 @@ # # default (undefined) #PRE_KTEST =3D ${SSH} ~/set_up_test +# +# To specify if the test should fail if PRE_KTEST fails, +# PRE_KTEST_DIE needs to be set to 1. Otherwise the PRE_KTEST +# result is ignored. +# (default 0) +#PRE_KTEST_DIE =3D 1 =20 # If you want to execute some command after all the tests have # completed, you can set this option. Note, it can be set as a --=20 2.51.0