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

[Xen-devel] [PATCH v6 14/20] osstest: introduce a script to set the runtime hostflags runvar for FreeBSD jobs

Due to the nature of the FreeBSD install media, which is
self-generated from the ts-freebsd-build script, the hostflags runvar
set to FreeBSD jobs are related to the current version under test.

The following hostflags might need to be fetched from the runvars of a
previous build-$arch-freebsd job:

 - share-build-freebsd-$arch-$hash: the $hash used here is calculated
   from the checksum of the installer image used by this specific job.
   This allows osstest to share FreeBSD build hosts, and be sure the
   exact desired FreeBSD version is used.
 - PropMinVer:Freebsd:$version: $version contains the major FreeBSD
   version under test. This version is obtained from the FreeBSD
   source code used to create the install media.

Note that the share-build-* hostflag is optional, and will only be set
for build jobs.

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Changes since v5:
 - Fetch the host idents from the arguments, instead of assuming
   "host" always.
 - Set PropMinVer:Freebsd:<version> instead of freebsd-<version> to
   better cope with FreeBSD version bumps. This should only happen
   every ~2 years.

Changes since v4:
 - Make the share-build- flag optional.

Changes since v3:
 - Make use of the set_runtime_hostflag helper.
 - Make use of the sha256file helper.

Changes since v2:
 - New in this version.
 ts-freebsd-set-hostflags | 78 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 78 insertions(+)
 create mode 100755 ts-freebsd-set-hostflags

diff --git a/ts-freebsd-set-hostflags b/ts-freebsd-set-hostflags
new file mode 100755
index 00000000..5676d1fb
--- /dev/null
+++ b/ts-freebsd-set-hostflags
@@ -0,0 +1,78 @@
+#!/usr/bin/perl -w
+# 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
+# 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/>.
+# This script sets the host_hostflags for a FreeBSD job based on the runvars
+# provided and the contents of the extra_hostflags runvar.
+# If the freebsd_distpath runvar is set the installer image will be retrieved
+# from "freebsd_distpath"/install.img, and the FreeBSD version from the
+# freebsd_version runvar. Note that both those runvars should be set on the
+# current job.
+# If freebsd_distpath is not set, it is assumed that freebsdbuildjob runvar is
+# set and the installer image will be retrieved from the path pointed to by
+# "path_freebsdddist"/install.img, and the FreeBSD version will be obtained
+# from the "freebsd_buildversion" runvar. Both of those runvars belong to the
+# flight and job pointed to by freebsdbuildjob.
+# As output upon successful completion this script will set the host_hostflags
+# runvar for the current job. Note that this _must_ be done before running
+# ts-host-allocate.
+use strict qw(vars);
+use DBI;
+use POSIX;
+unshift @INC, qw(.);
+use Osstest;
+use Osstest::TestSupport;
+our $share;
+if (@ARGV && $ARGV[0] eq "--share") {
+    $share = 1;
+    shift @ARGV;
+sub get_freebsd_image_hash() {
+    my $distpath =  $r{"freebsd_distpath"} ||
+                    get_stashed("path_freebsddist", $r{"freebsdbuildjob"});
+    return sha256file("$distpath/install.img", 16);
+sub get_freebsd_version() {
+    return $r{"freebsd_version"} ||
+           get_runvar("freebsd_buildversion", $r{"freebsdbuildjob"});
+while (@ARGV) {
+    my $ident = shift @ARGV;
+    die "Unexpected argument $ident" if $ident =~ m/^-/;
+    my $version = get_freebsd_version();
+    set_runtime_hostflag($ident, "PropMinVer:Freebsd:$version");
+    if ($share) {
+        my $hash = get_freebsd_image_hash();
+        set_runtime_hostflag($ident, "share-build-freebsd-$hash");
+    }
2.11.0 (Apple Git-81)

Xen-devel mailing list



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