4 use Test
::Simple tests
=> (3 * 4 + 0 + 1 + 2) + (3) + (3);
6 use Fedora
::Rebuild
::Mock
;
12 # Each call does 1 test.
14 my ($arch, $repos) = @_;
19 $mock = Fedora
::Rebuild
::Mock
->new(
20 architecture
=> $arch,
21 repositories
=> $repos
25 ok
( $@
ne '', "architecure <$arch> is forbidden");
26 unlink $mock->config_file if defined $mock;
30 # Each call does 4 + <number_of_repositories> tests.
32 my ($arch, $repos) = @_;
34 my $mock = Fedora
::Rebuild
::Mock
->new(
35 architecture
=> $arch,
36 repositories
=> $repos
38 my ($directory, $root) = $mock->make_configuration;
40 ok
(defined $directory, 'Method make_configuration returns the directory');
41 ok
(defined $root, 'Method make_configuration returns the root name');
43 my $filename = File
::Spec
->catfile($directory, ($root . '.cfg'));
44 open(my $fh, '<', $filename);
48 if (/config_opts\['target_arch'\]\s*=\s*'([^']*)'/) {
50 "target architecture: expected=<$arch> got=<$1>")
52 if (/config_opts\['legal_host_arches'\]\s*=\s*\('([^']*)',\)/) {
54 "host architectures: expected=<$arch> got=<$1>")
60 my $repo = URI
->new($_);
61 ok
( $content =~ /[^#]*baseurl\s*=\s*\Q$repo\E/,
62 "$repo is referrenced");
65 File
::Path
::remove_tree
($directory);
70 do_test
('a', [ 'http://example.com/' ]);
71 do_test
('a', [ 'http://1.example.com/', 'http://2.example.com/' ]);
73 expect_croak
(q{'}, []);
74 expect_croak
(q{"}, []);
75 expect_croak
(qq{\n}, []);
79 my ($arch, $repos) = ('q', [ 'http://example.com/'] );
81 my ($directory1, $root1) = Fedora
::Rebuild
::Mock
->new(
82 architecture
=> $arch,
83 repositories
=> $repos,
85 )->make_configuration;
87 my $filename = File
::Spec
->catfile($directory1, ($root1 . '.cfg'));
88 open(my $fh, '<', $filename);
90 while(<$fh>) { $content1 .= $_; }
93 for my $identifier (qw(ccache_enable yum_cache_enable root_cache_enable)) {
94 ok
($content1 =~ /\b\Q$identifier\E'\s*\]\s*=\s*True\b/,
95 "shared mock has enabled $identifier");
98 File
::Path
::remove_tree
($directory1);