summaryrefslogtreecommitdiff
path: root/test/pacman/pmtest.py
Commit message (Collapse)AuthorAge
* Update copyright yearsAllan McRae2017-01-04
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Update copyright years for 2016Allan McRae2016-01-04
| | | | | | make update-copyright OLD=2015 NEW=2016 Signed-off-by: Allan McRae <allan@archlinux.org>
* pactest: add hook/script supportAndrew Gregory2015-10-18
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* util.py: return the created pathAndrew Gregory2015-10-18
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* pactest: use pacman --hookdir optionAndrew Gregory2015-10-18
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Update copyright notices for 2015Allan McRae2015-02-01
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* pmtest: make test paths easily available to testsAndrew Gregory2014-11-04
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* pmtest: allow tests to specify test binaryAndrew Gregory2014-10-13
| | | | | | | | | | | Adds a cmd property to tests (defaults to pacman) which is resolved using directories specified with --bindir (defaults to PATH). The ability to manually specify a particular binary is preserved in order to allow running individual tests with differently named binaries such as lt-pacman. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* pacman: add --confirm optionAndrew Gregory2014-10-13
| | | | | | | | | --confirm cancels the effect of a previous --noconfirm. This makes it easier for scripts to default to --noconfirm but allow users to override it. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* pmtest: allow tests to specify db versionAndrew Gregory2014-10-13
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Check the version of the local database during validationAllan McRae2014-09-23
| | | | | | | When we check the database version directly, there is no longer a need to scan for depends files. Signed-off-by: Allan McRae <allan@archlinux.org>
* Add version file to empty local databaseAllan McRae2014-09-23
| | | | | | | If a user manually creates the local database directory, or has an empty local database for some other reason, we silently add a version file Signed-off-by: Allan McRae <allan@archlinux.org>
* pactest: only snapshot needed filesAndrew Gregory2014-08-04
| | | | | | | | | Only a few of our tests need file snapshots at all and most of them only need a few files. Taking snapshots of the entire test environment for every single test is a massive waste. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* pmtest: add memory check to tests with valgrindAndrew Gregory2014-02-04
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* pmtest: use valgrind --child-silent-after-forkAndrew Gregory2014-01-28
| | | | | | | Silences false warnings after alpm forks to run install scripts. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* pmtest: use --gen-suppression=all with valgrindAndrew Gregory2014-01-28
| | | | | | | | | Let valgrind do the work of writing any suppression rules needed by the test suite. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
* pmtest: send valgrind output to var/log/valgrindAndrew Gregory2014-01-28
| | | | | | | | This will allow us to detect whether valgrind found any errors while still preserving pacman's return code for tests. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Update copyright years for 2014Allan McRae2014-01-06
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Use the 'configure'd PYTHON to run pactest.Jeremy Heiner2013-12-21
| | | | | | | | | 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>
* Use dict iteration methods common to both Python 2 and 3.Jeremy Heiner2013-10-14
| | | | | | | | | | | | | | | 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>
* Use Python's "0o#" octal literal instead of deprecated "0#".Jeremy Heiner2013-10-14
| | | | | | | Reported as a compatibility issue by 2to3. Signed-off-by: Jeremy Heiner <ScalaProtractor@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Use "exec" instead of "execfile" (deprecated in Python 3).Jeremy Heiner2013-10-14
| | | | | | | 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>
* convert pactest to TAP outputAndrew Gregory2013-08-21
| | | | | | | | | 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>
* pactest: treat unknown rules as failuresAndrew Gregory2013-08-21
| | | | | | | | 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>
* pmtest: set LC_ALL=C in subprocess.callAndrew Gregory2013-05-29
| | | | | | | | | | | | 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>
* pmpkg: add missing directories to test packagesAndrew Gregory2013-03-10
| | | | | | | | | | | | | | | | | | 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>
* pmtest: install filesystem entries before packagesAndrew Gregory2013-02-16
| | | | | | | | | | | | | | | | 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>
* Print a warning if fakechroot is not foundChirantan Ekbote2013-02-07
| | | | | | | Fixes FS#33551. Signed-off-by: Chirantan Ekbote <chirantan.ekbote@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Make path to ldconfig configurableAllan McRae2013-01-28
| | | | | | | | | 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>
* pactest: handle non-default scriptlet shellsAllan McRae2013-01-28
| | | | | | | | | | 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>
* Revert execvp and related commitsAllan McRae2013-01-28
| | | | | | | | | This reverts commit 4a8c2852a887d2b1aaa43be3071ab586eb24b9e3. This reverts commit 993700bc6b12cd291544d2a22845f480e8a7925e. This reverts commit bb4d2b72c1d35ab9d65d632be0dcaf00cfa7d600. This reverts commit 60b192e3836a150eb6950ce52241efebbee00f11. Signed-off-by: Allan McRae <allan@archlinux.org>
* pmtest: resolve path to scriptlet shellAllan McRae2013-01-17
| | | | | | | | | | | | | | | 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>
* Merge branch 'maint'Dan McGee2012-09-18
|\
| * pactest: allow running with valgrind from any directoryAllan McRae2012-09-18
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Point python shebangs at python2Allan McRae2012-03-08
|/ | | | | | | | | | | | 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>
* pactest: remove PACMAN_OUTPUT from ldconfig testsDan McGee2011-09-01
| | | | | | | | | 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>
* Fix trailing whitespace in whole codebaseDan McGee2011-08-17
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* pactest: use subprocess module instead of os.systemDan McGee2011-08-02
| | | | | | | | | 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>
* pactest: create packages in memoryDan McGee2011-06-30
| | | | | | | | | | | | | 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>
* pactest: generate sync DB's in memoryDan McGee2011-06-24
| | | | | | | | | | | | | | | | | | 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>
* pactest: make pmfile a bit more pythonicDan McGee2011-06-24
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* pactest: small cleanups and chmod -x most filesDan McGee2011-06-24
| | | | | | Remove empty docstrings, small and easy pylint fixes, etc. Signed-off-by: Dan McGee <dan@archlinux.org>
* pactest: allow checking for cache file existenceDan McGee2011-01-31
| | | | | | This will allow some tests to be added for cache cleaning. Signed-off-by: Dan McGee <dan@archlinux.org>
* pactest: pass entire test to rule.check()Dan McGee2011-01-29
| | | | | | | | 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>
* pactest: use new-style python classesDan McGee2011-01-22
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* pactest: revamp modified logicDan McGee2011-01-22
| | | | | | | | | | 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>
* pactest: pylint changes for pmtestDan McGee2011-01-22
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* pactest: allow testing of package descriptionDan McGee2010-12-21
| | | | | | | 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>
* pactest: use valgrind.supp fileXavier Chantry2010-10-18
| | | | | Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* pactest: fix gensyncXavier Chantry2010-10-11
| | | | | | | | | | | | | | | 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>