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

[Xen-devel] [OSSTEST PATCH 24/24] host examination: bootloader: better handling of multiple runs



If ts-examine-serial-pre was run more than once (which happens by hand
during development, for example), it would reuse the same ids (which
is not idea for manual testing, since we normally want to know if the
last run was good).  Instead, generate new cookies each time (and
overwrite the old ones in the runvars).

Also, it owuld keep adding new copies to the grub menu entries
(obscuring the actual interesting menu text completely).  Instead,
prefix the mentries with a fixed string so they can be stripped out
again.  They now look a bit sillier after one run, but less silly
after several.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 ts-examine-serial-pre | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/ts-examine-serial-pre b/ts-examine-serial-pre
index 90037c6..3905e52 100755
--- a/ts-examine-serial-pre
+++ b/ts-examine-serial-pre
@@ -42,7 +42,6 @@ die "do not want to mess up a shared host" if
 sub get_cookie ($) {
     my ($key) = @_;
     my $rname = "examine_serial_cookie_$key";
-    return $r{$rname} if defined $r{$rname};
     open R, "/dev/urandom";
     my $v;
     my $l = 16;
@@ -82,7 +81,9 @@ sub bootloader () {
        $edit->('/boot/grub/grub.cfg', sub {
             while (<::EI>) {
                s{^(\s* (?: menuentry | submenu ) \s+
-                     (['"]) )( [^'"]+ \2) }{$1$c $3}x;
+                     (['"]) )
+                      (?: osstest \ cookie \ [0-9a-f]+ \ )?
+                      ( [^'"]+ \2) }{$1osstest cookie $c $3}x;
                print ::EO;
            }
        });
-- 
2.1.4


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

 


Rackspace

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