summaryrefslogtreecommitdiffstats
path: root/pactest
AgeCommit message (Collapse)AuthorFilesLines
2008-05-12pactest: fix --gdb optionDan McGee1-1/+1
A libtool upgrade broke the gdb option as we need a MODE specified; add the execute mode to the call. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-29Rework extract_single_file() temp file creationDan McGee1-0/+20
We were a bit juryrigged using one call to mkstemp() before rather than extracting the new files side-by-side and doing our comparisons there. We were also facing some permissions issues. Instead, make our life easier by extracting all temp files to a '.paccheck' extension, doing our md5 comparisons, and then taking the correct actions. Still to be done here- a cleanup of the use of PATH_MAX which should not be necessary if we use dynamic allocation on the heap. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-29Update pactest to allow setting modes on created filesDan McGee3-20/+34
This should allow some future tests to set modes and ensure they are set after installation. It is also in anticipation of a test for checking permissions on pacnew files. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-19Merge branch 'maint'Dan McGee3-14/+22
Conflicts: pactest/pmtest.py
2008-04-17pactest : Use tarfile module.Chantry Xavier2-12/+20
Previously, tar was called manually with os.system. This caused one fork per package/db creation, which is costly, especially on cygwin. Besides, it also caused some problems with directory with whitespaces (that could also be fixed with quotes, but well..) Using tarfile module is cleaner and more efficient, and still easy enough. Benchmark (time make check) : - windows / cygwin prepatch: real 6m36.360s user 2m28.914s sys 2m35.866s postpatch: real 5m25.428s user 1m26.029s sys 2m0.006s - linux prepatch: real 1m22.629s user 0m31.498s sys 0m18.899s postpatch: real 1m11.465s user 0m26.382s sys 0m12.986s Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-04-17pactest: Add quotes for directory with whitespacesChantry Xavier1-2/+2
Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-30Update -Ss and -Qs pactests to include groupsDan McGee2-0/+2
This update causes query003 to fail before commit 4b8ada818e21aae43b4f54f146ffa215fdb9213e. Hopefully the issue doesn't crop up again but we might as well test for it. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-23Avoid duplicated target names.Nagy Gabor2-17/+8
This patch should avoid duplicated target names in the backend. 1. sync_loadtarget will return with PM_ERR_TRANS_DUP_TARGET when trying to add a duplicated target 2. sysupgrade never pulls duplicated targets 3. resolvedeps won't pull duplicated targets anymore A pulled list was introduced in sync_prepare to improve the pmsyncpkg_t<->pmpkg_t list conversion by making it more direct. Also replace sync1005 and sync1006 by the sync1008 pactest, which is similar but more interesting (the provisions are dependencies instead of explicit targets). sync1005 didn't work as expected anyway. It was expecting that pacman failed, and pacman indeed failed, but not for the good reason. It didn't fail during the preparation step because of conflicting targets, but during the commit step, because of a md5 error... And sync1006 didn't pass and was not really worth fixing. We have already enough failing pactests more important than these two. sync1008 pass with this patch. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-03-23Add -q (quiet) option to valgrind call in pactestDan McGee1-1/+1
This gets rid of a lot of the unnecessary verbosity in the --valgrind output when running all the tests. It should also make diff-ing output between test runs a lot easier. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-22Kill the dependsonly option.Chantry Xavier2-37/+0
From the man page : "This is pretty useless and we're not sure why it even exists." Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-03-18Drop case insensitive comparisons in the config parsing.Chantry Xavier9-9/+9
These case insensitive comparisons didn't work in some locales, like tr_TR where upper(i) != I. So a second case sensitive comparison had to be made for each directive. Only keeping case sensitive comparisons make the code cleaner and treat all locales equally. Ref: http://www.archlinux.org/pipermail/pacman-dev/2008-March/011445.html Also fix pactests to use the correct case. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-11Add -Rss optionNagy Gabor2-0/+40
* -Rss removes all dependencies (including explicitly installed ones). * updated documentation * two pactest files added to test the difference between -Rs and -Rss Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
2008-03-11Remove trans->targetsNagy Gabor1-3/+2
Its implementation was quite broken: * add_loadtarget() might have silently filtered out some targets when replacing an older version. * This was used in sync.c to determine whether a target is implicit or not, which is incorrect behavior. Before this patch we silently removed user confirmed replacements; now we always warn on a replacement. * remove001.py behavior was quite odd in adding same target 5 times to the target list, we can change this behavior to be a failure. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> [Xav: changed remove001 pactest accordingly] Signed-off-by: Chantry Xavier <shiningxc@gmail.com> [Dan: rewrote commit message] Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-08Remove useless TESTS fileDan McGee2-65/+1
This hasn't been updated in forever, and a simple python program could regenerate it anyway. Or even grep. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-08Move -A pactests that are relevant to -U, clean the rest outDan McGee23-99/+18
This is in anticipation of removing the -A/--add option from the pacman frontend. I've went through each of the pacman pactests that used the -A operation and decided whether they were worth keeping, whether there was already an upgrade test doing the same thing, or whether it should be moved over. The GIT rename log should make several of the moves obvious, but for those that were deleted: add001: handled by upgrade004 add002: worthless add004: worthless add010: handled by upgrade011 add050: handled by upgrade010 Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-16Merge branch 'maint'Dan McGee5-1/+51
Conflicts: lib/libalpm/be_files.c lib/libalpm/package.c
2008-02-14Ensure DESC infolevel is loaded before checking pkg->filenameDan McGee1-0/+1
This is the first step of fixing FS#9547. This should not break any existing code that may rely on this function behaving the way it did, and should be good for inclusion in a maint release. In addition, update pactest so it fills the FILENAME field in the DB entries it creates so we can move forward with a real fix to this issue. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-12ensure chk_fileconflicts reads entire file listDan McGee1-0/+16
If the end of the pB list was reached before the end of pA, we failed to read any remaining files from the pA list. Add an additional loop to ensure all entries of pA are added to the return list regardless of whether we have reached the end of pB. This new loop also eliminates the now-unnecessary check for a null pB, as we need to ensure we are excluding directories in the resulting output anyway. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-12Fixes file relocation pactestsNagy Gabor3-1/+34
This patch fixes upgrade040.py and upgrade041.py (041 now fails!): * the old pactests didn't check the existence of the relocated file * upgrade041.py was broken due to a typo (missing comma) New upgrade046.py pactest was added (derived from the fixed upgrade041.py). This fails because the file relocation check is _hacked_ to conflict.c, and _alpm_db_find_fileconflicts is not called in case of --force. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-08Merge branch 'maint'Dan McGee3-2/+33
2008-02-08pactest: make more resiliant to missing filesDan McGee3-2/+33
Add a bunch of guards around function calls like open() and stat() to ensure we are not going to get ourselves a python error. This made implementing and testing the new upgrade045 pactest much easier, as its whole purpose was to create a dead symlink and debug a segfault of pacman (which caused no DB entries to be written) to support the previously checked in fix for FS#9235 (commit 0c2206f542ce6df2606586d43f190cd5a423fb13). Both of these cases are now non-fatal in pactest. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-06New remove option : -u / --unneeded (FS#6505).Nagy Gabor1-0/+19
With --unneeded option 'pacman -R' doesn't stop in case of dependency error; it removes the needed-dependency targets from the target-list instead. See also: http://archlinux.org/pipermail/pacman-dev/2007-October/009653.html . The patch also adds a new causingpkg field to pmdepmissing_t which indicates the to-be-removed package which would cause a dependency break. This is needed, because miss->depend.name may be a provision. miss->causingpkg will be useful in -R dependency error messages too. [Xavier: renamed inducer to causingpkg, removed the _alpm_pkgname_pkg_cmp helper function as requested by Aaron. This might be added by a further commit. Other small cleanups, updated manpage and bash completion.] Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-01-24libalpm/sync.c : conflicts resolving cleanup.Chantry Xavier2-5/+5
The original patch from Nagy tried to resolve target vs target conflicts, and so broke the following pactests : sync040, sync041 and sync990 Nagy's proposal to solve this situation was to choose the interactive way, ask the user how to deal with it: either remove pkg1 or remove pkg2 or stop here. So he left this as a TODO. But instead of trying to resolve these conflicts or asking the user, I tried to find a more conservative way, looking at what the current pactests expected: If between the two conflicting packages, one provides the other, pacman will keep that one and remove the other from the target list. That breaks sync893 and sync897. But Dan agreed these two looked weird and should be changed. This commit should close FS#8897, FS#8899 and FS#9024. Reference: http://www.archlinux.org/pipermail/pacman-dev/2007-October/009745.html http://www.archlinux.org/pipermail/pacman-dev/2007-December/010393.html Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-22pactest: remove check for root permissions messageDan McGee1-5/+0
Pacman isn't designed to fail when under fakeroot anymore, so kill this check off which fails anyway if the logfile is missing (such as when the --valgrind flag is used). Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-22New --asexplicit optionNagy Gabor2-0/+38
This is the symmetric of --asdeps, install packages explicitly. Documentation and completion files were updated accordingly. Added sync301.py and upgrade032.py pactest files to test this. I also made a little modification in ALLDEPS handling too. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-01-22Move the deptest code from frontend to backend.Chantry Xavier1-14/+10
The deptest code (pacman -T) used by makepkg was mostly in the frontend. There were 2 drawbacks: 1) the public splitdep function returns a pmdepend_t struct, but the _alpm_dep_free function for freeing it is private. So there was a memleak. 2) there is a helper in the backend (satisfycmp in deps.c) which makes this function much easier. So this adds a new public alpm_deptest in libalpm/deps.c, which cleans pacman_deptest in pacman/deptest.c a lot. Besides, alpm_splitdep was made private, because the frontend no longer requires it, and _alpm_dep_free is also private. Finally the deptest001 pactest was extended. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-15Merge branch 'maint'Dan McGee8-8/+53
2008-01-15Change the versioned provision format.Chantry Xavier6-7/+7
Change the 'provname provver' format to 'provname=provver'. In .PKGINFO, the provisions are copied from the PKGBUILD without quotes. So the provision version was actually handled as a different provision... See FS#9171. Dan: Unfortunately we have to change our original specification for versioned provisions with this patch, but it ends up being the simpler and cleaner solution in the long run, and if there is any time to change it the time is now before many packages have been built. Keeping the ' ' based format would have required us to do special parsing in repo-add, as well as being susceptible to users not using quotes in their provides array. Hopefully this will resolve the issues we had with our initial plan. Sorry for the confusion. Acked-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-15Rename provision related pactests to provision*.py.Chantry Xavier8-3/+48
Also add 3 new pactests to cover both the -U and -S operations for versioned provisions. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-12New reason001.py pactestNagy Gabor1-0/+16
This pactest demonstrates that we should copy the reason between the to-be-replaced and replaced packages Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-10Move the fallback on providers from backend to frontend.Chantry Xavier1-0/+15
This reverts commit e28973169d2e5eda8b64ebdda11ece0dc761d978. This code might fit better in the frontend than in the backend finally. Ref: http://www.archlinux.org/pipermail/pacman-dev/2007-November/010150.html I also changed it for fixing FS#8763 : if there is exactly one provider, pacman will pull it and print a warning. if there are several providers, pacman will list them and fail. It's up to the user to pick one. Add sync501 pactest to reflect that.
2008-01-06conflict.c : fix for FS#8156, detect conflict between symlink and dir.Chantry Xavier1-0/+18
The previous fileconflict check (package vs filesystem) skipped the conflict when the file on the filesystem was a directory or a symlink to a directory, no matter what the file in the package was. Now, the conflict will only be skipped if the file in the package is a directory (so compatible with a dir or a dir symlink on the filesystem). So in the case of 8156 (new fileconflict003 pactest for this case), instead of silently ignoring the extraction of the test symlink, pacman will now fail because of a file conflict between the test symlink in the pkg2 package and the test directory on the filesystem. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-01-06bugfix in pactest when creating a symlink at the top level.Chantry Xavier1-1/+2
Trying to make a symlink at the top level previously made pactest fail. For example : "test -> test2/" as a file in a package. The path to the test symlink was empty in this case, but the python code still tried to chdir in "", which failed. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-01-06sync.c: add sanity check so we don't dereference a null pointerDan McGee1-0/+26
Originally noticed in FS#9024, but was fixed in previous changes anyway. However, it doesn't hurt to still check it. Also add a pactest from Chantry Xavier for the original problem to ensure we can't reproduce it. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-05conflict.c : fix for upgrade042.Chantry Xavier1-0/+28
Thanks to the proactive backup handling, we don't need to add the moving file to the skip_add list. The backup handling will make sure nothing gets overwritten. Ref: http://www.archlinux.org/pipermail/pacman-dev/2007-December/010610.html Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-05add.c : fix upgrade026 pactest.Chantry Xavier1-1/+1
This was the case of the bash packaging error where a file was removed from the package but not the backup array. I just added a sanity check so that only the files from the backup array that are also in the filelist are used. I had to edit upgrade026 pactest slightly : it required the file to be copied to .pacsave instead of moved. But just moving it should be enough, as we agreed on the ML : http://www.archlinux.org/pipermail/pacman-dev/2007-December/010440.html Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-02new upgade042 pactest + bugfix in chk_filedifference.Chantry Xavier1-0/+28
This adds a pactest for the relocation of a config file between two packages (case of etc/profile moving from bash to filesystem). While running this pactest, I found out that chk_filedifference didn't work correctly with an empty list as second argument. So that's fixed now. Ref: http://www.archlinux.org/pipermail/pacman-dev/2007-December/010610.html Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-29Remove .FILELIST generation from makepkg (and elsewhere)Dan McGee1-18/+2
This is something pacman can do on its own straight from the archive, and we will reduce the chance of problems occurring becuase of inproper FILELIST generation as we have had in the past with special characters in filenames. Once we remove it from makepkg. we can remove any usage of it from all of our other tools, including pacman, pactest, and contrib/ utilities. Note that removing it from pacman uncovered a few other bugs anyway, so this was probably a good move. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-29add a new upgrade026 pactest for backup handling.Chantry Xavier1-0/+17
This is the bash case when the /etc/profile file was removed by error from the package, but stayed in the backup array. Ref: http://www.archlinux.org/pipermail/arch-dev-public/2007-December/003556.html Also fixed a little typo in add.c, but it's disabled code. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-12-29fix two broken pactests because of date localization.Chantry Xavier3-5/+24
query002 and sync1100 had PACMAN_OUTPUT rules that looked at the build/install date (localized). Instead of looking at the month name, it will now check the year, which should be safer. I also had to add another pactest (query005) for keeping the same coverage. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-12-19PM_DEP_MOD_LT and PM_DEP_MOD_GT depmods addedNagy Gabor2-0/+28
You can use foo<2.0 and foo>2.0 as depend add046.py and add047.py pactests were added to check this Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-11Add real scriptlet checking for pactestAaron Griffin3-22/+19
Due to commit da1222de2e30aabcae9d17bbfa10bbf0672338af, we can now use fakechroot to completely run scriptlet pactests Use "which" functionality so as not to REQUIRE it for all users Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-11Add "which" path searching functionality to pactestAaron Griffin1-0/+8
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-12-11Fail sanely on OUTPUT rules when --nolog is passedAaron Griffin1-2/+6
Check for existence of the logfile first, and output an error if not found Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-11Update GNU GPL boilerplate and copyright datesDan McGee8-24/+8
Update the GPL boilerplate to direct people to the GNU website for a copy of the license, as well as bump all of Judd's copyrights to 2007. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-11pactest: if we are root, don't use fakerootDan McGee1-1/+3
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-03Add a lot more tests (and some pactest fixes) to -Si and -Qi testsDan McGee3-8/+33
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-03Add more pactests to increase code coverageDan McGee9-1/+96
These new tests test the following ops at least once: -Ss, -Si, -Sl, -Sp, -Qs, -Qi, -T Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-03Add 4 new pactests to get better code coverage by pactestDan McGee4-0/+20
I started playing around with gcov today and it showed a few places in the code that we don't test at all. This is the start of ensuring that we execute most of the code in our codebase. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-01New sync1005 and sync1006 pactestsNagy Gabor2-0/+28
This pactest checks what happens if a package exists in two sync repos. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> [Dan: added sync1006, same test with different versions] Signed-off-by: Dan McGee <dan@archlinux.org>