Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1115499yba; Thu, 9 May 2019 10:59:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqzBvgCNYThp09iRtJJuF7diGlWir9ixRA5dR/TyED2BzMCEtc2YrWwu9ySqQmVGsywOsXpP X-Received: by 2002:a17:902:8f8d:: with SMTP id z13mr856181plo.166.1557424797186; Thu, 09 May 2019 10:59:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557424797; cv=none; d=google.com; s=arc-20160816; b=TFzNSOIIhratHtZIlCBsY6X+V9ZVv/xHHgAVXHk/fVlOLwlXIkx/G+60T+fsZoPKMQ njWTVGjl8qdhCzD4H22usKlDZmeIiR472w2ndooQG1TAOOI+m0kVKM9BA/5plvke4Hvf GbsA5ZQ5CAqzlR5M8Si77NSrWnEsDDLgbecpR7vz1jm8zet6TIQrLip5xrexzwD4p5e6 WVHXJ8Ioz3g5X38qKO3qW24o5T5bd2Q4wBdLnZvepIOXJiVHtNwl2ko/8BWTH6b6AA/X +vaNGyVvYq8ow2d7i1neF3m+vSGxTm0H++dmjGKm/V3M/e/mca6sCRag6oML98I4qeRG 3yyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=JchiC1RXIlu+eoR4RLU4QJel3JObd3Ig21XjuICOu/k=; b=sxq7gSfyfsSmKJ+9eeHEw07T8eBLIPtsvxwS5QQyl0o6/O0wFf5KTS8DzA8V5UN+YT O+pCO6LiZyjLH/IIDOza/WUZRD04VhFsQBF2fOA11Q3a/DP4RhppVnj/8pocUUnWgI8/ sWqBvbQUWnE983FkcrtUCYdQfK9ONDUlIdaEjQMQR87vVwJ22BLqutKW5gt/HH3jF8AU KS6KBEcjf/6Ltev6D5Iwssac4sLkxCKyTeY53AfMxlU7/hr3gsMvQxSiRTLYVrcxbzLV 4IwkJIvgDxbYSu/y8G8RXiTjObJSd3RFIS2O3QNBt+JW6Cp9Tk0G/6+Zd2/WG7MjIs0M ilwQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o8si4204860pgc.137.2019.05.09.10.59.40; Thu, 09 May 2019 10:59:57 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726780AbfEIR5Y (ORCPT + 99 others); Thu, 9 May 2019 13:57:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:45334 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726558AbfEIR5Y (ORCPT ); Thu, 9 May 2019 13:57:24 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4C53F21783; Thu, 9 May 2019 17:57:23 +0000 (UTC) Date: Thu, 9 May 2019 13:57:21 -0400 From: Steven Rostedt To: Masayoshi Mizuma Cc: Masayoshi Mizuma , linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/5] ktest: cleanup get_grub_index Message-ID: <20190509135721.4802161b@gandalf.local.home> In-Reply-To: <20190509174630.26713-3-msys.mizuma@gmail.com> References: <20190509174630.26713-1-msys.mizuma@gmail.com> <20190509174630.26713-3-msys.mizuma@gmail.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 ;-) -- 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