summaryrefslogtreecommitdiffstats
path: root/test/pacman/pmtest.py
AgeCommit message (Collapse)AuthorFilesLines
2014-01-06Update copyright years for 2014Allan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-21Use the 'configure'd PYTHON to run pactest.Jeremy Heiner1-2/+0
Use the 'configure'd PYTHON to run pactest instead of the one hard-coded (with '#!') in pactest.py. Also remove useless '#!' from non-main .py files. Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14Use dict iteration methods common to both Python 2 and 3.Jeremy Heiner1-3/+3
The .items, .keys, and .values methods in Python 2 make copies, so the test framework uses the .iter* flavors of those methods. But in Python 3 those .iter* (and even the 2.7 .view*) flavors are removed and the original methods return views. Measurements were taken under Python2 to see what impact the copying had, and there was none. Thus it is not worth the effort to avoid. Reported as a compatibility issue by 2to3. Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14Use Python's "0o#" octal literal instead of deprecated "0#".Jeremy Heiner1-1/+1
Reported as a compatibility issue by 2to3. Signed-off-by: Jeremy Heiner <ScalaProtractor@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14Use "exec" instead of "execfile" (deprecated in Python 3).Jeremy Heiner1-1/+2
This was the only compatibility issue reported by "python2 -3". Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21convert pactest to TAP outputAndrew Gregory1-12/+10
Each test produces a single TAP result with the rules run in a sub-test. This reduces output when run under automake and makes it possible to continue setting expectfailure at the test level rather than per-rule. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21pactest: treat unknown rules as failuresAndrew Gregory1-3/+1
Tests should only be skipped when they aren't relevant, not when the test itself is bad. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-29pmtest: set LC_ALL=C in subprocess.callAndrew Gregory1-1/+1
LC_ALL=C is required to force pacman's output to English for tests that rely on that output, but setting it in Makefile.am results in those tests breaking under different locales when pactest.py is run directly. This will also ease an eventual transition to python3 which LC_ALL=C causes to default to ascii encoded strings, creating problems for tests with unicode strings. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10pmpkg: add missing directories to test packagesAndrew Gregory1-0/+3
Several tests require complete file lists in order to provide accurate results. These can be non-obvious. Adding missing parent directories helps insure the integrity of tests against human error. Filling in parent directories also allows us to check that file lists are actually valid. There didn't seem to be a good place to do this that was always guaranteed to be run, so this adds a finalize() function to packages that will always be run before the package is actually used to allow for this type of tidying. Fixes FS#30723 Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-16pmtest: install filesystem entries before packagesAndrew Gregory1-3/+3
Installing filesystem entries first allows the filesystem to provide a symlink to a directory. Packages will then be able to use the symlink as if it were a directory instead of causing an error. For example: self.filesystem = ["dir/", "link -> dir/"] pkg = pmpkg("pkg1") pkg.files = ["link/file"] self.addpkg2db("local", pkg) Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-07Print a warning if fakechroot is not foundChirantan Ekbote1-1/+3
Fixes FS#33551. Signed-off-by: Chirantan Ekbote <chirantan.ekbote@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-28Make path to ldconfig configurableAllan McRae1-3/+4
The FHS (2.3) says having ldconfig in /sbin is optional and it is usually located in /usr/sbin. So /sbin/ldconfig should not be hard coded in pacman. Instead, provide a configure option --with-ldconfig that defaults to the current path. Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-28pactest: handle non-default scriptlet shellsAllan McRae1-2/+8
pacman can be configured to use a different shell than /bin/sh for scriplets. Pass the cnfigured value to the pactest suite and make the necessary "copy" of the shell in the test root. Also update all copyright years in the pactest suite. Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-28Revert execvp and related commitsAllan McRae1-19/+2
This reverts commit 4a8c2852a887d2b1aaa43be3071ab586eb24b9e3. This reverts commit 993700bc6b12cd291544d2a22845f480e8a7925e. This reverts commit bb4d2b72c1d35ab9d65d632be0dcaf00cfa7d600. This reverts commit 60b192e3836a150eb6950ce52241efebbee00f11. Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-17pmtest: resolve path to scriptlet shellAllan McRae1-2/+19
In order to support a variety of values for the --with-scriptlet-shell configure flag, pmtest has to be aware of what kind of path was passed, be it an absolute path or a fragment for a path lookup. For absolute paths, leave the path alone. For fragments, search the PATH environment var for the resolved path to the binary. In both cases, join the resultant path to the root directory defined for the test, not a pre-determined bin directory. Fixes FS#31552. With-contribution-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2012-09-18Merge branch 'maint'Dan McGee1-1/+4
2012-09-18pactest: allow running with valgrind from any directoryAllan McRae1-1/+4
When using the --valgrind flag with the pactest.py script, the path to the suppression file relies on the script being called from the source root directory. Construct the path from the scripts location to allow it to be called from directory. Dan: style cleanup. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-09Point python shebangs at python2Allan McRae1-1/+1
Python PEP-394 states that all python code should point at the python2 or python3 symlinks at maintain cross-distro compatibility. Note that this does not matter when calling these scripts using "make check" as they are explictly called using the detected python version. As this only affects manually calling these scripts, I have not had configure/make replace the shebangs. Signed-off-by: Allan McRae <allan@archlinux.org>
2011-09-01pactest: remove PACMAN_OUTPUT from ldconfig testsDan McGee1-1/+6
This removes the last usages of this rule that aren't explicitly looking at real output from pacman. Notably, these tests depended on one particular debug logger not ever being changed, which is too fragile, not to mention doesn't work at all with --nolog. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18Fix trailing whitespace in whole codebaseDan McGee1-2/+2
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-02pactest: use subprocess module instead of os.systemDan McGee1-23/+23
This is more in line with standard Python practice, and makes keyboard interrupts behave a lot more sanely. It also prevents the useless spawning of a shell as well as simplifies the command building and working directory stuff. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-30pactest: create packages in memoryDan McGee1-7/+2
This is similar to what was just done for the sync databases. Move a few pieces around so we never need to actually write out the filesystem to create a package, and simply stream the tarfile out from the data we've collected. Once again, a few newline addition hacks and other things have to be left in place in order not to break everything; this time however most of the assumptions are in pactest and not libalpm. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24pactest: generate sync DB's in memoryDan McGee1-18/+4
Sync database are no longer exploded on the filesystem. Rework the logic used to generate our test databases so we can create them completely in memory without having to write the individual files to disk at all. The local database is unaffected. Note that several shortcomings in libalpm parsing were discovered by this change, which have since been temporarily patched around in this test suite: * archive_fgets() did not properly handle a file that ended in a non-newline, and would silently drop the data in this line. * sync database with only the file entries and not the directories would fail to parse properly, and even cause segfaults in some cases. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24pactest: make pmfile a bit more pythonicDan McGee1-1/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24pactest: small cleanups and chmod -x most filesDan McGee1-19/+0
Remove empty docstrings, small and easy pylint fixes, etc. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-31pactest: allow checking for cache file existenceDan McGee1-1/+18
This will allow some tests to be added for cache cleaning. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-29pactest: pass entire test to rule.check()Dan McGee1-1/+1
We were piecemeal passing fields from the test object in and it was getting out of hand, and future work would have added yet another argument. Instead, just pass the entire test object and entrust the rule to get what it needs. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22pactest: use new-style python classesDan McGee1-1/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22pactest: revamp modified logicDan McGee1-2/+10
Remove all logic dealing with PKG_MODIFIED as this rule no longer exists. This removes a bunch of unnecessary stat and checksum logic that most of the time we were never even using. Also update the file modified checks to mark every file created using mkfile() with an older time so any modified checks will just work without hacks. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22pactest: pylint changes for pmtestDan McGee1-38/+42
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-21pactest: allow testing of package descriptionDan McGee1-6/+1
And modify the code to not print the full rule string if it is more than 40 characters long; truncate it instead. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-18pactest: use valgrind.supp fileXavier Chantry1-1/+1
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11pactest: fix gensyncXavier Chantry1-5/+7
gensync generated a sync.db file with PKGINFO syntax, this is not quite what pacman expects. Also the file was only added to the Server path: root/var/pub/sync/sync.db but it was not available in the normal sync db path: root/var/lib/pacman/sync/sync.db Change gensync() to generate var/lib/pacman/sync/sync.db and then copy it to var/pub/sync/sync.db (this is used by sync200 -Sy test). Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-27Merge branch 'maint'Dan McGee1-1/+4
2010-08-27pactest: add shell to fake root environmentJonathan Conder1-1/+4
Adds a shell to the fake root set up for pactests, which was not needed previously due to a bug (debian #582847) in fakechroot. Signed-off-by: Jonathan Conder <j@skurvy.no-ip.org>
2010-07-07Remove DBEXT usageAllan McRae1-1/+1
With commit 5dffef78, the repo database always has a symlink of the form reponame.db. Use that filename and let libarchive determine the compression type. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-02Move pacman test suiteAllan McRae1-0/+265
Move the test suite to test/pacman in order to make a logical location for a future makepkg test suite. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>