summaryrefslogtreecommitdiffstats
path: root/test/pacman/tests
AgeCommit message (Collapse)AuthorFilesLines
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-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-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-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-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-21integrate tests with automakeAndrew Gregory1-0/+288
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21query006: only set expectfailure on 32-bit systemsAndrew Gregory1-1/+4
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>
2013-07-30Remove setlocale usage from the backendAllan McRae2-7/+1
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>
2013-06-26deps.c: check for indirect deps when orderingAndrew Gregory2-2/+44
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>
2013-06-03improve dir->file transition conflict resolutionAndrew Gregory1-0/+17
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>
2013-06-03extract_single_file: consolidate symlink casesAndrew Gregory1-1/+2
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-03conflict.c: check for file -> dir replacementsAndrew Gregory2-2/+20
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-03conflict.c: exclude trailing slash from file pathAndrew Gregory2-4/+0
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>
2013-06-03conflict.c: do not ignore symlink<->dir conflictsAndrew Gregory7-10/+4
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-03alpm_filelist: remove resolved_pathAndrew Gregory7-6/+8
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-03update tests for symlink support removalAndrew Gregory9-31/+40
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-04-24Remove ALPM_QUESTION_LOCAL_NEWERConnor Behan5-5/+5
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>
2013-03-07libalpm: Search for replacers before literalsOlivier Brunel3-4/+19
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>
2013-03-07libalpm: Fix installing update of a replaced packageOlivier Brunel1-0/+18
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>
2013-03-07fix typos in pacman testsAndrew Gregory3-4/+4
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-24Perform limited conflict checking with --forceAllan McRae1-2/+0
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>
2013-02-24use resolved_path for filelist_containsAndrew Gregory1-2/+0
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>
2013-02-24return resolved paths from filelist_differenceAndrew Gregory2-4/+0
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>
2013-02-24return resolved paths from filelist_intersectionAndrew Gregory1-2/+0
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>
2013-02-24add fileconflict tests for cases with symlinksAndrew Gregory4-0/+80
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-07Remove conditional checks for fakechroot from test filesChirantan Ekbote2-8/+0
We don't want test files to do any checks for fakechroot since we will print a warning if it is not found. Signed-off-by: Chirantan Ekbote <chirantan.ekbote@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-28Remove leading / for pactest pathsAllan McRae4-4/+4
The leading / makes the pactest suite look for the file in the users filesystem. This meant the ldconfig tests always passed (even when broken in pacman...). Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-04Save backup files with extension .pacsave.nPang Yan Han1-0/+20
Teach pacman to save backup files with extension .pacsave.n, where n is a positive integer. The current backup file shall be saved as <name>.pacsave, while existing .pacsave.n files will be renamed to <name>.pacsave.n+1 Example: 1. You have subversion installed in your local repo. /etc/conf.d/svnserve is a file to be backed up. It contains local modifications 2. You remove subversion from your repo. /etc/conf.d/svnserve is backed up as /etc/conf.d/svnserve.pacsave 2. You install subversion again 3. You edit /etc/conf.d/svnserve 4. You remove subversion. The existing /etc/conf.d/svnserve.pacsave is renamed to /etc/conf.d/svnserve.pacsave.1 and /etc/conf.d/svnserve is backed up as /etc/conf.d/svnserve.pacsave Signed-off-by: Pang Yan Han <pangyanhan@gmail.com> Rebased from original email and adjusted for util-common usage. Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14Add pactest for "Optional for" outputBenedikt Morbach1-0/+13
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14Add pactests for displaying optdep installation statusBenedikt Morbach2-0/+27
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14It turns out we do care about directories...Allan McRae2-4/+0
This is a bug that has been around since at least 2007. On a package upgrade (either by -S or -U) a new directory could overwrite any file. This is caused by the filelist difference calculation ignoring all directories and thus no new directories were checked for conflicting files on the filesystem. Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14Add pactests for not detecting directory conflicts with upgradesFlorian Pritz2-0/+38
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14Fix overzealous package removal with unmet dependenciesAndrew Gregory3-6/+0
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> [Allan: Remove expected failure from fixed pactests] Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14pactest: variant of package removal due to unmet dependenciesAllan McRae1-0/+28
Duplicate of sync140.py but with the alphabetical ordering of the packages changed. Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14pactest: removal of packages with unmet dependenciesAllan McRae1-0/+28
Provide a package for removing packages with unmet dependencies. Currently pacman removes too many packages from the transaction (FS#30649). Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14Avoid upgrade conflict with unchanged effective pathAllan McRae1-2/+0
This applies to a case such as when /lib is a symlink to /usr/lib. If a package is installed which contains /lib/libfoo.so, pacman will complain if this package is then "fixed" to contain /usr/lib/libfoo.so. Since these have the same effective path and it exists within the same package, ignore the conflict. Fixes FS#30681. Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14Resolve file paths during inter-package conflict checkAllan McRae3-4/+26
File paths are resolved if necessary during inter-package conflict checks so that packages carrying the same effective file due to directory symlinks on the filesystem are flagged as conflicting. Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14Detect inter-package conflicts between files and directoriesAllan McRae2-4/+0
Detect a conflict between a file/symlink in one package and a directory in another when both are being installed at once. A side effect is the creation of conflicts between a directory symlink and a real directory (e.g lib -> usr/lib in pkg1 and /lib in pkg2). Given we can not guarantee pkg1 is installed before pkg2, this is a genuine conflict. Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14pactest: Provide a full filelist to the pactests that need itAllan McRae2-4/+11
It turns out when you set the filelist for a package to include "usr/lib/foo" in the pactest suite, it thinks there is only the file "usr/lib/foo" in there... No "usr/" or "usr/lib/" directory. This makes life difficult when testing code that scrolls through a filelist looking for directory entries. Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-02pactest: avoid upgrade conflict with unchanged effective pathDave Reisner1-0/+22
Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-02pactest: Do not remove symlink to directory if a to be installed package uses itAllan McRae2-0/+44
If a pacakge has a directory symlink (e.g. /lib -> usr/lib), do not allow it to be removed if any other package is trying to install a file into that path (e.g. /lib/foo). This is because the local database can become invalidated if the symlink is removed after the package with file /lib/foo is installed (sync702.py). If the symlink is removed before the file is installed (sync701.py), the upgrade is actually a success, but we can not guarantee the ordering so both cases should fail. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-02pactest: Do not remove symlink to directory if local package uses that pathAllan McRae1-0/+22
If we have a symlink to a directory (e.g. /lib -> usr/lib), then we can not remove it if a local package thinks it has files in the symlink directory (e.g. /lib/foo), because this will invalidate the local file database. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-02pactest: conflict between files having same effective pathAllan McRae1-0/+23
Note failure to detect a conflict between files having the same effective path across packages due to a directory symlink. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-02pactest: conflict between directory and a fileAllan McRae1-0/+17
Note failure to detect a conflict between a directory in one package and a file in the other when the directory is not currently on the filesystem. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-02Add pactest for empty subdirectory conflictAllan McRae2-1/+18
The wrong test file was inadvertantly committed in 44e9fdd0. Add the correct test and tidy up the test which was committed. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>