Skip to contentSkip to conversation

osstest: add a FreeBSD host

PATCH In review Roger Pau Monne 2 participants 21 messages Feb 18, 2015 – Mar 19, 2015

lore
Share & tools
lore
#0 lore raw

v4 cover osstest: add a FreeBSD host

Hello,

The following series enables setting up a FreeBSD PVH Dom0 host. Although this is marked as "v4" it should clearly have the RFC tag. The flow is based on the following diagram:

http://xenbits.xen.org/people/royger/osstest_freebsd.jpg

Patch 7 introduces a new management script, mg-freebsd-installer-update, but since this should be automatically executed when the FreeBSD/mfsBSD pushgate is updated it needs to be moved somewhere else, it's just that I'm not sure how the pushgate stuff works in order to integrate it.

Also the last patch, which adds two FreeBSD specific buildjobs, is dodgy and needs some close review.

Thanks, Roger.

#1 lore raw

PATCH v4 1/11 osstest: allow to disable the usage of a know_host file

This is only used by target_cmd_root and target_putfile_root and will be needed for mfsBSD which generates new keys on each boot.

Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
---
 Osstest/TestSupport.pm | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)
Osstest/TestSupport.pm +16 -9
index 5ac66e5..d930e55 100644
@@ -374,14 +374,21 @@ sub remote_perl_script_done ($) {
 
 sub sshuho ($$) { my ($user,$ho)= @_; return "$user\@$ho->{Ip}"; }
 
-sub sshopts () {
+sub sshopts {
+    my ($disable_hosts) = @_;
+    my $hosts = "tmp/t.known_hosts_$flight.$job";
+
+    if (defined $disable_hosts) {
+        $hosts = "/dev/null";
+    }
+
     return [ qw(-o StrictHostKeyChecking=no
                 -o BatchMode=yes
                 -o ConnectTimeout=100
                 -o ServerAliveInterval=100
                 -o PasswordAuthentication=no
                 -o ChallengeResponseAuthentication=no),
-             '-o', "UserKnownHostsFile=tmp/t.known_hosts_$flight.$job"
+             '-o', "UserKnownHostsFile=$hosts"
              ];
 }
 
@@ -412,16 +419,16 @@ sub target_getfile_root ($$$$) {
 }
 
 sub tputfileex {
-    my ($ruser, $ho,$timeout, $lsrc,$rdst, $rsync) = @_;
+    my ($ruser, $ho,$timeout, $lsrc,$rdst, $rsync, $disable_hosts) = @_;
     my @args= ($lsrc, sshuho($ruser,$ho).":$rdst");
     if (!defined $rsync) {
         tcmdex($timeout,undef,
-               'scp', sshopts(),
+               'scp', sshopts($disable_hosts),
                @args);
     } else {
         unshift @args, $rsync if length $rsync;
         tcmdex($timeout,undef,
-               'rsync', [ '-e', 'ssh '.join(' ',@{ sshopts() }) ],
+               'rsync', [ '-e', 'ssh '.join(' ',@{ sshopts($disable_hosts) }) ],
                @args);
     }
 }
@@ -429,7 +436,7 @@ sub target_putfile ($$$$;$) {
     # $ho,$timeout,$lsrc,$rdst,[$rsync_opt]
     tputfileex('osstest', @_);
 }
-sub target_putfile_root ($$$$;$) {
+sub target_putfile_root ($$$$;$$) {
     tputfileex('root', @_);
 }
 sub target_run_apt {
@@ -569,14 +576,14 @@ sub target_await_down ($$) {
 }    
 
 sub tcmd { # $tcmd will be put between '' but not escaped
-    my ($stdout,$user,$ho,$tcmd,$timeout) = @_;
+    my ($stdout,$user,$ho,$tcmd,$timeout,$disable_hosts) = @_;
     $timeout=30 if !defined $timeout;
     tcmdex($timeout,$stdout,
-           'ssh', sshopts(),
+           'ssh', sshopts($disable_hosts),
            sshuho($user,$ho), $tcmd);
 }
 sub target_cmd ($$;$) { tcmd(undef,'osstest',@_); }
-sub target_cmd_root ($$;$) { tcmd(undef,'root',@_); }
+sub target_cmd_root ($$;$$) { tcmd(undef,'root',@_); }
 
 sub tcmdout {
     my $stdout= IO::File::new_tmpfile();
Signature · 7 lines
1.9.3 (Apple Git-50)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#2 lore raw

Re: [PATCH v4 01/11] osstest: allow to disable the usage of a know_host file

On Wed, 2015-02-18 at 17:18 +0100, Roger Pau Monne wrote:

"known" in subject.

Quoted 2 lines

This is only used by target_cmd_root and target_putfile_root and will be needed for mfsBSD which generates new keys on each boot.

AIUI this is an installer thing which runs from a ramdisk and hence has no static host key, is that right?

I take it is has no preseeding like mechanisms then?

Would an alternative to plumbing this option all the way down be to invoke ssh-keyscan after booting this mfsBSD to populate the known_hosts?

Quoted 13 lines
Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
---
 Osstest/TestSupport.pm | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)
Osstest/TestSupport.pm +0 -0
index 5ac66e5..d930e55 100644
@@ -374,14 +374,21 @@ sub remote_perl_script_done ($) {
 

Osstest/TestSupport.pm sub remote_perl_script_done ($) { · line 383

Quoted 10 lines
Osstest/TestSupport.pm +7 -1
 sub sshuho ($$) { my ($user,$ho)= @_; return "$user\@$ho->{Ip}"; }
 
-sub sshopts () {
+sub sshopts {
+    my ($disable_hosts) = @_;
+    my $hosts = "tmp/t.known_hosts_$flight.$job";
+
+    if (defined $disable_hosts) {
+        $hosts = "/dev/null";
+    }

A more Perl-ish approach would be:

	$host = "/dev/null" if defined $disable_hosts;

(and I think the defined is optional there too).

Or perhaps $host = $disable_hosts ? "/dev/null" : "tmp/....";

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw

PATCH v4 2/11 osstest: add routine to execute ssh with password

In reply to Roger Pau Monne

This is needed when bootstrapping FreeBSD, since the installer has ssh enabled with the root password set to 'root' by default.

Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>

---
Changes since RFC:
- Place the temp filename in a local variable.
- Add error checks.

---
 Osstest/TestSupport.pm | 43 ++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 38 insertions(+), 5 deletions(-)
Osstest/TestSupport.pm +38 -5
index d930e55..0c72faa 100644
@@ -60,6 +60,7 @@ BEGIN {
                       target_install_packages target_install_packages_norec
                       target_jobdir target_extract_jobdistpath_subdir
                       target_extract_jobdistpath target_guest_lv_name
+                      target_cmd_root_with_password
 
                       poll_loop tcpconnect await_tcp
                       contents_make_cpio file_simple_write_contents
@@ -314,12 +315,11 @@ END
 #---------- running commands eg on targets ----------
 
 sub cmd {
-    my ($timeout,$stdout,@cmd) = @_;
+    my ($timeout,$child_sub,@cmd) = @_;
     my $child= fork;  die $! unless defined $child;
     if (!$child) {
-        if (defined $stdout) {
-            open STDOUT, '>&', $stdout
-                or die "STDOUT $stdout $cmd[0] $!";
+        if (defined $child_sub) {
+            $child_sub->();
         }
         exec @cmd;
         die "$cmd[0]: $!";
@@ -585,9 +585,42 @@ sub tcmd { # $tcmd will be put between '' but not escaped
 sub target_cmd ($$;$) { tcmd(undef,'osstest',@_); }
 sub target_cmd_root ($$;$$) { tcmd(undef,'root',@_); }
 
+sub target_cmd_root_with_password {
+    my ($ho,$tcmd,$timeout,$password, $disable_hosts) = @_;
+    my $temp_name = "tmp/t.ssh-password-helper.$flight.$job";
+
+    open(my $temp_fh, '>', $temp_name)
+      or die "Cannot open $temp_name: $!";
+    print $temp_fh "#!/bin/sh\n\necho \"$password\"\n"
+      or die "Cannot write to $temp_name: $!";
+    chmod 0755, $temp_name
+      or die "Cannot chmod $temp_name: $!";
+    close $temp_fh
+      or die "Cannot close $temp_name: $!";
+
+    my $child_sub = sub {
+                           $ENV{DISPLAY} = ":0";
+                           $ENV{SSH_ASKPASS} = "tmp/t.ssh-password-helper.$flight.$job";
+                           setsid or die "Can't start a new session: $!";
+                        };
+
+    my $ssh_opts = [qw(-o BatchMode=no
+                       -o PasswordAuthentication=yes
+                       -o ChallengeResponseAuthentication=yes),
+                    @{ sshopts($disable_hosts) }];
+
+    tcmdex($timeout,$child_sub,
+           'ssh', $ssh_opts,
+           sshuho("root",$ho), $tcmd);
+
+    unlink $temp_fh;
+}
+
 sub tcmdout {
     my $stdout= IO::File::new_tmpfile();
-    tcmd($stdout,@_);
+    my $stdout_sub = sub { open STDOUT, '>&', $stdout
+                              or die "STDOUT $stdout $!"; };
+    tcmd($stdout_sub,@_);
     $stdout->seek(0,0) or die "$stdout $!";
     my $r;
     { local ($/) = undef;
Signature · 7 lines
1.9.3 (Apple Git-50)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#4 lore raw

Re: [PATCH v4 02/11] osstest: add routine to execute ssh with password

Quoted 2 lines · Roger Pau Monne

This is needed when bootstrapping FreeBSD, since the installer has ssh enabled with the root password set to 'root' by default.

I think the commit message should mention the refactoring done WRT $stdout vs $child_sub (i.e. you are replacing the boolean with a hook, where the current invocations do the same thing as the old boolean used to cause).

I also think the trick with SSH_ASKPASS deserves a brief mention.

Quoted 9 lines
Osstest/TestSupport.pm +5 -0
@@ -585,9 +585,42 @@ sub tcmd { # $tcmd will be put between '' but not escaped
 sub target_cmd ($$;$) { tcmd(undef,'osstest',@_); }
 sub target_cmd_root ($$;$$) { tcmd(undef,'root',@_); }
 
+sub target_cmd_root_with_password {
+    my ($ho,$tcmd,$timeout,$password, $disable_hosts) = @_;
+    my $temp_name = "tmp/t.ssh-password-helper.$flight.$job";
+
+    open(my $temp_fh, '>', $temp_name)

Osstest/TestSupport.pm sub tcmd { # $tcmd will be put between '' but not escaped · line 602

Quoted 10 lines
Osstest/TestSupport.pm +10 -0
+      or die "Cannot open $temp_name: $!";
+    print $temp_fh "#!/bin/sh\n\necho \"$password\"\n"
+      or die "Cannot write to $temp_name: $!";
+    chmod 0755, $temp_name
+      or die "Cannot chmod $temp_name: $!";
+    close $temp_fh
+      or die "Cannot close $temp_name: $!";
+
+    my $child_sub = sub {
+                           $ENV{DISPLAY} = ":0";

? This seems like it must be pretty magic, in some terribly scary way...

Quoted 25 lines
Osstest/TestSupport.pm +19 -1
+                           $ENV{SSH_ASKPASS} = "tmp/t.ssh-password-helper.$flight.$job";
+                           setsid or die "Can't start a new session: $!";
+                        };
+
+    my $ssh_opts = [qw(-o BatchMode=no
+                       -o PasswordAuthentication=yes
+                       -o ChallengeResponseAuthentication=yes),
+                    @{ sshopts($disable_hosts) }];
+
+    tcmdex($timeout,$child_sub,
+           'ssh', $ssh_opts,
+           sshuho("root",$ho), $tcmd);
+
+    unlink $temp_fh;
+}
+
 sub tcmdout {
     my $stdout= IO::File::new_tmpfile();
-    tcmd($stdout,@_);
+    my $stdout_sub = sub { open STDOUT, '>&', $stdout
+                              or die "STDOUT $stdout $!"; };
+    tcmd($stdout_sub,@_);
     $stdout->seek(0,0) or die "$stdout $!";
     my $r;
     { local ($/) = undef;
#5 lore raw

PATCH v4 3/11 osstest: store a path runvar for built_stash_file

In reply to Roger Pau Monne

This mimics the behaviour of built_stash.

Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
---
 Osstest/TestSupport.pm | 1 +
 1 file changed, 1 insertion(+)
Osstest/TestSupport.pm +1 -0
index 0c72faa..4d35a19 100644
@@ -1221,6 +1221,7 @@ sub built_stash_file ($$$$;$) {
     target_getfile($ho, 300,
                    "$builddir/$fname",
                    "$stash/$stashleaf");
+    store_runvar("path_$item", $stashleaf);
 }
 
 sub built_compress_stashed($) {
Signature · 7 lines
1.9.3 (Apple Git-50)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Acked-by on v4 3/11
#6 lore raw

Re: [PATCH v4 03/11] osstest: store a path runvar for built_stash_file

Quoted 1 line · Roger Pau Monne

This mimics the behaviour of built_stash.

This will result in the creation of a bunch of new runvars, matching:

        ts-kernel-build:built_stash_file($ho, $builddir, 'vmlinux', 'linux/vmlinux');
        ts-kernel-build:built_stash_file($ho, $builddir, 'config', 'linux/.config');
        ts-xen-build:    built_stash_file($ho, $builddir, "xen-syms", "xen/xen/xen-syms", 1);
        ts-xen-build:    built_stash_file($ho, $builddir, "xen-config", "xen/.config", 1);
        ts-xen-build:    built_stash_file($ho, $builddir, "seabios-config",

which I suppose is expected and even desirable, so:

Quoted 13 lines
Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
---
 Osstest/TestSupport.pm | 1 +
 1 file changed, 1 insertion(+)
Osstest/TestSupport.pm +0 -0
index 0c72faa..4d35a19 100644

Osstest/TestSupport.pm sub built_stash_file ($$$$;$) { · line 1227

Quoted 7 lines
Osstest/TestSupport.pm +1 -0
@@ -1221,6 +1221,7 @@ sub built_stash_file ($$$$;$) {
     target_getfile($ho, 300,
                    "$builddir/$fname",
                    "$stash/$stashleaf");
+    store_runvar("path_$item", $stashleaf);
 }
 
 sub built_compress_stashed($) {

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#7 lore raw

PATCH v4 4/11 osstest: add support for installing bare metal FreeBSD

In reply to Roger Pau Monne

This is done using mfsBSD, which can be booted from pxelinux and contains a script to automatically install FreeBSD using ZFS on root. After the install the host is set to boot from the local disk.

Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>

---
Changes since RFC:
- Set the bridge to use the MAC from the first added interface instead of generating a random one.
- Launch DHCP on the bridge instead of the nic.
- Add a list of FreeBSD ftp mirrors and iterate over them in order to find a working one.
- Add support for finding the primary disk and nic automatically.
- Switch shell to sh (instead of the default csh), and use set -e in order to exit if a command fails.
- Replace echo "-Dh" with printf "%s" "-Dh".
- Copy installer keys into the installed system in order to prevent it from generating new keys on the first boot.

---
 production-config       |   2 +
 ts-freebsd-host-install | 283 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 285 insertions(+)
 create mode 100755 ts-freebsd-host-install
production-config +2 -0
index 515bd98..fefc467 100644
@@ -86,6 +86,8 @@ HostProp_GenEtherPrefixBase 5a:36:0e:00
 #                                      :00:01 guest number in job appended
 #                                    ^^ xor'd with low 8 bits of flight
 
+FreeBSDVersion current
+
 AuthorizedKeysAppend= <<'END'
 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq8eHHFJ+XHYgpHxfSdciq0b3tYPdMhHf9CgtwdKGSqCyDyocbn1jX6P0Z535K/JcVaxvaRQbGDl9FZ25neQw6lysE8pGf+G353mgLAE7Lw6xKqlTXDcR0GpKHiZUyY8Ck5AJlGF2MO0cDEzMBx+xkOahDBvAozikUcDHJsTNP+UUIGoRaPeQK0DfgprPkoaLzXFDiZvEoBtYcUUieuNygJt+QVM+ovyTXC68wg5Xb5Ou2PopmDaVMX6/A1HxziTWc3XdhOF5ocuRF/kfWpZL223Auuu/xvNQDly13DhuVlQiU3gRIP7BSCwCdsQC/K68Q6SgfBklKRiqHquYo/QyNQ== [email protected]
 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAs6FF9nfzWIlLPeYdqNteJBoYJAcgGxQgeNi7FHYDgWNFhoYPlMPXWOuXhgNxA2/vkX9tUMVZaAh+4WTL1iRBW5B/AS/Ek2O7uM2Uq8v68D2aU9/XalLVnIxssr84pewUmKW8hZfjNnRm99RTQ2Knr2BvtwcHqXtdGYdTYCJkel+FPYQ51yXGRU7dS0D59WapkDFU1tH1Y8s+dRZcRZNRJ5f1w/KO1zx1tOrZRkO3fPlEGNZHVUYfpZLPxz0VX8tOeoaOXhKZO8vSp1pD0L/uaD6FOmugMZxbtq9wEjhZciNCq61ynRf2yt2v9DMu4EAzbW/Ws7OBvWtYj/RHcSxKbw== [email protected]
ts-freebsd-host-install new file +283 -0

283 lines not on this page · raw message

Signature · 7 lines
1.9.3 (Apple Git-50)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#8 lore raw

Re: [PATCH v4 04/11] osstest: add support for installing bare metal FreeBSD

Quoted 2 lines · Roger Pau Monne

- Add a list of FreeBSD ftp mirrors and iterate over them in order to find a working one.

I didn't actually see this, and in general we try and avoid dependencies on random 3rd party webservices. Can we mirror FreeBSD locally like we do with Debian?

production-config HostProp_GenEtherPrefixBase 5a:36:0e:00 · line 89

Quoted 9 lines
production-config +1 -0
index 515bd98..fefc467 100644
@@ -86,6 +86,8 @@ HostProp_GenEtherPrefixBase 5a:36:0e:00
 #                                      :00:01 guest number in job appended
 #                                    ^^ xor'd with low 8 bits of flight
 
+FreeBSDVersion current

I think for the final deployment we would want a specific version here. IIRC the "current" stuff used with DiVersion is vestigial and no longer used (or perhaps a standalone-mode-ism).

(or perhaps there is something which that graphic from 00/11 should be telling me which I can't decipher)

production-config HostProp_GenEtherPrefixBase 5a:36:0e:00 · line 90

Quoted 1 line
production-config +1 -0
+exit 0 if $ho->{SharedReady};

I suppose this is some clever way to avoid unnecessary reinstalls?

Quoted 16 lines
production-config +16 -0
+sub get_mfsbsd() {
+
+    # Figure out the path to the mfsBSD image we have to use.
+    # This can either come from a previous buildjob or from
+    # a pre-seeded image.
+
+    if ($r{freebsd_buildjob}) {
+        # We are going to use the build output from a previous job.
+        return get_stashed('path_mfsbsd.img', $r{freebsd_buildjob});
+    } else {
+        # We are going to use a pre-seeded version.
+        return "$c{Images}/freebsd/$c{FreeBSDVersion}/$r{arch}/mfsbsd.img";
+    }
+}
+
+sub get_set($) {

production-config HostProp_GenEtherPrefixBase 5a:36:0e:00

Quoted 10 lines
production-config +10 -0
+    my ($set) = @_;
+
+    if ($r{freebsd_buildjob}) {
+        # We are going to use the build output from a previous job.
+        return get_stashed("path_$set", $r{freebsd_buildjob});
+    } else {
+        # We are going to use a pre-seeded version.
+        return "$c{Images}/freebsd/$c{FreeBSDVersion}/$r{arch}/$set";
+    }
+}

Isn't get_mfsbsd the same as get_set("mfsbsd.img") ?

production-config

Quoted 11 lines
production-config +11 -0
+
+sub setup_sets() {
+    my $webfolder = "$c{WebspaceFile}/$c{WebspaceCommon}/freebsd/$ho->{Name}";
+
+    # Link the sets to the public http folder
+    rmtree($webfolder);
+    mkpath($webfolder);
+    foreach my $set (@sets) {
+        my $set_src = abs_path(get_set($set));
+        logm("Using install set: $set_src");
+        symlink $set_src,"$webfolder/$set" or die "Unable to create symlink: $!";

This relies on the webserver and the controller having a shared NFS view of the world, which I'm not sure is always true?

production-config

Quoted 2 lines
production-config +2 -0
+    logm('Setting root shell to /bin/sh');
+    target_cmd_root($ho, 'chsh -s /bin/sh', 100);

Did you not already do this and/or can't you do it while tailoring rather than after first boot?

production-config

Quoted 10 lines
production-config +10 -0
+    logm('Adding osstest user');
+    target_cmd_root($ho, 'pw useradd osstest -m', 100);
+    target_cmd_root($ho, <<END, 100);
+            set -e
+            chsh -s /bin/sh osstest
+            mkdir -p /home/osstest/.ssh
+            cat <<ENDKEYS >/home/osstest/.ssh/authorized_keys
+$authkeys
+ENDKEYS
+END

Likewise.

Quoted 1 line

+ logm('OK: install completed');

That was remarkably painless, I thought it would be much worse!

#9 lore raw

PATCH v4 5/11 osstest: add script for building custom mfsBSD images

In reply to Roger Pau Monne

In order to test FreeBSD HEAD we need to build a mfsBSD installer and sets based on the version that we want to test. This patch adds support for building such mfsBSD image and sets.

In order to build the images sources from two different repositories are needed. The first ones of course are the FreeBSD sources which can be fetched from the official github mirror at:

https://github.com/freebsd/freebsd.git

And the mfsBSD sources which can be downloaded from:

https://github.com/mmatuska/mfsbsd.git

We would need to have a local copy of them in order to have a push gate like we do for Linux, Qemu or SeaBIOS.

The workflow of this would be:

1. Setup a FreeBSD host using a RELEASE image (10.1 right now).
2. Fetch upstream FreeBSD sources and compile a fresh FreeBSD world + kernel.
3. Generate a mfsBSD image using the output from the FreeBSD build process.
4. Stash all the resulting build files (MANIFEST, kernel.txz, base.txz and mfsbsd.img).
5. Use the newly created mfsBSD image in order to boot and the uploaded install sets with zfsinstall.

Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
---
 ts-freebsd-create-mfsbsd | 140 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 140 insertions(+)
 create mode 100755 ts-freebsd-create-mfsbsd
ts-freebsd-create-mfsbsd new file +140 -0
new file mode 100755
index 0000000..561766f
@@ -0,0 +1,140 @@
+#!/usr/bin/perl -w
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2009-2014 Citrix Inc.
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+# 
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+use strict qw(vars);
+use DBI;
+use POSIX;
+
+use Osstest;
+use Osstest::TestSupport;
+use Osstest::BuildSupport;
+
+tsreadconfig();
+selectbuildhost(\@ARGV);
+builddirsprops();
+
+sub pkg_install {
+
+    logm("Installing git");
+    target_cmd_root($ho, <<END, 1000);
+        set -e
+        export ASSUME_ALWAYS_YES="YES"
+        pkg install -y git
+END
+}
+
+sub build_freebsd {
+
+    # Since the build processes requires root access, we need to remove
+    # the folder as root also.
+    target_cmd_root($ho, <<END, 2400);
+        chflags -R noschg $builddir/freebsd
+        rm -rf $builddir/freebsd
+END
+
+    logm("Fetching FreeBSD sources");
+    build_clone($ho, 'freebsd', $builddir, 'freebsd');
+
+    logm("Building FreeBSD world");
+    target_cmd_root($ho, <<END, 1000);
+        set -e
+        chflags -R noschg /usr/obj
+        rm -rf /usr/obj/*
+        chmod 777 /usr/obj
+END
+
+    target_cmd_build($ho, 9000, $builddir, <<END);
+    rm -rf build-ok-stamp
+    cd freebsd
+        (make $makeflags buildworld 2>&1 && touch ../build-ok-stamp) |tee ../log-buildworld
+        test -f ../build-ok-stamp
+        echo ok.
+END
+
+    logm("Building FreeBSD kernel");
+    target_cmd_build($ho, 9000, $builddir, <<END);
+    rm -rf build-ok-stamp
+    cd freebsd
+        (make $makeflags buildkernel 2>&1 && touch ../build-ok-stamp) |tee ../log-buildkernel
+        test -f ../build-ok-stamp
+        echo ok.
+END
+
+    logm("Packing release files");
+    # Needs to be done as root...
+    target_cmd_root($ho, <<END, 2400);
+    cd $builddir
+    rm -rf build-ok-stamp
+    cd freebsd/release
+        (make ftp 2>&1 && touch ../../build-ok-stamp) |tee ../../log-release
+        test -f ../../build-ok-stamp
+        echo ok.
+END
+}
+
+sub build_mfsbsd {
+
+    # Since the build processes requires root access, we need to remove
+    # the folder as root also.
+    target_cmd_root($ho, <<END, 1000);
+        chflags -R noschg $builddir/mfsbsd
+        rm -rf $builddir/mfsbsd
+END
+
+    logm("Fetching mfsBSD sources");
+    build_clone($ho, 'mfsbsd', $builddir, 'mfsbsd');
+    target_cmd_build($ho, 100, $builddir, <<END);
+        set -e
+        cd mfsbsd
+        printf "%s" "-Dh" > conf/boot.config
+        cp conf/loader.conf.sample conf/loader.conf
+        cp conf/ttys.sample conf/ttys
+        sed -i .bak 's/std.[^"]*/std.$c{Baud}/' conf/ttys
+        cat <<ENDB >> conf/loader.conf
+mfsbsd.rootpw="root"
+boot_multicons="YES"
+boot_serial="YES"
+comconsole_speed="$c{Baud}"
+console="comconsole,vidconsole"
+boot_verbose="YES"
+ENDB
+END
+
+    target_cmd_root($ho, <<END, 2400);
+        cd $builddir
+        rm -rf build-ok-stamp
+        cd mfsbsd
+        (make BASE=../freebsd/release/ftp PKG_STATIC=`which pkg-static` RELEASE="HEAD" 2>&1 && touch ../build-ok-stamp) |tee ../log-mfsbsd
+END
+}
+
+sub copy_sets {
+
+    built_stash_file($ho, $builddir, 'kernel.txz',
+                     'freebsd/release/ftp/kernel.txz');
+    built_stash_file($ho, $builddir, 'base.txz',
+                     'freebsd/release/ftp/base.txz');
+    built_stash_file($ho, $builddir, 'MANIFEST',
+                     'freebsd/release/ftp/MANIFEST');
+    built_stash_file($ho, $builddir, 'mfsbsd.img',
+                     'mfsbsd/mfsbsd-HEAD-amd64.img');
+}
+
+pkg_install();
+build_freebsd();
+build_mfsbsd();
+copy_sets();
Signature · 7 lines
1.9.3 (Apple Git-50)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#10 lore raw

Re: [PATCH v4 05/11] osstest: add script for building custom mfsBSD images

On Wed, 2015-02-18 at 17:18 +0100, Roger Pau Monne wrote:
[...]

Quoted 5 lines

We would need to have a local copy of them in order to have a push gate like we do for Linux, Qemu or SeaBIOS.

The workflow of this would be:

Quoted 8 lines

1. Setup a FreeBSD host using a RELEASE image (10.1 right now).
2. Fetch upstream FreeBSD sources and compile a fresh FreeBSD world + kernel.
3. Generate a mfsBSD image using the output from the FreeBSD build process.
4. Stash all the resulting build files (MANIFEST, kernel.txz, base.txz and mfsbsd.img).
5. Use the newly created mfsBSD image in order to boot and the uploaded install sets with zfsinstall.

Is all this a bunch of TODO items or things which will happen later in the series?

The actual script seems reasonable.

#11 lore raw

PATCH v4 6/11 osstest: fix ts-build-check to work with freebsd_buildjob

In reply to Roger Pau Monne

The output of the FreeBSD buildjob generates several files that are stashed independently, so check each of them individually.

Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
---
 ts-build-check | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
ts-build-check +16 -4
index 0ae3be8..a3dc1ef 100755
@@ -24,12 +24,24 @@ die if @ARGV && $ARGV[0] =~ m/^-/;
 
 logm("checking builds ...");
 
+sub check_path($$) {
+        my ($path, $job) = @_;
+        logm("checking $job $path");
+        get_stashed($path, $r{$job});
+}
+
 foreach my $k (sort keys %r) {
     next unless $k =~ m/^(?:.*_)?([^_]*)buildjob$/;
-    my $part= $1;
-    my $path= "path_${part}dist";
-    logm("checking $k $path");
-    get_stashed($path, $r{$k});
+
+    if ($k =~ m/^freebsd/) {
+        my @check = qw(MANIFEST kernel.txz base.txz mfsbsd.img);
+        foreach my $elem (@check) {
+            check_path("path_$elem", $k);
+        }
+    } else {
+        my $part= $1;
+        check_path("path_${part}dist", $k);
+    }
 }
 
 logm("all ok.");
Signature · 7 lines
1.9.3 (Apple Git-50)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#12 lore raw

PATCH v4 7/11 osstest: add freebsd installer update script

In reply to Roger Pau Monne

This script allows moving a FreeBSD build (as produced by ts-freebsd-create-mfsbsd) so it's usable by other test/build jobs.

Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
---
 mg-freebsd-installer-update | 59 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100755 mg-freebsd-installer-update
mg-freebsd-installer-update new file +59 -0
new file mode 100755
index 0000000..b55d9e0
@@ -0,0 +1,59 @@
+#!/bin/bash
+# usage
+#   ./mg-freebsd-installer-update <flight> <job>
+
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2009-2015 Citrix Inc.
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+# 
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+
+set -e
+
+. cri-getconfig
+
+flight=$1
+job=$2
+
+fail () { echo >&2 "$0: $1"; exit 1; }
+
+case $job in
+    *amd64*)
+        arch=amd64
+        ;;
+    *i386*)
+        arch=i386
+        ;;
+    *)
+        fail "Unsupported arch"
+        ;;
+esac
+
+date=`date +%Y-%m-%d`
+images=`getconfig Images`
+dst=$images/freebsd/$date/$arch/
+src=logs/$flight/$job/build/
+
+mkdir -p $dst
+
+# Copy sets and mfsBSD image
+cp $src/*.txz $dst
+cp $src/MANIFEST $dst
+cp $src/mfsbsd.img $dst
+
+# Set "current" to point to the new version
+rm -rf $images/freebsd/current
+ln -s $date $images/freebsd/current
+
+echo "Produced version: $date"
Signature · 7 lines
1.9.3 (Apple Git-50)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#13 lore raw

PATCH v4 8/11 osstest: prepare FreeBSD host for Xen build

In reply to Roger Pau Monne

Install pkg (the binary package management tool) and the dependencies needed to build Xen.

Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>

---
Changes since RFC:
- Add the tools necessary in order to build the man pages and markdown documents.

---
 ts-xen-build-prep-freebsd | 48 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100755 ts-xen-build-prep-freebsd
ts-xen-build-prep-freebsd new file +48 -0
new file mode 100755
index 0000000..7a15b03
@@ -0,0 +1,48 @@
+#!/usr/bin/perl -w
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2009-2014 Citrix Inc.
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+# 
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+use strict qw(vars);
+use DBI;
+use POSIX;
+
+use Osstest;
+use Osstest::TestSupport;
+use Osstest::Logtailer;
+
+tsreadconfig();
+
+our ($whhost) = @ARGV;
+$whhost ||= 'host';
+our $ho= selecthost($whhost);
+exit 0 if $ho->{SharedReady};
+
+#TODO: should be a runvar
+our $compiler = 'gcc47';
+our $deps = "mercurial git bash python bcc glib pkgconf yajl gmake pixman ".
+            "perl5 markdown bison gettext gawk $compiler";
+
+sub install_depends () {
+    logm('Installing Xen build dependencies');
+    target_cmd_root($ho, <<END, 2400);
+        set -e
+        export ASSUME_ALWAYS_YES="YES"
+        pkg install -y $deps
+        ln -s /usr/local/bin/$compiler /usr/local/bin/gcc
+END
+}
+
+install_depends();
Signature · 7 lines
1.9.3 (Apple Git-50)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#14 lore raw

Re: [PATCH v4 08/11] osstest: prepare FreeBSD host for Xen build

Quoted 6 lines · Roger Pau Monne

Install pkg (the binary package management tool) and the dependencies needed to build Xen.

Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>

Looks reasonable.

Quoted 53 lines

---
Changes since RFC:
- Add the tools necessary in order to build the man pages and markdown documents.

---
 ts-xen-build-prep-freebsd | 48 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100755 ts-xen-build-prep-freebsd
ts-xen-build-prep-freebsd new file +38 -0
new file mode 100755
index 0000000..7a15b03
@@ -0,0 +1,48 @@
+#!/usr/bin/perl -w
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2009-2014 Citrix Inc.
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+# 
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+use strict qw(vars);
+use DBI;
+use POSIX;
+
+use Osstest;
+use Osstest::TestSupport;
+use Osstest::Logtailer;
+
+tsreadconfig();
+
+our ($whhost) = @ARGV;
+$whhost ||= 'host';
+our $ho= selecthost($whhost);
+exit 0 if $ho->{SharedReady};
+
+#TODO: should be a runvar
+our $compiler = 'gcc47';
+our $deps = "mercurial git bash python bcc glib pkgconf yajl gmake pixman ".
+            "perl5 markdown bison gettext gawk $compiler";
+
+sub install_depends () {

ts-xen-build-prep-freebsd line 48

Quoted 10 lines
ts-xen-build-prep-freebsd new file +10 -0
+    logm('Installing Xen build dependencies');
+    target_cmd_root($ho, <<END, 2400);
+        set -e
+        export ASSUME_ALWAYS_YES="YES"
+        pkg install -y $deps
+        ln -s /usr/local/bin/$compiler /usr/local/bin/gcc
+END
+}
+
+install_depends();

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#15 lore raw

PATCH v4 9/11 osstest: make ts-xen-build work on FreeBSD

In reply to Roger Pau Monne

This patch contains a new subroutine that guesses the right make command to use (gmake on BSDs, make otherwise).

Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
---
 ts-xen-build | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
ts-xen-build +12 -1
index 661f186..d800396 100755
@@ -28,6 +28,16 @@ selectbuildhost(\@ARGV);
 # remaining arguments are passed as targets to "make"
 builddirsprops();
     
+sub get_make_cmd() {
+    my $uname = target_cmd_output_root($ho, 'uname -a', 200);
+
+    if ($uname =~ m/BSD/) {
+        return "gmake";
+    } else {
+        return "make";
+    }
+}
+
 sub checkout () {
     prepbuilddirs();
 
@@ -91,6 +101,7 @@ END
 }
 
 sub build () {
+    my $make_cmd = get_make_cmd();
     my $xend_opt= $r{enable_xend} =~ m/true/ ? "--enable-xend" : "--disable-xend";
     my $ovmf_opt= $r{enable_ovmf} =~ m/true/ ? "--enable-ovmf" : "--disable-ovmf";
 
@@ -112,7 +123,7 @@ END
 END
 #/;
     buildcmd_stamped_logged(9000, 'build', '',<<END,'');
-            $make_prefix make $makeflags @ARGV
+            $make_prefix $make_cmd $makeflags @ARGV
 END
 }
 
Signature · 7 lines
1.9.3 (Apple Git-50)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#16 lore raw

Re: [PATCH v4 09/11] osstest: make ts-xen-build work on FreeBSD

Quoted 2 lines · Roger Pau Monne

This patch contains a new subroutine that guesses the right make command to use (gmake on BSDs, make otherwise).

Will this also be needed from e.g. the ts-libvirt-build script? (I assume you don't care about ts-kernel-build AKA ts-linux-build)

Quoted 38 lines
Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
---
 ts-xen-build | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
ts-xen-build +11 -0
index 661f186..d800396 100755
@@ -28,6 +28,16 @@ selectbuildhost(\@ARGV);
 # remaining arguments are passed as targets to "make"
 builddirsprops();
 
+sub get_make_cmd() {
+    my $uname = target_cmd_output_root($ho, 'uname -a', 200);
+
+    if ($uname =~ m/BSD/) {
+        return "gmake";
+    } else {
+        return "make";
+    }
+}
+
 sub checkout () {
     prepbuilddirs();
 
@@ -91,6 +101,7 @@ END
 }
 
 sub build () {
+    my $make_cmd = get_make_cmd();
     my $xend_opt= $r{enable_xend} =~ m/true/ ? "--enable-xend" : "--disable-xend";
     my $ovmf_opt= $r{enable_ovmf} =~ m/true/ ? "--enable-ovmf" : "--disable-ovmf";
 

ts-xen-build END · line 129

Quoted 8 lines
ts-xen-build +1 -1
@@ -112,7 +123,7 @@ END
 END
 #/;
     buildcmd_stamped_logged(9000, 'build', '',<<END,'');
-            $make_prefix make $makeflags @ARGV
+            $make_prefix $make_cmd $makeflags @ARGV
 END
 }
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#17 lore raw

PATCH v4 10/11 osstest: add a script to install Xen on FreeBSD hosts

In reply to Roger Pau Monne

This scripts takes care of installing the run-time dependencies, unpacking the Xen files and setup the right configuration in order to boot a FreeBSD PVH Dom0.

Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
---
 ts-xen-install-freebsd | 128 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 128 insertions(+)
 create mode 100644 ts-xen-install-freebsd
ts-xen-install-freebsd new file +128 -0
new file mode 100644
index 0000000..2e0c35d
@@ -0,0 +1,128 @@
+#!/usr/bin/perl -w
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2009-2015 Citrix Inc.
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+# 
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+use strict qw(vars);
+use DBI;
+use Osstest;
+use POSIX;
+use Osstest::TestSupport;
+
+my $checkmode= 0;
+
+tsreadconfig();
+
+our @hos;
+
+if (@ARGV and $ARGV[0] eq '--check') {
+    $checkmode= 1;
+    shift @ARGV;
+    logm("checking builds are done...");
+} else {
+    if (!@ARGV) {
+	push @ARGV, 'host';
+    }
+    foreach my $k (@ARGV) {
+        push @hos, selecthost($k);
+    }
+}
+
+our $ho;
+
+my %distpath;
+
+our $run_deps = "yajl python curl glib gettext pixman libiconv";
+
+sub packages () {
+    logm('Installing Xen runtime dependencies');
+target_cmd_root($ho, <<END, 2400);
+        set -e
+        export ASSUME_ALWAYS_YES="YES"
+        pkg install -y $run_deps
+END
+}
+
+sub extract () {
+    my @parts = ('', 'xen');
+
+    foreach my $part (@parts) {
+        target_extract_jobdistpath($ho, $part, "path_${part}dist",
+				   $r{"${part}buildjob"}, \%distpath);
+    }
+    target_cmd_root($ho, 'gunzip -c `readlink -f /boot/xen.gz` > /boot/xen', 100);
+}
+
+sub adjustconfig () {
+    target_cmd_root($ho, <<END, 100);
+        set -e
+        mkdir -p /usr/local/etc/rc.conf.d
+        echo 'XENCONSOLED_TRACE=guest' >> /usr/local/etc/rc.conf.d/xencommons
+        mkdir -p /var/log/xen/console
+        mkdir -p /var/lock
+        mkdir -p /var/run/xen
+        echo 'vm.max_wired=-1' >> /etc/sysctl.conf
+        echo 'xc0   "/usr/libexec/getty Pc"         xterm   on  secure' >> /etc/ttys
+        echo 'xencommons_enable="YES"' >> /etc/rc.conf
+END
+}
+
+sub setupboot () {
+    my $xenhopt = "dom0pvh=1";
+
+    my $cons= get_host_property($ho, 'XenSerialConsole', 'com1');
+
+    if ( $cons eq "com1" ) {
+	$xenhopt .= " com1=$c{Baud},8n1 console=com1,vga gdb=com1";
+    } elsif ( $cons eq "dtuart" ) {
+	$xenhopt .= " console=dtuart";
+	my $dtuart= get_host_property($ho, 'XenDTUARTPath', undef);
+	$xenhopt .= " dtuart=$dtuart" if $dtuart;
+    } else {
+	logm("No Xen console device defined for host");
+    }
+    if (toolstack()->{Dom0MemFixed}) {
+        $xenhopt .= " dom0_mem=2048M,max:2048M";
+    }
+    my $append= $r{xen_boot_append};
+    $xenhopt .= " $append" if defined $append;
+    $append = get_host_property($ho, 'xen-commandline-append', undef);
+    $xenhopt .= " $append" if defined $append;
+
+    die "pci-passthrough is not supported" if host_involves_pcipassthrough($ho);
+
+    target_cmd_root($ho, <<END, 100);
+            set -e
+            cat <<ENDB >>/boot/loader.conf
+vfs.zfs.arc_max="1G"
+xen_cmdline="$xenhopt"
+xen_kernel="/boot/xen"
+ENDB
+END
+
+    logm("ready to boot Xen");
+}
+
+if ($checkmode) {
+    extract();
+} else {
+    die if @hos > 1;
+    $ho= $hos[0];
+
+    packages();
+    extract();
+    adjustconfig();
+    setupboot();
+}
Signature · 7 lines
1.9.3 (Apple Git-50)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#18 lore raw

Re: [PATCH v4 10/11] osstest: add a script to install Xen on FreeBSD hosts

Quoted 11 lines · Roger Pau Monne
ts-xen-install-freebsd new file +11 -0
+sub setupboot () {
+    my $xenhopt = "dom0pvh=1";
+
+    my $cons= get_host_property($ho, 'XenSerialConsole', 'com1');
+
+    if ( $cons eq "com1" ) {
+	$xenhopt .= " com1=$c{Baud},8n1 console=com1,vga gdb=com1";
+    } elsif ( $cons eq "dtuart" ) {
+	$xenhopt .= " console=dtuart";
+	my $dtuart= get_host_property($ho, 'XenDTUARTPath', undef);
+	$xenhopt .= " dtuart=$dtuart" if $dtuart;

ts-xen-install-freebsd line 102

Quoted 10 lines
ts-xen-install-freebsd new file +10 -0
+    } else {
+	logm("No Xen console device defined for host");
+    }
+    if (toolstack()->{Dom0MemFixed}) {
+        $xenhopt .= " dom0_mem=2048M,max:2048M";
+    }
+    my $append= $r{xen_boot_append};
+    $xenhopt .= " $append" if defined $append;
+    $append = get_host_property($ho, 'xen-commandline-append', undef);
+    $xenhopt .= " $append" if defined $append;

Perhaps some or all of this could be common with ts-xen-install?

Quoted 1 line

+ die "pci-passthrough is not supported" if host_involves_pcipassthrough($ho);

If a host is passthrough capable does that imply that the current job is going to use it? It seems the two hosts with a passthrough-* host flag are gall-mite and itch-mite which are certainly used for other jobs.

I'm not sure how this can be dealt with, maybe Ian has an idea, or maybe you can just defer until a FreeBSD w/ passthrough job is created, at which point you would surely know what to write here.

#19 lore raw

PATCH v4 11/11 osstest: add FreeBSD build recipe

In reply to Roger Pau Monne

This patch introduces two new buildjobs:

build-<arch>-freebsd-xen: sets up a FreeBSD host and builds Xen. build-<arch>-freebsd-freebsd: sets up a FreeBSD host and builds FreeBSD sets and a mfsBSD installer image.

Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
---
 ap-common  |  2 ++
 mfi-common | 22 ++++++++++++++++++++++
 sg-run-job | 25 +++++++++++++++++++++----
 3 files changed, 45 insertions(+), 4 deletions(-)
ap-common +2 -0
index 96cbd14..8987637 100644
@@ -27,6 +27,8 @@
 #: ${TREE_QEMU:=git://mariner.uk.xensource.com/qemu-$xenbranch.git}
 : ${TREE_QEMU:=git://xenbits.xen.org/staging/qemu-$xenbranch.git}
 
+: ${TREE_FREEBSD:=https://github.com/freebsd/freebsd.git}
+: ${TREE_MFSBSD:=https://github.com/mmatuska/mfsbsd.git}
 
 : ${GIT_KERNEL_ORG:=git://git.kernel.org}
 : ${KERNEL_SCM:=${GIT_KERNEL_ORG}/pub/scm/linux/kernel/git}
mfi-common +22 -0
index e167606..636052e 100644
@@ -153,6 +153,28 @@ create_build_jobs () {
                 revision_qemuu=$REVISION_QEMU_UPSTREAM                       \
                 revision_seabios=$REVISION_SEABIOS
 
+    ./cs-job-create $flight build-$arch-freebsd-freebsd build-freebsd        \
+                arch=$arch                                                   \
+        tree_freebsd=$TREE_FREEBSD                                           \
+        tree_mfsbsd=$TREE_MFSBSD                                             \
+                $RUNVARS $BUILD_RUNVARS $arch_runvars                        \
+                host_hostflags=$build_hostflags                              \
+                revision_freebsd=$REVISION_FREEBSD                           \
+                revision_mfsbsd=$REVISION_MFSBSD
+
+    ./cs-job-create $flight build-$arch-freebsd-xen build                    \
+                arch=$arch enable_xend=false enable_ovmf=false               \
+        tree_qemu=$TREE_QEMU                                                 \
+        tree_qemuu=$TREE_QEMU_UPSTREAM                                       \
+        tree_xen=$TREE_XEN                                                   \
+        tree_seabios=$TREE_SEABIOS                                           \
+                $RUNVARS $BUILD_RUNVARS $BUILD_XEN_RUNVARS $arch_runvars     \
+                host_hostflags=$build_hostflags                              \
+                revision_xen=$REVISION_XEN                                   \
+                revision_qemu=$REVISION_QEMU                                 \
+                revision_qemuu=$REVISION_QEMU_UPSTREAM                       \
+                revision_seabios=$REVISION_SEABIOS
+
     if [ $build_extraxend = "true" ] ; then
     ./cs-job-create $flight build-$arch-xend build                           \
                 arch=$arch enable_xend=true enable_ovmf=$enable_ovmf         \
sg-run-job +21 -4
index 2cf810a..d8d75ba 100755
@@ -50,8 +50,13 @@ proc run-job {job} {
 
     if {$ok} { setstatus running                                          }
 
-    per-host-ts broken  host-install/@(*) ts-host-install-twice
-    per-host-ts .       xen-install/@     ts-xen-install
+    if {[string match *freebsd* $job]} {
+        per-host-ts broken  host-install/@(*) ts-freebsd-host-install
+        per-host-ts .       xen-install/@     ts-xen-install-freebsd
+    } else {
+        per-host-ts broken  host-install/@(*) ts-host-install-twice
+        per-host-ts .       xen-install/@     ts-xen-install
+    }
     per-host-ts .       xen-boot/@        ts-host-reboot
 
     per-host-ts .       =(*)             {ts-leak-check basis}
@@ -327,6 +332,7 @@ proc need-hosts/build {} { return BUILD }
 proc need-hosts/build-kern {} { return BUILD }
 proc need-hosts/build-libvirt {} { return BUILD }
 proc need-hosts/build-rumpuserxen {} { return BUILD }
+proc need-hosts/build-freebsd {} { return BUILD }
 
 proc run-job/build {} {
     run-ts . = ts-xen-build
@@ -345,11 +351,22 @@ proc run-job/build-rumpuserxen {} {
     run-ts . = ts-xen-build + host tools
 }
 
+proc run-job/build-freebsd {} {
+    run-ts . = ts-freebsd-create-mfsbsd
+}
+
 proc prepare-build-host {} {
     global jobinfo
     run-ts broken = ts-hosts-allocate + host
-    run-ts broken host-install(*) ts-host-install-twice
-    run-ts . host-build-prep ts-xen-build-prep
+    if {[string match *freebsd-xen* $jobinfo(job)]} {
+        run-ts broken host-install(*) ts-freebsd-host-install
+        run-ts . host-build-prep ts-xen-build-prep-freebsd
+    } elseif {[string match *freebsd-freebsd* $jobinfo(job)]} {
+        run-ts broken host-install(*) ts-freebsd-host-install
+    } else {
+        run-ts broken host-install(*) ts-host-install-twice
+        run-ts . host-build-prep ts-xen-build-prep
+    }
 }
 
 #---------- main program ----------
Signature · 7 lines
1.9.3 (Apple Git-50)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#20 lore raw

Re: [PATCH v4 11/11] osstest: add FreeBSD build recipe

Quoted 5 lines · Roger Pau Monne

This patch introduces two new buildjobs:

build-<arch>-freebsd-xen: sets up a FreeBSD host and builds Xen. build-<arch>-freebsd-freebsd: sets up a FreeBSD host and builds FreeBSD sets and a mfsBSD installer image.

Not sure why this is dodgy, it doesn't look too bad to me.

One thought I had all the way through this is that its a bit wrong that ts-xen-{install,build} and ts-kernel-build are actually ts-xen-{install,build}-linux and ts-linux-build.

Renaming those script would allow some of the iffs you are added to be replace with do-a-thing-$os.

A little care would be needed so that the testid doesn't change, but that's might be a good thing, since having the testid be host-install regardless of the OS being installed would make things a bit more readable IMHO (e.g. in the summary grid).

Perhaps the way to achieve that is to make ts-xen-build be:

    #!/bin/bash
    set -ex
    os=$1;shift
    exec ts-xen-build-$1 $@

Then things like:
per-host-ts broken host-install/@(*) ts-host-install + $os
per-host-ts . xen-install/@ ts-xen-install + $os

(the + makes the $os not be in the test id)

Ian.