From: Roger Pau Monne Date: Fri, 28 Jul 2017 15:02:59 +0000 (+0100) Subject: ts-freebsd-host-install: add arguments to test memdisk append options X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=7cf60320d6cdf8b34cf995194a8341898e0409c0;p=people%2Fiwj%2Fosstest.git ts-freebsd-host-install: add arguments to test memdisk append options 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é --- 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. --- diff --git a/ts-freebsd-host-install b/ts-freebsd-host-install index 483b9aec..bfc693a1 100755 --- a/ts-freebsd-host-install +++ b/ts-freebsd-host-install @@ -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);