summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2009-11-18 08:01:40 +0100
committermkanat%bugzilla.org <>2009-11-18 08:01:40 +0100
commitbc19f61c0c33e71a00dcc8e4ca3e791a9e3b661d (patch)
tree4a6b0e7a7800545f9083fe70fed45e3c9c0d1edf /t
parent900f8b1d1eacf44dbfd8d9c8b414b472f492abe8 (diff)
downloadbugzilla-bc19f61c0c33e71a00dcc8e4ca3e791a9e3b661d.tar.gz
bugzilla-bc19f61c0c33e71a00dcc8e4ca3e791a9e3b661d.tar.xz
Fix for Bug 527505: Make t/001compile.t work even after Bugzilla::Install::CPAN messes with @INC, and make Bugzilla->feature work during mod_perl.pl.
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=mkanat
Diffstat (limited to 't')
-rw-r--r--t/001compile.t40
1 files changed, 10 insertions, 30 deletions
diff --git a/t/001compile.t b/t/001compile.t
index 4a2ea0eda..3e4273492 100644
--- a/t/001compile.t
+++ b/t/001compile.t
@@ -32,40 +32,18 @@ use Test::More tests => scalar(@Support::Files::testitems);
BEGIN {
use_ok('Bugzilla::Constants');
+ use_ok('Bugzilla::Install::Requirements');
use_ok('Bugzilla');
}
-use constant FEATURE_FILES => (
- jsonrpc => ['Bugzilla/WebService/Server/JSONRPC.pm', 'jsonrpc.cgi'],
- xmlrpc => ['Bugzilla/WebService/Server/XMLRPC.pm', 'xmlrpc.cgi',
- 'Bugzilla/WebService.pm', 'Bugzilla/WebService/*.pm'],
- moving => ['importxml.pl'],
- auth_ldap => ['Bugzilla/Auth/Verify/LDAP.pm'],
- auth_radius => ['Bugzilla/Auth/Verify/RADIUS.pm'],
- inbound_email => ['email_in.pl'],
- jobqueue => ['Bugzilla/Job/*', 'Bugzilla/JobQueue.pm',
- 'Bugzilla/JobQueue/*', 'jobqueue.pl'],
- patch_viewer => ['Bugzilla/Attachment/PatchReader.pm'],
- updates => ['Bugzilla/Update.pm'],
-);
-
-sub map_files_to_feature {
- my %features = FEATURE_FILES;
- my %files;
- foreach my $feature (keys %features) {
- my @my_files = @{ $features{$feature} };
- foreach my $pattern (@my_files) {
- foreach my $file (glob $pattern) {
- $files{$file} = $feature;
- }
- }
- }
- return \%files;
-}
-
sub compile_file {
my ($file) = @_;
+ # Don't allow CPAN.pm to modify the global @INC, which the version
+ # shipped with Perl 5.8.8 does. (It gets loaded by
+ # Bugzilla::Install::CPAN.)
+ local @INC = @INC;
+
if ($file =~ s/\.pm$//) {
$file =~ s{/}{::}g;
use_ok($file);
@@ -91,12 +69,14 @@ sub compile_file {
}
my @testitems = @Support::Files::testitems;
-my $file_features = map_files_to_feature();
+my $file_features = map_files_to_features();
# Test the scripts by compiling them
foreach my $file (@testitems) {
# These were already compiled, above.
- next if ($file eq 'Bugzilla.pm' or $file eq 'Bugzilla/Constants.pm');
+ next if ($file eq 'Bugzilla.pm'
+ or $file eq 'Bugzilla/Constants.pm'
+ or $file eq 'Bugzilla/Install/Requirements.pm');
SKIP: {
if ($file eq 'mod_perl.pl') {
skip 'mod_perl.pl cannot be compiled from the command line', 1;