Commit Graph

25 Commits

Author SHA1 Message Date
Andrew Gregory 926280cfc7 remove support for .pacorig files
Leave user files in place and save new config files with a .pacnew
extension.  This reduces the complexity of file extraction and respects
the principle that pacman shouldn't modify files it didn't create.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:47 +10:00
Andrew Gregory 6dd593c293 pmrule: make backup file test more robust
This prevents an exception in the event backup entries are not in the
correct format and brings the test in line with alpm's backup parsing
which splits on the last tab rather than the first.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-13 12:54:29 +10:00
Andrew Gregory 85c80542a5 pactest: only snapshot needed files
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>
2014-08-04 14:23:58 +10:00
Andrew Gregory 4763341ea1 pmrule: add FILE_EMPTY rule
Succeeds if the specified path is a file and is empty.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-04 13:44:38 +10:00
Allan McRae 3bb3b1555a Update copyright years for 2014
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06 14:38:50 +10:00
Jeremy Heiner f7f8964c23 Use the 'configure'd PYTHON to run pactest.
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-12-21 10:20:04 +10:00
Jeremy Heiner 1bb0085dfe Jettison the truncation of the display of pmrules.
The truncation helped back when the test output appeared when run via
make. But now "make check" logs that output, and it makes little sense
to log the truncated rules.

Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 13:01:15 +10:00
Andrew Gregory 1152052b3e convert pactest to TAP output
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-21 11:00:18 +10:00
Allan McRae 801f7d1033 pactest: handle non-default scriptlet shells
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-28 23:38:34 +10:00
Dan McGee d521f30f07 pactest: make OPTDEPEND rule look at non-description only
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-16 09:54:02 -05:00
Allan McRae 82abe079ab Point python shebangs at python2
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>
2012-03-08 17:28:55 -06:00
Dan McGee 3ceef97799 Fix trailing whitespace in whole codebase
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-17 17:03:19 -05:00
Dan McGee cbaff216b3 Don't trim whitespace when reading database entries
We don't write with extra or unknown whitespace, so there is little
reason for us to trim it when reading either. This also fixes the
hopefully never encountered "paths that start or end with spaces" issue,
for which two pactests have been added. The tests also contain other
evil characters that we have encountered before and handle just fine,
but it doesn't hurt to ensure we don't break such support in the future.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-02 08:20:34 -04:00
Dan McGee 1c39e4fbad Handle removal of empty directories properly
This addresses FS#25141. We shouldn't remove every empty directory we
come across during the removal process unless it is truly not known to
any other package. This will prevent removal of essential directories
such as '/var/lock/'.

This is accomplished by first checking the empty/non-empty status of a
directory, which was previously done implicitly by calling rmdir() and
ignoring errors. We do this to avoid the next (new) check in most cases,
which is to look at all local packages to see if the to-be-removed
directory is present in another packages' filelist. If we do not find it
anywhere, then we remove it, else we keep the file around.

The pactest has been updated to test more cases, as well as finding a
flaw in the original expected to fail case- we need separate DIR and
FILE based EXIST rules.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-18 10:34:05 -05:00
Dan McGee 11d8418737 pactest: small cleanups and chmod -x most files
Remove empty docstrings, small and easy pylint fixes, etc.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24 01:36:48 -05:00
Dan McGee 3000b6b473 pactest: treat symlinks with more respect
Don't call os.stat() when we should be using os.lstat(); this allows us
to actually test dead symlinks that don't have a corresponding file. Add
a new LINK_EXIST rule that complements FILE_EXIST for a similar purpose.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-16 11:31:26 -05:00
Dan McGee 2d5ec02d7c pactest: allow checking for cache file existence
This will allow some tests to be added for cache cleaning.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-31 09:37:20 -06:00
Dan McGee ce089e1b97 pactest: pass entire test to rule.check()
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-29 12:15:15 -06:00
Dan McGee b3d71bf7d0 pactest: use new-style python classes
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 16:29:32 -06:00
Dan McGee 32727efc38 pactest: revamp modified logic
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-22 11:19:21 -06:00
Dan McGee 946f4af7f3 pactest: pylint changes for pmrule
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:14:42 -06:00
Dan McGee bf46e04614 Remove epoch as an independent field
Instead, go the same route we have always taken with version-release in
libalpm and treat it all as one piece of information. Makepkg is the only
script that knows about epoch as a distinct value; from there on out we will
parse out the components as necessary.

This makes the code a lot simpler as far as epoch handling goes. The
downside here is that we are tossing some compatibility to the wind;
packages using force will have to be rebuilt with an incremented epoch to
keep their special status.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 19:30:45 -06:00
Dan McGee a9cbd15260 pactest: correctly write epoch and force as necessary
We were missing this in a few places; also add the ability to check the
outcome via a new rule type.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-10 10:51:35 -06:00
Dan McGee fbcc427754 pactest: allow testing of package description
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-12-21 14:58:17 -06:00
Allan McRae 844d82fad8 Move pacman test suite
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>
2010-06-02 13:14:51 -05:00