From bd1413cdee0b4a6b955a900d53ed3d8d085fbbbc Mon Sep 17 00:00:00 2001 From: "Ricardo B. Marlière (SUSE)" Date: Wed, 14 Oct 2026 15:00:52 -0300 Subject: ktest: Sort config keys before writing config files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit apply_min_config(), save_config(), and make_min_config() write CONFIG_* lines by iterating "keys %hash" with no sort. Perl randomizes hash iteration order per process by default, so the line order of the resulting config files is not reproducible across otherwise identical invocations. When two of those lines are mutually exclusive members of the same Kconfig "choice", this can change which one "make olddefconfig" keeps, nondeterministically, from run to run. Observed with CONFIG_DEBUG_INFO_DWARF5 vs CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT: five consecutive "-C" builds from identical ADD_CONFIG/MIN_CONFIG inputs alternated between the two, which is enough to force a near-complete rebuild each time since CONFIG_DEBUG_INFO_* affects every object's compile flags. Sort the keys before writing so the same inputs always produce the same config output. Link: https://patch.msgid.link/20261014-ktest-kconfig-perl-hash-v1-1-66201a2dee82@marliere.net Signed-off-by: Ricardo B. Marlière (SUSE) Signed-off-by: Steven Rostedt --- tools/testing/ktest/ktest.pl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index f94ed2e98887..1945f6ee2483 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl @@ -2652,7 +2652,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; @@ -3325,7 +3325,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 +4137,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 +4165,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; -- cgit v1.2.3 From bde7aa6d4b0a5eaa23abba58538c7c571baf9b9e Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Tue, 20 Oct 2026 10:33:38 -0400 Subject: ktest.pl: Add total test run time to output It can be interesting to know what the total time of all the tests took. Instead of just seeing the time for each individual test, at the end of the test (even on failure) show the total time the test took to complete. This can also help identify if something has changed in the setup that should be investigated if the times suddenly increase drastically. Link: https://patch.msgid.link/20261020103338.4be97a72@gandalf.local.home Signed-off-by: Steven Rostedt --- tools/testing/ktest/ktest.pl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index 1945f6ee2483..ad61f1ee2e7c 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"; } @@ -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; -- cgit v1.2.3 From 5b598ba5f3bf367944956cee59c6d078c53ca694 Mon Sep 17 00:00:00 2001 From: "Ricardo B. Marlière (SUSE)" Date: Tue, 20 Oct 2026 16:41:31 -0300 Subject: ktest: Accept quoted bad term in git bisect output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Git commit 0c0f93e7fa64 ("bisect: print bisect terms in single quotes") changed the completion message to put single quotes around the bisect term. run_git_bisect() only recognizes "is the first bad commit", so it misses completion and continues the bisect loop with newer Git. Accept both quoted and unquoted forms to retain compatibility with older Git versions. Link: https://git.kernel.org/pub/scm/git/git.git/commit/?id=0c0f93e7fa645c1058226a9bfde9e2b4441edf96 Assisted-by: LLM Signed-off-by: Ricardo B. Marlière (SUSE) Signed-off-by: Steven Rostedt --- tools/testing/ktest/ktest.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index ad61f1ee2e7c..66fd98b6b04b 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl @@ -3030,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; -- cgit v1.2.3