From bc19f61c0c33e71a00dcc8e4ca3e791a9e3b661d Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Wed, 18 Nov 2009 07:01:40 +0000 Subject: 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 r=LpSolit, a=mkanat --- t/001compile.t | 40 ++++++++++------------------------------ 1 file changed, 10 insertions(+), 30 deletions(-) (limited to 't/001compile.t') 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; -- cgit v1.2.3-24-g4f1b