xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Ian.Jackson@eu.citrix.com, Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH v4 11/16] osstest: introduce a script to set the runtime hostflags runvar for FreeBSD jobs
Date: Thu, 6 Jul 2017 15:42:22 +0100	[thread overview]
Message-ID: <20170706144227.36580-12-roger.pau@citrix.com> (raw)
In-Reply-To: <20170706144227.36580-1-roger.pau@citrix.com>

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.
 - 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.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
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 | 64 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 64 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..1b0206a8
--- /dev/null
+++ b/ts-freebsd-set-hostflags
@@ -0,0 +1,64 @@
+#!/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
+# 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/>.
+
+# 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;
+
+tsreadconfig();
+
+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"});
+}
+
+my $hash = get_freebsd_image_hash();
+my $version = get_freebsd_version();
+my $arch = $r{"arch"};
+
+set_runtime_hostflag("host",
+                     "share-build-freebsd-$arch-$hash,freebsd-$version");
-- 
2.11.0 (Apple Git-81)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2017-07-06 14:42 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-06 14:42 [PATCH v4 00/16] osstest: initial FreeBSD support Roger Pau Monne
2017-07-06 14:42 ` [PATCH v4 01/16] osstest: make built_stash_file store a path_ runvar for each file Roger Pau Monne
2017-07-06 14:42 ` [PATCH v4 02/16] osstest: move known_hosts generation to TestSupport Roger Pau Monne
2017-07-06 14:42 ` [PATCH v4 03/16] osstest: introduce helper to get per-host tftp prefix Roger Pau Monne
2017-07-06 14:42 ` [PATCH v4 04/16] osstest: introduce a helper to calculate the sha256 of a given file Roger Pau Monne
2017-07-06 14:43   ` Ian Jackson
2017-07-06 14:42 ` [PATCH v4 05/16] osstest: introduce a helper to setup a host to boot using memdisk Roger Pau Monne
2017-07-06 16:07   ` Ian Jackson
2017-07-06 14:42 ` [PATCH v4 06/16] osstest: add a FreeBSD host install recipe Roger Pau Monne
2017-07-06 14:53   ` Ian Jackson
2017-07-06 15:13   ` Ian Jackson
2017-07-06 14:42 ` [PATCH v4 07/16] osstest: introduce build helpers for FreeBSD Roger Pau Monne
2017-07-06 14:56   ` Ian Jackson
2017-07-06 14:42 ` [PATCH v4 08/16] osstest: add support for the FreeBSD package manager Roger Pau Monne
2017-07-06 15:12   ` Ian Jackson
2017-07-07  9:55     ` Roger Pau Monne
2017-07-06 14:42 ` [PATCH v4 09/16] osstest: introduce a FreeBSD build script Roger Pau Monne
2017-07-06 15:25   ` Ian Jackson
2017-07-06 17:11     ` Roger Pau Monne
2017-07-06 17:31       ` Ian Jackson
2017-07-06 17:39         ` Roger Pau Monne
2017-07-06 17:42           ` Ian Jackson
2017-07-06 14:42 ` [PATCH v4 10/16] osstest: add support for runtime_IDENT_hostflags Roger Pau Monne
2017-07-06 15:28   ` Ian Jackson
2017-07-06 17:34     ` Roger Pau Monne
2017-07-06 17:42       ` Ian Jackson
2017-07-07 13:07     ` Roger Pau Monne
2017-07-07 13:08       ` Ian Jackson
2017-07-06 14:42 ` Roger Pau Monne [this message]
2017-07-06 15:30   ` [PATCH v4 11/16] osstest: introduce a script to set the runtime hostflags runvar for FreeBSD jobs Ian Jackson
2017-07-06 16:03   ` Ian Jackson
2017-07-06 14:42 ` [PATCH v4 12/16] osstest: allow catching-otherwise to pass arguments to the called script Roger Pau Monne
2017-07-06 15:33   ` Ian Jackson
2017-07-06 14:42 ` [PATCH v4 13/16] osstest: change the meaning of need_build_host Roger Pau Monne
2017-07-06 15:37   ` Ian Jackson
2017-07-07 11:36     ` Roger Pau Monne
2017-07-07 13:00       ` Ian Jackson
2017-07-06 14:42 ` [PATCH v4 14/16] osstest: add support for FreeBSD buildjobs to sg-run-job Roger Pau Monne
2017-07-06 15:38   ` Ian Jackson
2017-07-06 14:42 ` [PATCH v4 15/16] osstest: introduce a script to create a FreeBSD flight Roger Pau Monne
2017-07-06 16:04   ` Ian Jackson
2017-07-07 14:39     ` Roger Pau Monne
2017-07-06 14:42 ` [PATCH v4 16/16] osstest: hook FreeBSD flight into cr-daily-branch Roger Pau Monne
2017-07-06 16:10   ` Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170706144227.36580-12-roger.pau@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).