summaryrefslogtreecommitdiff
path: root/test/pacman
Commit message (Collapse)AuthorAge
* Update copyright years for 2014Allan McRae2014-01-06
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Add the unit tests for -Qk and -Qkk that are possible now.Jeremy Heiner2014-01-06
| | | | | | | | | | | | | | | | | | 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.Jeremy Heiner2013-12-21
| | | | | | | | | 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>
* trans_prepare: always sort trans->remove by depsAndrew Gregory2013-12-19
| | | | | | | | 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>
* Fix pactest READMEAllan McRae2013-12-15
| | | | | | The --test option no longer exists. Signed-off-by: Allan McRae <allan@archlinux.org>
* pacman -Si/-Qi: Autodetect best fitting file size unitFlorian Pritz2013-10-31
| | | | | | | | | | | | | 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>
* sortbydeps: include local pkgs in dep graphAndrew Gregory2013-10-31
| | | | | | | | | | | | | | | | 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>
* Add parens around tuples in Python list comprehensions.Jeremy Heiner2013-10-14
| | | | | | | 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>
* Use Python's "range" instead of deprecated "xrange".Jeremy Heiner2013-10-14
| | | | | | | | | | | | | 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>
* Use dict iteration methods common to both Python 2 and 3.Jeremy Heiner2013-10-14
| | | | | | | | | | | | | | | 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>
* Use Python's "0o#" octal literal instead of deprecated "0#".Jeremy Heiner2013-10-14
| | | | | | | Reported as a compatibility issue by 2to3. Signed-off-by: Jeremy Heiner <ScalaProtractor@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Use "exec" instead of "execfile" (deprecated in Python 3).Jeremy Heiner2013-10-14
| | | | | | | 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>
* Bail early with a clear error message if Python runtime isn't 2.7+.Jeremy Heiner2013-10-14
| | | | | | | | | | | | | | 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>
* Jettison the truncation of the display of pmrules.Jeremy Heiner2013-10-14
| | | | | | | | | | 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>
* Add make target for TESTSAndrew Gregory2013-10-14
| | | | | | | | | | | | | 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>
* TESTS: add missing testsAndrew Gregory2013-09-19
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Fix make distcheckAndrew Gregory2013-09-19
| | | | | | | | | * 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>
* libalpm: introduce a usage level for reposDave Reisner2013-09-04
| | | | | | | | | | | | | | | | 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>
* conflict.c: fix directory ownership checkAndrew Gregory2013-08-21
| | | | | | | | | * 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>
* pactest: remove results summaryAndrew Gregory2013-08-21
| | | | | | | | | 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>
* integrate tests with automakeAndrew Gregory2013-08-21
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* pactest: accept test names without a switchAndrew Gregory2013-08-21
| | | | | | | | 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>
* convert pactest to TAP outputAndrew Gregory2013-08-21
| | | | | | | | | 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>
* pactest: treat unknown rules as failuresAndrew Gregory2013-08-21
| | | | | | | | Tests should only be skipped when they aren't relevant, not when the test itself is bad. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* query006: only set expectfailure on 32-bit systemsAndrew Gregory2013-08-21
| | | | | | | | Use the architecture of the python interpreter running the test to detect 32bit systems. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Remove setlocale usage from the backendAllan McRae2013-07-30
| | | | | | | | Using setlocale in the backend is bound to lead to frontend issues and we have have been using epoch in our databases since April 2007 (commit 47622eef). Remove support for old style times. Signed-off-by: Allan McRae <allan@archlinux.org>
* deps.c: check for indirect deps when orderingAndrew Gregory2013-06-26
| | | | | | | | | | | | | | | | | | | | On upgrades, indirect dependencies were not being detected if there was a dependency in between them that was not part of the transaction. For example, with the dependency chain: pkg1 -> pkg2 -> pkg3, if pkg1 and pkg3 are being upgraded but not pkg2 pacman would not order pkg1 and pkg3 properly. This was particularly problematic when replacements were involved because the replaced package(s) would be removed at the start of the transaction. If an install script required the replacer and lacked a direct dependency, it could fail. Fixes FS#32764. Partially fixes FS#23011. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* improve dir->file transition conflict resolutionAndrew Gregory2013-06-03
| | | | | | | | | | | | | | | | | Packages removed due to conflicts are always removed at the beginning of the transaction and as such can be included in the check for whether all owners of a directory will be removed in a transaction. Installed versions of packages being upgraded, other than the one with the conflict, cannot be used because our transaction ordering is not intelligent enough to ensure that they are removed prior to the installation of the conflicted package. Also, return false from dir_belongsto_pkgs on errors. Previously, we simply continued which could return true even if we were unable to actually establish that the package owned the entire tree. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* extract_single_file: consolidate symlink casesAndrew Gregory2013-06-03
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* conflict.c: check for file -> dir replacementsAndrew Gregory2013-06-03
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* conflict.c: exclude trailing slash from file pathAndrew Gregory2013-06-03
| | | | | | | | | After the initial checks, we either use the path as a directory and have to append the trailing slash anyway or use it as a file in which case the trailing slash should be excluded. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* conflict.c: do not ignore symlink<->dir conflictsAndrew Gregory2013-06-03
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* alpm_filelist: remove resolved_pathAndrew Gregory2013-06-03
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* update tests for symlink support removalAndrew Gregory2013-06-03
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* pmtest: set LC_ALL=C in subprocess.callAndrew Gregory2013-05-29
| | | | | | | | | | | | LC_ALL=C is required to force pacman's output to English for tests that rely on that output, but setting it in Makefile.am results in those tests breaking under different locales when pactest.py is run directly. This will also ease an eventual transition to python3 which LC_ALL=C causes to default to ascii encoded strings, creating problems for tests with unicode strings. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Remove ALPM_QUESTION_LOCAL_NEWERConnor Behan2013-04-24
| | | | | | | | | Remove a question that hasn't been used since the 3.0 days. To prevent us from having an ugly enum of questions that is missing a bitmask, this changes the API of the hidden --ask option. Signed-off-by: Connor Behan <connor.behan@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* util.py: replace file() with open()Andrew Gregory2013-04-15
| | | | | | | open() is the standard way to open a file in python. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* pmpkg: default mode 0755 for dirs in sync packagesAndrew Gregory2013-04-15
| | | | | | | | | | | | TarInfo objects default to mode 0644 while mkfile in util.py uses 0755 for directories, causing pacman warnings about differing permissions on tests involving package updates. Set the mode on TarInfo directory objects to 0755 unless the test specifies a different mode. Bug referenced in FS#30723. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* pmpkg: add missing directories to test packagesAndrew Gregory2013-03-10
| | | | | | | | | | | | | | | | | | 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>
* libalpm: Search for replacers before literalsOlivier Brunel2013-03-07
| | | | | | | | | | | | | | | | | Since 882bff36 literals would be searched before replacers, resulting in a package being replaced by another not actually being replaced under certain conditions (e.g. they're both in the same repo). This change effectively reversed the expectations in test sync132. This patch switches the order back to replacers first, thus making sure if a package is replacing another one, the change will always happen, even if both are in the same repo. Note that a package replacing another one in a repo with higher priority will not be done, see FS#11737 and test sync1105 Signed-off-by: Olivier Brunel <i.am.jack.mail@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* libalpm: Fix installing update of a replaced packageOlivier Brunel2013-03-07
| | | | | | | | | During a sysupgrade, if a package is replaced by another, and an update for the former package is found (on another repo) the replaced package would be re-installed. Signed-off-by: Olivier Brunel <i.am.jack.mail@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* fix typos in pacman testsAndrew Gregory2013-03-07
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Perform limited conflict checking with --forceAllan McRae2013-02-24
| | | | | | | | | | | | Pacman currently bails when trying to extract a file over a directory when using --force. Instead of ignoring all conflict, perform the check and skip any file-file conflicts. Conflicts between directories and files are still flagged and cause the transation to abort. As a bonus, we now know about files changing packages when using --force, so we can skip removing them fixing upgrade046. Signed-off-by: Allan McRae <allan@archlinux.org>
* use resolved_path for filelist_containsAndrew Gregory2013-02-24
| | | | | | | | | | | alpm_filelist_contains was being used to search for resolved paths, but searching in the unresolved paths, causing it to miss matches. We always search unresolved paths and search the resolved paths if available because _alpm_filelist_resolve is not public and requires a context handle, so it can't be called from alpm_filelist_contains. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* return resolved paths from filelist_differenceAndrew Gregory2013-02-24
| | | | | | | | | | | We were comparing files based on resolved paths but returning the original file_t structures, which were not necessarily in the same order. The extra file_t information was only being used to determine if the file was a directory which can be accomplished by testing for a trailing slash, so just return the resolved path. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* return resolved paths from filelist_intersectionAndrew Gregory2013-02-24
| | | | | | | | | | We were comparing files based on resolved paths but returning the original file_t structures, which were not necessarily in the same order. The additional file_t information was never used, so just return the resolved path. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* add fileconflict tests for cases with symlinksAndrew Gregory2013-02-24
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* pmtest: install filesystem entries before packagesAndrew Gregory2013-02-16
| | | | | | | | | | | | | | | | Installing filesystem entries first allows the filesystem to provide a symlink to a directory. Packages will then be able to use the symlink as if it were a directory instead of causing an error. For example: self.filesystem = ["dir/", "link -> dir/"] pkg = pmpkg("pkg1") pkg.files = ["link/file"] self.addpkg2db("local", pkg) Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Document fakeroot and fakechroot as dependenciesChirantan Ekbote2013-02-07
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Remove outdated instructions in pactest READMEAllan McRae2013-02-07
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>