line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl -w |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# The script tests Arch::Registry with supermirror archives. |
4
|
|
|
|
|
|
|
# Usage: env DEBUG=1 USE_NETWORK=1 tests/registry-2 |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
917
|
use FindBin; |
|
1
|
|
|
|
|
1685
|
|
|
1
|
|
|
|
|
55
|
|
7
|
1
|
|
|
1
|
|
918
|
use lib "$FindBin::Bin/../perllib"; |
|
1
|
|
|
|
|
762
|
|
|
1
|
|
|
|
|
9
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
1460
|
use Test::More tests => 11; |
|
1
|
|
|
|
|
62107
|
|
|
1
|
|
|
|
|
12
|
|
10
|
1
|
|
|
1
|
|
9
|
use_ok("Arch::Registry"); |
|
1
|
|
|
|
|
1163
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
|
|
9804
|
my $registry = Arch::Registry->new; |
13
|
1
|
|
33
|
|
|
43
|
ok($registry && $registry->isa('Arch::Registry'), "create registry object"); |
14
|
|
|
|
|
|
|
|
15
|
1
|
50
|
|
|
|
13
|
SKIP: { |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
|
|
1255
|
skip("network tests by default", 9) unless $ENV{USE_NETWORK}; |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
0
|
my $archives = $registry->supermirror_archives; |
20
|
0
|
0
|
|
|
|
0
|
unless (defined $archives) { |
21
|
0
|
|
|
|
|
0
|
my $error = $registry->web_error; |
22
|
0
|
0
|
|
|
|
0
|
$error? pass($error): fail("supermirror get failed without web error"); |
23
|
0
|
|
|
|
|
0
|
skip("- seems like you have no network", 8); |
24
|
|
|
|
|
|
|
} |
25
|
0
|
|
|
|
|
0
|
is(ref($archives), 'HASH', "got all supermirror archives"); |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
0
|
my $perl_gpl_archive = 'migo@homemail.com--Perl-GPL'; |
28
|
0
|
|
|
|
|
0
|
my $arch_perl_version = 'arch-perl--devel--0'; |
29
|
0
|
|
|
|
|
0
|
ok($archives->{$perl_gpl_archive}, "got $perl_gpl_archive location"); |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
0
|
my $archive_versions = $registry->supermirror_archive_versions; |
32
|
0
|
|
|
|
|
0
|
is(ref($archive_versions), 'HASH', "got all supermirror archive versions"); |
33
|
0
|
|
|
|
|
0
|
my $versions = $archive_versions->{$perl_gpl_archive}; |
34
|
0
|
|
|
|
|
0
|
my $is_array = ref($versions) eq 'ARRAY'; |
35
|
0
|
0
|
|
|
|
0
|
print map { "\t$_\n" } @$versions if $ENV{DEBUG}; |
|
0
|
|
|
|
|
0
|
|
36
|
0
|
|
0
|
|
|
0
|
ok($is_array && @$versions > 5, "got $perl_gpl_archive versions"); |
37
|
0
|
|
0
|
|
|
0
|
ok($is_array && (grep /$arch_perl_version/, @$versions), "got $arch_perl_version version"); |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
0
|
$archives = $registry->search_supermirror('.*', '--cset-gui--'); |
40
|
0
|
|
|
|
|
0
|
is(ref($archives), 'ARRAY', "search for cset-gui branch"); |
41
|
0
|
|
|
|
|
0
|
ok(scalar(grep /$perl_gpl_archive/, @$archives), "got $arch_perl_version"); |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
0
|
$versions = $registry->search_supermirror('migo@.*', '.*-gui\b', 1); |
44
|
0
|
0
|
|
|
|
0
|
print map { "\t$_\n" } @$versions if $ENV{DEBUG}; |
|
0
|
|
|
|
|
0
|
|
45
|
0
|
|
|
|
|
0
|
is(ref($versions), 'ARRAY', "search for migo@*/*-gui branch"); |
46
|
0
|
|
|
|
|
0
|
my $archive = 'migo@homemail.com--archway-micro'; |
47
|
0
|
|
|
|
|
0
|
ok(scalar(grep /$archive/, @$versions), "got $archive"); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
} |