]> xenbits.xensource.com Git - people/liuw/osstest.git/commitdiff
apt: lock osstest's usages of apt-get against each other
authorIan Campbell <ian.campbell@citrix.com>
Tue, 15 Apr 2014 10:39:32 +0000 (11:39 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 30 Jan 2015 08:05:52 +0000 (08:05 +0000)
Currently we rely on all apt-get invocations being in a single
ts-xen-build-prep job which can't run on a shared host.

That is a bit inflexible so instead use our own lock. We wait
indefinitely and rely on osstest's existing command timeout
infrastructure to catch problems.

target_install_packages*() previous estimated the time taken to
install the packages based on the number of packages. This no longer
applies because the install might get stuck behind some other large
install. Use a 3000s (nearly an hour) timeout instead (I expect
failures here to be unusual so erred on the big side)

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Osstest/Debian.pm
Osstest/TestSupport.pm

index 9b54e5e153dcc4c683bc69ba2457e9450185a036..e3e1c903c65e823d9bced334865a5abd0c829592 100644 (file)
@@ -568,7 +568,7 @@ d-i apt-setup/another boolean false
 d-i apt-setup/non-free boolean false
 d-i apt-setup/contrib boolean false
 
-d-i pkgsel/include string openssh-server, ntp, ntpdate, ethtool, $extra_packages
+d-i pkgsel/include string openssh-server, ntp, ntpdate, ethtool, chiark-utils-bin, $extra_packages
 
 $xopts{ExtraPreseed}
 
index 76861b5b51ab9d9026f705647be1970d18e3a6ba..6cf01ba1f5effab92cc9dc3e2f3522c3cf73a718 100644 (file)
@@ -434,20 +434,18 @@ sub target_putfile_root ($$$$;$) {
     tputfileex('root', @_);
 }
 sub target_run_apt {
-    my ($ho, $timeout, @aptopts) = @_;
+    my ($ho, @aptopts) = @_;
     target_cmd_root($ho,
-   "DEBIAN_PRIORITY=critical UCF_FORCE_CONFFOLD=y apt-get @aptopts",
-                    $timeout);
+        "DEBIAN_PRIORITY=critical UCF_FORCE_CONFFOLD=y \
+            with-lock-ex -w /var/lock/osstest-apt apt-get @aptopts", 3000);
 }
 sub target_install_packages {
     my ($ho, @packages) = @_;
-    target_run_apt($ho, 300 + 100 * @packages,
-                  qw(-y install), @packages);
+    target_run_apt($ho, qw(-y install), @packages);
 }
 sub target_install_packages_norec {
     my ($ho, @packages) = @_;
-    target_run_apt($ho, 300 + 100 * @packages,
-                  qw(--no-install-recommends -y install), @packages);
+    target_run_apt($ho, qw(--no-install-recommends -y install), @packages);
 }
 
 sub target_somefile_getleaf ($$$) {