summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2006-12-12 18:01:49 +0000
committerPascal Rigaux <pixel@mandriva.com>2006-12-12 18:01:49 +0000
commit21a2bfd83b376e00cf05da1e2aa0e2fcdec3f40d (patch)
tree53c9f48587dbcbe2c50371d7db30487ee0715857 /t
parentfb710d68d533d9fafd8d91f68b9cba6a4089d281 (diff)
downloadurpmi-21a2bfd83b376e00cf05da1e2aa0e2fcdec3f40d.tar
urpmi-21a2bfd83b376e00cf05da1e2aa0e2fcdec3f40d.tar.gz
urpmi-21a2bfd83b376e00cf05da1e2aa0e2fcdec3f40d.tar.bz2
urpmi-21a2bfd83b376e00cf05da1e2aa0e2fcdec3f40d.tar.xz
urpmi-21a2bfd83b376e00cf05da1e2aa0e2fcdec3f40d.zip
check things like --media, --excludemedia...
Diffstat (limited to 't')
-rw-r--r--t/superuser--specify-media.t55
1 files changed, 55 insertions, 0 deletions
diff --git a/t/superuser--specify-media.t b/t/superuser--specify-media.t
new file mode 100644
index 00000000..b2548834
--- /dev/null
+++ b/t/superuser--specify-media.t
@@ -0,0 +1,55 @@
+#!/usr/bin/perl
+
+use strict;
+use lib '.', 't';
+use helper;
+use urpm::util;
+use Test::More 'no_plan';
+
+
+need_root_and_prepare();
+
+my $name = 'various';
+symlink $name, "media/${name}_bis";
+my @media = ($name, "${name}_bis");
+my @media_dirs = map { "$::pwd/media/$_" } @media;
+
+urpmi_addmedia("$_ $::pwd/media/$_") foreach @media;
+
+test_urpmq('', @media_dirs);
+test_urpmq("--media $media[0]", $media_dirs[0]);
+test_urpmq("--media $media[1]", $media_dirs[1]);
+test_urpmq("--excludemedia $media[1]", $media_dirs[0]);
+test_urpmq("--excludemedia $media[0]", $media_dirs[1]);
+test_urpmq("--sortmedia $media[0],$media[1]", $media_dirs[0], $media_dirs[1]);
+test_urpmq("--sortmedia $media[1],$media[0]", $media_dirs[1], $media_dirs[0]);
+
+test_urpmi('', $media_dirs[0], $media[1]);
+test_urpmi("--media $media[0]", $media_dirs[0], $media[1]);
+test_urpmi("--media $media[1]", $media_dirs[1], $media[0]);
+test_urpmi("--excludemedia $media[1]", $media_dirs[0], $media[1]);
+test_urpmi("--excludemedia $media[0]", $media_dirs[1], $media[0]);
+test_urpmi("--sortmedia $media[0],$media[1]", $media_dirs[0], $media[1]);
+test_urpmi("--sortmedia $media[1],$media[0]", $media_dirs[1], $media[0]);
+
+sub test_urpmq {
+ my ($para, @wanted) = @_;
+ my $urpmq = urpm_cmd('urpmq');
+ my @l = `$urpmq $para --sources $name`;
+ foreach my $dir (@wanted) {
+ my $found = shift @l;
+ is(dirname($found), $dir);
+ }
+}
+
+sub test_urpmi {
+ my ($para, $wanted, $bad) = @_;
+ my $urpmi = urpmi_cmd();
+ my $s = `$urpmi $para $name`;
+ $s =~ s/^Preparing.*//sm;
+
+ ok($s =~ m!^installing $name\S* from $wanted$!m, "$wanted in $s");
+ isnt($s =~ m!\Q$bad/!, "$bad not in $s");
+
+ urpme($name);
+}