Commit Graph

32 Commits

Author SHA1 Message Date
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 95b0a868f2 Use dict iteration methods common to both Python 2 and 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-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
Andrew Gregory 43a2f63194 pmpkg: add missing directories to test packages
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-03-10 09:01:56 +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
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 9d3d647f00 pactest: improve speed of local DB dependent rules
We were doing some really silly stuff before and abusing the os.walk()
call, having to walk the entire local database for every single PKG
rule. We really only need top level directories, and we can cache any
generated package since calls to db_read() are well-defined and only
happen in one place.

This speeds up the running of tests that may want to add 100 PKG_VERSION
rules at once, where before we had to limit how many we used in order to
not put a serious cramp in the speed of the test suite run.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-09 15:36:05 -05:00
Dan McGee 35ffe6af2d pactest: remove no longer necessary newline hacks
libalpm can now cope with this as of commit 719e0d3ddb.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-30 12:02:33 -05:00
Dan McGee 0ed848a9ea pactest: create packages in memory
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-30 11:55:00 -05:00
Dan McGee 624a878701 pactest: generate sync DB's in memory
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-24 01:36:48 -05:00
Dan McGee 63335859d1 pactest: refactor install file creation
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24 01:36:48 -05:00
Dan McGee f15cce1d41 pactest: move filelist/backup generation into package object
These are definite methods that operate on a package, so move them there
which cleans up util a bit more.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24 01:36:48 -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 763d638ca1 pactest: clean up database section writing
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24 01:36:48 -05:00
Dan McGee a8c3202836 pactest: add isize attribute, fix url attribute
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24 01:36:47 -05:00
Xavier Chantry f9505063f8 Added gpg verification options per repo to the config file.
Once we do this, add support for VerifySig to pactest. We just check if
the repo name contains Always, Never or Optional to determine the value
of VerifySig. The default is Never. pacman uses Always by default but
this is not suitable for pactest.

Original-work-by: shankar <jatheendra@gmail.com>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 03:35:50 -05:00
Dan McGee 39da0198cd Add PGP signature support to pactest
Allow pkg.pgpsig to end up in the created sync databases.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 02:22:00 -05: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 2a3b5e40bc pactest: pylint changes for pmdb
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 0d4dd09993 pactest: build the filelist using a set()
This will prevent duplicates, which we had plenty of once I made a few tests
that had a list of files greater than the normal two. The previous logic was
not working quite right.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 18:43:28 -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 46eda12c1b pactest: Use booleans where it makes sense
No need to use 0/1 when we can use False/True for the force option.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-05 20:55:57 -06:00
Allan McRae 8f3b485517 Update pactest suite for change in db structure
Merging desc and depends files in sync and local db.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 21:42:41 -06:00
Dan McGee 8aa7ed5a7e Add epoch support to pactest
This adds epoch support to pactest, while still producing packages and
database entries the same way makepkg and repo-add currently do in a
backward compatible fashion (still including the 'force' option).

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:29:26 -05:00
Xavier Chantry fa933df65b pactest: fix gensync
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-10-11 10:06:57 -05:00
Xavier Chantry 67068b64b9 pactest: use simpler method to create tar
Just like in 24fc623e1a8bf905cf0367f9bd40bc5bd6034378, apply to pmdb
gensync as well.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 10:06:57 -05:00
Allan McRae 68dcabdfbe Remove DBEXT usage
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-07-07 07:25:55 -05: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