summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-10-08 11:54:13 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-10-08 11:54:13 +0000
commit51a0bbfe1758bcf1526d41d63cd1c4518fa6ce80 (patch)
treeee74957892063e7ab4c220620224c0e5ad43342a /t
parentc64d0fa1ea26cc983818569f91974ad20b3ff11c (diff)
downloadurpmi-51a0bbfe1758bcf1526d41d63cd1c4518fa6ce80.tar
urpmi-51a0bbfe1758bcf1526d41d63cd1c4518fa6ce80.tar.gz
urpmi-51a0bbfe1758bcf1526d41d63cd1c4518fa6ce80.tar.bz2
urpmi-51a0bbfe1758bcf1526d41d63cd1c4518fa6ce80.tar.xz
urpmi-51a0bbfe1758bcf1526d41d63cd1c4518fa6ce80.zip
add tests, esp. for %triggerpostun failing that blocks upgrade of
drakxtools-backend in mdv2009.0
Diffstat (limited to 't')
-rw-r--r--t/data/SPECS/failing-scriptlets/post.spec17
-rw-r--r--t/data/SPECS/failing-scriptlets/posttrans.spec17
-rw-r--r--t/data/SPECS/failing-scriptlets/postun.spec17
-rw-r--r--t/data/SPECS/failing-scriptlets/pre.spec17
-rw-r--r--t/data/SPECS/failing-scriptlets/pretrans.spec17
-rw-r--r--t/data/SPECS/failing-scriptlets/preun.spec17
-rw-r--r--t/data/SPECS/failing-scriptlets/triggerin-1.spec17
-rw-r--r--t/data/SPECS/failing-scriptlets/triggerin-2.spec17
-rw-r--r--t/data/SPECS/failing-scriptlets/triggerpostun-1.spec17
-rw-r--r--t/data/SPECS/failing-scriptlets/triggerpostun-2.spec17
-rw-r--r--t/data/SPECS/failing-scriptlets/triggerprein-1.spec17
-rw-r--r--t/data/SPECS/failing-scriptlets/triggerprein-2.spec17
-rw-r--r--t/data/SPECS/failing-scriptlets/triggerun-1.spec17
-rw-r--r--t/data/SPECS/failing-scriptlets/triggerun-2.spec17
-rw-r--r--t/superuser--failing-scriptlets.t42
15 files changed, 280 insertions, 0 deletions
diff --git a/t/data/SPECS/failing-scriptlets/post.spec b/t/data/SPECS/failing-scriptlets/post.spec
new file mode 100644
index 00000000..2534ac9d
--- /dev/null
+++ b/t/data/SPECS/failing-scriptlets/post.spec
@@ -0,0 +1,17 @@
+Summary: x
+Name: post
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%post -p <lua>
+print("%{name}-%{version}")
+exit(1)
+
+%files
diff --git a/t/data/SPECS/failing-scriptlets/posttrans.spec b/t/data/SPECS/failing-scriptlets/posttrans.spec
new file mode 100644
index 00000000..c2a085d9
--- /dev/null
+++ b/t/data/SPECS/failing-scriptlets/posttrans.spec
@@ -0,0 +1,17 @@
+Summary: x
+Name: posttrans
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%posttrans -p <lua>
+print("%{name}-%{version}")
+exit(1)
+
+%files
diff --git a/t/data/SPECS/failing-scriptlets/postun.spec b/t/data/SPECS/failing-scriptlets/postun.spec
new file mode 100644
index 00000000..6f3ae0fd
--- /dev/null
+++ b/t/data/SPECS/failing-scriptlets/postun.spec
@@ -0,0 +1,17 @@
+Summary: x
+Name: postun
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%postun -p <lua>
+print("%{name}-%{version}")
+exit(1)
+
+%files
diff --git a/t/data/SPECS/failing-scriptlets/pre.spec b/t/data/SPECS/failing-scriptlets/pre.spec
new file mode 100644
index 00000000..4d7c1918
--- /dev/null
+++ b/t/data/SPECS/failing-scriptlets/pre.spec
@@ -0,0 +1,17 @@
+Summary: x
+Name: pre
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%pre -p <lua>
+print("%{name}-%{version}")
+exit(1)
+
+%files
diff --git a/t/data/SPECS/failing-scriptlets/pretrans.spec b/t/data/SPECS/failing-scriptlets/pretrans.spec
new file mode 100644
index 00000000..56ec1417
--- /dev/null
+++ b/t/data/SPECS/failing-scriptlets/pretrans.spec
@@ -0,0 +1,17 @@
+Summary: x
+Name: pretrans
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%pretrans -p <lua>
+print("%{name}-%{version}")
+exit(1)
+
+%files
diff --git a/t/data/SPECS/failing-scriptlets/preun.spec b/t/data/SPECS/failing-scriptlets/preun.spec
new file mode 100644
index 00000000..854678b7
--- /dev/null
+++ b/t/data/SPECS/failing-scriptlets/preun.spec
@@ -0,0 +1,17 @@
+Summary: x
+Name: preun
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%preun -p <lua>
+print("%{name}-%{version}")
+exit(1)
+
+%files
diff --git a/t/data/SPECS/failing-scriptlets/triggerin-1.spec b/t/data/SPECS/failing-scriptlets/triggerin-1.spec
new file mode 100644
index 00000000..cd7cc977
--- /dev/null
+++ b/t/data/SPECS/failing-scriptlets/triggerin-1.spec
@@ -0,0 +1,17 @@
+Summary: x
+Name: triggerin
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%triggerin -p <lua> -- triggerin > 0
+print("%{name}-%{version}")
+exit(1)
+
+%files
diff --git a/t/data/SPECS/failing-scriptlets/triggerin-2.spec b/t/data/SPECS/failing-scriptlets/triggerin-2.spec
new file mode 100644
index 00000000..caecbde8
--- /dev/null
+++ b/t/data/SPECS/failing-scriptlets/triggerin-2.spec
@@ -0,0 +1,17 @@
+Summary: x
+Name: triggerin
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%triggerin -p <lua> -- triggerin > 0
+print("%{name}-%{version}")
+exit(1)
+
+%files
diff --git a/t/data/SPECS/failing-scriptlets/triggerpostun-1.spec b/t/data/SPECS/failing-scriptlets/triggerpostun-1.spec
new file mode 100644
index 00000000..04f88b5d
--- /dev/null
+++ b/t/data/SPECS/failing-scriptlets/triggerpostun-1.spec
@@ -0,0 +1,17 @@
+Summary: x
+Name: triggerpostun
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%triggerpostun -p <lua> -- triggerpostun > 0
+print("%{name}-%{version}")
+exit(1)
+
+%files
diff --git a/t/data/SPECS/failing-scriptlets/triggerpostun-2.spec b/t/data/SPECS/failing-scriptlets/triggerpostun-2.spec
new file mode 100644
index 00000000..dd44e94a
--- /dev/null
+++ b/t/data/SPECS/failing-scriptlets/triggerpostun-2.spec
@@ -0,0 +1,17 @@
+Summary: x
+Name: triggerpostun
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%triggerpostun -p <lua> -- triggerpostun > 0
+print("%{name}-%{version}")
+exit(1)
+
+%files
diff --git a/t/data/SPECS/failing-scriptlets/triggerprein-1.spec b/t/data/SPECS/failing-scriptlets/triggerprein-1.spec
new file mode 100644
index 00000000..ecf51f00
--- /dev/null
+++ b/t/data/SPECS/failing-scriptlets/triggerprein-1.spec
@@ -0,0 +1,17 @@
+Summary: x
+Name: triggerprein
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%triggerprein -p <lua> -- triggerprein > 0
+print("%{name}-%{version}")
+exit(1)
+
+%files
diff --git a/t/data/SPECS/failing-scriptlets/triggerprein-2.spec b/t/data/SPECS/failing-scriptlets/triggerprein-2.spec
new file mode 100644
index 00000000..a3f1ecc6
--- /dev/null
+++ b/t/data/SPECS/failing-scriptlets/triggerprein-2.spec
@@ -0,0 +1,17 @@
+Summary: x
+Name: triggerprein
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%triggerprein -p <lua> -- triggerprein > 0
+print("%{name}-%{version}")
+exit(1)
+
+%files
diff --git a/t/data/SPECS/failing-scriptlets/triggerun-1.spec b/t/data/SPECS/failing-scriptlets/triggerun-1.spec
new file mode 100644
index 00000000..a717d184
--- /dev/null
+++ b/t/data/SPECS/failing-scriptlets/triggerun-1.spec
@@ -0,0 +1,17 @@
+Summary: x
+Name: triggerun
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%triggerun -p <lua> -- triggerun > 0
+print("%{name}-%{version}")
+exit(1)
+
+%files
diff --git a/t/data/SPECS/failing-scriptlets/triggerun-2.spec b/t/data/SPECS/failing-scriptlets/triggerun-2.spec
new file mode 100644
index 00000000..2419c4e2
--- /dev/null
+++ b/t/data/SPECS/failing-scriptlets/triggerun-2.spec
@@ -0,0 +1,17 @@
+Summary: x
+Name: triggerun
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%triggerun -p <lua> -- triggerun > 0
+print("%{name}-%{version}")
+exit(1)
+
+%files
diff --git a/t/superuser--failing-scriptlets.t b/t/superuser--failing-scriptlets.t
new file mode 100644
index 00000000..740e4369
--- /dev/null
+++ b/t/superuser--failing-scriptlets.t
@@ -0,0 +1,42 @@
+#!/usr/bin/perl
+
+use strict;
+use lib '.', 't';
+use helper;
+use Test::More 'no_plan';
+
+my $medium_name = 'failing-scriptlets';
+
+need_root_and_prepare();
+
+test_install_rpm_fail('pre');
+test_install_rpm('pretrans');
+test_install_rpm('post');
+test_install_rpm('preun');
+test_install_rpm('postun');
+test_install_rpm('posttrans');
+
+test_install_upgrade_rpm('triggerprein');
+test_install_upgrade_rpm('triggerin');
+test_install_upgrade_rpm('triggerun');
+test_install_upgrade_rpm('triggerpostun');
+
+sub test_install_rpm {
+ my ($name) = @_;
+ system_("rpm --root $::pwd/root -i media/$medium_name/$name-*.rpm");
+ check_installed_fullnames_and_remove("$name-1-1");
+}
+sub test_install_rpm_fail {
+ my ($name) = @_;
+ system_should_fail("rpm --root $::pwd/root -i media/$medium_name/$name-*.rpm");
+ check_nothing_installed();
+}
+
+sub test_install_upgrade_rpm {
+ my ($name) = @_;
+
+ system_("rpm --root $::pwd/root -i media/$medium_name/$name-1-*.rpm");
+ check_installed_fullnames("$name-1-1");
+ system_("rpm --root $::pwd/root -U media/$medium_name/$name-2-*.rpm");
+ check_installed_fullnames_and_remove("$name-2-1");
+}