From nobody Thu Sep 18 01:30:50 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9262C4332F for ; Mon, 12 Dec 2022 22:30:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233079AbiLLWaZ (ORCPT ); Mon, 12 Dec 2022 17:30:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229872AbiLLWaX (ORCPT ); Mon, 12 Dec 2022 17:30:23 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 901E813F82 for ; Mon, 12 Dec 2022 14:30:21 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2E03C61255 for ; Mon, 12 Dec 2022 22:30:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C122C433D2; Mon, 12 Dec 2022 22:30:19 +0000 (UTC) Date: Mon, 12 Dec 2022 17:30:18 -0500 From: Steven Rostedt To: Linus Torvalds Cc: LKML , John 'Warthog9' Hawley , Masami Hiramatsu Subject: [GIT PULL] ktest.pl: Updates for 6.2 Message-ID: <20221212173018.3c55203a@gandalf.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Linus, ktest changes for 6.2 - Fix minconfig test to unset the config and not relying on olddefconfig to do it, as some configs are set to default y - Fix reading grub2 menus for handling submenus - Add new ${shell } to execute shell commands that will be useful for setting variables like: HOSTNAME :=3D ${shell hostname} Please pull the latest ktest-v6.2 tree, which can be found at: git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest.git ktest-v6.2 Tag SHA1: 92ab08b90a396b3d430a1e95e387f110e453a852 Head SHA1: 88a51b4f2e65ca4378a81ff0925fad076e82e177 Steven Rostedt (2): ktest.pl minconfig: Unset configs instead of just removing them kest.pl: Fix grub2 menu handling for rebooting Steven Rostedt (Google) (1): ktest.pl: Add shell commands to variables ---- tools/testing/ktest/ktest.pl | 32 +++++++++++++++++++++++++------- tools/testing/ktest/sample.conf | 8 ++++++++ 2 files changed, 33 insertions(+), 7 deletions(-) --------------------------- diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index 09d1578f9d66..ac59999ed3de 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl @@ -802,7 +802,14 @@ sub process_variables { my $end =3D $3; # append beginning of value to retval $retval =3D "$retval$begin"; - if (defined($variable{$var})) { + if ($var =3D~ s/^shell\s+//) { + $retval =3D `$var`; + if ($?) { + doprint "WARNING: $var returned an error\n"; + } else { + chomp $retval; + } + } elsif (defined($variable{$var})) { $retval =3D "$retval$variable{$var}"; } elsif (defined($remove_undef) && $remove_undef) { # for if statements, any variable that is not defined, @@ -1963,7 +1970,7 @@ sub run_scp_mod { =20 sub _get_grub_index { =20 - my ($command, $target, $skip) =3D @_; + my ($command, $target, $skip, $submenu) =3D @_; =20 return if (defined($grub_number) && defined($last_grub_menu) && $last_grub_menu eq $grub_menu && defined($last_machine) && @@ -1980,11 +1987,16 @@ sub _get_grub_index { =20 my $found =3D 0; =20 + my $submenu_number =3D 0; + while () { if (/$target/) { $grub_number++; $found =3D 1; last; + } elsif (defined($submenu) && /$submenu/) { + $submenu_number++; + $grub_number =3D -1; } elsif (/$skip/) { $grub_number++; } @@ -1993,6 +2005,9 @@ sub _get_grub_index { =20 dodie "Could not find '$grub_menu' through $command on $machine" if (!$found); + if ($submenu_number > 0) { + $grub_number =3D "$submenu_number>$grub_number"; + } doprint "$grub_number\n"; $last_grub_menu =3D $grub_menu; $last_machine =3D $machine; @@ -2003,6 +2018,7 @@ sub get_grub_index { my $command; my $target; my $skip; + my $submenu; my $grub_menu_qt; =20 if ($reboot_type !~ /^grub/) { @@ -2017,8 +2033,9 @@ sub get_grub_index { $skip =3D '^\s*title\s'; } elsif ($reboot_type eq "grub2") { $command =3D "cat $grub_file"; - $target =3D '^menuentry.*' . $grub_menu_qt; - $skip =3D '^menuentry\s|^submenu\s'; + $target =3D '^\s*menuentry.*' . $grub_menu_qt; + $skip =3D '^\s*menuentry'; + $submenu =3D '^\s*submenu\s'; } elsif ($reboot_type eq "grub2bls") { $command =3D $grub_bls_get; $target =3D '^title=3D.*' . $grub_menu_qt; @@ -2027,7 +2044,7 @@ sub get_grub_index { return; } =20 - _get_grub_index($command, $target, $skip); + _get_grub_index($command, $target, $skip, $submenu); } =20 sub wait_for_input { @@ -2090,7 +2107,7 @@ sub reboot_to { if ($reboot_type eq "grub") { run_ssh "'(echo \"savedefault --default=3D$grub_number --once\" | grub --= batch)'"; } elsif (($reboot_type eq "grub2") or ($reboot_type eq "grub2bls")) { - run_ssh "$grub_reboot $grub_number"; + run_ssh "$grub_reboot \"'$grub_number'\""; } elsif ($reboot_type eq "syslinux") { run_ssh "$syslinux --once \\\"$syslinux_label\\\" $syslinux_path"; } elsif (defined $reboot_script) { @@ -3768,9 +3785,10 @@ sub test_this_config { # .config to make sure it is missing the config that # we had before my %configs =3D %min_configs; - delete $configs{$config}; + $configs{$config} =3D "# $config is not set"; make_new_config ((values %configs), (values %keep_configs)); make_oldconfig; + delete $configs{$config}; undef %configs; assign_configs \%configs, $output_config; =20 diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.c= onf index 5e7d1d729752..2d0fe15a096d 100644 --- a/tools/testing/ktest/sample.conf +++ b/tools/testing/ktest/sample.conf @@ -259,6 +259,14 @@ # If PATH is not a config variable, then the ${PATH} in # the MAKE_CMD option will be evaluated by the shell when # the MAKE_CMD option is passed into shell processing. +# +# Shell commands can also be inserted with the ${shell } +# expression. Note, this is case sensitive, thus ${SHELL } +# will not work. +# +# HOSTNAME :=3D ${shell hostname} +# DEFAULTS IF "${HOSTNAME}" =3D=3D "frodo" +# =20 #### Using options in other options #### #