mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* ktest: Updates for v7.4
@ 2026-10-29  1:35 Steven Rostedt
  0 siblings, 0 replies; only message in thread
From: Steven Rostedt @ 2026-10-29  1:35 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: LKML, John 'Warthog9' Hawley, Ricardo B. Marlière (SUSE)


Linus,

[ I just noticed I had some ktest patches sitting around in my repo.
  I just pushed everything up to my tree. They are minor updates so
  hopefully they are fine for this late in the merge window. ]

ktest updates for v7.4:

- Sort configs before writing config file

  Currently the .config file is created from the perl hash array from
  reading the applied min-configs. The order is determined by how perl
  hashes the values. This causes the .config file to be created in different
  orders for each run, and the order may determine the final value of the
  .config file after it goes through a make oldconfig.

  Sort the values when creating the .config so that the result is the same
  for every run.

- Add total test time to run output

  Have ktest display the total test time of running all the tests. This is
  useful to find issues in the build, install, boot or test run where things
  are hanging for longer than expected.

- Update reading of the git output during bisect

  The ktest bisect is an automated way to run git bisect. Since there
  currently no easy way to know if the bisect found the bad commit (I'm
  talking with the git maintainers to fix this[1]), it parses the output for
  the line "is first bad commit". But a recent update to git has the output
  state "is the first 'bad' commit" which breaks ktest bisect.

  Have ktest handle both output strings.

[1] https://lore.kernel.org/all/20261020141011.0015d172@gandalf.local.home/


Please pull the latest ktest-v7.4 tree, which can be found at:


  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest.git
ktest-v7.4

Tag SHA1: 2ea0984e576a2d61b0ec784deeb6d4889a794562
Head SHA1: 5b598ba5f3bf367944956cee59c6d078c53ca694


Ricardo B. Marlière (SUSE) (2):
      ktest: Sort config keys before writing config files
      ktest: Accept quoted bad term in git bisect output

Steven Rostedt (1):
      ktest.pl: Add total test run time to output

----
 tools/testing/ktest/ktest.pl | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)
---------------------------
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index f94ed2e98887..66fd98b6b04b 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -227,6 +227,7 @@ my $build_time;
 my $install_time;
 my $reboot_time;
 my $test_time;
+my $start_run_time;
 
 my $warning_found = 0;
 
@@ -1609,6 +1610,14 @@ sub run_post_ktest {
     $post_ktest_done = 1;
 }
 
+sub show_run_time {
+    return if (!$start_run_time);
+    my $end_run_time = time;
+    doprint "\n   Total run time: ";
+    show_time($end_run_time - $start_run_time);
+    doprint "\n";
+}
+
 sub dodie {
     # avoid recursion
     return if ($in_die);
@@ -1631,6 +1640,8 @@ sub dodie {
 	`$power_off`;
     }
 
+    show_run_time();
+
     if (defined($opt{"LOG_FILE"})) {
 	print " See $opt{LOG_FILE} for more info.\n";
     }
@@ -2652,7 +2663,7 @@ sub apply_min_config {
 	}
 	close IN;
     }
-    foreach my $config (keys %force_config) {
+    foreach my $config (sort keys %force_config) {
 	print OUT "$force_config{$config}\n";
     }
     close OUT;
@@ -3019,7 +3030,7 @@ sub run_git_bisect {
     doprint "SUCCESS\n";
     if ($output =~ m/^(Bisecting: .*\(roughly \d+ steps?\))\s+\[([[:xdigit:]]+)\]/) {
 	doprint "$1 [$2]\n";
-    } elsif ($output =~ m/^([[:xdigit:]]+) is the first bad commit/) {
+    } elsif ($output =~ m/^([[:xdigit:]]+) is the first (bad|'bad') commit/) {
 	$bisect_bad_commit = $1;
 	doprint "Found bad commit... $1\n";
 	return 0;
@@ -3325,7 +3336,7 @@ sub save_config {
 
     open(OUT, ">$file") or dodie "Can not write to $file";
 
-    foreach my $config (keys %configs) {
+    foreach my $config (sort keys %configs) {
 	print OUT "$configs{$config}\n";
     }
     close(OUT);
@@ -4137,7 +4148,7 @@ sub make_min_config {
 	    if (defined($ignore_config)) {
 		open (OUT, ">$temp_config") or
 		    dodie "Can't write to $temp_config";
-		foreach my $config (keys %save_configs) {
+		foreach my $config (sort keys %save_configs) {
 		    print OUT "$save_configs{$config}\n";
 		}
 		close OUT;
@@ -4165,10 +4176,10 @@ sub make_min_config {
 	    # Save off all the current mandatory configs
 	    open (OUT, ">$temp_config") or
 		dodie "Can't write to $temp_config";
-	    foreach my $config (keys %keep_configs) {
+	    foreach my $config (sort keys %keep_configs) {
 		print OUT "$keep_configs{$config}\n";
 	    }
-	    foreach my $config (keys %min_configs) {
+	    foreach my $config (sort keys %min_configs) {
 		print OUT "$min_configs{$config}\n";
 	    }
 	    close OUT;
@@ -4534,6 +4545,8 @@ print_test_preamble 0;
 
 $SIG{INT} = qw(cancel_test);
 
+$start_run_time = time;
+
 # First we need to do is the builds
 for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
 
@@ -4766,6 +4779,8 @@ if ($email_when_finished) {
 	"$successes of $opt{NUM_TESTS} tests started at $script_start_time were successful!");
 }
 
+show_run_time();
+
 if (defined($opt{"LOG_FILE"})) {
     print "\n See $opt{LOG_FILE} for the record of results.\n\n";
     close LOG;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-29  1:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-29  1:35 ktest: Updates for v7.4 Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®