diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2007-04-24 19:34:32 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2007-04-24 19:34:32 +0000 |
commit | 4df7583caa71a35d6d68c373fc0c62d1be6d955b (patch) | |
tree | bddf36169b314d82ff20036dea7e47fa4fec5bcd /t/helper.pm | |
parent | 7a606ec3537b2f465f8e06e99b445c756bfcca8f (diff) | |
download | urpmi-4df7583caa71a35d6d68c373fc0c62d1be6d955b.tar urpmi-4df7583caa71a35d6d68c373fc0c62d1be6d955b.tar.gz urpmi-4df7583caa71a35d6d68c373fc0c62d1be6d955b.tar.bz2 urpmi-4df7583caa71a35d6d68c373fc0c62d1be6d955b.tar.xz urpmi-4df7583caa71a35d6d68c373fc0c62d1be6d955b.zip |
re-sync after the big svn loss
Diffstat (limited to 't/helper.pm')
-rw-r--r-- | t/helper.pm | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/t/helper.pm b/t/helper.pm index 58499a7f..11614842 100644 --- a/t/helper.pm +++ b/t/helper.pm @@ -8,6 +8,7 @@ our @EXPORT = qw(need_root_and_prepare urpm_cmd urpmi_cmd urpmi urpme urpmi_cfg set_urpmi_cfg_global_options system_ + check_installed_names check_installed_and_remove check_installed_and_urpme ); my $using_root; @@ -89,6 +90,31 @@ sub system_ { ok($? == 0, $cmd); } + +sub check_installed_names { + my (@names) = @_; + is(`rpm -qa --qf '%{name}\\n' --root $::pwd/root | sort`, join('', map { "$_\n" } sort(@names))); +} + +sub check_nothing_installed() { + is(`rpm -qa --root $::pwd/root`, ''); +} + +sub check_installed_and_remove { + my (@names) = @_; + check_installed_names(@names); + system_("rpm --root $::pwd/root -e " . join(' ', @names)); + check_nothing_installed(); +} + +sub check_installed_and_urpme { + my (@names) = @_; + check_installed_names(@names); + urpme(join(' ', @names)); + check_nothing_installed(); +} + + END { $using_root and system('rm -rf root'); $server_pid and kill(9, $server_pid); |