Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ktest: Add PRE_KTEST_DIE for PRE_KTEST failures

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 <warthog9@eaglescrag.net>
Cc: Andrea Righi <arighi@nvidia.com>
Cc: Marcos Paulo de Souza <mpdesouza@suse.com>
Cc: Matthieu Baerts <matttbe@kernel.org>
Cc: Fernando Fernandez Mancera <fmancera@suse.de>
Cc: Pedro Falcato <pfalcato@suse.de>
Link: https://patch.msgid.link/20260307-ktest-fixes-v1-7-565d412f4925@suse.com
Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

authored by

Ricardo B. Marlière and committed by
Steven Rostedt
972816d2 eae247f6

+13 -1
+7 -1
tools/testing/ktest/ktest.pl
··· 101 101 my $build_options; 102 102 my $final_post_ktest; 103 103 my $pre_ktest; 104 + my $pre_ktest_die; 104 105 my $post_ktest; 105 106 my $pre_test; 106 107 my $pre_test_die; ··· 284 283 "BUILD_DIR" => \$builddir, 285 284 "TEST_TYPE" => \$test_type, 286 285 "PRE_KTEST" => \$pre_ktest, 286 + "PRE_KTEST_DIE" => \$pre_ktest_die, 287 287 "POST_KTEST" => \$post_ktest, 288 288 "PRE_TEST" => \$pre_test, 289 289 "PRE_TEST_DIE" => \$pre_test_die, ··· 4508 4506 if ($i == 1) { 4509 4507 if (defined($pre_ktest)) { 4510 4508 doprint "\n"; 4511 - run_command $pre_ktest; 4509 + my $ret = run_command $pre_ktest; 4510 + if (!$ret && defined($pre_ktest_die) && 4511 + $pre_ktest_die) { 4512 + dodie "failed to pre_ktest\n"; 4513 + } 4512 4514 } 4513 4515 if ($email_when_started) { 4514 4516 my $name = get_test_name;
+6
tools/testing/ktest/sample.conf
··· 494 494 # 495 495 # default (undefined) 496 496 #PRE_KTEST = ${SSH} ~/set_up_test 497 + # 498 + # To specify if the test should fail if PRE_KTEST fails, 499 + # PRE_KTEST_DIE needs to be set to 1. Otherwise the PRE_KTEST 500 + # result is ignored. 501 + # (default 0) 502 + #PRE_KTEST_DIE = 1 497 503 498 504 # If you want to execute some command after all the tests have 499 505 # completed, you can set this option. Note, it can be set as a