summaryrefslogtreecommitdiffstats
path: root/test
AgeCommit message (Collapse)AuthorFilesLines
2014-10-13pmrule: make backup file test more robustAndrew Gregory1-6/+4
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-13pmdb: include directories in package file listsAndrew Gregory1-1/+1
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>
2014-09-30Add --assume-installed optionFlorian Pritz4-0/+47
This allows to ignore specific dependencies. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-09-23Check the version of the local database during validationAllan McRae1-1/+1
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>
2014-09-23Add version file to empty local databaseAllan McRae1-0/+3
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>
2014-09-23Add version file when creating local database directoryAllan McRae1-0/+2
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>
2014-08-04pactest: delay test object creationAndrew Gregory1-3/+3
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>
2014-08-04pactest: only snapshot needed filesAndrew Gregory2-6/+17
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-03check_pkg_fast: check file typeAndrew Gregory1-2/+0
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-08-03add test for file type check with -QkAndrew Gregory2-0/+15
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>
2014-08-03pactest: check for tests before environment setupAndrew Gregory1-5/+4
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 Gregory1-1/+5
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 Gregory1-3/+5
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-06-10Add test case for the perl 5.20 dependency breakageFlorian Pritz2-0/+24
This test currently fails. Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-05-07remove.c: downgrade TRANS_DUP_TARGET to warningAndrew Gregory1-2/+2
Matches the behavior for sync packages. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-05-04pactest: treat arguments as files instead of globsAndrew Gregory1-7/+8
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-05-04pmdb.py: change siglevel name to RequiredAndrew Gregory2-2/+2
"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>
2014-03-03pactest: add prefix to temporary directoryAndrew Gregory1-1/+1
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-03-03pmpkg.py: remove unused importsAndrew Gregory1-4/+0
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-04pmtest: add memory check to tests with valgrindAndrew Gregory2-0/+6
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-04pmrule: add FILE_EMPTY ruleAndrew Gregory2-0/+5
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-01-30pacman: use exit status 0 for --help and --versionAndrew Gregory3-3/+3
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>
2014-01-28pmtest: use valgrind --child-silent-after-forkAndrew Gregory1-0/+1
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>
2014-01-28pmtest: use --gen-suppression=all with valgrindAndrew Gregory1-0/+1
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>
2014-01-28pmtest: send valgrind output to var/log/valgrindAndrew Gregory1-1/+2
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>
2014-01-28Remove ts and sw from vim modeline when noet is setFlorian Pritz4-4/+4
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>
2014-01-06Push down testing .gitignore entriesDan McGee1-0/+2
Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06Update copyright years for 2014Allan McRae11-10/+11
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06Add the unit tests for -Qk and -Qkk that are possible now.Jeremy Heiner3-0/+32
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>
2013-12-21Use the 'configure'd PYTHON to run pactest.Jeremy Heiner7-14/+0
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-19trans_prepare: always sort trans->remove by depsAndrew Gregory2-0/+30
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>
2013-12-15Fix pactest READMEAllan McRae1-3/+2
The --test option no longer exists. Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-15Replace "echo" command with "printf" in human_to_size_test.shJason St. John1-1/+1
Signed-off-by: Jason St. John <jstjohn@purdue.edu> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-15Fix whitespace and other formatting issuesJason St. John2-56/+56
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>
2013-11-15Makefile.am: fix typo in LOG_DRIVER variableAndrew Gregory4-5/+5
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>
2013-10-31pacman -Si/-Qi: Autodetect best fitting file size unitFlorian Pritz1-1/+1
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>
2013-10-31sortbydeps: include local pkgs in dep graphAndrew Gregory1-0/+2
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>
2013-10-14Add parens around tuples in Python list comprehensions.Jeremy Heiner34-34/+34
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>
2013-10-14Use Python's "range" instead of deprecated "xrange".Jeremy Heiner3-5/+5
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>
2013-10-14Use dict iteration methods common to both Python 2 and 3.Jeremy Heiner4-9/+9
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-14Use Python's "0o#" octal literal instead of deprecated "0#".Jeremy Heiner3-5/+5
Reported as a compatibility issue by 2to3. Signed-off-by: Jeremy Heiner <ScalaProtractor@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14Use "exec" instead of "execfile" (deprecated in Python 3).Jeremy Heiner1-1/+2
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>
2013-10-14Bail early with a clear error message if Python runtime isn't 2.7+.Jeremy Heiner1-0/+6
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-10-14Jettison the truncation of the display of pmrules.Jeremy Heiner1-3/+1
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-14Add make target for TESTSAndrew Gregory1-292/+291
This causes make to update TESTS when tests are added (or updated). For simplicity, this changes TESTS from a single multi-line list to individually appending each test file. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> [Allan: use C locale for sorting] Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-19TESTS: add missing testsAndrew Gregory1-0/+4
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-19Fix make distcheckAndrew Gregory1-0/+1
* set util binary paths relative to top_builddir * set pactest.py path relative to top_srcdir * include tap.py in check_SCRIPTS Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-04libalpm: introduce a usage level for reposDave Reisner2-0/+31
This defines a level of interest a user has in a repository. These are described by the bitmask flags in the alpm_db_usage_t enum: ALPM_DB_USAGE_SEARCH: repo is valid for searching ALPM_DB_USAGE_INSTALL: repo is valid for installs (e.g. -S pkg) ALPM_DB_USAGE_UPGRADE: repo is valid for sysupgrades ALPM_DB_USAGE_ALL: all of the above are valid Explicitly listing the contents of a repo will always be valid, and the repo will always be refreshed appropriately on sync operations. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21conflict.c: fix directory ownership checkAndrew Gregory2-0/+33
* append "/" to directories before searching package file lists * use lstat over stat so symlinks aren't resolved * fix the inverted check for stat's return value Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21pactest: remove results summaryAndrew Gregory2-71/+1
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>