diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2008-11-14 15:32:36 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2008-11-14 15:32:36 +0000 |
commit | 1f1f3ab742b39d3aa5b67a545cc924b78ec8279e (patch) | |
tree | acee4949454e5321643f8f836dcf65c3285468f1 | |
parent | 830d5819dd6280d8133342d700a26b4f6ee9ec56 (diff) | |
download | urpmi-1f1f3ab742b39d3aa5b67a545cc924b78ec8279e.tar urpmi-1f1f3ab742b39d3aa5b67a545cc924b78ec8279e.tar.gz urpmi-1f1f3ab742b39d3aa5b67a545cc924b78ec8279e.tar.bz2 urpmi-1f1f3ab742b39d3aa5b67a545cc924b78ec8279e.tar.xz urpmi-1f1f3ab742b39d3aa5b67a545cc924b78ec8279e.zip |
add a testcase for #45457
-rw-r--r-- | t/02create_pkgs.t | 1 | ||||
-rw-r--r-- | t/data/media.cfg | 6 | ||||
-rw-r--r-- | t/superuser--addmedia.t | 2 | ||||
-rw-r--r-- | t/superuser--urpmi_update.t | 65 |
4 files changed, 69 insertions, 5 deletions
diff --git a/t/02create_pkgs.t b/t/02create_pkgs.t index fc1fd341..9e567937 100644 --- a/t/02create_pkgs.t +++ b/t/02create_pkgs.t @@ -32,7 +32,6 @@ foreach my $spec (glob("data/SPECS/*.spec")) { system_("cp -r media/$name media/${name}_no_subdir"); system_("$genhdlist2 media/${name}_no_subdir"); symlink "${name}_nohdlist", "media/${name} nohdlist"; - symlink "${name}", "media/${name}_bis"; } genhdlist_std($name); } diff --git a/t/data/media.cfg b/t/data/media.cfg index e53dc85b..b106fa09 100644 --- a/t/data/media.cfg +++ b/t/data/media.cfg @@ -18,9 +18,9 @@ name=Various III size=1m noauto=1 -[various_bis] -hdlist=hdlist_bis.cz -name=Various Bis +[various-debug] +hdlist=hdlist_debug.cz +name=Various Debug size=1m debug_for=various noauto=1 diff --git a/t/superuser--addmedia.t b/t/superuser--addmedia.t index 1c1c41b2..d43cbd50 100644 --- a/t/superuser--addmedia.t +++ b/t/superuser--addmedia.t @@ -11,7 +11,7 @@ need_root_and_prepare(); my $name = 'various'; my $name2 = 'various2'; my $name3 = 'various3'; -my @names = ($name, $name2, $name3, 'bis'); +my @names = ($name, $name2, $name3, 'debug'); my @fields = qw(hdlist synthesis with_synthesis media_info_dir no-media-info list virtual ignore); diff --git a/t/superuser--urpmi_update.t b/t/superuser--urpmi_update.t new file mode 100644 index 00000000..475fb31c --- /dev/null +++ b/t/superuser--urpmi_update.t @@ -0,0 +1,65 @@ +#!/usr/bin/perl + +use strict; +use lib '.', 't'; +use helper; +use Test::More 'no_plan'; +BEGIN { use_ok 'urpm::cfg' } + +need_root_and_prepare(); + +try1(); +try2(); + +sub try1 { + urpmi_addmedia("--distrib $::pwd"); + check_urpmi('various', 'various2'); + + urpmi_update('--ignore Various'); + check_conf('Various' => { ignore => 1 }); + test_urpmi_fail('--auto various'); + + check_conf('Various Debug' => { ignore => 1 }); + test_urpmi_fail('various-debug'); + + urpmi_update('--no-ignore "Various Debug"'); + urpmi_update('"Various Debug"'); + check_conf('Various Debug' => { ignore => undef }); + check_urpmi('various-debug'); + + urpmi_removemedia('-a'); +} +# same as above, except urpmi.update is done before urpmi.update --no-ignore +sub try2 { + my ($want, $want3, $options) = @_; + + urpmi_addmedia("--distrib $::pwd"); + + urpmi_update('"Various Debug"'); + check_conf('Various Debug' => { ignore => 1 }); + test_urpmi_fail('various-debug'); + + urpmi_update('--no-ignore "Various Debug"'); + check_conf('Various Debug' => { ignore => undef }); + check_urpmi('various-debug'); + + urpmi_removemedia('-a'); +} + +sub check_conf { + my (%want) = @_; + my $config = urpm::cfg::load_config("root/etc/urpmi/urpmi.cfg"); + my %media = map { $_->{name} => $_ } @{$config->{media}}; + foreach my $name (keys %want) { + foreach my $field (keys %{$want{$name}}) { + my $val = $want{$name}{$field}; + is($media{$name}{$field}, $want{$name}{$field}, "$name:$field"); + } + } +} + +sub check_urpmi { + my (@names) = @_; + urpmi(join(' ', @names)); + check_installed_and_remove(@names); +} |