summaryrefslogtreecommitdiffstats
path: root/t/superuser--rpmnew.t
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-08-12 18:21:40 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-08-12 18:21:40 +0000
commit43adcb41d2209dbc1b573cca46c080790a5ce5c9 (patch)
treeccf64f122b23c4826ac85e5a9fb006a87b63053f /t/superuser--rpmnew.t
parentc4fde25c9baf13c2c644018eefdb0099e69342da (diff)
downloadurpmi-43adcb41d2209dbc1b573cca46c080790a5ce5c9.tar
urpmi-43adcb41d2209dbc1b573cca46c080790a5ce5c9.tar.gz
urpmi-43adcb41d2209dbc1b573cca46c080790a5ce5c9.tar.bz2
urpmi-43adcb41d2209dbc1b573cca46c080790a5ce5c9.tar.xz
urpmi-43adcb41d2209dbc1b573cca46c080790a5ce5c9.zip
also test through urpmi
Diffstat (limited to 't/superuser--rpmnew.t')
-rw-r--r--t/superuser--rpmnew.t59
1 files changed, 37 insertions, 22 deletions
diff --git a/t/superuser--rpmnew.t b/t/superuser--rpmnew.t
index 20320655..71c4d851 100644
--- a/t/superuser--rpmnew.t
+++ b/t/superuser--rpmnew.t
@@ -11,29 +11,49 @@ my @names = ('config-noreplace', 'config', 'normal');
need_root_and_prepare();
-test(['orig', 'orig', 'orig'],
- ['orig', 'orig', 'orig'],
- ['changed', 'changed', 'changed']);
+my $rpm_cmd = "rpm --root $::pwd/root -U";
+my $urpmi_cmd = urpmi_cmd();
-if (my @l = glob("$::pwd/root/etc/*")) {
- fail(join(' ', @l) . " files should not be there");
+test1($rpm_cmd);
+test2($rpm_cmd);
+test1($urpmi_cmd);
+test2($urpmi_cmd);
+
+sub test1 {
+ my ($cmd) = @_;
+
+ test($cmd,
+ ['orig', 'orig', 'orig'],
+ ['orig', 'orig', 'orig'],
+ ['changed', 'changed', 'changed']);
+
+ check_no_etc_files();
}
-system("echo foo > $::pwd/root/etc/$_") foreach @names;
+sub test2 {
+ my ($cmd) = @_;
+
+ system("echo foo > $::pwd/root/etc/$_") foreach @names;
-test(['foo', 'orig', 'orig'],
- ['foo', 'orig', 'orig'],
- ['foo', 'changed', 'changed']);
+ test($cmd,
+ ['foo', 'orig', 'orig'],
+ ['foo', 'orig', 'orig'],
+ ['foo', 'changed', 'changed']);
-check_one_content('<removed>', 'config.rpmorig', 'foo');
-check_one_content('<removed>', 'config-noreplace.rpmsave', 'foo');
-check_one_content('<removed>', 'config-noreplace.rpmnew', 'changed');
-unlink "$::pwd/root/etc/config.rpmorig";
-unlink "$::pwd/root/etc/config-noreplace.rpmsave";
-unlink "$::pwd/root/etc/config-noreplace.rpmnew";
+ check_one_content('<removed>', 'config.rpmorig', 'foo');
+ check_one_content('<removed>', 'config-noreplace.rpmsave', 'foo');
+ check_one_content('<removed>', 'config-noreplace.rpmnew', 'changed');
+ unlink "$::pwd/root/etc/config.rpmorig";
+ unlink "$::pwd/root/etc/config-noreplace.rpmsave";
+ unlink "$::pwd/root/etc/config-noreplace.rpmnew";
-if (my @l = glob("$::pwd/root/etc/*")) {
- fail(join(' ', @l) . " files should not be there");
+ check_no_etc_files();
+}
+
+sub check_no_etc_files() {
+ if (my @l = grep { !m!/urpmi$! } glob("$::pwd/root/etc/*")) {
+ fail(join(' ', @l) . " files should not be there");
+ }
}
sub check_content {
@@ -52,11 +72,6 @@ sub check_one_content {
}
sub test {
- my ($v1, $v2, $v3) = @_;
- test_raw("rpm --root $::pwd/root -U", $v1, $v2, $v3);
-}
-
-sub test_raw {
my ($cmd, $v1, $v2, $v3) = @_;
system_("$cmd media/$medium_name/a-1-*.rpm");