|
News
Aboutpactest is a test suite for the Arch Linux package manager pacman. It has a rather high level view of operations performed by pacman: it automatically creates a test environment based on a test case file description, then it runs pacman, and finally it checks the results of test according to a predefined set of rules. It is written in Python and provides most of what can be found in pacman's code to create Arch Linux packages or read and write databases entries. pactest generates the test environment in the subdirectory root which is created in the current working directory by default. The directory structure of the test environment is defined as follows:
Each test case is defined in a separate file that is sourced in order to set the environment. Test cases are Python scripts too. Test case sample sample.py: self.description = "Install a package" # Create a package object, and add two files to it p = pmpkg("dummy", "1.0-3") p.files = ["bin/dummy", "usr/man/man1/dummy.1"] # Include the package in the test environment self.addpkg(p) # Set the pacman command to be performed when running the test self.args = "-A dummy-1.0-3.pkg.tar.gz" # Define a set of rules to decide the test status upon completion: # - we want pacman to return 0 as its exit code # - package "dummy" must exist in the local database # - all files from the package must exist in the filesystem self.addrule("PACMAN_RETCODE=0") self.addrule("PKG_EXIST=dummy") for f in p.files: self.addrule("FILE_EXIST=%s" % f) Running the test case is as simple as calling: ./pactest.py --test=sample.py More documentation about test cases creation is available in the pactest archive (see the README file). DownloadLatest release is pactest 0.3. Archives are available here. Installationpactest needs the pacman binary used for test to be run in a fakeroot environment. By default, pacman refuses to run in such an environment. If you use the latest CVS pacman version (namely pacman 3.0 developement code), you can strip fakeroot detection code by recompiling the code as follows: ./configure --disable-fakeroot make If you use pacman 2.9 series, this can be done by applying the patch provided in pactest archive (since 0.3): cd /path/to/pacman-2.9.8 patch -Np1 -i pacman-2.9.7-fakeroot.patch export CFLAGS=-DNOFAKEROOT ./configure make pactest does not need any file to be installed. Simply extract the tarball and run the pactest.py script. Note: make sure the pacman binary you need to test is reachable through your PATH environment parameter, or use the --pacman option on the command line to specify the binary location. ContactThis test suite is still under development, so feel free to report any bugs or to submit suggestions to me. Copyright
|
Last update: 06/03/10, Aurelien Foret <orelien@chez.com>