[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [osstest test] 56922: regressions - FAIL



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).

I've done unit test with this piece of code, by making a sub comprised
of this piece of code and constructing various conditions: xsm, non-xsm,
xenhopt defined/undefined, all works as expected.

Of course, we'll further test this in real job-running cases.

> 
> 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 <<END or die $!;
>  
> -GRUB_DEFAULT=$entry->{Number}
> +GRUB_DEFAULT="$entry->{MenuEntryPath}"
>  END
>  
>              print ::EO <<END or die $! if defined $xenhopt;
> 
> 



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.