From patchwork Thu Jul 6 14:42:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Roger Pau Monne X-Patchwork-Id: 9828465 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8893760361 for ; Thu, 6 Jul 2017 14:45:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7AAAF28672 for ; Thu, 6 Jul 2017 14:45:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F313285FB; Thu, 6 Jul 2017 14:45:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D9B02285FB for ; Thu, 6 Jul 2017 14:45:05 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dT7zW-0008Jn-Q6; Thu, 06 Jul 2017 14:42:50 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dT7zU-0008AW-Ln for xen-devel@lists.xenproject.org; Thu, 06 Jul 2017 14:42:48 +0000 Received: from [193.109.254.147] by server-6.bemta-6.messagelabs.com id 25/DC-03937-86C4E595; Thu, 06 Jul 2017 14:42:48 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrHIsWRWlGSWpSXmKPExsXitHSDvW66T1y kwZcf1hbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8a2L0eYC7pkKx5uPMnYwDhPoouRk0NCwF/i /p71LCA2m4COxMW5O9m6GDk4RARUJG7vNQAJMwu4S9y5sIgJxBYWyJJYc7kFrJwFqGTumX6wO K+AlUTTiW3MECP1JN5OfMEIYnMCxU9f+QJmCwlYSuz72swMUS8ocXLmExaI+ZoSrdt/s0PY8h LNW2czQ9QrSvTPe8A2gZFvFpKWWUhaZiFpWcDIvIpRozi1qCy1SNfQUi+pKDM9oyQ3MTNH19D ATC83tbg4MT01JzGpWC85P3cTIzDUGIBgB+OPZQGHGCU5mJREeSvM4yKF+JLyUyozEosz4otK c1KLDzHKcHAoSfDqewPlBItS01Mr0jJzgEEPk5bg4FES4T3tDJTmLS5IzC3OTIdInWI05ljQs +ELE8erCf+/MQmx5OXnpUqJ8/KDTBIAKc0ozYMbBIvGS4yyUsK8jECnCfEUpBblZpagyr9iFO dgVBLmzQeZwpOZVwK37xXQKUxApyg2xoCcUpKIkJJqYFTcKGfhfoyH33LPr61HxJYs1i09sfp Wa1HlxznMm5kmmySf7Y95lRz9NfJ7Is8DJzWR2E/zq4N/SlXLv3R941/3z/f25JAPv49wm9mz Tq3R26bHYppXUsC5We/7nK0BsxrKsyc9r9Co7cxk0vPsTvxwfaLSgs1XT9/+xzvXId5qX9Uxr Wu7ZJVYijMSDbWYi4oTAd9nXZnBAgAA X-Env-Sender: prvs=3536ba782=roger.pau@citrix.com X-Msg-Ref: server-8.tower-27.messagelabs.com!1499352165!95643848!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 2510 invoked from network); 6 Jul 2017 14:42:47 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-8.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 6 Jul 2017 14:42:47 -0000 X-IronPort-AV: E=Sophos;i="5.40,317,1496102400"; d="scan'208";a="438999919" From: Roger Pau Monne To: Date: Thu, 6 Jul 2017 15:42:22 +0100 Message-ID: <20170706144227.36580-12-roger.pau@citrix.com> X-Mailer: git-send-email 2.11.0 (Apple Git-81) In-Reply-To: <20170706144227.36580-1-roger.pau@citrix.com> References: <20170706144227.36580-1-roger.pau@citrix.com> MIME-Version: 1.0 Cc: Ian.Jackson@eu.citrix.com, Roger Pau Monne Subject: [Xen-devel] [PATCH v4 11/16] osstest: introduce a script to set the runtime hostflags runvar for FreeBSD jobs X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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é --- 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 . + +# 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");