diff -Nru autopkgtest-3.20.2/debian/bzr-builder.manifest autopkgtest-3.20.6/debian/bzr-builder.manifest --- autopkgtest-3.20.2/debian/bzr-builder.manifest 2016-04-01 07:11:17.000000000 +0000 +++ autopkgtest-3.20.6/debian/bzr-builder.manifest 2016-05-11 10:03:08.000000000 +0000 @@ -1,2 +1,2 @@ -# bzr-builder format 0.3 deb-version {debupstream}-0~1439 -lp:~vila/autopkgtest/git-master revid:git-v1:0af13d706e94f5bad70236e53154b1525c737be5 +# bzr-builder format 0.3 deb-version {debupstream}-0~1477 +lp:~vila/autopkgtest/git-master revid:git-v1:e75ce0de137b425eaeb1fa18b1b7f10fea9a3b2d diff -Nru autopkgtest-3.20.2/debian/changelog autopkgtest-3.20.6/debian/changelog --- autopkgtest-3.20.2/debian/changelog 2016-04-01 07:11:17.000000000 +0000 +++ autopkgtest-3.20.6/debian/changelog 2016-05-11 10:03:08.000000000 +0000 @@ -1,10 +1,91 @@ -autopkgtest (3.20.2-0~1439~ubuntu15.10.1) wily; urgency=low +autopkgtest (3.20.6-0~1477~ubuntu15.10.1) wily; urgency=low * Auto build. - -- Vincent Ladeuil Fri, 01 Apr 2016 07:11:17 +0000 + -- Vincent Ladeuil Wed, 11 May 2016 10:03:08 +0000 -autopkgtest (3.20.2) UNRELEASED; urgency=medium +autopkgtest (3.20.6) UNRELEASED; urgency=medium + + * Fix OSError when running a shell is requested but /dev/tty does not exist; + just log an error instead. + * Fix parsing of candidate versions from "apt-cache policy" to always use + the precise given package name. By default it falls back to a + substring/regexp search (undocumented). + * adt-build-lxd: Check the LXD configuration for the LXD bridge instead of + the old LXC bridge, for apt proxy auto-detection. (LP: #1577968) + * Generalize the apt proxy detection in adt-build* and setup-testbed to + work for arbitrary proxies, not just apt-cacher-ng. (LP: #1577966) + * Eliminate the need to set $AUTOPKGTEST_BASE to execute runner/adt-run from + a git checkout. This also makes ./run-from-checkout obsolete, call + runner/adt-run directly. + + -- Martin Pitt Wed, 27 Apr 2016 12:44:42 +0200 + +autopkgtest (3.20.5) unstable; urgency=medium + + [ Martin Packman ] + * Fix ssh virt server example and testbed error. + + [ Martin Pitt ] + * If git clone fails with "--git-source" the first time, retry after 15 + seconds. This should defend short temporary network glitches. + (LP: #1571979) + * adt-virt-qemu: Call eofcat helper with PYTHONHASHSEED=0 to avoid long + hangs after booting the VM until the RNG gets initialized. (See #822431 + for details) (Closes: #821778) + * adt-virt-ssh: Fix UnboundLocalError crash when logging in as root. + * Fix running for multiple actions in one command line: (Closes: #822285) + - Close the summary stream after the last test, not after the first. + - Clean up the test tree on the testbed between actions. + * Fix NullRunner.test_timeout_no_output to work with multiple parallel runs. + (Closes: #816398) + + -- Martin Pitt Mon, 25 Apr 2016 00:14:05 +0200 + +autopkgtest (3.20.4) unstable; urgency=medium + + * setup-commands/setup-testbed: Fix kernel header installation for + precise/armhf, which does not yet have linux-headers-generic. + * Use "nproc" to determine the number of processors available, which is both + more correct in a cgroup world, and also simpler. + * Add new --build-parallel=N option to explicitly set the "parallel=N" + $DEB_BUILD_OPTION for building packages, to override the default of + "number of available CPUs". This is mostly useful in containers where you + can restrict the available RAM, but not restrict the number of CPUs. + (LP: #1569750) + * setup-commands/setup-testbed: ubuntu-snappy got renamed to snapd, adjust + package name. + * adt-build-lxd: Set "distribution", "release", and "architecture" + properties of generated images. + * adt-build-lxd: Clean up all old images of the same distro/release/arch, + not just the previous one. Also fix cleanup to work in non-English + locales. + * setup-commands/setup-testbed: Call apt-get purge only once with the list + of all packages, instead of once per package. This is much faster. + * SchrootClickRunner tests: Chown click dir in /opt after creating the user. + * Bump Standards-Version to 3.9.8 (no changes necessary). + * Update Vcs-* URLs. + + -- Martin Pitt Mon, 18 Apr 2016 11:19:45 +0200 + +autopkgtest (3.20.3) unstable; urgency=medium + + * Makefile: Install SKELETON after the programs (which use an [a-z] glob), + as the latter behaves differently in different locales. Thanks Alexis + Bienvenüe! (Closes: #820148) + * adt-buildvm-ubuntu-cloud: Use https for cloud image download. + (LP: #1566846) + * setup-commands/setup-testbed: Purge ubuntu-snappy. + * adt-virt-qemu: On AMD CPUs, default to -cpu host instead of + "kvm64,+svm,+lahf_lm". This introduces more jitter, but is the only -cpu + mode that actually allows nested QEMU with current QEMU versions. + * adt-build-lxd: Force-delete preparation container at the end, even if it + is running. + * adt-build-lxd: Disable apt proxy configuration with ADT_APT_PROXY=="none". + + -- Martin Pitt Mon, 11 Apr 2016 16:27:09 +0200 + +autopkgtest (3.20.2) unstable; urgency=medium * setup-commands/setup-testbed: Purge lxc-common for testbed preparation. * adt-buildvm-ubuntu-cloud: Use the same code for determining the default @@ -15,8 +96,14 @@ fixes building images for Ubuntu 15.04. * lib/VirtSubproc.py, cmd_reboot(): Drop workaround for dhclient hanging on reboot, LP #1556175 got fixed. + * setup-commands/setup-testbed: Ensure that purging packages does not hang + eternally on debconf prompts. + * setup-commands/setup-testbed: Drop purging of xkb-data. + * setup-commands/setup-testbed: Apply "vmalloc=512M" grub change also when + using as a --setup-commands with adt-run, not only with building images. + Fixes tests like udisks2 on i386 when using standard cloud images. - -- Martin Pitt Mon, 21 Mar 2016 21:31:24 +0100 + -- Martin Pitt Tue, 05 Apr 2016 14:53:01 +0200 autopkgtest (3.20.1) unstable; urgency=medium diff -Nru autopkgtest-3.20.2/debian/control autopkgtest-3.20.6/debian/control --- autopkgtest-3.20.2/debian/control 2016-04-01 07:11:17.000000000 +0000 +++ autopkgtest-3.20.6/debian/control 2016-05-11 10:03:08.000000000 +0000 @@ -3,7 +3,7 @@ Uploaders: Ian Jackson , Martin Pitt Section: devel Priority: optional -Standards-Version: 3.9.7 +Standards-Version: 3.9.8 Build-Depends: debhelper (>= 9), python3 (>= 3.1), python3-mock, @@ -12,8 +12,8 @@ pyflakes, procps, pep8 -Vcs-Git: https://anonscm.debian.org/gitweb/?p=autopkgtest/autopkgtest.git -Vcs-Browser: https://anonscm.debian.org/gitweb/?p=autopkgtest/autopkgtest.git +Vcs-Git: https://anonscm.debian.org/git/autopkgtest/autopkgtest.git +Vcs-Browser: https://anonscm.debian.org/git/autopkgtest/autopkgtest.git X-Python3-Version: >= 3.1 Package: autopkgtest diff -Nru autopkgtest-3.20.2/doc/README.running-tests.rst autopkgtest-3.20.6/doc/README.running-tests.rst --- autopkgtest-3.20.2/doc/README.running-tests.rst 2016-04-01 07:11:17.000000000 +0000 +++ autopkgtest-3.20.6/doc/README.running-tests.rst 2016-05-11 10:03:08.000000000 +0000 @@ -265,7 +265,7 @@ ~~~ :: - adt-run ... --- ssh -l joe -h testhost.example.com + adt-run ... --- ssh -l joe -H testhost.example.com This is a generic runner for an externally set up testbed which assumes nothing else than a working ssh connection. This can call a "setup diff -Nru autopkgtest-3.20.2/lib/adt_run_args.py autopkgtest-3.20.6/lib/adt_run_args.py --- autopkgtest-3.20.2/lib/adt_run_args.py 2016-04-01 07:11:17.000000000 +0000 +++ autopkgtest-3.20.6/lib/adt_run_args.py 2016-05-11 10:03:08.000000000 +0000 @@ -325,6 +325,9 @@ '--no-auto-control', dest='auto_control', action='store_false', default=True, help='Disable automatic test generation with autodep8') + g_misc.add_argument('--build-parallel', metavar='N', + help='Set "parallel=N" DEB_BUILD_OPTION for building ' + 'packages (default: number of available processors)') g_misc.add_argument( '-h', '--help', action='help', default=argparse.SUPPRESS, help='show this help message and exit') diff -Nru autopkgtest-3.20.2/lib/adt_testbed.py autopkgtest-3.20.6/lib/adt_testbed.py --- autopkgtest-3.20.2/lib/adt_testbed.py 2016-04-01 07:11:17.000000000 +0000 +++ autopkgtest-3.20.6/lib/adt_testbed.py 2016-05-11 10:03:08.000000000 +0000 @@ -357,7 +357,7 @@ self.bomb('unexpected whitespace-only line from the testbed') if ll[0] != keyword: if self.lastsend is None: - self.bomb("got banner `%s', expected `%s...'" + self.bomb("got banner `%s', expected `%s...'" % (l, keyword)) else: self.bomb("sent `%s', got `%s', expected `%s...'" % @@ -881,7 +881,8 @@ adtlog.info(' - - - - - - - - - - running shell - - - - - - - - - -') self.command('shell', [cwd or '/'] + self.install_tmp_env + extra_env) - def run_test(self, tree, test, extra_env=[], shell_on_failure=False, shell=False): + def run_test(self, tree, test, extra_env=[], shell_on_failure=False, + shell=False, build_parallel=None): '''Run given test in testbed tree (a Path) is the source tree root. @@ -925,6 +926,7 @@ # create script to run test test_artifacts = '%s/%s-artifacts' % (self.scratch, test.name) adttmp = '%s/adttmp' % (self.scratch) + assert self.nproc is not None script = 'set -e; ' \ 'export USER=`id -nu`; ' \ '. /etc/profile >/dev/null 2>&1 || true; ' \ @@ -935,14 +937,15 @@ 'mkdir -p -m 755 "%(tmp)s"; export ADTTMP="%(tmp)s" ' \ 'export DEBIAN_FRONTEND=noninteractive; ' \ 'export LANG=C.UTF-8; ' \ - '''export DEB_BUILD_OPTIONS=parallel=$(grep -c ^processor /proc/cpuinfo | sed 's/^0$/1/'); ''' \ + '''export DEB_BUILD_OPTIONS=parallel=%(cpu)s; ''' \ 'unset LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE '\ ' LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS '\ ' LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION LC_ALL;' \ 'rm -f /tmp/adt_test_script_pid; set -C; echo $$ > /tmp/adt_test_script_pid; set +C; ' \ 'trap "rm -f /tmp/adt_test_script_pid" EXIT INT QUIT PIPE; '\ 'cd "$buildtree"; '\ - % {'t': tree.tb, 'a': test_artifacts, 'tmp': adttmp} + % {'t': tree.tb, 'a': test_artifacts, 'tmp': adttmp, + 'cpu': build_parallel or self.nproc} for e in extra_env: script += 'export \'%s\'; ' % e diff -Nru autopkgtest-3.20.2/lib/VirtSubproc.py autopkgtest-3.20.6/lib/VirtSubproc.py --- autopkgtest-3.20.2/lib/VirtSubproc.py 2016-04-01 07:11:17.000000000 +0000 +++ autopkgtest-3.20.6/lib/VirtSubproc.py 2016-05-11 10:03:08.000000000 +0000 @@ -602,11 +602,14 @@ except KeyError: pass cmd += 'bash -i' - with open('/dev/tty', 'rb') as sin: - with open('/dev/tty', 'wb') as sout: - with open('/dev/tty', 'wb') as serr: - subprocess.call(auxverb + ['sh', '-c', cmd], - stdin=sin, stdout=sout, stderr=serr) + try: + with open('/dev/tty', 'rb') as sin: + with open('/dev/tty', 'wb') as sout: + with open('/dev/tty', 'wb') as serr: + subprocess.call(auxverb + ['sh', '-c', cmd], + stdin=sin, stdout=sout, stderr=serr) + except (OSError, IOError) as e: + adtlog.error('Cannot run shell: %s' % e) def command(): diff -Nru autopkgtest-3.20.2/Makefile autopkgtest-3.20.6/Makefile --- autopkgtest-3.20.2/Makefile 2016-04-01 07:11:17.000000000 +0000 +++ autopkgtest-3.20.6/Makefile 2016-05-11 10:03:08.000000000 +0000 @@ -72,8 +72,8 @@ $(INSTALL_DATA) CREDITS $(docdir) $(INSTALL_DATA) $(rstfiles) $(htmlfiles) $(docdir) $(INSTALL_PROG) setup-commands/*[!~] $(datadir)/setup-commands - $(INSTALL_DATA) ssh-setup/SKELETON $(datadir)/ssh-setup $(INSTALL_PROG) ssh-setup/[a-z]*[!~] $(datadir)/ssh-setup + $(INSTALL_DATA) ssh-setup/SKELETON $(datadir)/ssh-setup clean: rm -f */*.pyc diff -Nru autopkgtest-3.20.2/run-from-checkout autopkgtest-3.20.6/run-from-checkout --- autopkgtest-3.20.2/run-from-checkout 2016-04-01 07:11:17.000000000 +0000 +++ autopkgtest-3.20.6/run-from-checkout 2016-05-11 10:03:08.000000000 +0000 @@ -1,8 +1,3 @@ #!/bin/sh -# Run adt-run from git checkout/source tree -set -e - -# our root directory -export AUTOPKGTEST_BASE=$(dirname $(readlink -f $0)) -export PATH="${AUTOPKGTEST_BASE}/runner:${AUTOPKGTEST_BASE}/virt-subproc:$PATH" -exec adt-run "$@" +# This wrapper is obsolete, call runner/adt-run directly +exec $(dirname $(readlink -f $0))/runner/adt-run "$@" diff -Nru autopkgtest-3.20.2/runner/adt-run autopkgtest-3.20.6/runner/adt-run --- autopkgtest-3.20.2/runner/adt-run 2016-04-01 07:11:17.000000000 +0000 +++ autopkgtest-3.20.6/runner/adt-run 2016-05-11 10:03:08.000000000 +0000 @@ -36,11 +36,14 @@ from debian import deb822 -try: - our_base = os.environ['AUTOPKGTEST_BASE'] + '/lib' -except KeyError: - our_base = '/usr/share/autopkgtest/python' -sys.path.insert(1, our_base) +# support running out of git and from packaged install +our_base = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +if os.path.isdir(os.path.join(our_base, 'virt-subproc')): + sys.path.insert(0, os.path.join(our_base, 'lib')) + os.environ['PATH'] = os.path.join(our_base, 'virt-subproc') + ':' + os.environ.get('PATH', '') +else: + sys.path.insert(0, '/usr/share/autopkgtest/python') + import adtlog import testdesc import adt_run_args @@ -148,7 +151,8 @@ binaries.publish() testbed.install_deps(t.depends, 'needs-recommends' in t.restrictions) - testbed.run_test(tree, t, opts.env, opts.shell_fail, opts.shell) + testbed.run_test(tree, t, opts.env, opts.shell_fail, opts.shell, + opts.build_parallel) if not t.result: errorcode |= 4 if 'breaks-testbed' in t.restrictions: @@ -355,7 +359,7 @@ # apt-get source is terribly noisy; only show what gets downloaded create_command = ('''pkgs=$(apt-cache showsrc %(src)s | awk "/^Package-List:/ { inlist=1; next } (/^ / && inlist == 1) { thissrc[\$1] = 1; next } { if (!inlist) next; inlist=0; if (intersect) {for (p in pkgs) { if (!(p in thissrc)) delete pkgs[p] }} else { for (p in thissrc) { pkgs[p] = 1}; intersect=1 }; delete thissrc } END {for (p in pkgs) print p}");''' ' for pkg in $pkgs; do' - ' pkg_candidate=$(apt-cache policy $pkg|sed -n "/Candidate:/ { s/^.* //; /none/d; p}");' + ' pkg_candidate=$(apt-cache policy "^$pkg\$"|sed -n "/Candidate:/ { s/^.* //; /none/d; p}") || continue;' ' [ -n "$pkg_candidate" ] || continue; ' ' show=$(apt-cache show $pkg=$pkg_candidate | grep "^Source:" || true);' ' [ "$pkg" = "%(src)s" ] || echo "$show" | grep -q "^Source: %(src)s\\b" || continue; ' @@ -369,9 +373,10 @@ elif kind == 'git-source': fields = arg.split() if len(fields) == 1: - create_command = "git clone '%s'" % arg + create_command = "git clone '%s' || { sleep 15; git clone '%s'; }" % (arg, arg) elif len(fields) == 2: - create_command = "git clone --branch '%s' '%s'" % (fields[1], fields[0]) + create_command = "git clone --branch '%(b)s' '%(u)s' || { sleep 15; git clone --branch '%(b)s' '%(u)s'; }" \ + % {'b': fields[1], 'u': fields[0]} else: adtlog.bomb('--git-source argument must be "URL" or "URL branchname"') @@ -448,7 +453,9 @@ # determine build command and build-essential packages build_essential = ['build-essential'] - dpkg_buildpackage = '''DEB_BUILD_OPTIONS="parallel=$(grep -c ^processor /proc/cpuinfo | sed 's/^0$/1/') $DEB_BUILD_OPTIONS" dpkg-buildpackage -us -uc -b''' + assert testbed.nproc + dpkg_buildpackage = 'DEB_BUILD_OPTIONS="parallel=%s $DEB_BUILD_OPTIONS" dpkg-buildpackage -us -uc -b' % ( + opts.build_parallel or testbed.nproc) if opts.gainroot: dpkg_buildpackage += ' -r' + opts.gainroot else: @@ -504,6 +511,7 @@ control_override = None testname = None pending_click_source = None + tests_tree = None for (kind, arg, built_binaries) in actions: # non-tests/build actions @@ -532,6 +540,11 @@ 'git-source', 'click') adtlog.info('@@@@@@@@@@@@@@@@@@@@ %s %s' % (kind, arg)) + # remove tests tree from previous action + if tests_tree and tests_tree.tb: + adtlog.debug('cleaning up previous tests tree %s on testbed' % tests_tree.tb) + testbed.execute(['rm', '-rf', tests_tree.tb]) + if kind == 'click': if control_override: # locally specified manifest @@ -597,8 +610,9 @@ adtlog.summary_stream.seek(0) adtlog.info('@@@@@@@@@@@@@@@@@@@@ summary') sys.stderr.buffer.write(adtlog.summary_stream.read()) - adtlog.summary_stream.close() - adtlog.summary_stream = None + + adtlog.summary_stream.close() + adtlog.summary_stream = None def main(): diff -Nru autopkgtest-3.20.2/runner/adt-run.1 autopkgtest-3.20.6/runner/adt-run.1 --- autopkgtest-3.20.2/runner/adt-run.1 2016-04-01 07:11:17.000000000 +0000 +++ autopkgtest-3.20.6/runner/adt-run.1 2016-05-11 10:03:08.000000000 +0000 @@ -359,7 +359,6 @@ When running commands on the testbed, sets the \fBLANG\fR environment variable to \fIlangval\fR. The default in \fBadt-run\fR is to set it to \fBC.UTF-8\fR. -.TP .SH OTHER OPTIONS @@ -369,6 +368,15 @@ that case, packages without tests will exit with code 8 ("No tests in this package") just like without autodep8. + +.TP +.BI --build-parallel N +Set +.I parallel=N +DEB_BUILD_OPTION for building packages. By default this is the number of +available processors. This is mostly useful in containers where you can +restrict the available RAM, but not restrict the number of CPUs. + .TP .BR \-h | \-\-help Show command line help and exit. diff -Nru autopkgtest-3.20.2/setup-commands/setup-testbed autopkgtest-3.20.6/setup-commands/setup-testbed --- autopkgtest-3.20.2/setup-commands/setup-testbed 2016-04-01 07:11:17.000000000 +0000 +++ autopkgtest-3.20.6/setup-commands/setup-testbed 2016-05-11 10:03:08.000000000 +0000 @@ -14,8 +14,8 @@ # See adt-virt-qemu(1) for details how to use this with vmdeboostrap. # # You can set $ADT_APT_PROXY; if set, it will be configured in apt in -# /etc/apt/apt.conf.d/01proxy. If apt-cacher-ng is running on localhost, this -# will be used automatically, unless $ADT_APT_PROXY is set. +# /etc/apt/apt.conf.d/01proxy. If you have an apt proxy configured on the host, +# it will be used automatically, unless $ADT_APT_PROXY is set. set -eu @@ -59,26 +59,28 @@ "$root/etc/init/tty2.conf" > "$root/etc/init/ttyS0.conf" fi +ARCH="$(chroot "$root" dpkg --print-architecture)" + # serial console for systemd # bump vmalloc on i386, necessary for tests like udisks2 -if [ -z "${ADT_IS_SETUP_COMMAND:-}" ] && [ ! -e "$root/etc/default/grub.d/90-autopkgtest.cfg" ] && chroot "$root" which update-grub >/dev/null 2>&1; then +if [ ! -e "$root/etc/default/grub.d/90-autopkgtest.cfg" ] && chroot "$root" which update-grub >/dev/null 2>&1; then changed= if [ -d "$root/etc/default/grub.d" ]; then - if [ "$(chroot "$root" dpkg --print-architecture)" = "i386" ]; then + if [ "$ARCH" = "i386" ]; then echo 'GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0 vmalloc=512M"' > \ "$root/etc/default/grub.d/90-autopkgtest.cfg" changed=1 - elif [ "$(chroot "$root" dpkg --print-architecture)" = "amd64" ]; then + elif [ "$ARCH" = "amd64" ]; then echo 'GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0"' > \ "$root/etc/default/grub.d/90-autopkgtest.cfg" changed=1 fi else # fallback for Ubuntu 12.04 - if [ "$(chroot "$root" dpkg --print-architecture)" = "i386" ]; then + if [ "$ARCH" = "i386" ]; then sed -i '/CMDLINE_LINUX_DEFAULT/ s/"$/ console=ttyS0 vmalloc=512M"/' "$root/etc/default/grub" changed=1 - elif [ "$(chroot "$root" dpkg --print-architecture)" = "amd64" ]; then + elif [ "$ARCH" = "amd64" ]; then sed -i '/CMDLINE_LINUX_DEFAULT/ s/"$/ console=ttyS0"/' "$root/etc/default/grub" changed=1 fi @@ -150,13 +152,15 @@ echo "Acquire::Languages \"none\";" > "$root"/etc/apt/apt.conf.d/90nolanguages echo 'force-unsafe-io' > "$root"/etc/dpkg/dpkg.cfg.d/autopkgtest -# auto-detect apt-cacher-ng on the host (in chroot mode) +# detect apt proxy on the host (in chroot mode) if [ "$root" != "/" ] && [ -z "${ADT_APT_PROXY:-}" ]; then RES=`apt-config shell proxy Acquire::http::Proxy` if [ -n "$RES" ]; then eval $RES - if echo "$proxy" | egrep -q '(localhost|127\.0\.0\.[0-9]*):3142'; then - ADT_APT_PROXY="http://10.0.2.2:3142" + if echo "$proxy" | egrep -q '(localhost|127\.0\.0\.[0-9]*)'; then + ADT_APT_PROXY=$(echo "$proxy" | sed -r "s#localhost|127\.0\.0\.[0-9]*#10.0.2.2#") + elif [ -n "${proxy:-}" ]; then + ADT_APT_PROXY="$proxy" fi fi fi @@ -178,18 +182,22 @@ [ ! -d "$root/usr/share/doc/cloud-init" ] || have_cloudinit=1 # clean up bloat from Ubuntu cloud images when building an image + purge_list='' for p in accountsservice apt-xapian-index cryptsetup landscape-client \ landscape-common open-vm-tools w3m vim-runtime aptitude-common \ command-not-found-data manpages ntfs-3g sosreport \ ubuntu-release-upgrader-core libcpan-changes-perl git \ cgmanager lxc-common lxc lxd lxd-client open-iscsi mdadm dmeventd lvm2 \ unattended-upgrades update-notifier-common ureadahead debootstrap \ - lxcfs ppp pppconfig pppoeconf \ - thermald xdg-user-dirs xkb-data zerofree xml-core; do + lxcfs ppp pppconfig pppoeconf snapd \ + thermald xdg-user-dirs zerofree xml-core; do if [ -d "$root/usr/share/doc/$p" ]; then - chroot "$root" eatmydata apt-get --auto-remove -y purge $p || true + purge_list="$purge_list $p" fi done + if [ -n "$purge_list" ]; then + chroot "$root" env DEBIAN_FRONTEND=noninteractive eatmydata apt-get --auto-remove -y purge $purge_list || true + fi if [ "${ADT_SETUP_VM_UPGRADE:-}" != "false" ]; then DEBIAN_FRONTEND=noninteractive chroot "$root" eatmydata apt-get -o Dpkg::Options::="--force-confold" -y dist-upgrade @@ -211,7 +219,12 @@ # provides kmods like scsi_debug or mac80211_hwsim on Ubuntu chroot "$root" eatmydata apt-get install -y linux-generic else - chroot "$root" eatmydata apt-get install -y linux-headers-generic + if [ "$RELEASE" = precise -a "$ARCH" = armhf ]; then + # no linux-image-generic in precise/armhf yet + chroot "$root" eatmydata apt-get install -y linux-headers-omap + else + chroot "$root" eatmydata apt-get install -y linux-headers-generic + fi fi fi diff -Nru autopkgtest-3.20.2/tests/adt-run autopkgtest-3.20.6/tests/adt-run --- autopkgtest-3.20.2/tests/adt-run 2016-04-01 07:11:17.000000000 +0000 +++ autopkgtest-3.20.6/tests/adt-run 2016-05-11 10:03:08.000000000 +0000 @@ -64,7 +64,7 @@ def __init__(self, virt_args, *args, **kwargs): super(AdtTestCase, self).__init__(*args, **kwargs) - self.adt_run_path = os.path.join(root_dir, 'run-from-checkout') + self.adt_run_path = os.path.join(root_dir, 'runner', 'adt-run') self.virt_args = virt_args self.orig_home = os.path.expanduser('~') @@ -99,7 +99,7 @@ os.environ['HOME'] = temp_home - def build_src(self, test_control, test_scripts): + def build_src(self, test_control, test_scripts, pkgname='testpkg'): '''Create source package tree with given tests. @test_control: contents of debian/tests/control @@ -107,7 +107,7 @@ Return path to the source tree. ''' - srcdir = os.path.join(self.workdir, 'testpkg') + srcdir = os.path.join(self.workdir, pkgname) shutil.copytree(os.path.join(test_dir, 'testpkg'), srcdir, symlinks=True) if test_control: dtdir = os.path.join(srcdir, 'debian', 'tests') @@ -648,8 +648,11 @@ def test_timeout_no_output(self): '''handling test timeout for test without any output''' + # use pid-specific name here to avoid clashes during multiple parallel runs + procname = 'adtsleep%i' % os.getpid() + p = self.build_dsc('Tests: totest\nDepends:\n', - {'totest': '#!/bin/bash\nexec -a adtsleep sleep 15\n'}) + {'totest': '#!/bin/bash\nexec -a %s sleep 15\n' % procname}) time_start = time.time() (code, out, err) = self.adt_run(['--no-built-binaries', '--timeout-test=3', p]) @@ -662,7 +665,7 @@ self.assertLess(duration, 10, err) # should not leave test process running - self.assertEqual(subprocess.getoutput('pidof adtsleep'), '') + self.assertEqual(subprocess.getoutput('pidof ' + procname), '') def test_timeout_long_test(self): '''long-running test with custom timeouts @@ -1218,6 +1221,46 @@ self.assertEqual(code, 0, err) self.assertRegex(out, '/var/tmp/adt.*') + def test_build_parallel(self): + '''--build-parallel option''' + + p = self.build_src('Tests: pass\nDepends:\nRestrictions: build-needed\n', + {'pass': '#!/bin/sh -e\necho DBO=$DEB_BUILD_OPTIONS\n'}) + + (code, out, err) = self.adt_run(['--build-parallel=17', '--no-built-binaries', '--unbuilt-tree=' + p]) + # test should succeed + self.assertEqual(code, 0, out + err) + self.assertRegex(out, 'pass\s+PASS', out) + + # should build package + self.assertIn('dh build', err) + + # should have expected parallel= option + self.assertIn('DBO=parallel=17\n', out) + # should not have any test stderr + self.assertNotIn(' stderr ', err) + + def test_multiple_actions(self): + '''multiple actions''' + + p = self.build_src('Tests: p\nDepends:\n', + {'p': '#!/bin/sh\necho I am fine\n'}) + q = self.build_src('Tests: q\nDepends:\n', + {'q': '#!/bin/sh\necho I am good\n'}, + pkgname='testpkg2') + + (code, out, err) = self.adt_run(['-d', p + '/', q + '/']) + # tests should succeed + self.assertEqual(code, 0, err) + self.assertRegex(out, 'p\s+PASS', out) + self.assertRegex(out, 'q\s+PASS', out) + + self.assertRegex(out, '(^|\n)I am fine\n') + self.assertRegex(out, '(^|\n)I am good\n') + self.assertRegex(err, 'testbed running kernel: Linux \d') + # should not have any test stderr + self.assertNotIn(' stderr ', err) + @unittest.skipIf(os.getuid() > 0, 'NullRunnerRoot tests need to run as root') @@ -1449,7 +1492,7 @@ # run this under C locale to test that UTF-8 debian/control is still # handled correctly (code, out, err) = self.adt_run(['-d', '-B', '--unbuilt-tree=' + p], - env={'LC_ALL': 'C'}) + env={'LC_ALL': 'C', 'PATH': os.environ['PATH']}) self.assertEqual(code, 0, err) self.assertRegex(out, 'pass\s+PASS') @@ -2449,7 +2492,7 @@ '''adt-virt-qemu options and /dev/baseimage''' p = self.build_src('Tests: t\nDepends:', - {'t': '''echo CPUNUM; grep ^processor /proc/cpuinfo |wc -l + {'t': '''echo CPUNUM; nproc mkdir -p $ADTTMP/one/subdir echo deep > $ADTTMP/one/subdir/subdir.txt cat $ADTTMP/one/subdir/subdir.txt @@ -2995,6 +3038,7 @@ ['schroot', os.environ.get('ADT_TEST_SCHROOT_CLICK')], *args, **kwargs) self.click = os.path.join(test_dir, 'testclick_0.1_all.click') self.click_src = os.path.join(test_dir, 'testclick') + self.setup_cmd = 'adduser --no-create-home --system clickpkg; chown -R clickpkg:root /opt/click.ubuntu.com' def test_click_local_source_implicit(self): '''click package with local source, implicit arg type''' @@ -3005,7 +3049,7 @@ (code, out, err) = self.adt_run( ['-d', '-o', outdir, '--summary-file', sumfile, - '--setup-commands', 'adduser --system clickpkg', + '--setup-commands', self.setup_cmd, self.click_src, self.click]) self.assertEqual(code, 4, err) @@ -3037,7 +3081,7 @@ (code, out, err) = self.adt_run( ['-d', '--summary-file', sumfile, - '--setup-commands', 'adduser --system clickpkg', + '--setup-commands', self.setup_cmd, '--click-source', self.click_src, '--click', self.click]) self.assertEqual(code, 4, err) @@ -3058,7 +3102,7 @@ (code, out, err) = self.adt_run( ['-d', '--summary-file', sumfile, - '--setup-commands', 'adduser --system clickpkg', + '--setup-commands', self.setup_cmd, '--setup-commands', os.path.join(root_dir, 'setup-commands', 'ro-apt'), self.click_src, self.click]) self.assertEqual(code, 4, err) @@ -3086,7 +3130,7 @@ (code, out, err) = self.adt_run( ['-d', '--summary-file', sumfile, '--copy', '%s:/root/testclick.click' % self.click, - '--setup-commands', 'adduser --system clickpkg', + '--setup-commands', self.setup_cmd, '--setup-commands', 'click install --all-users /root/testclick.click', '--setup-commands', os.path.join(root_dir, 'setup-commands', 'ro-apt'), self.click_src, '--click', 'testclick']) @@ -3110,7 +3154,7 @@ (code, out, err) = self.adt_run( ['-d', '--summary-file', sumfile, '--copy', '%s:/root/testclick.click' % self.click, - '--setup-commands', 'adduser --system clickpkg', + '--setup-commands', self.setup_cmd, '--setup-commands', 'click install --user $ADT_NORMAL_USER /root/testclick.click', '--setup-commands', os.path.join(root_dir, 'setup-commands', 'ro-apt'), self.click_src, '--click', 'testclick']) @@ -3139,7 +3183,7 @@ (code, out, err) = self.adt_run( ['--summary-file', sumfile, - '--setup-commands', 'adduser --system clickpkg', + '--setup-commands', self.setup_cmd, '--override-control', custom_manifest, '--click-source', self.click_src, '--click', self.click]) self.assertEqual(code, 0, err) diff -Nru autopkgtest-3.20.2/tests/run_args autopkgtest-3.20.6/tests/run_args --- autopkgtest-3.20.2/tests/run_args 2016-04-01 07:11:17.000000000 +0000 +++ autopkgtest-3.20.6/tests/run_args 2016-05-11 10:03:08.000000000 +0000 @@ -302,6 +302,15 @@ self.assertEqual(acts, [('built-tree', './', False)]) self.assertEqual(virt, ['adt-virt-foo']) + def test_build_parallel(self): + (args, acts, virt) = self.parse( + ['--build-parallel=17', './', '---', 'adt-virt-foo']) + self.assertEqual(args.build_parallel, '17') + + (args, acts, virt) = self.parse( + ['./', '---', 'adt-virt-foo']) + self.assertEqual(args.build_parallel, None) + # # Errors # diff -Nru autopkgtest-3.20.2/tools/adt-build-lxc autopkgtest-3.20.6/tools/adt-build-lxc --- autopkgtest-3.20.2/tools/adt-build-lxc 2016-04-01 07:11:17.000000000 +0000 +++ autopkgtest-3.20.6/tools/adt-build-lxc 2016-05-11 10:03:08.000000000 +0000 @@ -54,12 +54,12 @@ LXC_CREATE_PREFIX="eatmydata" fi -# auto-detect apt-cacher-ng +# detect apt proxy proxy_detect() { if [ -z "$ADT_APT_PROXY" ]; then RES=`apt-config shell proxy Acquire::http::Proxy` eval $RES - if echo "$proxy" | egrep -q '(localhost|127\.0\.0\.[0-9]*):3142'; then + if echo "${proxy:-}" | egrep -q '(localhost|127\.0\.0\.[0-9]*)'; then # set http_proxy for the initial debootstrap export http_proxy="$proxy" @@ -69,13 +69,17 @@ if [ -n "$bridge_interface" ]; then local bridge_ip=$(ip -4 a show dev "$bridge_interface" | awk '/ inet / {sub(/\/.*$/, "", $2); print $2}') || true if [ -n "$bridge_ip" ]; then - ADT_APT_PROXY="http://$bridge_ip:3142" + ADT_APT_PROXY=$(echo "$proxy" | sed -r "s#localhost|127\.0\.0\.[0-9]*#$bridge_ip#") fi fi - echo "Detected apt-cacher-ng. Using local proxy $http_proxy" if [ -n "$ADT_APT_PROXY" ]; then - echo "Using $ADT_APT_PROXY as container proxy" + echo "Detected local apt proxy, using $ADT_APT_PROXY as container proxy" fi + elif [ -n "${proxy:-}" ]; then + ADT_APT_PROXY="$proxy" + echo "Using $ADT_APT_PROXY as container proxy" + # set http_proxy for the initial debootstrap + export http_proxy="$proxy" fi fi } diff -Nru autopkgtest-3.20.2/tools/adt-build-lxc.1 autopkgtest-3.20.6/tools/adt-build-lxc.1 --- autopkgtest-3.20.2/tools/adt-build-lxc.1 2016-04-01 07:11:17.000000000 +0000 +++ autopkgtest-3.20.6/tools/adt-build-lxc.1 2016-05-11 10:03:08.000000000 +0000 @@ -46,11 +46,8 @@ You can specify an apt proxy to use in the container in the .B $ADT_APT_PROXY -environment variable. If apt-cacher-ng is running on the local host, the -container will automatically use this (i. e. use the IP from the -.B lxcbr0 -interface) -otherwise there is no default. +environment variable. If you have an apt proxy configured on the host, +the container will automatically use this, otherwise there is no default. .SH EXAMPLES diff -Nru autopkgtest-3.20.2/tools/adt-build-lxd autopkgtest-3.20.6/tools/adt-build-lxd --- autopkgtest-3.20.2/tools/adt-build-lxd 2016-04-01 07:11:17.000000000 +0000 +++ autopkgtest-3.20.6/tools/adt-build-lxd 2016-05-11 10:03:08.000000000 +0000 @@ -33,31 +33,31 @@ done } -# auto-detect apt-cacher-ng +# detect apt proxy proxy_detect() { if [ -z "${ADT_APT_PROXY:-}" ]; then RES=`apt-config shell proxy Acquire::http::Proxy` eval $RES - if echo "${proxy:-}" | egrep -q '(localhost|127\.0\.0\.[0-9]*):3142'; then + if echo "${proxy:-}" | egrep -q '(localhost|127\.0\.0\.[0-9]*)'; then # translate proxy address to one that can be accessed from the # running container - local bridge_interface=$(awk '{ if ($1 == "lxc.network.link") print($3)}' /etc/lxc/default.conf) - if [ -n "$bridge_interface" ]; then - local bridge_ip=$(ip -4 a show dev "$bridge_interface" | awk '/ inet / {sub(/\/.*$/, "", $2); print $2}') || true - if [ -n "$bridge_ip" ]; then - ADT_APT_PROXY="http://$bridge_ip:3142" - fi + local bridge_ip=$(sh -c '. /etc/default/lxd-bridge; echo $LXD_IPV4_ADDR' 2>/dev/null) + if [ -n "$bridge_ip" ]; then + ADT_APT_PROXY=$(echo "$proxy" | sed -r "s#localhost|127\.0\.0\.[0-9]*#$bridge_ip#") fi if [ -n "${ADT_APT_PROXY:-}" ]; then - echo "Detected local apt-cacher-ng, using $ADT_APT_PROXY as container proxy" + echo "Detected local apt proxy, using $ADT_APT_PROXY as container proxy" fi + elif [ -n "${proxy:-}" ]; then + echo "Using $ADT_APT_PROXY as container proxy" + ADT_APT_PROXY="$proxy" fi fi } setup() { # set up apt proxy for the container - if [ -n "${ADT_APT_PROXY:-}" ]; then + if [ -n "${ADT_APT_PROXY:-}" ] && [ "$ADT_APT_PROXY" != "none" ]; then echo "Acquire::http::Proxy \"$ADT_APT_PROXY\";" | lxc file push - "$CONTAINER/etc/apt/apt.conf.d/01proxy" # work around LP#1548878 lxc exec "$CONTAINER" -- chmod 644 /etc/apt/apt.conf.d/01proxy @@ -103,7 +103,7 @@ fi IMAGE="$1" CONTAINER='' -trap '[ -z "$CONTAINER" ] || lxc delete "$CONTAINER"' EXIT INT QUIT PIPE +trap '[ -z "$CONTAINER" ] || lxc delete -f "$CONTAINER"' EXIT INT QUIT PIPE proxy_detect generate_container_name @@ -112,15 +112,14 @@ # if there already is a published image, get its fingerprint to clean it up # afterwards -ALIAS="adt/$(echo "$DISTRO" | tr '[:upper:]' '[:lower:]')/$RELEASE/$ARCH" -OLD_IMAGE='' -if O=$(lxc image info "$ALIAS" 2>/dev/null); then - OLD_IMAGE=$(echo "$O" | awk 'tolower($1) ~ /fingerprint:/ { print $2}') -fi - -lxc publish "$CONTAINER" --alias "$ALIAS" --public description="autopkgtest $DISTRO $RELEASE $ARCH" - -if [ -n "$OLD_IMAGE" ]; then - echo "Removing previous image $OLD_IMAGE" - lxc image delete "$OLD_IMAGE" -fi +DISTROLC=$(echo "$DISTRO" | tr '[:upper:]' '[:lower:]') +ALIAS="adt/$DISTROLC/$RELEASE/$ARCH" +DESCRIPTION="autopkgtest $DISTRO $RELEASE $ARCH" + +lxc publish "$CONTAINER" --alias "$ALIAS" --public description="$DESCRIPTION" distribution="$DISTROLC" release="$RELEASE" architecture="$ARCH" + +# clean up old images +for i in $(lxc image list | grep "$DESCRIPTION" | grep -v "$ALIAS" | cut -d'|' -f3); do + echo "Removing previous image $i" + lxc image delete "$i" +done diff -Nru autopkgtest-3.20.2/tools/adt-build-lxd.1 autopkgtest-3.20.6/tools/adt-build-lxd.1 --- autopkgtest-3.20.2/tools/adt-build-lxd.1 2016-04-01 07:11:17.000000000 +0000 +++ autopkgtest-3.20.6/tools/adt-build-lxd.1 2016-05-11 10:03:08.000000000 +0000 @@ -19,12 +19,8 @@ You can specify an apt proxy to use in the container in the .B $ADT_APT_PROXY -environment variable. If apt-cacher-ng is running on the local host, the -container will automatically use this (i. e. use the IP from the -.B lxcbr0 -interface, or whichever interface is configured in /etc/lxc/default.conf) -otherwise there is no default. - +environment variable. If you have an apt proxy configured on the host, the +container will automatically use this, otherwise there is no default. .SH EXAMPLE diff -Nru autopkgtest-3.20.2/tools/adt-buildvm-ubuntu-cloud autopkgtest-3.20.6/tools/adt-buildvm-ubuntu-cloud --- autopkgtest-3.20.2/tools/adt-buildvm-ubuntu-cloud 2016-04-01 07:11:17.000000000 +0000 +++ autopkgtest-3.20.6/tools/adt-buildvm-ubuntu-cloud 2016-05-11 10:03:08.000000000 +0000 @@ -6,7 +6,7 @@ # autopkgtest is Copyright (C) 2006-2014 Canonical Ltd. # # Build a suitable autopkgtest VM from the Ubuntu cloud images: -# http://cloud-images.ubuntu.com/ +# https://cloud-images.ubuntu.com/ # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -34,14 +34,11 @@ import urllib.request import os import time -import socket import re -try: - our_base = os.environ['AUTOPKGTEST_BASE'] + '/lib' -except KeyError: - our_base = '/usr/share/autopkgtest/python' -sys.path.insert(1, our_base) +sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname( + os.path.abspath(__file__))), 'lib')) +sys.path.insert(0, '/usr/share/autopkgtest/python') import VirtSubproc @@ -72,12 +69,17 @@ def parse_args(): '''Parse CLI args''' - # auto-detect apt-cacher-ng + # use host's apt proxy + default_proxy = '' try: - socket.create_connection(('localhost', 3142), 0.5) - default_proxy = 'http://10.0.2.2:3142' - except socket.error: - default_proxy = '' + p = subprocess.check_output( + 'eval `apt-config shell p Acquire::http::Proxy`; echo $p', + shell=True, universal_newlines=True).strip() + if p: + # translate proxy on localhost to QEMU IP + default_proxy = re.sub('localhost|127\.0\.0\.[0-9]*', '10.0.2.2', p) + except subprocess.CalledProcessError: + pass parser = argparse.ArgumentParser(fromfile_prefix_chars='@') @@ -101,8 +103,7 @@ default='http://archive.ubuntu.com/ubuntu', help='Use this mirror for apt (default: %(default)s)') parser.add_argument('-p', '--proxy', metavar='URL', default=default_proxy, - help='Use a proxy for apt; a local apt-cacher-ng ' - 'gets used automatically (default: %s)' % ( + help='Use a proxy for apt (default: %s)' % ( default_proxy or 'none')) parser.add_argument('-s', '--disk-size', default='20G', help='grow image by this size (default: %(default)s)') @@ -115,7 +116,7 @@ parser.add_argument('-v', '--verbose', action='store_true', default=False, help='Show VM guest and cloud-init output') parser.add_argument('--cloud-image-url', metavar='URL', - default='http://cloud-images.ubuntu.com', + default='https://cloud-images.ubuntu.com', help='cloud images URL (default: %(default)s)') parser.add_argument('--no-apt-upgrade', action='store_true', help='Do not run apt-get dist-upgrade') diff -Nru autopkgtest-3.20.2/tools/adt-buildvm-ubuntu-cloud.1 autopkgtest-3.20.6/tools/adt-buildvm-ubuntu-cloud.1 --- autopkgtest-3.20.2/tools/adt-buildvm-ubuntu-cloud.1 2016-04-01 07:11:17.000000000 +0000 +++ autopkgtest-3.20.6/tools/adt-buildvm-ubuntu-cloud.1 2016-05-11 10:03:08.000000000 +0000 @@ -51,10 +51,8 @@ .TP .BI -p " URL" " | --proxy=" URL -Proxy for apt. If apt-cacher-ng is running on the local host, the VM will -automatically use this (i. e. use -.BR http://10.0.2.2:3142 ) -otherwise there is no default. +Proxy for apt. If you have an apt proxy configured on the local host, the VM +will automatically use this; otherwise there is no default. .TP diff -Nru autopkgtest-3.20.2/virt-subproc/adt-virt-chroot autopkgtest-3.20.6/virt-subproc/adt-virt-chroot --- autopkgtest-3.20.2/virt-subproc/adt-virt-chroot 2016-04-01 07:11:17.000000000 +0000 +++ autopkgtest-3.20.6/virt-subproc/adt-virt-chroot 2016-05-11 10:03:08.000000000 +0000 @@ -24,15 +24,13 @@ import sys import os +import argparse -try: - our_base = os.environ['AUTOPKGTEST_BASE'] + '/lib' -except KeyError: - our_base = '/usr/share/autopkgtest/python' -sys.path.insert(1, our_base) +sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname( + os.path.abspath(__file__))), 'lib')) +sys.path.insert(0, '/usr/share/autopkgtest/python') import VirtSubproc -from adt_run_args import ArgumentParser import adtlog @@ -43,7 +41,7 @@ def parse_args(): global chroot_dir - parser = ArgumentParser() + parser = argparse.ArgumentParser() parser.add_argument('-r', '--gain-root', metavar='COMMAND', help='can become root by prefixing commands with COMMAND') parser.add_argument('-d', '--debug', action='store_true', diff -Nru autopkgtest-3.20.2/virt-subproc/adt-virt-lxc autopkgtest-3.20.6/virt-subproc/adt-virt-lxc --- autopkgtest-3.20.2/virt-subproc/adt-virt-lxc 2016-04-01 07:11:17.000000000 +0000 +++ autopkgtest-3.20.6/virt-subproc/adt-virt-lxc 2016-05-11 10:03:08.000000000 +0000 @@ -35,14 +35,11 @@ import shutil import argparse -try: - our_base = os.environ['AUTOPKGTEST_BASE'] + '/lib' -except KeyError: - our_base = '/usr/share/autopkgtest/python' -sys.path.insert(1, our_base) +sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname( + os.path.abspath(__file__))), 'lib')) +sys.path.insert(0, '/usr/share/autopkgtest/python') import VirtSubproc -from adt_run_args import ArgumentParser import adtlog @@ -58,7 +55,7 @@ def parse_args(): global args - parser = ArgumentParser() + parser = argparse.ArgumentParser() parser.add_argument('-d', '--debug', action='store_true', help='Enable debugging output') parser.add_argument('-e', '--ephemeral', action='store_true', diff -Nru autopkgtest-3.20.2/virt-subproc/adt-virt-lxd autopkgtest-3.20.6/virt-subproc/adt-virt-lxd --- autopkgtest-3.20.2/virt-subproc/adt-virt-lxd 2016-04-01 07:11:17.000000000 +0000 +++ autopkgtest-3.20.6/virt-subproc/adt-virt-lxd 2016-05-11 10:03:08.000000000 +0000 @@ -32,14 +32,11 @@ import time import argparse -try: - our_base = os.environ['AUTOPKGTEST_BASE'] + '/lib' -except KeyError: - our_base = '/usr/share/autopkgtest/python' -sys.path.insert(1, our_base) +sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname( + os.path.abspath(__file__))), 'lib')) +sys.path.insert(0, '/usr/share/autopkgtest/python') import VirtSubproc -from adt_run_args import ArgumentParser import adtlog @@ -54,7 +51,7 @@ def parse_args(): global args - parser = ArgumentParser() + parser = argparse.ArgumentParser() parser.add_argument('-d', '--debug', action='store_true', help='Enable debugging output') parser.add_argument('-r', '--remote', default='', diff -Nru autopkgtest-3.20.2/virt-subproc/adt-virt-null autopkgtest-3.20.6/virt-subproc/adt-virt-null --- autopkgtest-3.20.2/virt-subproc/adt-virt-null 2016-04-01 07:11:17.000000000 +0000 +++ autopkgtest-3.20.6/virt-subproc/adt-virt-null 2016-05-11 10:03:08.000000000 +0000 @@ -24,15 +24,13 @@ import sys import os +import argparse -try: - our_base = os.environ['AUTOPKGTEST_BASE'] + '/lib' -except KeyError: - our_base = '/usr/share/autopkgtest/python' -sys.path.insert(1, our_base) +sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname( + os.path.abspath(__file__))), 'lib')) +sys.path.insert(0, '/usr/share/autopkgtest/python') import VirtSubproc -from adt_run_args import ArgumentParser import adtlog @@ -42,7 +40,7 @@ def parse_args(): - parser = ArgumentParser() + parser = argparse.ArgumentParser() parser.add_argument('-d', '--debug', action='store_true', help='Enable debugging output') args = parser.parse_args() diff -Nru autopkgtest-3.20.2/virt-subproc/adt-virt-qemu autopkgtest-3.20.6/virt-subproc/adt-virt-qemu --- autopkgtest-3.20.2/virt-subproc/adt-virt-qemu 2016-04-01 07:11:17.000000000 +0000 +++ autopkgtest-3.20.6/virt-subproc/adt-virt-qemu 2016-05-11 10:03:08.000000000 +0000 @@ -35,15 +35,13 @@ import errno import fcntl import re +import argparse -try: - our_base = os.environ['AUTOPKGTEST_BASE'] + '/lib' -except KeyError: - our_base = '/usr/share/autopkgtest/python' -sys.path.insert(1, our_base) +sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname( + os.path.abspath(__file__))), 'lib')) +sys.path.insert(0, '/usr/share/autopkgtest/python') import VirtSubproc -from adt_run_args import ArgumentParser import adtlog @@ -68,7 +66,7 @@ else: qemu_cmd_default = 'qemu-system-' + arch - parser = ArgumentParser() + parser = argparse.ArgumentParser() parser.add_argument('-q', '--qemu-command', default=qemu_cmd_default, help='QEMU command (default: %s)' % qemu_cmd_default) @@ -372,7 +370,7 @@ # "real" stdin behaviour. s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) s.connect('%(tty)s') -cmd = '/bin/eofcat %%(d)s/stdin_eof %%(d)s/exit.tmp < %%(d)s/stdin | ' \\ +cmd = 'PYTHONHASHSEED=0 /bin/eofcat %%(d)s/stdin_eof %%(d)s/exit.tmp < %%(d)s/stdin | ' \\ '(%%(c)s >> %%(d)s/stdout 2>> %%(d)s/stderr; echo $? > %%(d)s/exit.tmp);' \\ 'mv %%(d)s/exit.tmp %%(d)s/exit\\n' %% \\ {'d': job_guest, 'c': ' '.join(map(pipes.quote, sys.argv[1:]))} @@ -430,7 +428,10 @@ return ['-cpu', 'kvm64,+vmx,+lahf_lm'] elif 'svm' in words: # AMD kvm adtlog.debug('Detected KVM capable AMD host CPU, enabling nested KVM') - return ['-cpu', 'kvm64,+svm,+lahf_lm'] + # FIXME: this should really be the one below for more + # reproducible testbeds, but nothing except -cpu host works + # return ['-cpu', 'kvm64,+svm,+lahf_lm'] + return ['-cpu', 'host'] except IOError as e: adtlog.warning('Cannot read /proc/cpuinfo to detect CPU flags: %s' % e) # fetching CPU flags isn't critical (only used to enable nested KVM), diff -Nru autopkgtest-3.20.2/virt-subproc/adt-virt-qemu.1 autopkgtest-3.20.6/virt-subproc/adt-virt-qemu.1 --- autopkgtest-3.20.2/virt-subproc/adt-virt-qemu.1 2016-04-01 07:11:17.000000000 +0000 +++ autopkgtest-3.20.6/virt-subproc/adt-virt-qemu.1 2016-05-11 10:03:08.000000000 +0000 @@ -198,8 +198,8 @@ specified above) and also supports additional features such as snapshots or compression. You can run that command with setting the environment variable .B ADT_APT_PROXY -to a proxy which will be used by apt in the VM. If you have apt-cacher-ng -installed on the host, this will be used automatically; otherwise you can run +to a proxy which will be used by apt in the VM. If you have an apt proxy +configured on the host, this will be used automatically; otherwise you can run e. g. .RS diff -Nru autopkgtest-3.20.2/virt-subproc/adt-virt-schroot autopkgtest-3.20.6/virt-subproc/adt-virt-schroot --- autopkgtest-3.20.2/virt-subproc/adt-virt-schroot 2016-04-01 07:11:17.000000000 +0000 +++ autopkgtest-3.20.6/virt-subproc/adt-virt-schroot 2016-05-11 10:03:08.000000000 +0000 @@ -29,15 +29,13 @@ import pwd import subprocess import time +import argparse -try: - our_base = os.environ['AUTOPKGTEST_BASE'] + '/lib' -except KeyError: - our_base = '/usr/share/autopkgtest/python' -sys.path.insert(1, our_base) +sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname( + os.path.abspath(__file__))), 'lib')) +sys.path.insert(0, '/usr/share/autopkgtest/python') import VirtSubproc -from adt_run_args import ArgumentParser import adtlog @@ -72,7 +70,7 @@ def parse_args(): global schroot, sessid - parser = ArgumentParser() + parser = argparse.ArgumentParser() parser.add_argument('-d', '--debug', action='store_true', help='Enable debugging output') parser.add_argument('-s', '--session-id', diff -Nru autopkgtest-3.20.2/virt-subproc/adt-virt-ssh autopkgtest-3.20.6/virt-subproc/adt-virt-ssh --- autopkgtest-3.20.2/virt-subproc/adt-virt-ssh 2016-04-01 07:11:17.000000000 +0000 +++ autopkgtest-3.20.6/virt-subproc/adt-virt-ssh 2016-05-11 10:03:08.000000000 +0000 @@ -36,14 +36,11 @@ import subprocess import socket -try: - our_base = os.environ['AUTOPKGTEST_BASE'] + '/lib' -except KeyError: - our_base = '/usr/share/autopkgtest/python' -sys.path.insert(1, our_base) +sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname( + os.path.abspath(__file__))), 'lib')) +sys.path.insert(0, '/usr/share/autopkgtest/python') import VirtSubproc -from adt_run_args import ArgumentParser import adtlog capabilities = [] @@ -106,7 +103,7 @@ def parse_args(): global args - parser = ArgumentParser() + parser = argparse.ArgumentParser() parser.add_argument('-d', '--debug', action='store_true', help='Enable debugging output') @@ -314,6 +311,8 @@ if sshconfig['login'] != 'root': (sudocmd, askpass) = can_sudo(sshcmd) + else: + (sudocmd, askpass) = (None, None) if sudocmd: if 'root-on-testbed' not in capabilities: capabilities.append('root-on-testbed')