From: Ian Jackson <ian.jackson@eu.citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>,
Ian Campbell <ian.campbell@citrix.com>
Subject: [OSSTEST PATCH 03/13] BuildSupport, ts-*-build: Remove some clone-and-hack
Date: Fri, 16 May 2014 19:01:30 +0100 [thread overview]
Message-ID: <1400263300-22903-4-git-send-email-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <1400263300-22903-1-git-send-email-ian.jackson@eu.citrix.com>
Introduce Osstest::BuildSupport containing selectbuildhost,
builddirsprops and prepbuilddirs. The corresponding replicated code
from the various ts-*-build scripts is abolished.
Also break out xendist, which we are going to want to reuse.
No functional change.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
Osstest/BuildSupport.pm | 93 +++++++++++++++++++++++++++++++++++++++++++++++
ts-kernel-build | 15 ++------
ts-libvirt-build | 22 +++--------
ts-xen-build | 15 ++------
4 files changed, 106 insertions(+), 39 deletions(-)
create mode 100644 Osstest/BuildSupport.pm
diff --git a/Osstest/BuildSupport.pm b/Osstest/BuildSupport.pm
new file mode 100644
index 0000000..1b15557
--- /dev/null
+++ b/Osstest/BuildSupport.pm
@@ -0,0 +1,93 @@
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2009-2013 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/>.
+
+
+package Osstest::BuildSupport;
+
+use strict;
+use warnings;
+
+use POSIX;
+use IO::File;
+
+use Osstest::TestSupport;
+
+BEGIN {
+ use Exporter ();
+ our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
+ $VERSION = 1.00;
+ @ISA = qw(Exporter);
+ @EXPORT = qw(
+
+ selectbuildhost
+ $whhost $ho
+
+ builddirsprops
+ $builddir $makeflags
+
+ prepbuilddirs
+
+ xendist
+ $xendist
+
+ );
+ %EXPORT_TAGS = ( );
+
+ @EXPORT_OK = qw();
+}
+
+our ($whhost,$ho);
+our ($builddir,$makeflags);
+our ($xendist);
+
+sub selectbuildhost {
+ # pass @ARGV
+ ($whhost) = @_;
+ $whhost ||= 'host';
+ $ho= selecthost($whhost);
+}
+
+sub builddirsprops {
+ my (%xbuildopts) = @_;
+
+ $xbuildopts{DefMakeFlags} ||= '-j4';
+
+ my $leaf= "build.$flight.$job";
+ my $homedir = get_host_property($ho, 'homedir', '/home/osstest');
+ $builddir= "$homedir/$leaf";
+
+ $makeflags= get_host_property($ho, 'build make flags',
+ $xbuildopts{DefMakeFlags});
+}
+
+sub prepbuilddirs {
+ my (@xbuilddirs) = @_;
+ my $cmd = "rm -rf $builddir && mkdir $builddir";
+ $cmd .= " && mkdir $builddir/$_" foreach @xbuilddirs;
+ target_cmd($ho,$cmd,600);
+}
+
+sub xendist () {
+ $xendist= "$builddir/xendist";
+ target_cmd($ho,"rm -rf $xendist && mkdir $xendist",60);
+
+ my $path = get_stashed("path_dist", $r{"buildjob"});
+ my $distcopy= "$builddir/dist.tar.gz";
+ target_putfile($ho, 300, $path, $distcopy);
+ target_cmd($ho, "tar -C $xendist -hzxf $distcopy", 300);
+}
+
+1;
diff --git a/ts-kernel-build b/ts-kernel-build
index 9d890a7..984a935 100755
--- a/ts-kernel-build
+++ b/ts-kernel-build
@@ -19,18 +19,11 @@ use strict qw(vars);
use DBI;
use Osstest;
use Osstest::TestSupport;
+use Osstest::BuildSupport;
tsreadconfig();
-
-our ($whhost) = @ARGV;
-$whhost ||= 'host';
-our $ho= selecthost($whhost);
-
-my $leaf= "build.$flight.$job";
-my $homedir = get_host_property($ho, 'homedir', '/home/osstest');
-my $builddir= "$homedir/$leaf";
-
-my $makeflags= get_host_property($ho, 'build make flags', '-j4');
+selectbuildhost(@ARGV);
+builddirsprops();
my $archparms = {
'armhf' => { DefConfig => 'multi_v7_defconfig', KernelImage => 'arch/arm/boot/zImage' },
@@ -41,7 +34,7 @@ my $archparms = {
sub enable_xen_config ();
sub checkout () {
- target_cmd($ho, "rm -rf $builddir && mkdir $builddir", 600);
+ prepbuilddirs();
build_clone($ho, 'linux', $builddir, 'linux');
diff --git a/ts-libvirt-build b/ts-libvirt-build
index 9c731ce..ffef714 100755
--- a/ts-libvirt-build
+++ b/ts-libvirt-build
@@ -19,29 +19,17 @@ use strict qw(vars);
use DBI;
use Osstest;
use Osstest::TestSupport;
+use Osstest::BuildSupport;
tsreadconfig();
-
-our ($whhost) = @ARGV;
-$whhost ||= 'host';
-our $ho= selecthost($whhost);
-
-my $leaf= "build.$flight.$job";
-my $homedir = get_host_property($ho, 'homedir', '/home/osstest');
-my $builddir= "$homedir/$leaf";
-my $xendist= "$builddir/xendist";
+selectbuildhost(@ARGV);
+builddirsprops();
sub libvirtd_init ();
-my $makeflags= get_host_property($ho, 'build make flags', '-j4');
-
sub checkout () {
- target_cmd($ho, "rm -rf $builddir && mkdir $builddir && mkdir $xendist", 600);
-
- my $path = get_stashed("path_dist", $r{"buildjob"});
- my $distcopy= "$builddir/dist.tar.gz";
- target_putfile($ho, 300, $path, $distcopy);
- target_cmd($ho, "tar -C $xendist -hzxf $distcopy", 300);
+ prepbuilddirs();
+ xendist();
build_clone($ho, 'libvirt', $builddir, 'libvirt');
build_clone($ho, 'gnulib_libvirt', $builddir, 'gnulib-libvirt');
diff --git a/ts-xen-build b/ts-xen-build
index 7ac46ea..d251e16 100755
--- a/ts-xen-build
+++ b/ts-xen-build
@@ -21,21 +21,14 @@ use Osstest;
use File::Path;
use POSIX;
use Osstest::TestSupport;
+use Osstest::BuildSupport;
tsreadconfig();
-
-our ($whhost) = @ARGV;
-$whhost ||= 'host';
-our $ho= selecthost($whhost);
-
-my $leaf= "build.$flight.$job";
-my $homedir = get_host_property($ho, 'homedir', '/home/osstest');
-my $builddir= "$homedir/$leaf";
-
-my $makeflags= get_host_property($ho, 'build make flags', '-j4');
+selectbuildhost(@ARGV);
+builddirsprops();
sub checkout () {
- target_cmd($ho, "rm -rf $builddir && mkdir $builddir", 60);
+ prepbuilddirs();
build_clone($ho, 'xen', $builddir, 'xen-unstable');
--
1.7.10.4
next prev parent reply other threads:[~2014-05-16 18:02 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-16 18:01 [OSSTEST PATCH 00/13] Test rump kernels Ian Jackson
2014-05-16 18:01 ` [OSSTEST PATCH 01/13] TestSupport: Provide target_editfile Ian Jackson
2014-05-16 18:01 ` [OSSTEST PATCH 02/13] git_massage_url: Make idempotent Ian Jackson
2014-05-16 18:01 ` Ian Jackson [this message]
2014-05-16 18:01 ` [OSSTEST PATCH 04/13] BuildSupport: Provide some support for git submodules Ian Jackson
2014-05-16 18:01 ` [OSSTEST PATCH 05/13] TestSupport: Break out target_jobdir Ian Jackson
2014-05-16 18:01 ` [OSSTEST PATCH 06/13] TestSupport: Break out target_extract_jobdistpath_subdir Ian Jackson
2014-05-16 18:01 ` [OSSTEST PATCH 07/13] target_jobdir: Create the directory Ian Jackson
2014-05-16 18:01 ` [OSSTEST PATCH 08/13] guest_umount_lv: Tolerate lack of volume group Ian Jackson
2014-05-16 18:01 ` [OSSTEST PATCH 09/13] prepareguest: Tolerate $mb=undef Ian Jackson
2014-05-16 18:01 ` [OSSTEST PATCH 10/13] mfi-common: Honour REVISION_LIBVIRT=disable Ian Jackson
2014-05-16 18:01 ` [OSSTEST PATCH 11/13] rump kernels: Provide a build job Ian Jackson
2014-05-16 18:01 ` [OSSTEST PATCH 12/13] rump kernels: Provide two test jobs Ian Jackson
2014-05-16 18:01 ` [OSSTEST PATCH 13/13] rump kernels: Create a "branch" for rump kernel tests 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=1400263300-22903-4-git-send-email-ian.jackson@eu.citrix.com \
--to=ian.jackson@eu.citrix.com \
--cc=ian.campbell@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).