autopkgtest-2.14.1/0000755000000000000000000000000012321262032011030 5ustar autopkgtest-2.14.1/CREDITS0000644000000000000000000000030012321262032012041 0ustar autopkgtest is Copyright (C) 2006-2014 Canonical Ltd. autopkgtest was initially written by Ian Jackson for Canonical, and is currently being developed by Martin Pitt . autopkgtest-2.14.1/Makefile0000644000000000000000000000344712321262032012500 0ustar # This file is part of autopkgtest # autopkgtest is a tool for testing Debian binary packages # # autopkgtest is Copyright (C) 2006 Canonical Ltd. # # 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 # the Free Software Foundation; either version 2 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 General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # See the file CREDITS for a full list of credits information (often # installed as /usr/share/doc/autopkgtest/CREDITS). include settings.make programs = virt-subproc/adt-virt-chroot \ virt-subproc/adt-virt-xenlvm \ virt-subproc/adt-virt-null \ virt-subproc/adt-virt-schroot \ virt-subproc/adt-virt-lxc \ virt-subproc/adt-virt-qemu \ tools/adt-buildvm-ubuntu-cloud \ tools/adt-build-lxc \ runner/adt-run pythonfiles = lib/VirtSubproc.py all: cd xen && $(MAKE) install-here: $(INSTALL_DIRS) -d $(bindir) $(docdir) $(man1dir) \ $(pythondir) set -e; for f in $(programs); do \ $(INSTALL_PROGRAM) $$f $(bindir); \ test ! -f $$f.1 || $(INSTALL_DOC) $$f.1 $(man1dir); \ done $(INSTALL_PROGRAM) tools/adt-setup-vm $(share)/$(pkgname) $(INSTALL_DATA) $(pythonfiles) $(pythondir) $(INSTALL_DOC) CREDITS debian/changelog $(docdir) $(INSTALL_DOC) doc/README*[!~] $(docdir) install: install-here cd xen && $(MAKE) install clean: rm -f */*.pyc cd xen && $(MAKE) clean autopkgtest-2.14.1/TODO0000644000000000000000000000000012321262032011506 0ustar autopkgtest-2.14.1/debian/0000755000000000000000000000000012321262032012252 5ustar autopkgtest-2.14.1/debian/autopkgtest.links0000644000000000000000000000010612321262032015663 0ustar usr/share/doc/autopkgtest/copyright usr/share/doc/autopkgtest/CREDITS autopkgtest-2.14.1/debian/changelog0000644000000000000000000015150612321262032014134 0ustar autopkgtest (2.14.1) unstable; urgency=medium * tools/adt-buildvm-ubuntu-cloud: Enable ssh login with passwords. -- Martin Pitt Wed, 09 Apr 2014 17:15:29 +0200 autopkgtest (2.14) unstable; urgency=medium * lxc: Greatly simplify bind mounting of shared tmp dir using the lxc-start -s option. * adt-virt-qemu: Forward VM's ssh port 22 to the first free localhost port starting from 10022. When finding one, suggest connecting to the VM with an appropriate ssh command on --shell. -- Martin Pitt Wed, 09 Apr 2014 17:06:44 +0200 autopkgtest (2.13.1) unstable; urgency=medium * Fix "--build-tree" typo in error message, and also add the missing --unbuilt-tree. (Closes: #743427) * lxc: Enable live output in clone mode. -- Martin Pitt Tue, 08 Apr 2014 12:18:00 +0200 autopkgtest (2.13) unstable; urgency=medium * Split package/version list that got introduced in 2.10: Introduce a new output file "testbed-packages" with the packages and versions of the pristine testbed, and filter them out of "-packages", so that the latter only contains the packages and versions that are specific to that test. This is generally more useful, and how debci does/wants it. -- Martin Pitt Tue, 01 Apr 2014 14:43:12 +0100 autopkgtest (2.12) unstable; urgency=medium [ Martin Pitt ] New features: * Add new options -s/--shell-fail for running a shell in the testbed after every failed test, and --shell for running a shell in the testbed after every test. This should make debugging tests or regressions quite a bit simpler. This actually spawns a shell for the null, chroot, schroot, and lxc runners, and shows how to login to the VM for qemu (this will hopefully be improved in the future, but at least makes debugging possible for now). Bug fixes: * adt-build-lxc: Fix apt proxy setting for ubuntu template; use $HTTP_PROXY, not $APT_PROXY. * Make PEP-8 failures non-fatal during package build. They often fail in backports to old releases, and running them before releasing a new package is sufficient. * Filter out comment lines from control lines, as python-debian doesn't properly do that (Debian #743174). Fixes lintian autopkgtest. (LP: #1300031) [ Antonio Terceiro ] * adt-virt-schroot: Add new option -s/--session-id for specifying a custom schroot session id. This is useful for debugging test suites that go crazy on ci.debian.net, so you can `schroot --list --all-sessions` and see which sessions are still open. (Closes: #742969) -- Martin Pitt Mon, 31 Mar 2014 11:45:13 +0200 autopkgtest (2.11) unstable; urgency=medium * Add tools/adt-setup-vm: Setup script for vmdebootstrap (and potentially others) to start a root shell on tty1, set up networking for eth0, and enable deb-src apt sources. * adt-virt-qemu.1: Describe how to create a suitable Debian VM with vmdebootstrap. * doc/README.package-tests: Point out to use "build-needed" with consideration. * Make installation of packages/dependencies print a warning instead of failing immediately when root is not available on the testbed. This allows tests to be run with the "null" runner locally as user with some restrictions. Check if dpkg-source is available before installing dpkg-dev, to avoid the warning in that simple case. (Closes: #742242) * Fix ugly error message if a package does not have a debian/tests/ directory. Properly fail with code 8 and "SKIP no tests in this package". * Clean up temporary files in NullRunner tests. -- Martin Pitt Fri, 21 Mar 2014 09:36:25 +0100 autopkgtest (2.10) unstable; urgency=medium * Record name and version of tested package in log and in output-dir/testpkg-version. (first part of LP #1292431) * Record installed packages and their versions for each test, in /-packages. (second half of LP: #1292431) * Drop adt-testreport-*, adt-openbugs-*: These have been marked deprecated for a while, haven't been used or maintained in many years, and are superseded by jenkins/debci. (Closes: #695974) -- Martin Pitt Tue, 18 Mar 2014 16:12:24 +0100 autopkgtest (2.9.2) unstable; urgency=medium * VirtSubproc.py, copydown_shareddir(): Fix "src and dest are the same file" error when file is already in the shared downtmp. * VirtSubproc.py, copydown_shareddir(): Remove already existing target directory to avoid copying an updated directory into the old one. * adt-run: Show timestamps at the beginning, start of preparation (i. e. mostly installing dependencies), and start and end of tests. (LP: #1290760) * Run NullRunnerNoRoot tests during package build. Add python-debian build dependency for that. -- Martin Pitt Wed, 12 Mar 2014 08:13:50 +0100 autopkgtest (2.9.1) unstable; urgency=medium [ Martin Pitt ] * doc/README.package-tests: Clarify syntax of test Depends:, and point to the relevant Debian Policy specification. * adt-build-lxc: Fall back to assuming /var/lib/lxc/ as container directory if lxc-config does not exist. It was introduced in 1.0, but Debian unstable still has 0.9. (Closes: #740437) * tests: Extend test_artifacts() to multiple tests writing artifacts, also with overwriting existing files and writing into subdirs. * VirtSubproc: Fix copyup_shareddir() to get along with existing directories. (LP: #1288668) * settings.make: Switch default prefix to /usr, as our scripts hardcode that for finding VirtSubproc.py and this is a native package. (LP: #1287264) [ Steve Langasek ] * Fix adt-virt-schroot to correctly return root-on-testbed when we're running adt-run as root. (Closes: #740868) -- Martin Pitt Thu, 06 Mar 2014 13:44:07 +0100 autopkgtest (2.9) unstable; urgency=low New features: * Add "downtmp-host=" testbed capability, for runners which can set up a shared directory between host and testbed. This is used by copyupdown to more efficiently copy files back and forth, and in many/most cases, don't explicitly copy anything at all. * Introduce a new testbed capability "downtmp-shared-fifo" that declares that testbed and the host can use a FIFO in the shared downtmp for communication. Use this to generalize live test output to all runners which declare that, not just -null. * Convert null, chroot, schroot, lxc, and qemu runners to use a shared downtmp dir. Note that qemu does not support FIFO (through the 9p file system), so that one does not get live test output. * Don't define $TMPDIR for tests any more. Having $TMPDIR in the shared dir isn't efficient and even breaks some tests (as they might not be able to put sockets etc. into it), and it's an artificial difference to the default system behaviour of just using /tmp. The documentation already was changed a long time ago to only document $ADTTMP as a scratch directory for tests. * Add test restrictions "isolation-container" and "isolation-machine", and corresponding testbed capabilities. Tests can use that to declare that they want to start services or open ports (i. e. a simple chroot/schroot is insufficient) or access hardware, reboot, and interact the kernel (where even a container is insufficient), and will be skipped instead of failing when they run in a virtualization server which does not provide enough isolation. * Add manpage for adt-build-lxc script. * Ship adt-build-lxc script and its manpage in the package. Documentation updates: * doc/README.package-tests: Some stylistic updates, and add section headers. * adt-virt-lxc.1: Point to, and show how to use adt-build-lxc. * Add doc/README.running-tests: Overview of how to run adt-run, most common scenarios, and available virtualization servers with their pros/cons. Bug fixes: * tests: Copy tests/home/ into a temporary dir and set $HOME to that, to avoid cluttering the source dir. * Don't produce empty stderr/stdout files with --output-dir. (LP: #1282866) * adt-buildvm-ubuntu-cloud: Install linux-generic, to get the full kernel (needed for e. g. udisks2 to get scsi_debug). * tests: Add a broken symlink to testpkg, to ensure that copying trees around gets along with those. * adt-run: Always use fakeroot with adt-virt-qemu, to work around chown failing on 9p. * xen/initscript: Always source /lib/lsb/init-functions. (Thanks lintian) * tests/adt-run: Increase timeout in NullRunner.test_timeout_long_build to avoid failure on slow architectures. * adt-build-lxc: Properly wait for finished container boot instead of a static 10 second sleep. * adt-build-lxc: Only flush the cache when updating an existing container. -- Martin Pitt Thu, 27 Feb 2014 11:23:32 +0100 autopkgtest (2.8.1) unstable; urgency=medium * Use the install timeout instead of the short one for --setup-commands/--apt-upgrade. * Fix --apt-upgrade to not hang on dpkg conffile prompts. * Use ./tests/home/ as $HOME during tests, and add a gpg key to it so that we don't have to generate one (which often hangs due to lack of entropy). * Make the test suite run as user, skip tests which require root (all ChrootRunner and most NullRunner tests). -- Martin Pitt Fri, 21 Feb 2014 17:15:41 -0800 autopkgtest (2.8) unstable; urgency=medium * Add adt-virt-qemu: Virtualization server using QEMU. This provides even more isolation than containers and thus is able to run tests which interact with the kernel. See the manpage for the requirements that VMs need to satisfy, and how to use it. (Closes: #719215) * Add adt-buildvm-ubuntu-cloud: This tool downloads an Ubuntu cloud image and configures it for autopkgtest. See its manpage for how to use it. * adt-run: Stop using a $TMPDIR for package builds. It's unnecessary overhead, and causes problems with dpkg-deb if it is on e. g. a 9p file system. * Allow the virt-server argument to be given without the common "adt-virt-" prefix, for brevity. Update the manpage accordingly, and also move virt-server into its own heading instead of burying it in the middle of "other options". * tests: Show stderr output if adt-run unexpectedly fails. * Fix endless recursion when an error happens during resetting apt. * tests: Fix skip message if no container is given; it does not need to be an Ubuntu cloud container any more. * Add tools/adt-build-lxc: Script to create or upgrade a Debian/Ubuntu container, suitable as a daily cron (or Jenkins) job. Not shipped in package for now. * Allow --setup-commands to be given multiple times. * Add -U/--apt-upgrade option to run apt-get update/dist-upgrade before running the test. * Add --apt-pocket option to create an additional apt source for release-pocket. -- Martin Pitt Mon, 17 Feb 2014 21:00:58 -0800 autopkgtest (2.7.2) unstable; urgency=medium * debian/copyright, CREDITS: Bump copyright year. * Eliminate lib/Autopkgtest.py, use pipes.quote() instead of shellquote_*(). * Drop doc/README.schroot-setup. Using LVM for schroot overlays is not recommended as it is too slow and also too hard to set up. You should rather use overlays or unpacked tarballs on tmpfs. Adjust adt-virt-schroot.1 to point to mk-sbuild(1) instead. * CREDITS: Remove license information, it does not belong there and we don't need that any more as debian/copyright file. * adt-testreport-*, adt-openbugs-*: Add warning that these scripts are unmaintained and deprecated in favour of http://ci.debian.net, debci, and/or jenkins. If you still use them, please mail autopkgtest-devel@lists.alioth.debian.org! * README.package-tests: Document that @builddeps@ also installs make. (Closes: #738129) * Add Suggests: for schroot and lxc, and explain those in the package description. * NullRunner.test_timeout_long_test: Increase (unrelated) build timeout from 3 to 20 s, to cope with the bit of overhead that dpkg-buildpackage introduced. -- Martin Pitt Sun, 09 Feb 2014 19:31:34 +0100 autopkgtest (2.7.1) unstable; urgency=medium * VirtSubproc.py, command(): Intercept/retry on EAGAIN. * runner/adt-run: Robustify cleanup of empty "binaries" output directory, it does not always work in __del__(). * adt-run: Replace direct invocation of "debian/rules build" with "dpkg-buildpackage -us -uc -b". dpkg-buildpackage is the de-facto interface these days (also on the buildds), and does additional things now such as passing build flags or cleaning the package. This also implies dpkg-source --before build to apply patches, so remove the explicit call to that again. (Closes: #737632) * adt-run: If all tests get skipped, but there are some tests, don't claim that there are none. (Closes: #737242) * adt-run: When expanding @builddeps@, add "make" as test almost always need it to call "make installcheck" or similar. * Print package version as first adt-run message ("@devel@" when running out of source tree). * Turn VirtSubproc.Timeout into a proper exception class (RuntimeError). * Make VirtSubproc.bomb() useful outside the mainloop, so that we can use it in utility functions that are used outside of runners. * VirtSubproc: Add a "timeout" context manager which plumbs timeout_start(), timeout_end() and bomb() (if an exit message is given) or a Timeout exception (otherwise) together in the right way, for convenience. -- Martin Pitt Fri, 07 Feb 2014 14:52:42 +0100 autopkgtest (2.7) unstable; urgency=medium * adt-virt-lxc: Drop all the file-based checks for container bootup, and replace with "lxc-attach runlevel" to wait until the container booted to a numeric runlevel. This greatly simplifies the logic and drops the cloud-init requirement so that this runner is now suitable for Debian or debootstrap-based Ubuntu containers. (LP: #1273725) * adt-virt-lxc.1: Drop --gain-root in notes/example. It's unnecessary (adt-run will install fakeroot if missing) and confusing (as it's not related to LXC specifically and otherwise not really used/useful). * adt-virt-lxc.1: Add example how to create a Debian container, and some cleanup of obsolete commentary. * adt-virt-lxc: Add -s/--sudo option to run lxc-* commands through sudo; use this option if you run adt-run as normal user, but need to run the container itself as root (if you use LXC system-level containers). This drops the hardcoded sudo commands and thus the dependency on sudo, which is more palatable for Debian. (LP: #1273977) * adt-virt-lxc: Add -e shortcut for --ephemeral, as this is an option which you pretty much always want. * adt-virt-lxc.1: Move more important options to the top. * adt-virt-lxc: Stop hardcoding the "ubuntu" suggested normal user; instead, call "getent passwd" to detect the first user with uid >= 500. Don't advertise suggested-normal-user if none exists. * adt-run: Rearrange finalizing options and reading capabilities to happen after testbed opening. That allows the testbed to determine its full capablities in its open hook. * adt-run: Call dpkg-source --before-build for --unbuilt-tree arguments, to ensure that patches are applied for "3.0 (quilt)" source trees. This is useful to test *-buildpackage source trees where patches don't get applied. (LP: #1212208) -- Martin Pitt Fri, 31 Jan 2014 11:14:32 +0100 autopkgtest (2.6.1) unstable; urgency=medium * adt-virt-lxc: Call lxc-config through sudo as well like all the other LXC commands. This fixes running adt-run as user with the LXC runner. * adt-run: For copydown(), always chown the testbed files to the non-root user (if available). This fixes a "Permission denied" error with the schroot or LXC runners and --unbuilt-tree if the source tree has tight permissions. (LP: #1266811) * Adjust LxcRunner.test_tree_built_binaries to also work with current apt (similar to commit 5798b7f for the schroot runner). * adt-virt-lxc: Call "sudo test" and "sudo readlink" instead of os.lexists() and os.readlink() as recent LXC now makes the default container dir /var/lib/lxc not readably by non-users. Fixes running adt-virt-lxc/adt-run as user. (LP: #1266809) * Add test for --binary with --built-tree. * adt-run.1: Clarify and fix some wrong and misleading documentation what happens with debs produced by source packages and specified with --binary. (LP: #1175557) -- Martin Pitt Wed, 29 Jan 2014 06:53:16 +0100 autopkgtest (2.6) unstable; urgency=medium New features: * Add --apt-source option as an alternative for --source, implied if argument is a valid package name. It calls "apt-get source" in the testbed instead of using a .dsc from the host, which for the common case of testing packages in the acual archive avoids having to manually download the source and then copying it into the testbed. This simplifies the command line for running tests for a package in the archive to "adt-run mypkgname --- adt-virt-[...]". * Add --setup-commands option to run things like "apt-get update" or adding apt sources after opening the testbed. Bug fixes: * adt-virt-lxc: Stop assuming that containers live in /var/lib/lxc/; ask lxc-config about the root path instead. * Only reset the test bed after the build stage if builds actually happened. * Reset the test bed after running a test group, to avoid an unnecessary setup if there is just one test. * Don't put an empty "binaries" directory into the output directory. New test cases: * --timeout handling. -- Martin Pitt Thu, 23 Jan 2014 17:19:11 +0100 autopkgtest (2.5.6) unstable; urgency=medium * Adjust "su" calls to explicitly specify /bin/sh as shell, as recent base-passwd disables them now for system users. (Closes: #734740) -- Martin Pitt Thu, 09 Jan 2014 15:21:44 +0100 autopkgtest (2.5.5) unstable; urgency=medium * Test that the schroot runner installs packages with --user, and that it runs the tests as root with --user if the test has a "needs-root" restriction. (Related to #728304) * adt-virt-schroot: Add suggested-normal-user capability to the calling user (unless that's root), so that tests are run as user by default. (Closes: #728304) * Add support for virtual "@builddeps@" test dependency, which will be replaced with the package's B-D and B-D-I. Document in doc/README.package-tests. (Closes: #720458) -- Martin Pitt Wed, 25 Dec 2013 21:12:38 +0100 autopkgtest (2.5.4) unstable; urgency=medium * Only clean up binary if we built them ourselves. adt-run previously removed debs specified with --binary. -- Martin Pitt Thu, 19 Dec 2013 16:18:03 +0100 autopkgtest (2.5.3) unstable; urgency=low * Drop hosts/ and {onepackage,ubuntu}-config example files; these scripts haven't been used nor maintained in years, and we won't need them anytime soon. Ubuntu does, and Debian plans to drive autopkgtest from britney and/or Jenkins, not from cron. * Move adt-testreport-* scripts and manpages into autopkgtest-xenlvm package, as they require the xen runner. * tests/run-parallel: Immediately stop on pep8/pyflakes errors. * Adjust SchrootRunner.test_tree_built_binaries test to also work with current apt. * Always write UTF-8 to stdout and summary stream, to avoid UnicodeEncodeError crash when running in a C locale. (LP: #1259529) * tests/pyflakes: Always use pyflakes, not pyflakes3, as the latter doesn't get along with non-ASCII strings when running under a non-UTF-8 locale (as in sbuild). -- Martin Pitt Wed, 11 Dec 2013 08:45:07 +0100 autopkgtest (2.5.2) unstable; urgency=low * virt-subproc/adt-virt-lxc: Fix PEP-8 error. * Explicitly kill the logging tee processes, for backwards compatibility with Python 2.6. * Avoid assertNotRegex() in test suite as it isn't yet available in Python 3.1. * Skip dependency version check instead of crashing if python-debian does not provide NativeVersion() (for wheezy/lucid). * Fix some minor PEP-8 errors. -- Martin Pitt Fri, 29 Nov 2013 18:07:09 +0100 autopkgtest (2.5.1) unstable; urgency=low * adt-virt-lxc: Drop some dead code. * Fix ownership of test tree with --user option. -- Martin Pitt Tue, 26 Nov 2013 10:43:30 +0100 autopkgtest (2.5) unstable; urgency=low Behaviour changes: * Drop --output-dir option. It has never really been useful as it only works for paths in the testbed, has a confusing semantics, is redundant with --tmp-dir, and currently even crashes adt-run. (Closes: #729790) * Rename --tmp-dir option to --output-dir, as its main purpose is really to collect test artifacts. Keep --tmp-dir alias for backwards compatibility. * Drop --override-control option. It complicates the code too much for its very limited utility, and it was not even documented in the manpage. * Drop --paths-testbed (and thus also --paths-host) options. There is no use case for them. * Add short options for common command line options: -B for --no-built-binaries, -o for --output-dir, -l for --log-file, -u for --user. * Clean up uninteresting files from --output-dir directory. * Tests which want to create additional artifacts can now put them into the $ADT_ARTIFACTS directory. When using the --output-dir option, they will be copied into /artifacts/. Document this new feature in README.package-tests. (LP: #1137763) Packaging changes: * Drop obsolete autodebtest Conflicts/Replaces. * Update copyright years. * Bump Standards-Version to 3.9.5. No changes necessary. * CREDITS: Add myself. * Makefile: Support $DESTDIR, like automake. * Adjust sharedir* defaults in settings.make to what we actually want, and drop their overrides in debian/rules * Move debian/rules to using dh. * Add ./run-from-checkout script to run adt-run from the git checkout or source package. Change tests/adt-run to use it. * Add tests/run-parallel to run tests for different runners in parallel. Bug fixes: * Fix OSError crash if --output-dir/--tmp-dir does not exist. (Closes: #729791) * Pass line number to Test constructor argument, to be able to report proper errors instead of crashing. (side issue in #698551) * Fix exit code for "Unsupported" error. * When encountering an unsupported test, report only this test as skipped, not all the others in the same "Tests:" stanza. * README.package-tests: Test names must not contain '/'. (Closes: #698551) * Create manpage for adt-virt-schroot. (first half of #695974) * Fix "su: must be run from a terminal" failure when running as user and testbed doesn't provide root-on-testbed. (Closes: #648148) * Add bandaid to avoid mixing order of stdout and stderr in the log file when reporting results. Code cleanup: * Simplify logging by dropping the explicit functions for writing to stderr plus log, and instead set up pipes so that the whole stdout/stderr will be tee'd into the logfile. * Replace the usage of the AutoFile classes (which are underdocumented, magic, and hard to understand) with a more explicit and much simpler TestbedPath class. * Stop installing the redundant /etc/apt/apt.conf.d/90autopkgtest into testbeds, and simplify invocation of apt-get. New test cases: * Access /dev/std{out,err} in a non-root test, like the "mafft" autopkgtest does. * --log-file test cases for chroot and schroot runners. * schroot and LXC runner test cases for installing built binaries. * --output-dir in schroot runner with complete package build. * Recommends do not get installed by default. * Test case with '/' in the name. * --user option for schroot and null runners. * breaks-testbed restriction for all runners. -- Martin Pitt Mon, 25 Nov 2013 07:31:22 +0100 autopkgtest (2.4) unstable; urgency=low * Add adt-virt-lxc test runner, many thanks to Robie Basak for this! This runner provides "revert" and "revert-full-system" capabilities which is useful for packages which have the "breaks-testbed" restriction and multiple tests. For the time being this only works with the ubuntu-cloud template; support for general debian/ubuntu containers requires an lxc-wait mechanism ("did the container finish booting?") and getting along with the different user setups (debian using "root", ubuntu using an "ubuntu" user with sudo capabilities). * Add tests for adt-virt-lxc. * Code cleanup to slightly improve readability: - Drop two-letter aliases for methods. - Consistent usage of quotes. - Drop orphaned/unnecessary globals. - Consistent logging methods/object names, add some docstrings. * Install fakeroot into testbed for "build-needed". Thanks Jean-Baptiste Lallement! (Closes: #726714, LP: #1241456) * Create testtmp directory with 0755 permissions to fix failure with tight umasks. Thanks Arthur de Jong! (Closes: #728057) * Allow test control Depends: to have a trailing comma. Thanks Jean-Baptiste Lallement for the patch! * Make test stdout re-appear in --log-file file for realtime output. -- Martin Pitt Mon, 28 Oct 2013 11:25:30 +0100 autopkgtest (2.3.8) unstable; urgency=low * Skip ChrootRunner test if running under cowdancer, as chrooting in cowdancer doesn't work. * Fix endless bomb/stop loop if the virt runner fails and exits unexpectedly. * adt-virt-schroot: Add some debugging output of the schroot config. * Fix OSError crash with real-time output when running adt-run as non-root on the host, and the runner bind-mounts /tmp (such as -schroot), in which case the temporary runner dir isn't accessible to the host. This is a quickfix, eventually we should make real-time output work properly in this situation. * Show stderr also for non-zero exit codes. * Restrict live stdout/stderr to the null virt runner for now, as it does not work properly with the schroot runner even if /tmp gets bind-mounted. * Add tests for the schroot runner. Ad building a schroot would be too expensive for a test, use an existing schroot if $ADT_TEST_SCHROOT is set, otherwise skip the tests. * Show stderr for all non-null runners with "allow-stderr". -- Martin Pitt Wed, 16 Oct 2013 14:55:39 +0200 autopkgtest (2.3.7) unstable; urgency=low * tests/adt-run: Factorize a base test class with common functionality. * lib/VirtSubproc.py, downtmp_mktemp(): Create temporary directory in the target (which isn't the host for anything but the null runner), to fix the schroot/chroot runners for directories. * Only show stdout/stderr in realtime if tests run in the same file system as the host, as otherwise we cannot create/use a named pipe. If not, fall back to the old way of just showing the complete stdout/stderr after the tests finished. (LP: #1235189) * Add some test cases for adt-virt-chroot. * Add new --timeout-copy option to make copy timeout configurable. Pass that down to adt-virt-* via the environment ($ADT_VIRT_COPY_TIMEOUT). (LP: #1200693) * Fix tests to also work with Python 3.1. * tests/testpkg: Go back to compat level 7 so that this also works on older Debian/Ubuntu releases. -- Martin Pitt Tue, 08 Oct 2013 18:55:33 +0200 autopkgtest (2.3.6) unstable; urgency=low * Always kill the tee children after a test finishes, to avoid race condition when they get stuck in a read() call which doesn't return with "no data". * Fix pyflakes failure on older Debian/Ubuntu releases. * Fix PEP-8 errors. -- Martin Pitt Thu, 26 Sep 2013 13:12:11 +0200 autopkgtest (2.3.5) unstable; urgency=low * Don't show source_rules_command() "set -x" trace unless running with -d. * Kill the tee child process if the testbed bombs out (e. g. due to a timeout), to avoid hanging eternally. Add test case for --timeout-test handling. * Add test case for --summary option. -- Martin Pitt Wed, 25 Sep 2013 08:51:21 +0200 autopkgtest (2.3.4) unstable; urgency=low * Add tests/testpkg/: Simple source package for testing autopkgtest. * Add tests/adt-run: Automatic regression tests for adt-run, covering/using the null runner. * Add debian/tests: autopkgtest for autopkgtest, using tests/adt-run. * Make topmost temporary directory group/world-readable and make $ADTTMP have appropriate 1777 permissions so that users other than root can actually use it. (Closes: #722458) * Don't clip first stderr line to 35 characters in summary. (Side issue in #722457) * Don't show shell tracing of script that creates the temporary directories. * Move unimportant messages to debug level 1, to not clutter up default output so much. * Drop unnecessary "trace: " from adt-run debug/progress lines. * Show stdout/err of the running tests in realtime, which is much nicer for watching. Don't split that realtime output, so that stderr messages appear in the right context. Show separate stderr if and only if the allow-stderr restriction is not set and there is stderr output. (Closes: #722457) * For tests with "build-needed", actually run the tests in the built directory, not in the original unbuilt tree. (Closes: #711209) * Fix various unknown and unused symbols throughout the source, spotted by pyflakes. * Add tests/pyflakes: Run pyflakes over source and test code. * Add tests/pep8: Run pep8 over source and test code. * Support empty "Depends:" test control field, installing no dependencies in that case. * README.package-tests: Point out that you can use upper-case test names as well. Update test_tree_tmp_dir() test to use these, to ensure it stays working. (Closes: #711844) * Some code cleanups: - Don't rename modules on import. - Format to be PEP-8 compliant. - Rename first argument of methods to "self", as that's the wide convention, gets rid of some single-letter variable names, and makes it a bit easier to see which variables refer to foreign objects. * Run tests/pep8 and tests/pyflakes during package build. -- Martin Pitt Mon, 23 Sep 2013 14:44:13 +0200 autopkgtest (2.3.3) unstable; urgency=low * runner/adt-run: Drop "errors" keyword from decode() call to fix compatibility with earlier Python versions. Thanks Christoph Berg. * adt-run: Fail tests if they exit with nonzero if "allow-stderr" restriction is set. Thanks Robie Basak! (LP: #1210503) -- Martin Pitt Mon, 09 Sep 2013 15:49:52 -0400 autopkgtest (2.3.2) unstable; urgency=low * runner/adt-run: Fix "allow-stderr" restrictions to still report success, so that this gets into the summary.log. -- Martin Pitt Fri, 26 Jul 2013 12:41:07 +0200 autopkgtest (2.3.1) unstable; urgency=low * adt-run: Support older python-debian versions whose module was still called "debian_bundle". (Closes: #717191) * runner/adt-run: Correctly re-raise exception on some register failure errors. Thanks Robie Basak! * runner/adt-run: Short-circuit publishing if there are no registered built binaries. This is the step that takes by far the longest time for short tests, and thus speeds up test running significantly. * runner/adt-run: Set DEBIAN_FRONTEND=noninteractive for installing build or test dependencies, too. Thanks Robie Basak! (LP: #1204989) -- Martin Pitt Fri, 26 Jul 2013 08:02:35 +0200 autopkgtest (2.3) unstable; urgency=low * runner/adt-run.1: Fix bad "affect modify" wording. (LP: #1199500) * Drop hosts/chinstrap. We haven't actually used this in many years, it has been replaced with https://launchpad.net/auto-package-testing, Jenkins, and blocking migration to release until tests pass. (LP: #381210) * Promote apt-utils from Recommends to Depends:, to avoid test failures due to not finding apt-ftparchive. (LP: #1065874) * Promote pbuilder from Recommends: to Depends:, as we always call pbuilder-satisfydepends-classic. (LP: #1065874) * runner/adt-run: Stop explicitly checking for $HOME (with broken error message) when giving --gnupg-home, use os.path.expanduser() instead. (LP: #1065873) * runner/adt-run: Fix timeout --help output. * runner/adt-run: Fix bomb() to clean up the testbed before removing it. Afterwards (in cleanup()) we don't have a testbed object any more to run commands in. (LP: #1157292) * runner/adt-run: Fix UnicodeDecodeError crash if stderr contains non-ASCII characters. (LP: #1100283) * Add "allow-stderr" restriction for tests where re-routing or disabling stderr is impractical. (LP: #1197005) * runner-adt-run: Support architecture specifiers in Depends: field. (LP: #1165128) * runner/adt-run: Remove/fix some unused variables, spotted by pyflakes. -- Martin Pitt Fri, 19 Jul 2013 11:58:15 +0200 autopkgtest (2.2.5) unstable; urgency=low [ Jean-Baptiste Lallement ] * Fix call to atmostone(), so that Tests-Directory: actually works. -- Martin Pitt Thu, 11 Jul 2013 06:54:29 +0200 autopkgtest (2.2.4) unstable; urgency=low [Jean-Baptiste Lallement] * Fix failure with "permission denied" with option --user. Closes: #686292, LP: #1084116 * Use debian.deb822 Python module to parse control files. This fixes parsing of folded dependencies. Closes: #695797, LP: #1073856 * Support versioned dependencies in debian/tests/control. Closes: #693540, LP: #1164362 [ Martin Pitt ] * Add myself as a co-maintainer, as per mailing list discussion. * Add machine-readable debian/copyright as per current 1.0 standard. Remove dynamic creation of debian/copyright from debian/rules. * Move from deprecated dh compat level 4 to 8 (supported in squeeze). * debian/rules: Use dh_installdocs to install copyright file instead of custom shell code. * debian/control: Add missing ${misc:Depends}. * Bump Standards-Version to 3.9.4. -- Martin Pitt Thu, 27 Jun 2013 13:49:25 +0200 autopkgtest (2.2.3+nmu1) unstable; urgency=medium * Non-maintainer upload. * adt-run: Catch EXDEV. Closes: #696625. -- Christoph Berg Thu, 31 Jan 2013 10:31:56 +0100 autopkgtest (2.2.3) unstable; urgency=medium [ Martin Pitt ] * Make `@' in tests' Depends work even if we're not building the source tree. Closes: #678359. This is an important bugfix. -- Ian Jackson Sun, 08 Jul 2012 23:15:42 +0100 autopkgtest (2.2.2) unstable; urgency=low [ Martin Pitt ] * Fix hashbang lines to use python instead of python2.6, and update debian/control to only depend on python (>= 2.6) instead of python2.6. Closes: #644332. -- Ian Jackson Thu, 28 Jun 2012 01:03:02 +0100 autopkgtest (2.2.1) unstable; urgency=low [ Stefano Zacchiroli ] * specification: document (XS-)Testsuite source header Closes: #679097 * debian/control: add Vcs-* headers pointing to Alioth Git repository -- Ian Jackson Wed, 27 Jun 2012 21:36:56 +0100 autopkgtest (2.2.0) unstable; urgency=low * Provide tests with ADTTMP rather than TMPDIR. Well, actually, that's just according to the spec. In reality, for backward compatibity, we provide each test script with both (pointing to different directories so that tests don't need to worry about possible filename clashes between ADTTMP and TMPDIR). -- Ian Jackson Fri, 15 Jun 2012 02:05:54 +0100 autopkgtest (2.1.0) unstable; urgency=low Bugfixes: * Remove our strange apt config on exit. Partial fix to #648142, from Timo Lindfors. * Suppress apt-listbugs and apt-listchanges. Michael Prokop. * Fix parsing of "@" dependencies. Colin Watson. Closes: #667022. * Fix NameError re "f" in restriction parsing. Martin Pitt. Closes: #647882. * Improve handling of schroot root-users and root-groups. Colin Watson. Closes: #667001. * Correctly handle quoting of copyup/copydown filenames. Fixes but where we couldn't cope with packages' filenames containing + and ~. Report from Martin Pitt. Closes: #648161. Documentation fixes: * Clarify the spec to say that copyup/down takes encoded filenames. * Fix the spec to refer to `breaks-testbed' rather than `breaks-computer'. Report from Jakub Wilk. Closes: #669721. * Manpage should refer to `*' in tests file's Depends field, not `@'. Report from Jakub Wilk. Closes: #670648. Packaging fixes: * Add Recommends against pbuilder, whose dependency resolver adt-run uses. * Remove runner/tmp on debian/rules clean, and add it to .gitignore, for convenience. -- Ian Jackson Mon, 11 Jun 2012 02:05:49 +0100 autopkgtest (2.0.1) unstable; urgency=medium * Bugfixes: - Python backtrace (no method "bomb") on bad tests/control syntax. - Permit tests/control fields with medial capital letters. - Do not duplicate previous stanzas (closes: #637333). - Make adt-run --quiet work (closes: #637350). - Make "build-needed" restriction work (closes: #637353). - Fix a debugging message which was spuriously sent to stderr. * Change Maintainer to the new list and move me to Uploaders. -- Ian Jackson Sat, 27 Aug 2011 11:21:29 +0100 autopkgtest (2.0.0) unstable; urgency=medium * Incompatible test declaration spec changes: - no-build-needed is now the default; build-needed is a Restriction that tests which need it have to declare. * Incompatible virtualisation server spec changes: - print-execute-command replaced by print-{auxverb,shscript}-command. - "revert" capability split into "revert" and "revert-full-system" * New adt-virt-schroot for driving schroot. Sorry, no manpage yet. * New README.schroot-setup. * Remove dependency on python in testbed. * Update python version to 2.6. * Spec wording improvements, clarifications, editorial changes, etc. * Many bugfixes, including: - replace Python string exceptions (closes:#585226). - fix some broken formatting in adt-run manpage (closes:#636034). - fix adt-virt-chroot for simple chroots (closes:#520066). -- Ian Jackson Sat, 30 Jul 2011 17:57:27 +0100 autopkgtest (1.2.0~) unstable; urgency=low * adt-xenlvm-*: support for swap, defaulting to 5G. This will break existing setups with insufficient LVM space. * adt-xenlvm-*: allow specification of LVM PVs to use. * remove spurious mkdir of empty variable $snap. * hosts/magrathea/*: setup as working for initial tests. * adt-xenlvm-with-testbed: sleep 1 after xm destroy, which is racy. * Fix a few other bugs from deployment in 2008. -- Ian Jackson Wed, 27 Aug 2008 22:12:13 +0100 autopkgtest (1.1.1~) unstable; urgency=low * adt-xenlvm-setup: new hooks for xmdomain config file. * hosts/cadmium/update-suppression: really do not install empty file. * allow suppresspackages and blacklist lists to contain more information after some whitespace * adt-openbugs-*: new machinery for working with debbugs. * hosts/magrathea/*: work-in-progress configuration * Add Recommends against apt-utils. * hosts/cadmium/crontab: savelog -c7 not savelog -n7 * hosts/{cadmium,chinstrap}/crontab: set MAILTO * adt-testreport-cronjob: make executable. -- Ian Jackson Fri, 26 Oct 2007 18:12:32 +0100 autopkgtest (1.1.0) unreleased; urgency=low * adt-testreport-runloop: manpage * adt-testreport-runloop: better command line parsing * adt-testreport-runloop: removed old lalonde junk * adt-testreport-runloop: replaced `..._ok' vars with sentinel files * hosts/chinstrap/update-suppressions: big comment * adt-testreport-runloop: renamed from hosts/cadmium/lalonde-nightly * hosts/cadmium/onepackage-config: set PATH (was in lalonde-nightly) * adt-testreport-onepackage: many manpage improvements * adt-testreport-runloop: add to Makefile * hosts/* installed as examples with a big fat warning. * adt-testreport-cronjob: renamed from hosts/cadmium/cronjob * adt-testreport-runloop: copyright message. * cfg and adt-testreport-runloop: do not cd in config files. * adt-testreport-runloop: fix handling of test_classes (was xoptslist) * hosts/cadmium/*, debian/rules: onepackage_config renamed to cfg. -- Ian Jackson Thu, 18 Oct 2007 17:17:31 +0100 autopkgtest (1.0.9) unstable; urgency=low * Separate email_sourcepackage_header and email_binarypackage_header to allow us to properly file bugs in LP against binary packages built from differently-named sources. * adt-testreport-onepackage: Dump a logfile giving the scores and facts used for package selection. * adt-testreport-onepackage: Do not prefer packages whose source package is listed in the suppressions file. * hosts/cadmium/manual-test-one-binary: new testing script. * hosts/cadmium/onepackage-config: explain about archive skew. * adt-testreport-onepackage: nicer score logging re skip chars. * adt-testreport-onepackage: skip emails if _source_ is suppresed. * adt-testreport-onepackage etc.: new blacklist feature, and initially blacklist ltsp-client{,-core}. * adt-testreport-onepackage: limit log to 64K (32K head, 32K tail) to avoid humungous bug reports which LP silently discards. * hosts/cadmium/lalonde-nightly: check for testbed sentinel file and stop if not present. -- Ian Jackson Thu, 18 Oct 2007 11:56:51 +0100 autopkgtest (1.0.8) gutsy; urgency=low * adt-run: pass -o Debug::pkgProblemResolver=true to apt & gdebi; this improves dependency problem reporting. (LP: #135581.) * adt-testreport-onepackage: seddery the log to remove ctrl chars. In particular, this gets rid of ^M's from apt which get corrupted by email transport and thus break the email signatures. * hosts/chinstrap/update-suppressions: pass -S to curl. * hosts/{chinstrap,cadmium}/install-on-*: use --ubuntu branch. -- Ian Jackson Wed, 19 Sep 2007 15:44:33 +0100 autopkgtest (1.0.7) gutsy; urgency=low * Build properly with debian/copyright. -- Ian Jackson Tue, 28 Aug 2007 18:16:35 +0100 autopkgtest (1.0.6) unstable; urgency=low * Better changelog for 1.0.4. * .bzrignore debian/copyright. -- Ian Jackson Tue, 28 Aug 2007 18:08:46 +0100 autopkgtest (1.0.5) gutsy; urgency=low * Generate debian/copyright file in source package. -- Ian Jackson Tue, 28 Aug 2007 18:01:16 +0100 autopkgtest (1.0.4) gutsy; urgency=low * adt-testreport-onepackage: - Handling of source packages' Architecture: field corrected so package selection works properly. - Use ln -f when installing summary. - Capability to suppress emails similar to ones already sent. - Launchpad bug filing including PGP-signing, `affects' line, etc. - Capability to suppress email for packages listed in a suppression file. - Better formatting and explanations in some emails. * adt-run: - Options for setting timeouts. - Increase default timeouts 100s, 3ks, 10ks, 100ks. * hosts/chinstrap/*: Screen-scrape Launchpad to get existing bugs and generate a suitable suppression file so we file a bug iff there isn't one already. * hosts/cadmium/*: New directory for convenience scripts etc on Canonical buildd. -- Ian Jackson Tue, 28 Aug 2007 17:42:13 +0100 autopkgtest (1.0.3) unstable; urgency=low * Set LANG to C by default for commands (eg builds and tests) run on testbed, and make this configurable. * Make builds work again: Fix `cd *' in work.write (broken by inclusion of `tmpdir' in that directory). * adt-testreport-onepackage has better reporting for DC-running. * Fix handling of non-.deb-producing source packages (eg, ones which produce only .udebs). -- Ian Jackson Mon, 16 Jul 2007 17:18:03 +0100 autopkgtest (1.0.2) unstable; urgency=low * xenlvm command-line settings properly override config file settings everywhere. * Default value for adt_distro computed in time to be used for default value for adt_play. * Close fd 4 for lvm tools too (suppresses daft `File descriptor left open' message). * Change default lvm lv sizes and make documentation correspond to reality. -- Ian Jackson Fri, 13 Jul 2007 15:31:58 +0100 autopkgtest (1.0.1) unstable; urgency=low * adt_debootstrap_opts mentioned in README and passable on command lines, instead of unused adt_pbuilder_args. * Dependency on pbuilder fixed; we use debootstrap, not pbuilder. -- Ian Jackson Thu, 12 Jul 2007 16:54:47 +0100 autopkgtest (1.0.0) gutsy; urgency=low * Locking: .lock (unlinkable fcntl style) plus /good sentinel file. This will avoid conflicts between simultaneous calls to with-testbed and setup (and others). The `with' mode of the userv target is enhanced so that the caller can take out the lock and hold it will starting and discarding the testbed more than once. -- Ian Jackson Thu, 12 Jul 2007 15:01:35 +0100 autopkgtest (0.9.2) unreleased; urgency=low * Really discard stderr from our ought-to-be-unnecessary modprobe dm-snapshot. -- Ian Jackson Thu, 12 Jul 2007 14:31:20 +0100 autopkgtest (0.9.1) gutsy; urgency=low * autopkgtest-xenlvm declares that it Depends on dmsetup. * Discard stderr from our ought-to-be-unnecessary modprobe dm-snapshot. * New `console' mode for userv service. * Move README.userv to autopkgtest-xenlvm package (and hence to /usr/share/doc/autopkgtest-xenlvm). * Do not mind if directory named by adt_modules doesn't exist - in that case just don't copy any modules. * Attempt to install libc6-xen in fixups-inside, rather than instructing debootstrap to install it. This makes us not mind if it's missing. -- Ian Jackson Thu, 12 Jul 2007 09:50:13 +0100 autopkgtest (0.9.0) gutsy; urgency=low New features: * userv service for testbed invocation now provided and at least somewhat tested, and useable by adt-virt-xenlvm. * New print-execute-command command for virtualisation servers. * New adt_sshauthkeys_hook config variable. * pass count= to dd for erasure when lvm_erasebase=true. Bugfixes: * Fix filename pattern bug which can prevent automatic keypair generation (false claim that privkey and pubkey do not match). * Do not demand vg or distro information for initscript to work. * export adt_* variable settings resulting from command-line arguments so that subprocesses get them properly, and arrange for the `defaults for simple settings' not to override environment variables. * suppress various variable settings' default computations (and consequent failure if the default can't be established) when processing config for the initscript. The initscript does not need per-testbed configuration options. * close fd 8 when running vgdisplay (which avoids an annoying and spurious warning from the lvm tools). Packaging: * autopkgtest-xenlvm now Recommends: lvm2 and debootstrap. * autopkgtest Suggests curl (adt-testreport-onepackage needs it). Portability: * Check for udev persistent-net-generator and if enabled we write a rune for eth0 for guest_macaddr into the RULES_FILE specified in /lib/udev/write_net_rules. (Needed for gutsy.) * Remove iwj-specific stuff from adt-testreport-onepackage and put it into onepackage-config with scary warnings to tell people to edit the file. Documentation: * ip forwarding warning clarified. * README documentation of default value for erasebase corrected. -- Ian Jackson Tue, 3 Jul 2007 14:58:56 +0100 autopkgtest (0.8.2feisty1~iwj) feisty-updates; urgency=low * Fix readconfig.in to set adt_$var rather than just $var. * Use fd 8 for readconfig stdout parking rather than fd 10, to avoid Debian #423400 (bash bug). * Truncate files when writing them (copyup, copydown, etc) (!) * Remove spurious \ from `do not know how to handle filename' message. * Reset signal handlers in VirtSubproc cleanup. -- Ian Jackson Thu, 17 May 2007 15:11:31 +0100 autopkgtest (0.8.2) gutsy unstable; urgency=low * Fix fd handling to work around Python's habit of closing files you specify in subprocess.Popen. * Error handling bugfixes: say except (IOError,OSError) everywhere rather than just one of those two; correct harmless bug in gpg key generation error handling. * Make adt-virt-null work properly (VirtSubProc runs `down' with a single argument, so down must be sh -c and not []). * In VirtSubProc close spurious copy of plumbing pipe, which prevents certain hangs during error situations. * Xen cleanup script runs dmsetup info / dmsetup remove several times with some sleeps because xm destroy is not properly instantaneous. * Fix handling of pre-built source trees. * Fix cleanup handling not to delete tmpdir before resetting testbed's apt. -- Ian Jackson Fri, 27 Apr 2007 16:06:15 +0100 autopkgtest (0.8.1) feisty; urgency=low * Call dmsetup remove repeatedly instead of messing with udevsettle. udevsettle doesn't always help with the dmsetup remove race. -- Ian Jackson Wed, 4 Apr 2007 18:04:38 +0100 autopkgtest (0.8.0) feisty; urgency=low * adt-run: new --instantiate option to allow package installation to be forced for testing. (This is not an ideal approach - it's not very flexible - but works well enough for the current requirements.) * adt-testreport-onepackage: new ability to test binary as well as source packages, using new --instantiate option. * new `timeout=' option on `execute' virt server command. * set some default timeouts (these should be settable with options, really). * Default kernel image guesser is more sophisticated - now we look for something that looks like a Xen kernel rather than guessing from the filename since the filenames seem unstable. * Default setting for adt_fw_allowglobalports is none. * Set DEBIAN_FRONTEND=noninteractive. * Run udevsettle after xm destroy but before dmsetup remove. * Run sendmail -odi not -odq in adt-testreport-onepackage. * Longer timeouts by default. * Print `adt-run: trace' for trace output. * Show all apt stdout (including dpkg stdout) in contemporaneous trace. -- Ian Jackson Tue, 3 Apr 2007 20:08:13 +0100 autopkgtest (0.7.2) feisty; urgency=low * adt-testreport-onepackage: new management script, with some example config files onepackage-config and ubuntu-config. * Fixed quite a few bugs in adt-run. * Made adt_distro xenlvm config var settable. * Fixed various packaging problems. -- Ian Jackson Thu, 8 Mar 2007 14:54:33 +0000 autopkgtest (0.7.1) feisty; urgency=low * Actually ship README.* files. * Manpage for adt-virt-xenlvm. * New adt-virt-null. -- Ian Jackson Mon, 26 Feb 2007 16:34:41 +0000 autopkgtest (0.7.0) feisty; urgency=low * Many new features, including: - Xen virtualisation service works - Can build packages as necessary - Many bugfixes. - Documentation (moved from the wiki). -- Ian Jackson Thu, 22 Feb 2007 20:10:30 +0000 autopkgtest (0.6.1) edgy; urgency=low * autopkgtest-xenlvm: filter output from debootstrap to make the amount of output more reasonable. set -o pipefail. Create a timestamp file on image creation. Warn if ipv4 forwarding is turned off. * Add missing file `xen/justconfig' to bzr. * Fix typo in usage message in adt-virt-chroot. -- Ian Jackson Wed, 11 Oct 2006 15:42:18 +0100 autopkgtest (0.6.0) edgy; urgency=low * autopkgtest-xenlvm: new package with Xen/LVM management scripts productised. Not yet glued into autopkgtest proper. -- Ian Jackson Fri, 6 Oct 2006 20:45:41 +0100 autopkgtest (0.5.3) dapper; urgency=low * Rename package autodebtest => autopkgtest. * Remove a leftover debugging print from adt-virt-chroot. -- Ian Jackson Tue, 7 Feb 2006 18:02:08 +0000 autodebtest (0.5.2) dapper; urgency=low * New --output-dir option to adt-run. * Bugfixes (including new mandatory cwd argument to `execute' virt server command). -- Ian Jackson Thu, 2 Feb 2006 19:44:18 +0000 autodebtest (0.5.1) dapper; urgency=low * Manpages and minor fixes. -- Ian Jackson Tue, 24 Jan 2006 18:37:46 +0000 autodebtest (0.5.0) unstable; urgency=low * Initial release of (still largely proof-of-concept) automatic binary package testing framework. -- Ian Jackson Fri, 20 Jan 2006 17:56:55 +0000 autopkgtest-2.14.1/debian/compat0000644000000000000000000000000212321262032013450 0ustar 8 autopkgtest-2.14.1/debian/control0000644000000000000000000000370112321262032013656 0ustar Source: autopkgtest Maintainer: Autopkgtest team Uploaders: Ian Jackson , Martin Pitt Section: devel Priority: optional Standards-Version: 3.9.5 Build-Depends: debhelper (>= 8), python-debian, pyflakes, pep8 Vcs-Git: git://git.debian.org/git/autopkgtest/autopkgtest.git Vcs-Browser: http://anonscm.debian.org/gitweb/?p=autopkgtest/autopkgtest.git XS-Testsuite: autopkgtest Package: autopkgtest Architecture: all Depends: python (>= 2.6), debhelper, python-debian, apt-utils, pbuilder, ${misc:Depends} Suggests: autopkgtest-xenlvm, schroot, lxc, qemu-system, qemu-utils Description: automatic as-installed testing for Debian packages autopkgtest runs tests on binary packages. The tests are run on the package as installed on a testbed system (which may be found via a virtualisation or containment system). The tests are expected to be supplied in the corresponding Debian source package. . See adt-run(1) and /usr/share/doc/autopkgtest. Depending on which virtualization server you want to use, you need to install additional packages (schroot, lxc, qemu-system, or autopkgtest-xenlvm). Package: autopkgtest-xenlvm Architecture: all Depends: libadns1-bin, chiark-utils-bin, iproute, dmsetup, ${misc:Depends} Recommends: lvm2, debootstrap Suggests: autopkgtest Replaces: autopkgtest (<< 2.5.3~) Breaks: autopkgtest (<< 2.5.3~) Description: autopkgtest Xen/LVM2 based testbed snapshot system Machinery for setting up a Xen domain which can be resumed over and over again, discarding changes made each time. This can be useful for automated testing and other advanced techniques; autopkgtest is able to make use of this machinery for its virtualisation needs. . You will need a working Xen setup to make use of this software. Your network administrator will need to provide support for the testbeds' networking requirements. See the README for documentation. autopkgtest-2.14.1/debian/copyright0000644000000000000000000000076112321262032014211 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Files: * Copyright: Copyright (C) 2006-2014 Canonical Ltd. License: GPL-2+ 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. . The full text of the GPL is distributed as in /usr/share/common-licenses/GPL-2 on Debian systems. autopkgtest-2.14.1/debian/rules0000755000000000000000000000336212321262032013336 0ustar #!/usr/bin/make -f # # This file is part of autopkgtest # autopkgtest is a tool for testing Debian binary packages # # autopkgtest is Copyright (C) 2006 Canonical Ltd. # # 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 # the Free Software Foundation; either version 2 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 General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # See the file CREDITS for a full list of credits information (often # installed as /usr/share/doc/autopkgtest/CREDITS). VERSION=$(shell dpkg-parsechangelog | sed -n '/^Version:/ {s/^.*: //; p}') %: dh "$@" override_dh_auto_install: $(MAKE) install-here DESTDIR=$(CURDIR)/debian/autopkgtest $(MAKE) -C xen install \ DESTDIR=$(CURDIR)/debian/autopkgtest-xenlvm \ pkgname=autopkgtest-xenlvm \ cfg_suffix='' cd debian/autopkgtest-xenlvm/etc/userv/services.d && \ mv -f adt-xenlvm-testbed:dist adt-xenlvm-testbed # put our package version into adt-run for logging sed -i 's/@devel@/$(VERSION)/' debian/autopkgtest/usr/bin/adt-run override_dh_installinit: dh_installinit -p autopkgtest-xenlvm --onlyscripts --name=adtxenlvm -- defaults 19 override_dh_auto_test: tests/pyflakes tests/pep8 || true tests/adt-run NullRunnerNoRoot # necessary until we move to compat level 9 override_dh_pysupport: true autopkgtest-2.14.1/debian/tests/0000755000000000000000000000000012321262032013414 5ustar autopkgtest-2.14.1/debian/tests/control0000644000000000000000000000022712321262032015020 0ustar Tests: adt-run Depends: autopkgtest, python3 Restrictions: needs-root Tests-Directory: tests Tests: pyflakes Depends: pyflakes Tests-Directory: tests autopkgtest-2.14.1/doc/0000755000000000000000000000000012321262032011575 5ustar autopkgtest-2.14.1/doc/README.package-tests0000644000000000000000000002034212321262032015210 0ustar AUTOPKGTEST - DEFINING TESTS FOR PACKAGES ========================================= This document describes how the autopkgtest tester core (the program `adt-run') interprets and executes tests found in source packages. Overview -------- The source package provides a test metadata file debian/tests/control. This is a file containing zero or more RFC822-style stanzas, along these lines: Tests: fred bill bongo Restrictions: needs-root breaks-testbed This example defines three tests, called `fred', `bill' and `bongo'. The tests will be performed by executing debian/tests/fred, debian/tests/bill, etc. Each test program should, on success, exit with status 0 and print nothing to stderr; if a test exits nonzero, or prints to stderr, it is considered to have failed. The cwd of each test is guaranteed to be the root of the source package, which will have been unpacked but not built. HOWEVER note that the tests must test the INSTALLED version of the program. Tests may not modify the source tree (and may not have write access to it). If the file to be executed has no execute bits set, chmod a+x is applied to it (this means that tests can be added in patches without the need for additional chmod; contrast this with debian/rules). During execution of the test, the environment variable ADTTMP will point to a directory for the execution of this particular test, which starts empty and will be deleted afterwards (so there is no need for the test to clean up files left there). If tests want to create artifacts which are useful to attach to test results, such as additional log files or screenshots, they can put them into the directory specified by the ADT_ARTIFACTS environment variable. When using the --output-dir option, they will be copied into /artifacts/. Tests must declare all applicable Restrictions - see below. Control fields -------------- The fields which may appear in debian/tests/control stanzas are: Tests: [ ...] This field is mandatory. It names the tests which are defined by this stanza. All of the other fields in the same stanza apply to all of the named tests. Test names are separated by whitespace and should contain only characters which are legal in package names. It is permitted, but not encouraged, to use upper-case characters as well. Restrictions: [ ...] Declares some restrictions or problems with the tests defined in this stanza. Depending on the test environment capabilities, user requests, and so on, restrictions can cause tests to be skipped or can cause the test to be run in a different manner. Tests which declare unknown restrictions will be skipped. See below for the defined restrictions. Features: [ ...] Declares some additional capabilities or good properties of the tests defined in this stanza. Any unknown features declared will be completely ignored. See below for the defined features. Depends: Declares that the specified packages must be installed for the test to go ahead. This supports all features of dpkg dependencies (see https://www.debian.org/doc/debian-policy/ch-relationships.html), plus the following extensions: `@' stands for the package(s) generated by the source package containing the tests; each dependency (strictly, or-clause, which may contain `|'s but not commas) containing `@' is replicated once for each such binary package, with the binary package name substituted for each `@' (but normally `@' should occur only once and without a version restriction). `@builddeps@' will be replaced by the package's Build-Depends:, Build-Depends-Indep:, and "make". This is useful if you have many build dependencies which are only necessary for running the test suite and you don't want to replicate them in the test Depends:. However, please use this sparingly, as this can easily lead to missing binary package dependencies being overlooked if they get pulled in via build dependencies. If no Depends field is present, `Depends: @' is assumed. Note that the source tree's Build-Dependencies are _not_ necessarily installed, and if you specify any Depends, no binary packages from the source are installed unless explicitly requested. Tests-Directory: Replaces the path segment `debian/tests' in the filenames of the test programs with . Ie, the tests are run by executing /path/to/built/source/tree//. must be a relative path and is interpreted starting from the root of the built source tree. This allows tests to live outside the debian/ metadata area, so that they can more palatably be shared with non-Debian distributions. Any unknown fields will cause the whole stanza to be skipped. Defined restrictions -------------------- rw-build-tree The test(s) needs write access to the built source tree (so it may need to be copied first). Even with this restriction, the test is not allowed to make any change to the built source tree which (i) isn't cleaned up by debian/rules clean, (ii) affects the future results of any test, or (iii) affects binary packages produced by the build tree in the future. breaks-testbed The test, when run, is liable to break the testbed system. This includes causing data loss, causing services that the machine is running to malfunction, or permanently disabling services; it does not include causing services on the machine to temporarily fail. When this restriction is present the test will usually be skipped unless the testbed's virtualisation arrangements are sufficiently powerful, or alternatively if the user explicitly requests. needs-root The test script must be run as root. build-needed The tests need to be run from a built source tree. The test runner will build the source tree (honouring the source package's build dependencies), before running the tests. However, the tests are NOT entitled to assume that the source package's build dependencies will be installed when the test is run. Please use this considerately, as for large builds it unnecessarily builds the entire project when you only need a tiny subset (like the tests/ subdirectory). It is often possible to run "make -C tests" instead, or copy the test code to $ADTTMP and build it there with some custom commands. This cuts down the load on the Continuous Integration servers and also makes tests more robust as it prevents accidentally running them against the built source tree instead of the installed packages. allow-stderr Output to stderr is not considered a failure. This is useful for tests which write e. g. lots of logging to stderr. isolation-container The test wants to start services or open network TCP ports. This commonly fails in a simple chroot/schroot, so tests need to be run in their own container (e. g. adt-virt-lxc) or their own machine/VM (e. g. adt-virt-qemu or adt-virt-null). When running the test in a virtualization server which does not provide this (like adt-virt-schroot) it will be skipped. isolation-machine The test wants to interact with the kernel, reboot the machine, or other things which fail in a simple schroot and even a container. Those tests need to be run in their own machine/VM (e. g. adt-virt-qemu or adt-virt-null). When running the test in a virtualization server which does not provide this it will be skipped. Defined features ---------------- There are no currently defined Features. Source package header --------------------- To allow test execution environments to discover packages which provide tests, their source packages should have a `Testsuite:` header containing `autopkgtest` (which is currently the only defined value). Multiple values get comma separated, as usual in control files. This tag can be set manually in debian/control by adding XS-Testsuite: autopkgtest in the `Source:' paragraph. Future versions of dpkg-source might add this automatically when a debian/tests/control file is present. autopkgtest-2.14.1/doc/README.running-tests0000644000000000000000000001677612321262032015315 0ustar AUTOPKGTEST - RUNNING TESTS =========================== This document gives an overview how to run tests with autopkgtest. It does not cover each detail, please consult the individual manpages like adt-run(1), adt-virt-schroot(1), etc. for all available options. Ingredients ----------- To run a test you need the following: - A source package which defines tests in debian/tests/. See README.package-tests for how to define them. There are plenty of existing package tests in Debian/Ubuntu which you can use as examples and inspiration, just look for a source package with a "Testsuite: autopkgtest" header, or the automatic test running services in Debian (http://ci.debian.net/) and Ubuntu (e. g. for Ubuntu 14.04 LTS: https://jenkins.qa.ubuntu.com/view/Trusty/view/AutoPkgTest/) - A location for the source/tests: This can be a local source tree, a local .dsc, or "download with apt-get source". - Optionally some pre-built binary packages which should be tested. - A virtualization server: this creates the environment in which the test runs. Depending on how intrusive the test is this can provide various degrees of isolation, from "run on my local system" (fastest, but unsafe) to "run in a temporary virtual machine" (slowest, but highest possible isolation). These are described in detail below. The "adt-run" program is the main program to run tests which gets all these ingredients as arguments, in the following form: adt-run [options] --- [] Specifying tests and packages ----------------------------- All possible options are explained in the adt-run(1) manpage. This section shows the most common scenarios, with using "mysrc" as source package name. Note that specifying the virtualization server and its options is handled in the following section, and it is independent of specifying tests and packages, so it is merely abbreviated as here. - Run tests from the source package in the distribution. This calls "apt-get source mysrc" in the virt-server, thus will use whichever distribution/release that /etc/apt/sources.list configures: adt-run mysrc --- - Run tests from a local unbuilt source tree, using the binary packages from the distribution. This is useful if you are creating or fixing tests, but the actual binary packages are fine: adt-run -B --unbuilt-tree=packages/mysrc --- Note that you can abbreviate --unbuilt-tree= with just the directory with two(!) trailing slashes, i. e. adt-run -B packages/mysrc// --- - Run tests from a local built source tree, using the binary packages from the distribution: adt-run -B --built-tree=packages/mysrc --- Note that you can abbreviate --built-tree= with just the directory with one(!) trailing slash, i. e. adt-run -B packages/mysrc/ --- Built vs. unbuilt only makes a difference for tests which declare the "build-needed" restriction (see README.package-tests), in which case --built-tree avoids having to re-build the source in the virt-server. - Build a local source package in the virt-server, then run its tests against the built binaries. This is useful if you need to fix a bug in the actual packages to make the tests succeed: adt-run packages/mysrc// --- - Same as above, but with specifying a built source package instead of a source tree: adt-run packages/mysrc_*.dsc --- - Test new built binaries with a new source and avoid rebuilding them in virt-server. This is useful if you e. g. update a package to a new version and now want to check whether its tests still succeed: adt-run -B packages/*.deb packages/mysrc_*.dsc --- Output ------ Unless you specify some options, adt-run just writes the logging, test outputs, and test results to stdout/stderr and exits with code 0 on success, or some non-zero code if there were skipped or failed tests or problems with the virt-server. (See adt-run(1) for defined codes). For getting output files you have three choices: - If you just want the "testname: PASS/FAIL" results, use --summary-file=/path/to/summary.txt. - If you want the complete output of adt-run in a file, use -l /path/to/test.log (or the long option --log-file) - If you want the log file, the individual test stdout and stderr output, and built binaries (if any) in a directory, use -o /path/to/test-output/ (or the long option --output-dir). You can also combine these. Virtualization server --------------------- These virtualization servers are available: - adt-run ... --- schroot schroot-name Run tests in the specified schroot. You can use mk-sbuild(1) to conveniently create schroots, and run this as normal user if you configured schroot accordingly. This server is the fastest available that provides "proper" file system isolation and revert, but it does not provide enough isolation for tests that need to start services, reconfigure the network, or open TCP ports which are already open at the host. If your test does not need to do these things this is the recommended server, as schroots are also useful for other tasks like building packages with sbuild. See adt-virt-schroot(1) manpage. - adt-run ... --- lxc container-name Run tests in the specified LXC container. Containers provide full service and network isolation, but tests or packages cannot change the kernel or hardware configuration. If your test does not need that, this is the recommended server as it is faster than QEMU and works on all Linux architectures. container-name will be cloned or be called with a temporary overlay file system if you specify the -e (--ephemeral) option, thus it will never be modified and you can run several tests in parallel safely. Unless your test or architecture or RAM availability doesn't work with overlayfs, using -e is highly recommended for better performance. If your user can get root privileges with sudo, you can call adt-run as your normal user and specify -s (--sudo) so that the container can be started as root. See adt-virt-lxc(1) manpage. This also explains how to build containers. - adt-run ... --- qemu path/to/image Run tests with QEMU/KVM using the specified image. The image will be run with a temporary overlay file system, thus it will never be modified and you can run several tests in parallel safely. If your test needs a full machine including kernel/hardware access, this is the recommended runner; it provides complete system isolation, revert and breaks-testbed capabilities. But it is also the one with the biggest overhead and only works well on architectures with KVM acceleration (i. e. mostly x86). See adt-virt-qemu(1) manpage. This also explains how to build suitable images, and the requirements of the guest. - adt-run ... --- null This does not do any virtualization, but runs tests straight on the host. Beware that this will leave some clutter on your system (installed test or build dependency packages, configuration changes that the tests might make, etc.). It is not able to run tests with the "breaks-testbed" restriction. See adt-virt-null(1) manpage. - adt-run ... --- chroot /path/to/chroot Run tests in the specified chroot. You need to call adt-run as root for this. There is no automatic cleanup or revert for the chroot, so unless you can provide this by some other means, don't use this. autopkgtest-2.14.1/doc/README.virtualisation-server0000644000000000000000000002455312321262032017046 0ustar AUTOPKGTEST VIRTUALISATION SERVICE INTERFACE ============================================ The virtualisation regime provides a single executable program which is used by the tester core to request virtualisation facilities. The server has the following states: * Closed: there is no particular testbed. This is the initial state. * Open: the testbed is running and can be communicated with (and, if applicable, is not being used by any other concurrent test run) Note that these are the states of the server, in the tester core to server protocol. The actual testbed will probably have more states, including for example Closed, Open (and therefore busy), Modified, Broken, etc. Ideally the virtualisation regime will prevent multiple concurrent uses of the same testbed; the tester core is allowed to assume that either its caller or the virtualisation regime will ensure that it has exclusive use of the testbed. The server program is invoked with the argument --debian-package-testing and then proceeds to speak a protocol on its stdin/stdout. The protocol is line-based. In the future other ways of invoking the server may be defined; the current server should of course reject such invocations. Protocol -------- * Initial response from regime server: ok This response is also the response from any of the commands listed below, unless otherwise specified. * Command capabilities response, for example ok gnomovision-server revert ... where the words after ok are features that not all regimes support. Valid in all states. Currently defined capabilities: + revert The "revert" command is supported. The base semantics are that the following aspects of the testbed are reverted: - the set of installed packages - the contents of the root filesystem, BUT - NOT the contents of /home - NOT the contents of /tmp - NOT the set of running processes + revert-full-system The "revert" and "close" commands will completely revert the testbed to the state after "open". This reversion is done with some kind of virtualisation, and includes (without limitation) the contents of all the testbed filesystems, its running processes, network configuration, etc. etc. etc. + revert The testbed will actually revert when it is closed. If this feature is not mentioned then changes to the testbed are persistent (so destructive tests should not be performed). + root-on-testbed Commands specified by `execute' will be run as root on the testbed, and copyup/copydown will have full access to the filesystem. Unless this capability is advertised, root access is not (or may not be) available. + suggested-normal-user= The caller is advised that would be a good user to use for running tests (and doing other operations) when root is not required. The advertised account will exist on the testbed already. Several suggested-normal-user= capabilities (with distinct s) may be advertised in which case more than one such user is available. + downtmp-host= If the testbed has the ability of setting up a shared directory with the host, this gives the host directory path of the "downtmp" directory as reported by the virt server's hook_downtmp() function. + downtmp-shared-fifo The shared downtmp-host directory supports FIFOs between the host and testbed. Only relevant if downtmp-host is set. + isolation-container The testbed runs in a Linux cgroup/container (nspawn, LXC, docker, etc.) and thus tests have full control over starting services and opening network ports. + isolation-machine The testbed runs in a complete (virtual or real) machine on its own (qemu or bare metal) and thus tests have full control over starting services, opening network ports, interacting with the kernel (e. g. modprobe), rebooting, and accessing hardware. * Command open response ok Checks that the testbed is present and reserves it (waiting for other uses of the testbed to finish first, if necessary). State: Closed to Open. is a pathname on the testbed which can be used freely by the test scripts and which is valid until the next `close', `revert' or `quit'. * Command revert response ok Restores the testbed, undoing all of the changes made so far. State: Open, remains Open. Only available if the `revert' capability is advertised. If possible, the testbed's set of running processes will also be restored to the initial state. * Command close Stops the testbed and undoes filesystem changes (if `revert' is advertised). State: Open to Closed. * Commands print-auxverb-command print-shstring-command response ok ,,... [ ...] Prints a command that can be executed by the caller to run a command on the testbed. The command has the following properties (which are, for example, satisfiable when the virt server uses `env' `ssh' or `dchroot'): - The caller is expected to url-decode and each , append the command to be run on the testbed, and call exec on the results. - For the command provided by `print-auxverb-command', the supplied additional arguments to command will be interpreted as the command and arguments to be run on the testbed (as env and nice interpret their arguments) - The command provided by `print-shstring-command', should be invoked with exactly one additional argument which should be a legal shell script. It will be fed to sh -c on the testbed (this is the way ssh interprets its arguments). - The testbed program's stdin, stdout and stderr will be plumbed through to the stdin, stdout and stderr passed to ; this may involve fd passing, or indirection via pipes or sockets. The testbed program may not assume that the descriptors it receives are seekable even if the originals are. - It is not defined whether other file descriptors, environment variables, and process properties in general, are inherited by the testbed command. - may exit as soon as the testbed command does, or it may wait until every copy of the stdout and stderr descriptors passed to the testbed command have been closed on the testbed. - 's exit status will be that of the testbed command if the latter exits with a value from 0..125. If the testbed command dies due to a signal, then either (i) will exit with the signal number with 128 added, or (ii) will die with the same signal (although it may fail to dump core even if the testbed program did), or (iii) will fail. If fails it will exit 126, 127, 254, or 255; of course may die to a some signals other than because the testbed program died with the same signal. - The caller may run several of these at once, subject to limitation of resources (eg, file descriptors, processes) - The behaviour if a command is running when the testbed is closed or reverted is not defined. However, if the testbed advertises `revert' then after the testbed is closed or reverted any such invocation will not have any further effect on the testbed. - Sending signals in an attempt to terminate it may not terminate all of the relevant processes and may not have any effect on the testbed. - The behaviour if no testbed command is specified (ie, if just the specified and s is passed to exec) is not defined. - Currently no s are defined; they work the same way as capabilities in that unrecognised ones should be ignored by the caller. The response (ie, the ) is only valid between `open' and the next subsequent `close', `revert' or `quit'. Using it at other times has undefined behaviour. * Command execute ,,... \ [ ...] response ok Executes the command (args separated by commas, everything including filenames and env var names and values url-encoded). stdin, stdout, stderr are files on the testbed (must be files, not pipes). Currently defined keyword arguments: env== Sets the environment variable to . debug=- Arranges to pass fd the testbed command, and send all output to it to the fd as passed by the virt server's caller. may be 1 or 2, in which case no output will be written to the or files. If this feature is available, execute-debug will be advertised. Only one such plumbing is available. timeout= Ensures that the whole execute command does not take more than . If it does, the response is timeout instead of `ok '. An effort will be made to kill the processes on the testbed but this is not guaranteed to be possible or successful. After an `execute' has timed out, the testbed should probably be reverted with `revert' if that facility is available. * Commands copydown copyup Either 1. Both paths end in `/', in which case the source must be an existing directory. The destination directory is replaced with a copy as if made by cp -dR --preserve=mode,timestamps except across the testbed boundary. 2. Neither path ends in `/', in which case the source must be an existing file. The data from the source file is written to the destination as if via shell redirection; except that if for copydown of an executable file, `chmod +x' is run on the destination file after the copy. Both filenames are url-encoded. * Command quit response ok and then the regime server exits with status 0, after closing the testbed if applicable. * Command shell response: one of ok not supported by virt server Runs a shell in the testbed (as root, if available), while the testbed is open. This is intended for interactively debugging problems with tests. The virt server has to provide a hook_shell() function for this, otherwise this command is not supported. On any error including signals to the regime server or EOF on stdin the testbed is unreserved and restored to its original state (ie, closed), and the regime server will print a message to stderr (unless it is dying with a signal). autopkgtest-2.14.1/lib/0000755000000000000000000000000012321262032011576 5ustar autopkgtest-2.14.1/lib/VirtSubproc.py0000644000000000000000000004540712321262032014444 0ustar # VirtSubproc is part of autopkgtest # autopkgtest is a tool for testing Debian binary packages # # autopkgtest is Copyright (C) 2006-2007 Canonical Ltd. # # 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 # the Free Software Foundation; either version 2 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 General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # See the file CREDITS for a full list of credits information (often # installed as /usr/share/doc/autopkgtest/CREDITS). import __main__ import sys import os import string import urllib import signal import subprocess import traceback import errno import time import re import pipes import socket import shutil debuglevel = None progname = "" devnull_read = file('/dev/null', 'r') caller = __main__ copy_timeout = int(os.getenv('ADT_VIRT_COPY_TIMEOUT', '300')) downtmp = None down = None downkind = None downs = None cleaning = False in_mainloop = False class Quit: def __init__(self, ec, m): self.ec = ec self.m = m class Timeout(RuntimeError): pass def alarm_handler(*a): raise Timeout() def timeout_start(to): signal.signal(signal.SIGALRM, alarm_handler) signal.alarm(to) def timeout_stop(): signal.alarm(0) class FailedCmd: def __init__(self, e): self.e = e def debug(m): if not debuglevel: return print >> sys.stderr, progname + ": debug:", m def bomb(m): if in_mainloop: raise Quit(12, progname + ": failure: %s" % m) else: sys.stderr.write(m) sys.stderr.write('\n') sys.exit(1) def ok(): print 'ok' def cmdnumargs(c, ce, nargs=0, noptargs=0): if len(c) < 1 + nargs: bomb("too few arguments to command `%s'" % ce[0]) if noptargs is not None and len(c) > 1 + nargs + noptargs: bomb("too many arguments to command `%s'" % ce[0]) def cmd_capabilities(c, ce): cmdnumargs(c, ce) return caller.hook_capabilities() + ['execute-debug'] def cmd_quit(c, ce): cmdnumargs(c, ce) raise Quit(0, '') def cmd_close(c, ce): cmdnumargs(c, ce) if not downtmp: bomb("`close' when not open") cleanup() def cmd_print_auxverb_command(c, ce): return print_command('auxverb', c, ce) def cmd_print_shstring_command(c, ce): return print_command('shstring', c, ce) def print_command(which, c, ce): global downs cmdnumargs(c, ce) if not downtmp: bomb("`print-%s-command' when not open" % which) cl = downs[which] if not len(cl): cl = ['sh', '-c', 'exec "$@"', 'x'] + cl return [','.join(map(urllib.quote, cl))] def preexecfn(): caller.hook_forked_inchild() def execute_raw(what, instr, timeout, *popenargs, **popenargsk): debug(" ++ %s" % string.join(popenargs[0])) sp = subprocess.Popen(preexec_fn=preexecfn, *popenargs, **popenargsk) if instr is None: popenargsk['stdin'] = devnull_read timeout_start(timeout) (out, err) = sp.communicate(instr) timeout_stop() if err: bomb("%s unexpectedly produced stderr output `%s'" % (what, err)) status = sp.wait() return (status, out) def execute(cmd_string, cmd_list=[], downp=False, outp=False, timeout=0): cmdl = cmd_string.split() if downp: perhaps_down = downs['auxverb'] else: perhaps_down = [] if outp: stdout = subprocess.PIPE else: stdout = None cmd = cmdl + cmd_list if len(perhaps_down): cmd = perhaps_down + cmd (status, out) = execute_raw(cmdl[0], None, timeout, cmd, stdout=stdout) if status: bomb("%s%s failed (exit status %d)" % ((downp and "(down) " or ""), cmdl[0], status)) if outp and out and out[-1] == '\n': out = out[:-1] return out class timeout: def __init__(self, secs, exit_msg=None): '''Context manager that times out after given number of seconds. If exit_msg is given, the program bomb()s with that message, otherwise it raises a Timeout exception. ''' self.secs = secs self.exit_msg = exit_msg def __enter__(self): timeout_start(self.secs) def __exit__(self, type_, value, traceback): timeout_stop() if type_ is Timeout and self.exit_msg: bomb(self.exit_msg) return True return False def get_unix_socket(path): '''Open a connected client socket to given Unix socket with a 5s timeout''' s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) with timeout(5, 'Timed out waiting for %s socket\n' % path): while True: try: s.connect(path) break except socket.error: continue return s def expect(sock, search_str, timeout_sec, description=None): debug('expect: "%s"' % search_str) what = '"%s"' % (description or search_str or 'data') out = b'' with timeout(timeout_sec, description and ('timed out waiting for %s' % what) or None): while True: time.sleep(0.1) block = sock.recv(4096) #debug('expect: got block: %s' % block) out += block if search_str is None or search_str in out: debug('expect: found "%s"' % what) break def cmd_open(c, ce): global downtmp cmdnumargs(c, ce) if downtmp: bomb("`open' when already open") caller.hook_open() opened1() downtmp = caller.hook_downtmp() return opened2() def downtmp_mktemp(): d = execute('mktemp -d /tmp/adt-run.XXXXXX', [], downp=True, outp=True) execute('chmod 1777', [d], downp=True) return d def downtmp_remove(): global downtmp execute('rm -rf --', [downtmp], downp=True) perl_quote_re = re.compile('[^-+=_.,;:() 0-9a-zA-Z]') def perl_quote_1chargroup(m): return '\\x%02x' % ord(m.group(0)) def perl_quote(s): return '"' + perl_quote_re.sub(perl_quote_1chargroup, s) + '"' def opened1(): global down, downkind, downs debug("downkind = %s, down = %s" % (downkind, str(down))) if downkind == 'auxverb': downs = {'auxverb': down, 'shstring': down + ['sh', '-c']} elif downkind == 'shstring': downs = {'shstring': down, 'auxverb': ['perl', '-e', ''' @cmd=(''' + (','.join(map(perl_quote, down))) + '''); my $shstring = pop @ARGV; s/'/'\\\\''/g foreach @ARGV; push @cmd, "'$_'" foreach @ARGV; my $argv0=$cmd[0]; exec $argv0 @cmd; die "$argv0: $!"''']} debug("downs = %s" % str(downs)) def opened2(): global downtmp, downs debug("downtmp = %s" % (downtmp)) return [downtmp] def cmd_revert(c, ce): global downtmp cmdnumargs(c, ce) if not downtmp: bomb("`revert' when not open") if not 'revert' in caller.hook_capabilities(): bomb("`revert' when `revert' not advertised") caller.hook_revert() opened1() downtmp = caller.hook_downtmp() return opened2() def cmd_execute(c, ce): cmdnumargs(c, ce, 5, None) if not downtmp: bomb("`execute' when not open") debug_re = re.compile('debug=(\d+)\-(\d+)$') debug_g = None timeout = 0 envs = [] for kw in ce[6:]: if kw.startswith('debug='): if debug_g: bomb("multiple debug= in execute") m = debug_re.match(kw) if not m: bomb("invalid execute debug arg `%s'" % kw) debug_g = m.groups() elif kw.startswith('timeout='): try: timeout = int(kw[8:], 0) except ValueError: bomb("invalid timeout arg `%s'" % kw) elif kw.startswith('env='): es = kw[4:] eq = es.find('=') if eq <= 0: bomb("invalid env arg `%s'" % kw) envs.append((es[:eq], es[eq + 1:])) else: bomb("invalid execute kw arg `%s'" % kw) rune = 'set -e; exec ' stdout = None tfd = None if debug_g: rune += " 3>&1" for ioe in range(3): rune += " %d%s%s" % (ioe, '<>'[ioe > 0], pipes.quote(ce[ioe + 2])) if debug_g: (tfd, hfd) = m.groups() tfd = int(tfd) rune += " %d>&3 3>&-" % tfd stdout = int(hfd) rune += '; ' rune += 'cd %s; ' % pipes.quote(ce[5]) for e in envs: (en, ev) = map(urllib.unquote, e) rune += "%s=%s " % (en, pipes.quote(ev)) cmdl = map(urllib.unquote, ce[1].split(',')) rune += 'exec ' + ' '.join(map(pipes.quote, cmdl)) cmdl = downs['shstring'] + [rune] stdout_copy = None try: if isinstance(stdout, int): stdout_copy = os.dup(stdout) try: (status, out) = execute_raw('target-cmd', None, timeout, cmdl, stdout=stdout_copy, stdin=devnull_read, stderr=subprocess.PIPE) except Timeout: raise FailedCmd(['timeout']) finally: if stdout_copy is not None: os.close(stdout_copy) if out: bomb("target command unexpected produced stdout" " visible to us `%s'" % out) return [str(status)] def get_downtmp_host(): '''Return host directory of the testbed's downtmp dir, if supported''' for cap in caller.hook_capabilities(): if cap.startswith('downtmp-host='): return cap.split('=', 1)[1] return None def copytree(src, dst): '''Like shutils.copytree(), but merges with existing dst''' if not os.path.exists(dst): shutil.copytree(src, dst, symlinks=True) return for f in os.listdir(src): fsrc = os.path.join(src, f) subprocess.check_call(['cp', '-at', dst, fsrc]) def copyup_shareddir(tb, host, is_dir, downtmp_host): debug('copyup_shareddir: tb %s, host %s, is_dir %s, downtmp_host %s' % ( tb, host, is_dir, downtmp_host)) timeout_start(copy_timeout) try: tb_tmp = None if tb.startswith(downtmp): # translate into host path tb = downtmp_host + tb[len(downtmp):] else: tb_tmp = os.path.join(downtmp, os.path.basename(host)) debug('copyup_shareddir: tb path %s is not already in downtmp, ' 'copying to %s' % (tb, tb_tmp)) cp = subprocess.Popen(downs['auxverb'] + ['cp', '-a', tb, tb_tmp], preexec_fn=preexecfn) cp.communicate() if cp.returncode != 0: bomb('copyup_shareddir: cp -a exited with code %i' % cp.returncode) # translate into host path tb = os.path.join(downtmp_host, os.path.basename(host)) if tb == host: tb_tmp = None else: debug('copyup_shareddir: tb(host) %s is not already at ' 'destination %s, copying' % (tb, host)) if is_dir: copytree(tb, host) else: shutil.copy(tb, host) if tb_tmp: (is_dir and shutil.rmtree or os.unlink)(tb_tmp) finally: timeout_stop() def copydown_shareddir(host, tb, is_dir, downtmp_host): debug('copydown_shareddir: host %s, tb %s, is_dir %s, downtmp_host %s' % ( host, tb, is_dir, downtmp_host)) host = os.path.normpath(host) tb = os.path.normpath(tb) downtmp_host = os.path.normpath(downtmp_host) timeout_start(copy_timeout) try: host_tmp = None if host.startswith(downtmp_host): # translate into tb path host = downtmp + host[len(downtmp_host):] else: host_tmp = os.path.join(downtmp_host, os.path.basename(tb)) if is_dir: shutil.rmtree(host_tmp, ignore_errors=True) shutil.copytree(host, host_tmp, symlinks=True) else: shutil.copy(host, host_tmp) # translate into tb path host = os.path.join(downtmp, os.path.basename(tb)) if host == tb: host_tmp = None else: subprocess.call(downs['auxverb'] + ['rm', '-rf', tb], preexec_fn=preexecfn) cp = subprocess.Popen(downs['auxverb'] + ['cp', '-a', host, tb], preexec_fn=preexecfn) cp.communicate() if cp.returncode != 0: bomb('copydown_shareddir: cp -a exited with code %i' % cp.returncode) if host_tmp: (is_dir and shutil.rmtree or os.unlink)(host_tmp) finally: timeout_stop() def copyupdown(c, ce, upp): cmdnumargs(c, ce, 2) if not downtmp: bomb("`copyup'/`copydown' when not open") isrc = 0 idst = 1 ilocal = 0 + upp iremote = 1 - upp wh = ce[0] sd = c[1:] if not sd[0] or not sd[1]: bomb("%s paths must be nonempty" % wh) dirsp = sd[0][-1] == '/' if dirsp != (sd[1][-1] == '/'): bomb("% paths must agree about directoryness" " (presence or absence of trailing /)" % wh) # if we have a shared directory, we just need to copy it from/to there; in # most cases, it's testbed end is already in the downtmp dir downtmp_host = get_downtmp_host() if downtmp_host: if upp: copyup_shareddir(sd[0], sd[1], dirsp, downtmp_host) else: copydown_shareddir(sd[0], sd[1], dirsp, downtmp_host) return deststdout = devnull_read srcstdin = devnull_read remfileq = pipes.quote(sd[iremote]) if not dirsp: rune = 'cat %s%s' % ('><'[upp], remfileq) if upp: deststdout = file(sd[idst], 'w') else: srcstdin = file(sd[isrc], 'r') status = os.fstat(srcstdin.fileno()) if status.st_mode & 0111: rune += '; chmod +x -- %s' % (remfileq) localcmdl = ['cat'] else: taropts = [None, None] taropts[isrc] = '-c .' taropts[idst] = '-p -x --no-same-owner' rune = 'cd %s; tar %s -f -' % (remfileq, taropts[iremote]) if upp: try: os.mkdir(sd[ilocal]) except (IOError, OSError), oe: if oe.errno != errno.EEXIST: raise else: rune = ('if ! test -d %s; then mkdir -- %s; fi; ' % ( remfileq, remfileq) ) + rune localcmdl = ['tar', '-C', sd[ilocal]] + ( ('%s -f -' % taropts[ilocal]).split() ) rune = 'set -e; ' + rune downcmdl = downs['shstring'] + [rune] if upp: cmdls = (downcmdl, localcmdl) else: cmdls = (localcmdl, downcmdl) debug(str(["cmdls", str(cmdls)])) debug(str(["srcstdin", str(srcstdin), "deststdout", str(deststdout), "devnull_read", devnull_read])) subprocs = [None, None] debug(" +< %s" % string.join(cmdls[0])) subprocs[0] = subprocess.Popen(cmdls[0], stdin=srcstdin, stdout=subprocess.PIPE, preexec_fn=preexecfn) debug(" +> %s" % string.join(cmdls[1])) subprocs[1] = subprocess.Popen(cmdls[1], stdin=subprocs[0].stdout, stdout=deststdout, preexec_fn=preexecfn) subprocs[0].stdout.close() timeout_start(copy_timeout) for sdn in [1, 0]: debug(" +" + "<>"[sdn] + "?") status = subprocs[sdn].wait() if not (status == 0 or (sdn == 0 and status == -13)): timeout_stop() bomb("%s %s failed, status %d" % (wh, ['source', 'destination'][sdn], status)) timeout_stop() def cmd_copydown(c, ce): copyupdown(c, ce, False) def cmd_copyup(c, ce): copyupdown(c, ce, True) def cmd_shell(c, ce): cmdnumargs(c, ce, 4) if not downtmp: bomb("`shell' when not open") try: caller.hook_shell(c[1], c[2], c[3], c[4]) except AttributeError: raise FailedCmd(['not supported by virt server']) def command(): sys.stdout.flush() while True: try: ce = sys.stdin.readline() break except IOError as e: if e.errno == errno.EAGAIN: time.sleep(0.1) continue else: raise if not ce: bomb('end of file - caller quit?') ce = ce.rstrip().split() c = map(urllib.unquote, ce) if not c: bomb('empty commands are not permitted') debug('executing ' + string.join(ce)) c_lookup = c[0].replace('-', '_') try: f = globals()['cmd_' + c_lookup] except KeyError: bomb("unknown command `%s'" % ce[0]) try: r = f(c, ce) if not r: r = [] r.insert(0, 'ok') except FailedCmd, fc: r = fc.e print string.join(r) signal_list = [ signal.SIGHUP, signal.SIGTERM, signal.SIGINT, signal.SIGPIPE] def sethandlers(f): for signum in signal_list: signal.signal(signum, f) def cleanup(): global downtmp, cleaning debug("cleanup...") sethandlers(signal.SIG_DFL) cleaning = True if downtmp: caller.hook_cleanup() cleaning = False downtmp = False def error_cleanup(): try: ok = False try: cleanup() ok = True except Quit, q: print >> sys.stderr, q.m except: print >> sys.stderr, "Unexpected cleanup error:" traceback.print_exc() print >> sys.stderr, '' if not ok: print >> sys.stderr, ("while cleaning up" " because of another error:") except: pass def prepare(): global downtmp downtmp = None def handler(sig, *any): cleanup() os.kill(os.getpid(), sig) sethandlers(handler) def mainloop(): global in_mainloop in_mainloop = True try: while True: command() except Quit, q: error_cleanup() if q.m: print >> sys.stderr, q.m sys.exit(q.ec) except: error_cleanup() print >> sys.stderr, "Unexpected error:" traceback.print_exc() sys.exit(16) finally: in_mainloop = False def main(): ok() prepare() mainloop() autopkgtest-2.14.1/run-from-checkout0000755000000000000000000000034512321262032014330 0ustar #!/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" adt-run "$@" autopkgtest-2.14.1/runner/0000755000000000000000000000000012321262032012341 5ustar autopkgtest-2.14.1/runner/adt-run0000755000000000000000000022741212321262032013651 0ustar #!/usr/bin/python # # adt-run is part of autopkgtest # autopkgtest is a tool for testing Debian binary packages # # autopkgtest is Copyright (C) 2006-2007, 2013 Canonical Ltd. # # 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 # the Free Software Foundation; either version 2 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 General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # See the file CREDITS for a full list of credits information (often # installed as /usr/share/doc/autopkgtest/CREDITS). import signal import optparse import tempfile import sys import subprocess import traceback import urllib import string import re import os import errno import fnmatch import shutil import copy import time import atexit import pipes try: from debian import deb822, debian_support deb822, debian_support # pyflakes except ImportError: from debian_bundle import deb822, debian_support from optparse import OptionParser signal.signal(signal.SIGINT, signal.SIG_DFL) # undo stupid Python SIGINT thing try: our_base = os.environ['AUTOPKGTEST_BASE'] + '/lib' except KeyError: our_base = '/usr/share/autopkgtest/python' sys.path.insert(1, our_base) #---------- global variables tmp = None # pathstring on host testbed = None # Testbed shared_downtmp = None # testbed's downtmp on the host, if supported opts = None # optparse options errorcode = 0 # exit status that we are going to use timeouts = {'short': 100, 'copy': 300, 'install': 3000, 'test': 10000, 'build': 100000} binaries = None # Binaries (.debs we have registered) build_essential = ['build-essential'] dpkg_buildpackage = 'dpkg-buildpackage -us -uc -b' os.putenv('APT_LISTBUGS_FRONTEND', 'none') # do not consider using apt-listbugs os.putenv('APT_LISTCHANGES_FRONTEND', 'none') # do not consider using apt-listchanges # # logging/error functions # summary_stream = None def error(message): '''Write an error message to stderr''' print >> sys.stderr, message def debug(message, minlevel=0, timestamp=False): '''Write a debug message to stderr according to --quiet''' if opts.debuglevel < minlevel: return p = 'adt-run' if minlevel: p += str(minlevel) if timestamp: p += ' [%s]' % time.strftime('%Y-%m-%d %H:%M:%S') p += ': ' log_msg(message, p) def log_msg(message, prefix=''): '''Write a string to stderr according to --quiet''' if opts.quiet: return for line in message.rstrip('\n').splitlines(): s = prefix + line if not opts.quiet: print >> sys.stderr, s def log_file(path, minlevel=0): '''Write a file to stderr according to --quiet''' if opts.debuglevel < minlevel or opts.quiet: return rc = subprocess.call(['cat', path], stdout=sys.stderr) if rc: bomb('cat failed for %s, exit code %d' % (path, rc)) def debug_subprocess(what, argv, script=None): '''Log a subprocess call for debugging''' o = '$ ' + what + ':' if argv is not None: ol = [] for x in argv: if x is script: x = '