From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robert Hu Subject: Re: [osstest test] 56922: regressions - FAIL Date: Sat, 23 May 2015 11:35:04 +0800 Message-ID: <1432352104.8273.3.camel@localhost> References: <1432288654.10746.161.camel@citrix.com> <1432294374.14664.12.camel@citrix.com> <1432297842.14664.32.camel@citrix.com> <1432298867.26800.5.camel@localhost> <1432299517.14664.37.camel@citrix.com> <1432302144.14664.43.camel@citrix.com> <1432304517.14664.48.camel@citrix.com> Reply-To: robert.hu@intel.com Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1432304517.14664.48.camel@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: robert.hu@intel.com, "Pang, LongtaoX" , ian.jackson@eu.citrix.com, xen-devel List-Id: xen-devel@lists.xenproject.org On Fri, 2015-05-22 at 15:21 +0100, Ian Campbell wrote: > On Fri, 2015-05-22 at 14:42 +0100, Ian Campbell wrote: > > From my particular grub.cfg. For real usage setupboot_grub2 will > > obviously need to become cleverer to count things correctly. > > I've not tested extensively but the following incremental patch seems to > do the right thing, at least by inspection of the resulting grub.cfg. > > Needs more testing (e.g. I haven't tried non-XSM yet) and review from > Ian I think, since there may be a more idiomatically Perl way to > manipulate the @offsets array (in particular shrinking it). Thanks Ian. You are so quick. I wrote that piece of code almost a year ago; was just about to warm up. We're to test your fix in our environment as well on non-XSM. > Ian. > > diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm > index 282175b..b5148fd 100644 > --- a/Osstest/Debian.pm > +++ b/Osstest/Debian.pm > @@ -393,8 +393,6 @@ sub setupboot_grub1 ($$$$) { > # Note on running OSSTest on Squeeze with old Xen kernel: check out > # Debian bug #633127 "/etc/grub/20_linux does not recognise some old > # Xen kernels" > -# Currently setupboot_grub2 relies on Grub menu not having submenu. > -# Check Debian bug #690538. > sub setupboot_grub2 ($$$$) { > my ($ho,$want_kernver,$want_xsm,$xenhopt,$xenkopt) = @_; > my $bl= { }; > @@ -405,7 +403,7 @@ sub setupboot_grub2 ($$$$) { > my $parsemenu= sub { > my $f= bl_getmenu_open($ho, $rmenu, "$stash/$ho->{Name}--grub.cfg.1"); > > - my $count= 0; > + my @offsets = (0); > my $entry; > my $submenu; > while (<$f>) { > @@ -417,6 +415,8 @@ sub setupboot_grub2 ($$$$) { > "$submenu->{StartLine}. ". > "Our want kern is $want_kernver"); > $submenu=undef; > + $#offsets = $#offsets-1; > + $offsets[$#offsets]++; > next; > } > my (@missing) = > @@ -446,11 +446,12 @@ sub setupboot_grub2 ($$$$) { > } > if (m/^menuentry\s+[\'\"](.*)[\'\"].*\{\s*$/) { > die $entry->{StartLine} if $entry; > - $entry= { Title => $1, StartLine => $., Number => $count }; > - $count++; > + $entry= { Title => $1, StartLine => $., MenuEntryPath => join ">", @offsets }; > + $offsets[$#offsets]++; > } > if (m/^submenu\s+[\'\"](.*)[\'\"].*\{\s*$/) { > - $submenu={ StartLine =>$.}; > + $submenu={ StartLine =>$., MenuEntryPath => join ">", @offsets }; > + $offsets[$#offsets+1] = 0; > } > if (m/^\s*multiboot\s*(?:\/boot)?\/(xen\S+)/) { > die unless $entry; > @@ -511,7 +512,7 @@ sub setupboot_grub2 ($$$$) { > } > print ::EO < > -GRUB_DEFAULT=$entry->{Number} > +GRUB_DEFAULT="$entry->{MenuEntryPath}" > END > > print ::EO < >