]> xenbits.xensource.com Git - people/iwj/osstest.git/commitdiff
ts-freebsd-host-install: add arguments to test memdisk append options
authorRoger Pau Monne <roger.pau@citrix.com>
Fri, 28 Jul 2017 15:02:59 +0000 (16:02 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 24 Oct 2017 11:04:31 +0000 (12:04 +0100)
This is needed in order to figure out which memdisk options should be
used to boot the images on each specific box.

Note that when passed the --record-append argument upon success the
script stores the tentative host property in the runvars.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Changes since v12:
 - Add hyphens between words in command line options.
 - Die if --record-append is specified without --test-boot.

Changes since v2:
 - Fix commit message.

Changes since v1:
 - Provide a --recordappend argument to force the recording the
   memdisk parameters.
 - Exit gracefully if a bootonly test is attempted against a
   non-supported architecture.
 - Use NONE instead of an empty string when calling
   setup_netboot_memdisk if nothing should be appended.
 - Do not perform any arch test in ts-freebsd-host-install.

ts-freebsd-host-install

index 483b9aecedd98e3acb98ae639853774a46ac9adb..bfc693a18391c0ad209b9b44c3264500d0f3ed0f 100755 (executable)
@@ -41,6 +41,26 @@ use Osstest::TestSupport;
 
 tsreadconfig();
 
+our $bootonly;
+our $memdisk_append;
+our $record_append;
+while (@ARGV && $ARGV[0] =~ m/^-/g) {
+    if ($ARGV[0] =~ m/^--memdisk-append=(.*)/) {
+        $memdisk_append = $1;
+    } elsif ($ARGV[0] eq "--test-boot") {
+        $memdisk_append //= "NONE";
+        $bootonly = 1;
+    } elsif ($ARGV[0] eq "--record-append") {
+        $record_append = 1;
+    } else {
+        die "Unknown argument $ARGV[0]";
+    }
+    shift @ARGV;
+}
+
+die "--record-append specified without --test-boot"
+    if $record_append and !$bootonly;
+
 our ($whhost) = @ARGV;
 $whhost ||= 'host';
 our $ho= selecthost($whhost);
@@ -95,7 +115,7 @@ END
 
     # Setup the pxelinux config file
     logm("Booting from installer image at $pxeimg");
-    setup_netboot_memdisk($ho, $pxeimg);
+    setup_netboot_memdisk($ho, $pxeimg, $memdisk_append);
 }
 
 sub install () {
@@ -247,6 +267,12 @@ power_state($ho, 1);
 logm("Waiting for the installer to boot");
 await_tcp(get_timeout($ho,'reboot',$timeout), 5, $ho);
 
+if ($bootonly) {
+    hostprop_putative_record($ho, "MemdiskAppend", $memdisk_append)
+        if $record_append;
+    exit 0;
+}
+
 # Next boot will be from local disk
 setup_netboot_local($ho);