Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1159110yba; Thu, 9 May 2019 11:43:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqz4LsgSzYFpZhGYBchayTtAWZM8vYiij5xt7lc8oqOFfTciDkv6BT3TQAHu/q3LXVpsUum2 X-Received: by 2002:a17:902:e407:: with SMTP id ci7mr7200983plb.219.1557427409686; Thu, 09 May 2019 11:43:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557427409; cv=none; d=google.com; s=arc-20160816; b=ieEqh8UzBcL+nBKMRvvGiUwbnNSi3kb9hAvmGqgnemCurhyPjtHaJfXWRDMlDDH3FF 1iGqzg6aN+JP2apU7RcUMiGFAbogSynSbGvwf+47PbQnwFsGBId2dtp3B8Z3yDpr5tQT EG4dDtlD1XFGqBrMO8EraQrCexBtryenrXOkgcWKloMkwcdtbG0myHkiThYYv1qLQeCx dlQkPuRwC5o3hAyGcOE8jz+d4+vsNpxKX0FVWjSI03gbk4mVP0qIJ7HrC6B3IZSw1gnm sATJDGj8EbHGazwUjt2WkEGBFjdr4bgJfFj8PmjV61SJWnk+POTMBaOznrhyApz+Cuka 3oQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=mptSEhGHOQIt+up5U30KoZZlHsfX6RVuFMamD67Y8W4=; b=j7yEdDwS+bOQH3OlRLOOpDxQvwqdtFRI5Yr+j+MI4tPa2iJsYJSqvFVTcDlgYDVcxG xTiH965i2vC5J2fKNQJPIvt6gLacVPRoSAZX7BaAeZ7m/+cd7joBRcK9M0CmIK9i9tso UeGtKJDrh31259io26VuAGxd2xSUqwezAD5+thF2dpjDejjblfMBY+fMyQPBagKXLvLe o42MUOnbxcZGL8WYLrPThpR9rBCF5eHKi3UmeVL94aJxZ9TKFSaaU0AUA6bQcgxlv7LR eNFB8Hj3FOUuEZ79V2DhdGT8tEKzaPPAkrJi6T7Am01zNKpdr/mhwvA5FffcHmspMIVX vNGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gnYxh+ld; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 4si3679677plc.424.2019.05.09.11.43.13; Thu, 09 May 2019 11:43:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gnYxh+ld; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726714AbfEISmH (ORCPT + 99 others); Thu, 9 May 2019 14:42:07 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:33906 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726632AbfEISmG (ORCPT ); Thu, 9 May 2019 14:42:06 -0400 Received: by mail-qk1-f195.google.com with SMTP id n68so2130534qka.1 for ; Thu, 09 May 2019 11:42:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=mptSEhGHOQIt+up5U30KoZZlHsfX6RVuFMamD67Y8W4=; b=gnYxh+ldLfrRUjqO2nIHOA75ebVHTGKpNFzsD2lTr9WZeB0wfxgipMgWNCZ5Yh575I dReUlS5Hcvp4xzRd4Q+AYnpY7PFsjiZIMJeVkg+OCtnXru8iTIO6P5/bwaUbCEe9881t byl22PacZPGLwSIE85PozxZuvEsM0e6gQ6vHWC5HGdy0ewW0ll7lgu7xrgSQxP722xg8 ACOfUtsIu4XvQgb8Z5A1BhCcMxqL9DVHCofF+t7uCfikW/Cde6PvubeA62o39VXV8mgU gIwexii9dIUBn3fH5TyIIJSFzxNfVjJdqq5nKYCIOsemjwpM7nPI2uMNnRAqwwrl+pfj tTUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=mptSEhGHOQIt+up5U30KoZZlHsfX6RVuFMamD67Y8W4=; b=GdgHwQQJ6Poabkc7uQZo6kQdxqlIAmafQviuCqqaWxFVueTf5c8mcqHOrbxPm31nqe kRdfAG2gyMf18mz2LYERGCArgT92IE0HMbAP9L4VSYY+t0FehhFKpHRXTqnKig4UqeIW 6CQYGnq8BP+iev5+6i7MLOHXkQvCpYDsCRKJFb+GLx5tn7rf6kfHKInheXJLk8070/dA XMTm8ka4CInztG3iENyIzxpGrG+RB/dbqFLOpq4sB0tdTuJtS2Vmm5Rsm9PzuJpR+cHG BZfP5/S2oRjS5vQVFSKpdtsB4B8SiOQNSR27RHgOuVbLCI1qeBrgphdPiaLUKRixFV42 eEwg== X-Gm-Message-State: APjAAAWmOqgLIsINgi5x801OVmy0Hucj04m2xYTqXSyQH4CwlqFtV2jH gWOo9/a2P0FdOyXmixqTkw== X-Received: by 2002:a37:7d82:: with SMTP id y124mr4916226qkc.167.1557427325876; Thu, 09 May 2019 11:42:05 -0700 (PDT) Received: from gabell (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id t10sm1679402qti.83.2019.05.09.11.42.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 May 2019 11:42:05 -0700 (PDT) Date: Thu, 9 May 2019 14:41:59 -0400 From: Masayoshi Mizuma To: Steven Rostedt Cc: Masayoshi Mizuma , linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/5] ktest: cleanup get_grub_index Message-ID: <20190509184158.te2cglg2nuvgm6gm@gabell> References: <20190509174630.26713-1-msys.mizuma@gmail.com> <20190509174630.26713-3-msys.mizuma@gmail.com> <20190509135721.4802161b@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190509135721.4802161b@gandalf.local.home> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 09, 2019 at 01:57:21PM -0400, Steven Rostedt wrote: > On Thu, 9 May 2019 13:46:27 -0400 > Masayoshi Mizuma wrote: > > > From: Masayoshi Mizuma > > > > Cleanup get_grub_index(). > > Hi Masayoshi, > > Thanks for the patches, quick comment below. > > > > > Signed-off-by: Masayoshi Mizuma > > --- > > tools/testing/ktest/ktest.pl | 50 +++++++++++------------------------- > > 1 file changed, 15 insertions(+), 35 deletions(-) > > > > diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl > > index 3862b23672f7..1255ea0d9df4 100755 > > --- a/tools/testing/ktest/ktest.pl > > +++ b/tools/testing/ktest/ktest.pl > > @@ -1934,46 +1934,26 @@ sub get_grub2_index { > > > > sub get_grub_index { > > > > - if ($reboot_type eq "grub2") { > > - get_grub2_index; > > - return; > > - } > > - > > - if ($reboot_type ne "grub") { > > - return; > > - } > > We still need something like: > > if ($reboot_type !~ /^grub/) { > return; > } > > Because I believe this will run (and probably error) for syslinux boot > systems. I have a couple, I could test it and find out ;-) Thank you for your review! I'll add the check. Thanks! Masa > > -- Steve > > > - return if (defined($grub_number) && defined($last_grub_menu) && > > - $last_grub_menu eq $grub_menu && defined($last_machine) && > > - $last_machine eq $machine); > > - > > - doprint "Find grub menu ... "; > > - $grub_number = -1; > > + my $command; > > + my $target; > > + my $skip; > > + my $grub_menu_qt; > > > > - my $ssh_grub = $ssh_exec; > > - $ssh_grub =~ s,\$SSH_COMMAND,cat /boot/grub/menu.lst,g; > > + return if ($reboot_type ne "grub") and ($reboot_type ne "grub2"); > > > > - open(IN, "$ssh_grub |") > > - or dodie "unable to get menu.lst"; > > - > > - my $found = 0; > > - my $grub_menu_qt = quotemeta($grub_menu); > > + $grub_menu_qt = quotemeta($grub_menu); > > > > - while () { > > - if (/^\s*title\s+$grub_menu_qt\s*$/) { > > - $grub_number++; > > - $found = 1; > > - last; > > - } elsif (/^\s*title\s/) { > > - $grub_number++; > > - } > > + if ($reboot_type eq "grub") { > > + $command = "cat /boot/grub/menu.lst"; > > + $target = '^\s*title\s+' . $grub_menu_qt . '\s*$'; > > + $skip = '^\s*title\s'; > > + } elsif ($reboot_type eq "grub2") { > > + $command = "cat $grub_file"; > > + $target = '^menuentry.*' . $grub_menu_qt; > > + $skip = '^menuentry\s|^submenu\s'; > > } > > - close(IN); > > > > - dodie "Could not find '$grub_menu' in /boot/grub/menu on $machine" > > - if (!$found); > > - doprint "$grub_number\n"; > > - $last_grub_menu = $grub_menu; > > - $last_machine = $machine; > > + _get_grub_index($command, $target, $skip); > > } > > > > sub wait_for_input >