summaryrefslogtreecommitdiff
path: root/test/pacman/pactest.py
AgeCommit message (Collapse)Author
2019-01-04allow tests for disabled features to be skippedAndrew Gregory
Previously, pacman's test suite would fail when compiled without signature support. Adds a require_capability method to pmtest objects. Currently recognized values are 'gpg', 'curl', and 'nls'; although only gpg is used presently. Missing features are indicated by running pactest with one of the --without-<feature> options. This modifies pmenv to run each case as independent tests. Previously, a single pmenv could run multiple tests, combining there output into a single TAP stream but making it impossible to properly skip an entire test case. This change does not affect running pactest.py with a single test (as both autotools and meson do), but will affect anybody manually running pactest.py with multiple tests at once. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-04remove unused test summary codeAndrew Gregory
Unused since 12e00af5315135a29a66c9aaa01e141a32d4634b Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2018-10-18Port pactest to python3Dave Reisner
Use BytesIO instead of StringIO, and ensure that we unicode-encode data where needed.
2018-05-14Remove all modelines from the projectEli Schwartz
Many of these are pointless (e.g. there is no need to explicitly turn on spellchecking and language dictionaries for the manpages by default). The only useful modelines are the ones enforcing the project coding standards for indentation style (and "maybe" filetype/syntax, but everything except the asciidoc manpages and makepkg.conf is already autodetected), and indent style can be applied more easily with .editorconfig Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-14Update coyrights for 2018Allan McRae
make update-copyright OLD=2017 NEW=201 Signed-off-by: Allan McRae <allan@archlinux.org>
2017-04-04pactest: add --review optionAndrew Gregory
Opens the test file(s), test output, and any log files in the test environment in an editor after the tests run for review. Simplifies debugging tests by avoiding the need to use --keep-root and manually opening the relevant files. The editor used can be set with --editor or $EDITOR, falling back to vim. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04Update copyright yearsAllan McRae
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-04Update copyright years for 2016Allan McRae
make update-copyright OLD=2015 NEW=2016 Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-01Update copyright notices for 2015Allan McRae
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-13pmtest: allow tests to specify test binaryAndrew Gregory
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>
2014-08-03pactest: check for tests before environment setupAndrew Gregory
Setting up the temporary directory and environment is pointless if there are no tests to run. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-08-03pactest: check for pacman binary before runningAndrew Gregory
Using fakeroot or fakechroot as the command with subprocess.call prevents the detection and reporting of a missing pacman binary. Some tests even pass when run with a non-existent binary. Checking manually allows us to provide a meaningful error message and prevent the false positives. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-08-03pactest: parse options before environment setupAndrew Gregory
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-05-04pactest: treat arguments as files instead of globsAndrew Gregory
glob() returns an empty list if input does not match any files, causing non-existent test files to be silently skipped. Treating arguments as files causes pactest to immediately bail out with an appropriate error message on non-existent files. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03pactest: add prefix to temporary directoryAndrew Gregory
This makes cleaning up /tmp after several --keep-root runs much easier. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06Update copyright years for 2014Allan McRae
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14Bail early with a clear error message if Python runtime isn't 2.7+.Jeremy Heiner
Prior to this a test that used a feature too new for the runtime would blow up when it was "exec"d (possibly in the middle of a run of a bunch of tests) with an error message that was not very helpful. Remove Python 2.5 and 2.6 runtimes from the list configure searches. 2.5 suffers the problem described above. The code currently will run on 2.6 but, as was noted on the dev list, that runtime is at the end of its life, so 2.7 is a better cutoff. Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21pactest: remove results summaryAndrew Gregory
This functionality can be provided by a test harness. Having pactest output this information as well clutters the result log created by automake. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21pactest: accept test names without a switchAndrew Gregory
This removes the --test switch, making it easier to call pactest from a test harness. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21convert pactest to TAP outputAndrew Gregory
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-01-28Make path to ldconfig configurableAllan McRae
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 McRae
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 McRae
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 McRae
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-03-08Point python shebangs at python2Allan McRae
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-08-17Fix trailing whitespace in whole codebaseDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24pactest: small cleanups and chmod -x most filesDan McGee
Remove empty docstrings, small and easy pylint fixes, etc. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-03Use standard errno codes in return from _alpm_archive_fgetsDan McGee
This allows us to not require the context (e.g. handle) when calling this function. Also beef up the checks in the two callers of this function to bail if the last return code is not ARCHIVE_EOF, which is the expected value. This requires a change to one of the pactest return codes and the overall result of the test, but results in a much safer operating condition whereby invalid database entries will stop the operation. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05pactest: run with root in /tmp and clean up automaticallyDan McGee
This moves the generated root/ directory into /tmp, or at least a path returned by tempfile.mkdtemp(), by default. This can make test runs significantly faster if done when /tmp is a tmpfs. If you are debugging a failed test, use the new --keep-root option to not clean up and pactest will print the location of the generated root/ test directory. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22pactest: pylint changes for pactestDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-02Move pacman test suiteAllan McRae
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>