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 | |
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
-rw-r--r-- | t/data/SPECS/file-conflicts/ga.spec | 22 | ||||
-rw-r--r-- | t/data/SPECS/file-conflicts/gc.spec | 22 | ||||
-rw-r--r-- | t/data/SPECS/file-conflicts/gc_.spec | 22 | ||||
-rw-r--r-- | t/data/SPECS/file-conflicts/gd.spec | 22 | ||||
-rw-r--r-- | t/superuser--file-conflicts.t | 55 |
5 files changed, 139 insertions, 4 deletions
diff --git a/t/data/SPECS/file-conflicts/ga.spec b/t/data/SPECS/file-conflicts/ga.spec new file mode 100644 index 00000000..8418bb07 --- /dev/null +++ b/t/data/SPECS/file-conflicts/ga.spec @@ -0,0 +1,22 @@ +Summary: x +Name: ga +Version: 1 +Release: 1 +License: x +Group: x +Url: x +BuildArch: noarch + +%description +x + +%install +rm -rf $RPM_BUILD_ROOT +install -d $RPM_BUILD_ROOT/etc +ln -s dir $RPM_BUILD_ROOT/etc/dir_symlink + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +/etc/* diff --git a/t/data/SPECS/file-conflicts/gc.spec b/t/data/SPECS/file-conflicts/gc.spec new file mode 100644 index 00000000..75bd6f20 --- /dev/null +++ b/t/data/SPECS/file-conflicts/gc.spec @@ -0,0 +1,22 @@ +Summary: x +Name: gc +Version: 1 +Release: 1 +License: x +Group: x +Url: x +BuildArch: noarch + +%description +x + +%install +rm -rf $RPM_BUILD_ROOT +install -d $RPM_BUILD_ROOT/etc/dir_symlink +echo a > $RPM_BUILD_ROOT/etc/dir_symlink/a + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +/etc/dir_symlink/a diff --git a/t/data/SPECS/file-conflicts/gc_.spec b/t/data/SPECS/file-conflicts/gc_.spec new file mode 100644 index 00000000..69dcac82 --- /dev/null +++ b/t/data/SPECS/file-conflicts/gc_.spec @@ -0,0 +1,22 @@ +Summary: x +Name: gc_ +Version: 1 +Release: 1 +License: x +Group: x +Url: x +BuildArch: noarch + +%description +x + +%install +rm -rf $RPM_BUILD_ROOT +install -d $RPM_BUILD_ROOT/etc/dir_symlink +echo a > $RPM_BUILD_ROOT/etc/dir_symlink/a + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +/etc/dir_symlink/a diff --git a/t/data/SPECS/file-conflicts/gd.spec b/t/data/SPECS/file-conflicts/gd.spec new file mode 100644 index 00000000..d11fb1db --- /dev/null +++ b/t/data/SPECS/file-conflicts/gd.spec @@ -0,0 +1,22 @@ +Summary: x +Name: gd +Version: 1 +Release: 1 +License: x +Group: x +Url: x +BuildArch: noarch + +%description +x + +%install +rm -rf $RPM_BUILD_ROOT +install -d $RPM_BUILD_ROOT/etc/dir_symlink +echo d > $RPM_BUILD_ROOT/etc/dir_symlink/a + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +/etc/dir_symlink/a 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"); + } +} |