From bca32182ad43ddbcab36eefb467822f14fd77cef Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 27 Sep 2007 12:14:19 +0000 Subject: - move some test from superuser--media_info_dir.t into superuser--rpm.t - add a test --- t/data/SPECS/rpm-query-in-scriptlet.spec | 31 +++++++++++++++++++++++++++++++ t/superuser--media_info_dir.t | 9 --------- t/superuser--rpm.t | 25 +++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 9 deletions(-) create mode 100644 t/data/SPECS/rpm-query-in-scriptlet.spec create mode 100644 t/superuser--rpm.t diff --git a/t/data/SPECS/rpm-query-in-scriptlet.spec b/t/data/SPECS/rpm-query-in-scriptlet.spec new file mode 100644 index 00000000..dc331998 --- /dev/null +++ b/t/data/SPECS/rpm-query-in-scriptlet.spec @@ -0,0 +1,31 @@ +Summary: x +Name: rpm-query-in-scriptlet +Version: 1 +Release: 1 +License: x +Group: x +Url: x +BuildRoot: %{_tmppath}/%{name} + +%description +x + +%install +rm -rf %buildroot +echo > list +for i in sh rpm; do + bin=`which $i` + echo $bin >> list + ldd $bin | sed -e 's/^[ \t]*//' -e 's/.* => //' -e 's/ .*//' >> list +done +grep '/' list | (cd / ; cpio -pumd --dereference %buildroot) + +find %buildroot + +%post +echo "RPMLOCK_NOWAIT is '$RPMLOCK_NOWAIT'" +rpm -q foo +true + +%files +/* diff --git a/t/superuser--media_info_dir.t b/t/superuser--media_info_dir.t index 7ba9f0c9..7d2a18d2 100644 --- a/t/superuser--media_info_dir.t +++ b/t/superuser--media_info_dir.t @@ -26,8 +26,6 @@ sub rpm_v3 { system_("rpm --root $::pwd/root -i --noscripts media/rpm-v3/*.i386.rpm"); check_installed_names(@names); - rebuilddb(); # why here? well, why not - check_installed_names(@names); system_("rpm --root $::pwd/root -e --noscripts " . join(' ', @names)); is(`rpm -qa --root $::pwd/root`, ''); @@ -53,10 +51,3 @@ sub rpm_v3 { is($arch, $wanted_arch, "$fullname should have arch $wanted_arch (found $arch)"); } } - -sub rebuilddb { - # testing rebuilddb (could be done elsewhere, but here is - system_("rpm --root $::pwd/root --rebuilddb"); - my ($dir) = glob("$::pwd/root/var/lib/rpmrebuilddb*"); - is($dir, undef, "$dir should not be there"); -} diff --git a/t/superuser--rpm.t b/t/superuser--rpm.t new file mode 100644 index 00000000..4930d30d --- /dev/null +++ b/t/superuser--rpm.t @@ -0,0 +1,25 @@ +#!/usr/bin/perl + +use strict; +use lib '.', 't'; +use helper; +use Test::More 'no_plan'; + +my $name = 'rpm-query-in-scriptlet'; + +need_root_and_prepare(); +test_rpm_query_in_scriptlet(); + +sub test_rpm_query_in_scriptlet { + system_("rpm --root $::pwd/root -i media/$name/$name*.rpm --nodeps"); + check_installed_names($name); + rebuilddb(); + check_installed_names($name); +} + +sub rebuilddb { + # testing rebuilddb (could be done elsewhere, but here is + system_("rpm --root $::pwd/root --rebuilddb"); + my ($dir) = glob("$::pwd/root/var/lib/rpmrebuilddb*"); + is($dir, undef, "$dir should not be there"); +} -- cgit v1.2.1