From a03bae98662e36648ee8005656b09c03aa0c4d33 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 18 Dec 2007 14:06:59 +0000 Subject: add tests for %ghost conflicts (which should be allowed) --- t/data/SPECS/file-conflicts/fa.spec | 22 ++++++++++++++++++++++ t/data/SPECS/file-conflicts/fb.spec | 22 ++++++++++++++++++++++ t/superuser--file-conflicts.t | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 t/data/SPECS/file-conflicts/fa.spec create mode 100644 t/data/SPECS/file-conflicts/fb.spec diff --git a/t/data/SPECS/file-conflicts/fa.spec b/t/data/SPECS/file-conflicts/fa.spec new file mode 100644 index 00000000..98dc2c79 --- /dev/null +++ b/t/data/SPECS/file-conflicts/fa.spec @@ -0,0 +1,22 @@ +Summary: x +Name: fa +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 fa $RPM_BUILD_ROOT/etc/foo + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%ghost /etc/foo diff --git a/t/data/SPECS/file-conflicts/fb.spec b/t/data/SPECS/file-conflicts/fb.spec new file mode 100644 index 00000000..6fc6e4ef --- /dev/null +++ b/t/data/SPECS/file-conflicts/fb.spec @@ -0,0 +1,22 @@ +Summary: x +Name: fb +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 fb $RPM_BUILD_ROOT/etc/foo + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%ghost /etc/foo diff --git a/t/superuser--file-conflicts.t b/t/superuser--file-conflicts.t index 9edf794d..d341de95 100644 --- a/t/superuser--file-conflicts.t +++ b/t/superuser--file-conflicts.t @@ -4,6 +4,8 @@ # 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 +# +# fa and fb contains the same file name, with different content but %ghost => should work # # 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 @@ -49,6 +51,13 @@ sub test_rpm_same_transaction { test_rpm_i_fail('a', 'e'); check_nothing_installed(); } + + # WARNING: should it really fail? + test_rpm_i_fail('a', 'fa'); + check_nothing_installed(); + + test_rpm_i_succeeds('fa', 'fb'); + check_installed_and_remove('fa', 'fb'); } sub test_rpm_different_transactions { @@ -66,6 +75,15 @@ sub test_rpm_different_transactions { test_rpm_i_succeeds('d'); check_installed_and_remove('a', 'd'); + # WARNING: should it really fail? + test_rpm_i_succeeds('a'); + test_rpm_i_fail('fa'); + check_installed_and_remove('a'); + + test_rpm_i_succeeds('fa'); + test_rpm_i_succeeds('fb'); + check_installed_and_remove('fa', 'fb'); + # the following need to be done in different transactions otherwise rpm is lost test_rpm_i_succeeds('a'); test_rpm_i_succeeds('gd'); @@ -105,6 +123,13 @@ sub test_urpmi_same_transaction { test_urpmi_fail('a e'); check_nothing_installed(); } + + # WARNING: should it really fail? + test_urpmi_fail('a fa'); + check_nothing_installed(); + + urpmi('fa fb'); + check_installed_and_remove('fa', 'fb'); } sub test_urpmi_different_transactions { @@ -123,6 +148,14 @@ sub test_urpmi_different_transactions { urpmi('d'); check_installed_and_remove('a', 'd'); + urpmi('a'); + test_urpmi_fail('fa'); + check_installed_and_remove('a'); + + urpmi('fa'); + urpmi('fb'); + check_installed_and_remove('fa', 'fb'); + # the following need to be done in different transactions otherwise rpm is lost urpmi('a'); urpmi('gd'); -- cgit v1.2.1