diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2007-08-29 10:40:16 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2007-08-29 10:40:16 +0000 |
commit | 280ae81a2e6427dd3433d3968d2336bd010b71d5 (patch) | |
tree | bcc59bf0de469d27cdf2be75e128cc5666f3d0a9 /t/superuser--file-conflicts.t | |
parent | 0b2440569263b477b3c2263f93c06a66001852b1 (diff) | |
download | urpmi-280ae81a2e6427dd3433d3968d2336bd010b71d5.tar urpmi-280ae81a2e6427dd3433d3968d2336bd010b71d5.tar.gz urpmi-280ae81a2e6427dd3433d3968d2336bd010b71d5.tar.bz2 urpmi-280ae81a2e6427dd3433d3968d2336bd010b71d5.tar.xz urpmi-280ae81a2e6427dd3433d3968d2336bd010b71d5.zip |
- add a test case for same files but different paths through symlink
- perl-URPM do not drop tags anymore, so re-enable the test which fails without tag RPMTAG_FILEDIGESTS
Diffstat (limited to 't/superuser--file-conflicts.t')
-rw-r--r-- | t/superuser--file-conflicts.t | 55 |
1 files changed, 51 insertions, 4 deletions
diff --git a/t/superuser--file-conflicts.t b/t/superuser--file-conflicts.t index 195f5006..f02d1dc6 100644 --- a/t/superuser--file-conflicts.t +++ b/t/superuser--file-conflicts.t @@ -4,6 +4,10 @@ # a and c contents the same file name, with same content => should work # a and d contents the same directory name => should work # a and e contents the same path for a directory vs a symlink => should fail +# +# a and gc/gc_/gd contains different file => should work +# ga and a and gc/gc_ contains the same resulting file, through symlink in ga, with same content => should work +# ga and a and gd contains the same resulting file, through symlink in ga, with different content => should fail use strict; use lib '.', 't'; @@ -55,6 +59,24 @@ sub test_rpm_different_transactions { test_rpm_i_succeeds('a'); test_rpm_i_succeeds('d'); check_installed_and_remove('a', 'd'); + + # the following need to be done in different transactions otherwise rpm is lost + test_rpm_i_succeeds('a'); + test_rpm_i_succeeds('gd'); + check_installed_and_remove('a', 'gd'); + rmdir 'root/etc/dir_symlink'; # remove unowned directory + check_no_etc_files(); + + test_rpm_i_succeeds('a', 'ga'); + test_rpm_i_fail('gd'); + check_installed_names('a', 'ga'); + + test_rpm_i_succeeds('gc'); + test_rpm_i_succeeds('gc_'); + check_installed_names('a', 'ga', 'gc', 'gc_'); + urpme('gc gc_'); # if you remove gc and a/ga at the same time, hell can happen... + check_installed_and_remove('a', 'ga'); + check_no_etc_files(); } sub test_urpmi_same_transaction { @@ -81,13 +103,32 @@ sub test_urpmi_different_transactions { test_urpmi_fail('e'); check_installed_names('a'); - # disabled, fail when dropping RPMTAG_FILEDIGESTS - #urpmi('c'); - #check_installed_and_remove('a', 'c'); + # fail when dropping RPMTAG_FILEDIGESTS + urpmi('c'); + check_installed_and_remove('a', 'c'); - #urpmi('a'); + urpmi('a'); urpmi('d'); check_installed_and_remove('a', 'd'); + + # the following need to be done in different transactions otherwise rpm is lost + urpmi('a'); + urpmi('gd'); + check_installed_and_remove('a', 'gd'); + rmdir 'root/etc/dir_symlink'; # remove unowned directory + check_no_etc_files(); + + urpmi('a ga'); + test_urpmi_fail('gd'); + check_installed_names('a', 'ga'); + + urpmi('gc'); + urpmi('gc_'); + check_installed_names('a', 'ga', 'gc', 'gc_'); + urpme('gc gc_'); # if you remove gc and a/ga at the same time, hell can happen... + check_installed_and_remove('a', 'ga'); + check_no_etc_files(); + } sub test_rpm_i_succeeds { @@ -104,3 +145,9 @@ sub test_urpmi_fail { my ($rpms) = @_; system_should_fail(urpmi_cmd() . " $rpms"); } + +sub check_no_etc_files() { + if (my @l = grep { !m!/urpmi$! } glob("$::pwd/root/etc/*")) { + fail(join(' ', @l) . " files should not be there"); + } +} |