Skip to contentSkip to conversation

osstest: initial FreeBSD support

PATCH Superseded Roger Pau Monne 1 participant 9 messages May 25, 2017 – May 26, 2017

v2 of 17 Superseded Latest is v17 →

lore
Share & tools
lore
#0 lore raw

v2 cover osstest: initial FreeBSD support

Hello,

This series introduces initial FreeBSD host support to osstest. The current series allow installing a bare-metal host with FreeBSD and building FreeBSD on it in order to generate new install media that can be fed into the installer script.

This is still very limited, since no Xen testing is done on those hosts, however it sets the base to add a Xen build test for FreeBSD.

Note that it should be quite easy to add more steps to the build script so that FreeBSD VM images are also generated, that could be used by osstest.

I've tried to add a detailed commit log at each relevant patch, so not much more to add here in the cover letter.

The series can also be found on my git repo:

git://xenbits.xen.org/people/royger/osstest.git freebsd_v2

Thanks, Roger.

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

#1 lore raw

PATCH v2 1/7 osstest: make built_stash_file store a path_ runvar for each file

And introduce built_stash_debugfile in order the keep the previous behavior of built_stash_file.

---
 Osstest/TestSupport.pm | 14 ++++++++++++--
 ts-kernel-build        |  4 ++--
 ts-xen-build           |  8 ++++----
 3 files changed, 18 insertions(+), 8 deletions(-)
Osstest/TestSupport.pm +12 -2
index c23ac135..5f13eb0b 100644
@@ -83,7 +83,7 @@ BEGIN {
                       get_stashed open_unique_stashfile compress_stashed
                       dir_identify_vcs
                       build_url_vcs build_clone
-                      built_stash built_stash_file
+                      built_stash built_stash_file built_stash_debugfile
                       built_compress_stashed
                       hg_dir_revision git_dir_revision vcs_dir_revision
                       store_revision store_vcs_revision
@@ -1445,7 +1445,7 @@ END
     store_runvar("path_$item", $stashleaf);
 }
 
-sub built_stash_file ($$$$;$) {
+sub built_stash_debugfile ($$$$;$) {
     my ($ho, $builddir, $item, $fname, $optional) = @_;
     my $build= "build";
     my $stashleaf= "$build/$item";
@@ -1458,6 +1458,16 @@ sub built_stash_file ($$$$;$) {
                    "$stash/$stashleaf");
 }
 
+sub built_stash_file ($$$$;$) {
+    my ($ho, $builddir, $item, $fname, $optional) = @_;
+    my $build= "build";
+    my $stashleaf= "$build/$item";
+
+    built_stash_debugfile($ho, $builddir, $item, $fname, $optional);
+    store_runvar("path_$item", $stashleaf);
+}
+
+
 sub built_compress_stashed($) {
     my ($path) = @_;
     compress_stashed("build/$path");
ts-kernel-build +2 -2
index 94e67a47..5b87f5a7 100755
@@ -438,9 +438,9 @@ if ($r{tree_linuxfirmware}) {
     fwinstall();
 }
 built_stash($ho, $builddir, 'dist', 'kerndist');
-built_stash_file($ho, $builddir, 'vmlinux', 'linux/vmlinux');
+built_stash_debugfile($ho, $builddir, 'vmlinux', 'linux/vmlinux');
 built_compress_stashed('vmlinux');
-built_stash_file($ho, $builddir, 'config', 'linux/.config');
+built_stash_debugfile($ho, $builddir, 'config', 'linux/.config');
 
 sub enable_xen_config () {
     return <<'END';
ts-xen-build +4 -4
index 31acb9dd..0152ea05 100755
@@ -209,10 +209,10 @@ sub stash () {
                     "xen/dist/${part}install",
                     "${part}dist");
     }
-    built_stash_file($ho, $builddir, "xen-syms", "xen/xen/xen-syms", 1);
-    built_stash_file($ho, $builddir, "xen-config", "xen/.config", 1);
-    built_stash_file($ho, $builddir, "xen-hv-config", "xen/xen/.config", 1);
-    built_stash_file($ho, $builddir, "seabios-config",
+    built_stash_debugfile($ho, $builddir, "xen-syms", "xen/xen/xen-syms", 1);
+    built_stash_debugfile($ho, $builddir, "xen-config", "xen/.config", 1);
+    built_stash_debugfile($ho, $builddir, "xen-hv-config", "xen/xen/.config", 1);
+    built_stash_debugfile($ho, $builddir, "seabios-config",
 		     "xen/tools/firmware/seabios-dir-remote/.config", 1);
     built_compress_stashed("xen-syms");
 }
Signature · 7 lines
2.11.0 (Apple Git-81)


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

PATCH v2 2/7 osstest: move known_hosts generation to TestSupport

In reply to Roger Pau Monne

This is equivalent to the already existing authorized_keys function, and generates the contents of the known_hosts file that should be installed on targets.

---
 Osstest/Debian.pm      | 36 +-----------------------------------
 Osstest/TestSupport.pm | 41 ++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 41 insertions(+), 36 deletions(-)
Osstest/Debian.pm +1 -35
index 8ba48bfa..87539822 100644
@@ -709,41 +709,7 @@ sub preseed_ssh ($$) {
     my ($ho,$sfx) = @_;
 
     my $authkeys_url= create_webfile($ho, "authkeys$sfx", authorized_keys());
-
-    my $hostkeyfile= "$c{OverlayLocal}/etc/ssh/ssh_host_rsa_key.pub";
-    my $hostkey= get_filecontents($hostkeyfile);
-    chomp($hostkey); $hostkey.="\n";
-    my $knownhosts= '';
-
-    my $hostsq= $dbh_tests->prepare(<<END);
-        SELECT val FROM runvars
-         WHERE flight=? AND name LIKE '%host'
-         GROUP BY val
-END
-    $hostsq->execute($flight);
-    while (my ($node) = $hostsq->fetchrow_array()) {
-        my $defaultfqdn = $node;
-        $defaultfqdn .= ".$c{TestHostDomain}" unless $defaultfqdn =~ m/\./;
-
-        my %props;
-        $mhostdb->get_properties($node, \%props);
-
-        my $longname= $props{Fqdn} // $defaultfqdn;
-        my (@hostent)= gethostbyname($longname);
-        if (!@hostent) {
-            logm("skipping host key for nonexistent host $longname");
-            next;
-        }
-        my $specs= join ',', $longname, $node, map {
-            join '.', unpack 'W4', $_;
-        } @hostent[4..$#hostent];
-        logm("adding host key for $specs");
-        $knownhosts.= "$specs ".$hostkey;
-    }
-    $hostsq->finish();
-
-    $knownhosts.= "localhost,127.0.0.1 ".$hostkey;
-    my $knownhosts_url= create_webfile($ho, "known_hosts$sfx", $knownhosts);
+    my $knownhosts_url= create_webfile($ho, "known_hosts$sfx", known_hosts());
 
     preseed_hook_command($ho, 'late_command', $sfx, <<END);
 #!/bin/sh
Osstest/TestSupport.pm +40 -1

53 lines not on this page · raw message

Signature · 7 lines
2.11.0 (Apple Git-81)


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

PATCH v2 3/7 osstest: introduce helper to get per-host tftp prefix

In reply to Roger Pau Monne

This is used in order to get the per-host tftp prefix, used to store the host initrd file.

---
Changes since v1:
- New in this version.

---
 Osstest/TestSupport.pm | 8 +++++++-
 ts-host-install        | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)
Osstest/TestSupport.pm +7 -1
index 8c7078c5..8b41a4bc 100644
@@ -67,7 +67,7 @@ BEGIN {
                       target_run_apt
                       target_install_packages target_install_packages_norec
                       target_jobdir target_extract_jobdistpath_subdir
-                      target_extract_jobdistpath
+                      target_extract_jobdistpath target_tftp_prefix
                       lv_create lv_dev_mapper
 
                       poll_loop tcpconnect await_tcp
@@ -2278,6 +2278,12 @@ sub target_extract_jobdistpath ($$$$$) {
     target_cmd_root($ho, "cd / && tar -hzxf $distcopy", 300);
 }
 
+sub target_tftp_prefix ($) {
+    my ($ho) = @_;
+
+    return "$ho->{Tftp}{TmpDir}/" . hostnamepath($ho);
+}
+
 sub guest_find_domid ($$) {
     my ($ho,$gho) = @_;
     return if defined $gho->{Domid};
ts-host-install +1 -1
index 299eae48..9f9c84fd 100755
@@ -253,7 +253,7 @@ END
     push @initrds, "$initrd_overlay.cpio.gz";
 
     logm("using initrds: @initrds");
-    my $initrd= "$ho->{Tftp}{TmpDir}".hostnamepath($ho)."--initrd.gz";
+    my $initrd= target_tftp_prefix($ho) . "--initrd.gz";
     system_checked("cat -- @initrds >$ho->{Tftp}{Path}$initrd");
     
     push @dicmdline, "domain=$c{TestHostDomain}";
Signature · 7 lines
2.11.0 (Apple Git-81)


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

PATCH v2 4/7 osstest: add a FreeBSD host install recipe

In reply to Roger Pau Monne

The installation is performed using the bsdinstall tool, which is part of the FreeBSD base system. The installer image is setup with the osstest ssh keys and sshd enabled by default, which allows the test harness to just ssh into the box, create the install config file and launch the scripted install.

Currently the installation is done with ZFS only, in stripe mode, and a single disk.

In order to support the FreeBSD installer a new method is added, that allows setting the pxe boot of a host using a memdisk.

The install script either picks the binary images from the output of a previous FreeBSD buildjob (yet to be introduced), or from the folder pointed by freebsd_distpath. This folder should contain the installer image (install.img) and the compressed install sets (kernel.txz, base.txz) together with the MANIFEST file that contains the checksums.

Note that the FreeBSD installer image uses "memdisk" from pxelinux, so the tftp root needs to provide a copy of memdisk.

---
Changes since v1:
- Use pkg bootstrap instead of pkg update.
- Use freebsdbuildjob instead of freebsd_buildjob.
- add "append raw" to the memdisk command line.
- Use with-lock-ex instead of flock.
- Use system_checked and an array to hold the locked command to execute.
- Use an array to store the list of possible disk devices.
- Use target_putfilecontents_root_stash in order to upload the install script to the target.
- Remove the usage of TftpFreeBSDBase.
- Use target_tftp_prefix in order to get the prefix for the tftp target image path.
- Add a missing linewrap.
- Replace the split used to get the runvar paths with a regexp.
- Place the install sets at /root/osstest_sets instead of /tmp/osstest_sets.
- Pick the sets/installer image from the freebsdbuildjob path_freebsdist or from the runvar variable freebsd_distpath.
- Add a comment about which FreeBSD specific inputs the script consumes.

---
 Osstest/TestSupport.pm  |  22 +++-
 ts-freebsd-host-install | 263 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 284 insertions(+), 1 deletion(-)
 create mode 100755 ts-freebsd-host-install
Osstest/TestSupport.pm +21 -1
index 8b41a4bc..ba1d6cc9 100644
@@ -118,7 +118,7 @@ BEGIN {
                       await_webspace_fetch_byleaf create_webfile
                       file_link_contents get_timeout
                       setup_netboot_di setup_netboot_local host_netboot_file
-		      subst_netboot_template
+                      subst_netboot_template setup_netboot_memdisk
 
                       ether_prefix
 
@@ -2559,6 +2559,26 @@ default local
 END
 }
 
+sub setup_netboot_memdisk ($$) {
+    my ($ho, $img) = @_;
+    setup_netboot_bootcfg($ho, <<END);
+serial 0 $c{Baud}
+timeout 5
+label overwrite
+        menu label ^Overwrite
+        menu default
+        kernel memdisk
+        initrd $img
+        # NB: according to the memdisk syslinux wikipage [0]
+        # adding "append raw" is required in order to boot on
+        # some boxes, and in fact some hardware will not boot
+        # without it.
+        # [0] http://www.syslinux.org/wiki/index.php?title=MEMDISK#Memory_access_method
+        append raw
+default overwrite
+END
+}
+
 # uboot emulates pxelinux, so reuse BIOS stuff
 sub setup_netboot_di_uboot ($$$$$;%) { return &setup_netboot_di_bios; }
 sub setup_netboot_local_uboot ($) { return &setup_netboot_local_bios; }
ts-freebsd-host-install new file +263 -0

263 lines not on this page · raw message

Signature · 7 lines
2.11.0 (Apple Git-81)


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

PATCH v2 5/7 osstest: introduce a FreeBSD build script

In reply to Roger Pau Monne

In order to generate the FreeBSD installer image and the install media.

The install sets are the vanilla ones generated by the 'ftp' release target. The installer image is handcrafted based on the filesystem created by the 'bootonly' target, which is then populated with the ssh host keys, and setup in order to use the serial console. The other difference from upstream FreeBSD installer images is that the one built by osstest uses a ramdisk instead of relying on the installer media to be somehow attached, either on a CD or USB drive. This is required in order to boot the image from pxelinux (where no CD or USB is actually attached to the host, and everything is fetched from tftp).

Due to the nature of the FreeBSD build, the outputs are different from what osstest expects from a buildjob, more specifically path_freebsddist points to a folder that contains the several outputs form this buildjob.

---
Changes since v1:
- Remove the ts-build-check FreeBSD hack.
- Use pkg-static instead of pkg.
- Introduce buildcmd_stamped_logged_root and target_cmd_build_root.
- Use target_cmd_build_root and buildcmd_stamped_logged_root in the ts-freebsd-build script.
- Fix the script snippets to use <<END.<<'END' in order to avoid escaping the shell variables.
- Set path_freebsddist runvar to point to the folder where the build files are stashed.
- Add a comment at the top of the file describing what runvars are consumed/produced by the build script.

---
 Osstest/BuildSupport.pm |  26 +++++-
 Osstest/TestSupport.pm  |  28 +++++-
 ts-freebsd-build        | 244 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 290 insertions(+), 8 deletions(-)
 create mode 100755 ts-freebsd-build
Osstest/BuildSupport.pm +22 -4
index 4c2b658b..b96ce766 100644
@@ -36,7 +36,7 @@ BEGIN {
                       $whhost $ho
 
                       builddirsprops
-                      buildcmd_stamped_logged
+                      buildcmd_stamped_logged buildcmd_stamped_logged_root
                       $builddir $makeflags
 		      $buildcmd_global_prefix
 
@@ -60,9 +60,9 @@ our ($xendist);
 
 our $buildcmd_global_prefix //= '';
 
-sub buildcmd_stamped_logged ($$$$$$) {
-    my ($timeout, $component, $stampname, $prefix, $cmd, $suffix) = @_;
-    target_cmd_build($ho, $timeout, $builddir, <<END);
+sub buildcmd_stamped_logged_script ($$$$$) {
+    my ($component, $stampname, $prefix, $cmd, $suffix) = @_;
+    my $script = <<END;
         cd $component
         $buildcmd_global_prefix
         $prefix
@@ -73,6 +73,24 @@ sub buildcmd_stamped_logged ($$$$$$) {
         echo ok.
 END
 #/;
+
+    return $script;
+}
+
+sub buildcmd_stamped_logged_root ($$$$$$) {
+    my ($timeout, $component, $stampname, $prefix, $cmd, $suffix) = @_;
+    my $script = buildcmd_stamped_logged_script($component, $stampname,
+                                                $prefix, $cmd, $suffix);
+
+    target_cmd_build_root($ho, $timeout, $builddir, $script);
+}
+
+sub buildcmd_stamped_logged ($$$$$$) {
+    my ($timeout, $component, $stampname, $prefix, $cmd, $suffix) = @_;
+    my $script = buildcmd_stamped_logged_script($component, $stampname,
+                                                $prefix, $cmd, $suffix);
+
+    target_cmd_build($ho, $timeout, $builddir, $script);
 }
 
 sub selectbuildhost {
Osstest/TestSupport.pm +24 -4
index ba1d6cc9..3f136777 100644
@@ -53,6 +53,7 @@ BEGIN {
                       stashfilecontents
 
                       target_cmd_root target_cmd target_cmd_build
+                      target_cmd_build_root
                       target_cmd_output_root target_cmd_output
                       target_cmd_inputfh_root sshuho
                       target_getfile target_getfile_root
@@ -635,8 +636,8 @@ sub target_editfile      ($$$;$$) { teditfileex('osstest',@_); }
     # my ($ho,$rfile, $lleaf,$rdest) = @_;
     #                 ^^^^^^^^^^^^^ optional
 
-sub target_cmd_build ($$$$) {
-    my ($ho,$timeout,$builddir,$script) = @_;
+sub target_cmd_build_script ($$$) {
+    my ($ho, $builddir, $script) = @_;
 
     my $distcc_hosts = get_host_property($ho,'DistccHosts',undef);
     my $distcc = defined($distcc_hosts) ? <<END : "";
@@ -648,8 +649,8 @@ END
 
     my $httpproxy = http_proxy_envsettings($ho);
 
-    target_cmd($ho, <<END.$distcc.<<END.$script, $timeout);
-	set -xe
+    my $cmd =  <<END.$distcc.<<END.$script;
+        set -xe
         LC_ALL=C; export LC_ALL
         PATH=/usr/lib/ccache:\$PATH:/usr/lib/git-core
         $httpproxy
@@ -658,8 +659,27 @@ END
         cd $builddir
         rm -f build-ok-stamp
 END
+
+    return $cmd;
+}
+
+sub target_cmd_build ($$$$) {
+    my ($ho,$timeout,$builddir,$script) = @_;
+
+    my $cmd = target_cmd_build_script($ho, $builddir, $script);
+
+    target_cmd($ho, $cmd, $timeout);
+}
+
+sub target_cmd_build_root ($$$$) {
+    my ($ho,$timeout,$builddir,$script) = @_;
+
+    my $cmd = target_cmd_build_script($ho, $builddir, $script);
+
+    target_cmd_root($ho, $cmd, $timeout);
 }
 
+
 sub target_ping_check_core {
     my ($ho, $exp) = @_;
     my $out= `ping -c 5 $ho->{Ip} 2>&1`;
ts-freebsd-build new file +244 -0

244 lines not on this page · raw message

Signature · 7 lines
2.11.0 (Apple Git-81)


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

Re: [PATCH v2 5/7] osstest: introduce a FreeBSD build script

On Thu, May 25, 2017 at 05:24:16PM +0100, Roger Pau Monne wrote:
[...]

ts-freebsd-build line 85

Quoted 4 lines
ts-freebsd-build new file +4 -0
+    buildcmd_stamped_logged(18000, 'freebsd', 'buildworld',
+                            $prefix, <<END, '');
+make $makeflags buildworld
+END

This is still timing out on some of the Citrix internal osstest instance hosts (bush-criket, which only has two ways):

http://osstest.xs.citrite.net/~osstest/testlogs/logs/71438/build-amd64-freebsd/4.ts-freebsd-build.log

Timeout should be set to 21600 (6h). I hope that once osstest is able to finish a build on that host successfully it will realize it's awfully slow and prefer other hosts instead.

Roger.

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

#7 lore raw

PATCH v2 6/7 osstest: add a FreeBSD build to flights

In reply to Roger Pau Monne

This requires changes in several places in order to accommodate the FreeBSD build, which although it's a build job, it doesn't have the same set of dependencies as the current builds.

First, a new build recipe is added to sg-run-job, and accordingly sg-run-job is also made aware about the differences between a Linux and a FreeBSD build job. A Linux build job requires ts-host-allocate
+ ts-host-install-twice + ts-xen-build-prep, while a FreeBSD build job requires ts-host-allocate + ts-freebsd-host-install.

All the current build jobs are kept to use the Linux build recipe, while the newly added build-freebsd is using the new FreeBSD recipe.

cri-getconfig is also modified to introduce two new helpers, used to fetch a runvar and a stashed file from a specific job. This is needed by the FreeBSD build job creator in order to fetch information from a previous buildjob (so the output from a previous buildjob can be used as input to a new buildjob).

Finally, the logic to create a FreeBSD build job is added to mfi-common. This includes creating a FreeBSD build job, and also testing the output of that build job (by creating another build job that depends on the output of the first).

Note that the FreeBSD build job needs some input in order to setup a FreeBSD host, and that can be fetched from different places:

1. Env variable FREEBSD_BUILDJOB: use the output from a previous build-<arch>-freebsd.

2. Env variables FREEBSD_IMAGE, FREEBSD_SETS, FREEBSD_VERSION: set before calling into make-flight, provide the installer image, the sets to install and the version being installed.

3. Config file FreeBSDImage, FreeBSDSets and FreeBSDVersion: same as
2. except that they are set on the config file.

---
Changes since v1:
- Replace freebsd_buildjob with freebsdbuildjob.
- Replace FREEBSD_SETS/IMAGE with a single FREEBSD_DIST that points to a folder that should contain both things.
- Document the FreeBSDDist and FreeBSDVersion config file options in the README file.

---
 README        | 11 ++++++++++
 ap-common     |  4 ++++
 cri-getconfig | 37 ++++++++++++++++++++++++++++++++++
 mfi-common    | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 sg-run-job    | 39 ++++++++++++++++++++++++-----------
 5 files changed, 144 insertions(+), 12 deletions(-)
README +11 -0
index b45058da..51243974 100644
@@ -423,6 +423,17 @@ HostGroupFlags_<group>
 DebianPreseed
    Text to add to the debian-installer preseed file.  Optional.
 
+FreeBSDDist
+   Path to the folder that contains the FreeBSD install image and
+   the FreeBSD compressed install sets, together with the MANIFEST
+   file that holds the checksums. This is required in order to run
+   a FreeBSD host install if no previous FreeBSD buildjob is
+   available (ie: for example when running in standalone mode).
+
+FreeBSDVersion
+   Numeric value holding the major FreeBSD version of the media
+   provided in FreeBSDDist (ie: 12).
+
 ========================================
 
 Config settings relevant only to standalone mode
ap-common +4 -0
index cbb815ce..d4fa7aef 100644
@@ -37,6 +37,10 @@
 : ${PUSH_TREE_XTF:=$XENBITS:/home/xen/git/xtf.git}
 : ${BASE_TREE_XTF:=git://xenbits.xen.org/xtf.git}
 
+: ${TREE_FREEBSD:=git://github.com/freebsd/freebsd.git}
+: ${PUSH_TREE_FREEBSD:=$XENBITS:/home/xen/git/freebsd.git}
+: ${BASE_TREE_FREEBSD:=git://xenbits.xen.org/freebsd.git}
+
 : ${TREE_LIBVIRT:=git://libvirt.org/libvirt.git}
 : ${PUSH_TREE_LIBVIRT:=$XENBITS:/home/xen/git/libvirt.git}
 : ${BASE_TREE_LIBVIRT:=git://xenbits.xen.org/libvirt.git}
cri-getconfig +37 -0
index b2c91ac7..b7f7ae0c 100644
@@ -25,6 +25,43 @@ getconfig () {
         '
 }
 
+# Get the path to a stashed file from another job.
+#
+# $1: current flight
+# $2: current job
+# $3: name of the stashed file
+# $4: flight (optional) and job where to fetch the stashed file from
+#     (in $flight.$job format or $job).
+getstashed() {
+	perl -e '
+		use Osstest;
+		use Osstest::TestSupport;
+		csreadconfig();
+		$flight = "'$1'";
+		$job = "'$2'";
+		print get_stashed("'$3'", "'$4'") or die $!;
+	'
+}
+
+# Get a runvar from another job.
+#
+# $1: current flight
+# $2: current job
+# $3: name of the runvar
+# $4: flight (optional) and job where to fetch the runvar from
+#     (in $flight.$job format or $job).
+
+getrunvar() {
+	perl -e '
+		use Osstest;
+		use Osstest::TestSupport;
+		csreadconfig();
+		$flight = "'$1'";
+		$job = "'$2'";
+		print get_runvar("'$3'", "'$4'") or die $!;
+	'
+}
+
 getconfig_TftpDiVersion_suite () {
 	perl -e '
 		use Osstest;
mfi-common +65 -0

77 lines not on this page · raw message

sg-run-job +27 -12
index ceb79800..c480a02b 100755
@@ -53,12 +53,15 @@ proc run-job {job} {
     set skip_globs     [jobdb::read-runvar $flight $job skip_testids]
 
     set nh [need-hosts/$jobinfo(recipe)]
-    if {![string compare $nh BUILD]} {
+    if {![string compare $nh BUILD_LINUX]} {
         set need_xen_hosts {}
-        set need_build_host 1
+        set need_build_host LINUX
+    } elseif {![string compare $nh BUILD_FREEBSD]} {
+        set need_xen_hosts {}
+        set need_build_host FREEBSD
     } else {
         set need_xen_hosts $nh
-        set need_build_host 0
+        set need_build_host ""
     }
     set nested_layers_hosts {}
 
@@ -69,7 +72,8 @@ proc run-job {job} {
         eval run-ts broken  =             ts-hosts-allocate + $need_xen_hosts
     }
 
-    if {$need_build_host} { catching-otherwise broken prepare-build-host }
+    if {![string compare $need_build_host LINUX]} { catching-otherwise broken prepare-build-host-linux }
+    if {![string compare $need_build_host FREEBSD]}  { catching-otherwise broken prepare-build-host-freebsd }
 
     if {$ok} { setstatus running                                          }
 
@@ -89,7 +93,7 @@ proc run-job {job} {
         set need_xen_hosts [lunappend nested_layers_hosts]
     }
 
-    if {$need_build_host && $anyfailed} {
+    if {[string length $need_build_host] && $anyfailed} {
 	run-ts  !broken capture-logs      ts-logs-capture + host
     }
 
@@ -106,7 +110,7 @@ proc run-job {job} {
 
     if {$ok} { setstatus pass                                             }
 
-    if {$need_build_host && $ok} { jobdb::preserve-task 90 }
+    if {[string length $need_build_host] && $ok} { jobdb::preserve-task 90 }
 
     if {$anyfailed} {
         jobdb::logputs stdout "at least one test failed"
@@ -535,11 +539,12 @@ proc need-hosts/host-examine-linux {} {
 
 #---------- builds ----------
 
-proc need-hosts/build {} { return BUILD }
-proc need-hosts/build-kern {} { return BUILD }
-proc need-hosts/build-libvirt {} { return BUILD }
-proc need-hosts/build-rumprun {} { return BUILD }
-proc need-hosts/build-xtf {} { return BUILD }
+proc need-hosts/build {} { return BUILD_LINUX }
+proc need-hosts/build-kern {} { return BUILD_LINUX }
+proc need-hosts/build-libvirt {} { return BUILD_LINUX }
+proc need-hosts/build-rumprun {} { return BUILD_LINUX }
+proc need-hosts/build-xtf {} { return BUILD_LINUX }
+proc need-hosts/build-freebsd {} { return BUILD_FREEBSD }
 
 proc run-job/build {} {
     run-ts . = ts-xen-build
@@ -566,13 +571,23 @@ proc run-job/build-xtf {} {
     run-ts . = ts-xtf-build
 }
 
-proc prepare-build-host {} {
+proc run-job/build-freebsd {} {
+    run-ts . = ts-freebsd-build
+}
+
+proc prepare-build-host-linux {} {
     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
 }
 
+proc prepare-build-host-freebsd {} {
+    global jobinfo
+    run-ts broken = ts-hosts-allocate + host
+    run-ts broken host-install(*) ts-freebsd-host-install
+}
+
 proc need-hosts/coverity {} { return BUILD }
 proc run-job/coverity {} {
     run-ts . = ts-coverity-build + host
Signature · 7 lines
2.11.0 (Apple Git-81)


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

PATCH v2 7/7 osstest: introduce make-freebsd-flight

In reply to Roger Pau Monne

At the moment this flight only contains a build-amd64-freebsd and build-amd64-freebsd-again jobs, because that's all osstest can do with FreeBSD now.

This allows testing FreeBSD specific functionality without generating a fully-fledged flight, that also includes the Linux jobs.

---
Changes since v1:
- Replace freebsd_buildjob with freebsdbuildjob.

---
 make-freebsd-flight | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
 create mode 100755 make-freebsd-flight
make-freebsd-flight new file +62 -0
new file mode 100755
index 00000000..10e8f863
@@ -0,0 +1,62 @@
+#!/bin/bash
+
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2017 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 -o posix
+
+branch=$1
+xenbranch=$2
+blessing=$3
+buildflight=$4
+
+flight=`./cs-flight-create $blessing $branch`
+
+. ./cri-common
+. ./ap-common
+. ./mfi-common
+
+arch=amd64
+
+job_create_build_filter_callback () {
+    :
+}
+
+job_create_build build-$arch-freebsd build-freebsd                       \
+            arch=$arch                                                   \
+            $RUNVARS $BUILD_RUNVARS $BUILD_FREEBSD_RUNVARS $arch_runvars \
+            tree_freebsd=$TREE_FREEBSD                                   \
+            revision_freebsd=$REVISION_FREEBSD
+version=`set_freebsd_build_job_flags $arch`
+
+# Pass new hostflags, now the buildhost must not be shared, since we are
+# testing the newly built image
+job_create_build build-$arch-freebsd-again build-freebsd                 \
+            arch=$arch                                                   \
+            $RUNVARS $BUILD_RUNVARS $BUILD_FREEBSD_RUNVARS $arch_runvars \
+            host_hostflags=arch-$arch,freebsd-$version,purpose-build     \
+            tree_freebsd=$TREE_FREEBSD                                   \
+            revision_freebsd=$REVISION_FREEBSD                           \
+            freebsdbuildjob=build-$arch-freebsd
+
+echo $flight
+
+# Local variables:
+# mode: sh
+# sh-basic-offset: 2
+# indent-tabs-mode: nil
+# End:
Signature · 7 lines
2.11.0 (Apple Git-81)


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