--config does not respect root, causing pacman-db-upgrade to read the
local pacman.conf rather than the one in the test root.
Also add a rule to ensure the ALPM_DB_VERSION file is actually being
created.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
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>
--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>
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>
Needed for checking directories with PKG_FILES.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
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>
The version of the local pacman database is stored in its root in the file
ALPM_DB_VERSION. The version is starting at 9, corresponding to the
next libalpm library version.
Signed-off-by: Allan McRae <allan@archlinux.org>
The actual test object is only used to run the test. Storing test cases
as strings limits the test object scope and allows it to be garbage
collected, reducing memory usage when multiple tests are run.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
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>
If a directory has been replaced by a symlink, -Qk currently stats the
symlink target rather than the symlink itself and doesn't check that the
actual file type matches the package file list. This will make it
difficult to discover errors once 4.2 is released and replacing
directories with symlinks is no longer supported.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
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>
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>
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>
"Always" is not a valid siglevel. sign002.py was succeeding because
pacman failed to parse the resulting config file rather than a failed
signature check.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
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>
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>
The user requesting usage or version information is not an error.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
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>
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>
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>
Forcing vim users to view files with a tabstop of 2 seems really
unnecessary when noet is set. I find it much easier to read code with
ts=4 and I dislike having to override the modeline by hand.
Command run:
find . -type f -exec sed -i '/vim.* noet/s# ts=2 sw=2##' {} +
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
The -Qk test (001) validates the existence of the package files (which
were installed to the filesystem by the framework because the package
was added to the "local" db).
The -Qkk test (002) does not validate any file's properties - it can
only check that the pacman run produces the expected warning message
saying that the package lacks an mtree.
Further tests will require modifications to the testing framework to
allow intentional damage to the filesystem and generating an mtree.
Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com>
[Allan] Make warning message detection more specific
Signed-off-by: Allan McRae <allan@archlinux.org>
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>
Packages can be removed during a sync transaction either directly or
due to conflicts and need to be sorted.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit:
-- replaces space-based indents with tabs per the coding standards
-- removes extraneous whitespace (e.g. extra spaces between function args)
-- adds missing braces for a one-line if statement
Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Self-executing tests were not being run through the tap log driver.
This caused `make check` to ignore discrepancies between the expected
number of tests and the actual number of tests.
Also, fix some uncommented output from test scripts that could confuse
TAP parsers.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
I've tracked this back to e223366 and it looks like this just forces KiB
because back then humanize_size didn't exist, but the size was just
divided by 1024 to keep it somewhat readable. When humanize_size got
introduced in 3c8a448 this was just carried over.
The unit detected for "Download Size" is reused for "Installed Size" to
make it easier to read.
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
Detecting indirect dependencies by traversing a package's entire
dependency tree is prohibitively slow for larger transactions. Instead
add local packages to the dependency graph. This additionally requires
delaying dependency ordering for sync operations so that removed
packages may be excluded from dependency detection.
tests/sync012.py was also updated to ensure that the dependency cycle
was actually detected.
Fixes FS#37380
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Reported by 2to3: optional in Python 2, but required in 3.
Signed-off-by: Jeremy Heiner <ScalaProtractor@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Reported by 2to3. Python 3 throws out the old range, renames the old
xrange to be the new range, leaving no xrange. A shim could be used,
but using the less efficient version does not have a noticeable impact
on the run time. This observed (lack of an) effect is as described in
the Python 2 docs for xrange. The largest range created is only 1000
elements big, and the memory cost of those ranges is negligible when
compared to that of all the pmpkg instances created.
Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
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>
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>
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>