fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-06-14 09:55 am

[dw-free] fix skipped modules in t/00-compile.t

[commit: http://hg.dwscoalition.org/dw-free/rev/c63e1636530c]

http://bugs.dwscoalition.org/show_bug.cgi?id=2659

Add evals and explicitly use some modules, to avoid errors when running the
compile test.

Patch by [personal profile] kareila.

Files modified:
  • cgi-bin/DW/External/XPostProtocol.pm
  • cgi-bin/DW/User/Edges/CommMembership.pm
  • cgi-bin/DW/User/Edges/WatchTrust.pm
  • cgi-bin/LJ/S2/EntryPage.pm
  • cgi-bin/LJ/Widget/CreateAccountProfile.pm
  • cgi-bin/LJ/Widget/IPPU/SettingProd.pm
  • cgi-bin/lj-bml-blocks.pl
  • cgi-bin/lj-bml-init.pl
  • cgi-bin/ljdefaults.pl
  • cgi-bin/ljuserpics.pl
  • cgi-bin/modperl_subs.pl
  • t/00-compile.t
--------------------------------------------------------------------------------
diff -r e46450388786 -r c63e1636530c cgi-bin/DW/External/XPostProtocol.pm
--- a/cgi-bin/DW/External/XPostProtocol.pm	Sun Jun 13 22:13:56 2010 -0500
+++ b/cgi-bin/DW/External/XPostProtocol.pm	Mon Jun 14 18:01:08 2010 +0800
@@ -20,7 +20,7 @@ LJ::ModuleLoader->autouse_subclasses("DW
 LJ::ModuleLoader->autouse_subclasses("DW::External::XPostProtocol");
 
 my %protocols;
-$protocols{"lj"} = DW::External::XPostProtocol::LJXMLRPC->new;
+eval { $protocols{"lj"} = DW::External::XPostProtocol::LJXMLRPC->new; };
 
 # returns the given protocol, if configured.
 sub get_protocol {
diff -r e46450388786 -r c63e1636530c cgi-bin/DW/User/Edges/CommMembership.pm
--- a/cgi-bin/DW/User/Edges/CommMembership.pm	Sun Jun 13 22:13:56 2010 -0500
+++ b/cgi-bin/DW/User/Edges/CommMembership.pm	Mon Jun 14 18:01:08 2010 +0800
@@ -18,6 +18,7 @@ use strict;
 use strict;
 
 use Carp qw/ confess /;
+use DW::User::Edges;
 
 # membership edges are for someone who is a member of a community
 DW::User::Edges::define_edge(
diff -r e46450388786 -r c63e1636530c cgi-bin/DW/User/Edges/WatchTrust.pm
--- a/cgi-bin/DW/User/Edges/WatchTrust.pm	Sun Jun 13 22:13:56 2010 -0500
+++ b/cgi-bin/DW/User/Edges/WatchTrust.pm	Mon Jun 14 18:01:08 2010 +0800
@@ -20,6 +20,8 @@ use strict;
 use strict;
 
 use Carp qw/ confess /;
+use LJ::Constants;
+use DW::User::Edges;
 use DW::User::Edges::WatchTrust::Loader;
 use DW::User::Edges::WatchTrust::UserHelper;
 
diff -r e46450388786 -r c63e1636530c cgi-bin/LJ/S2/EntryPage.pm
--- a/cgi-bin/LJ/S2/EntryPage.pm	Sun Jun 13 22:13:56 2010 -0500
+++ b/cgi-bin/LJ/S2/EntryPage.pm	Mon Jun 14 18:01:08 2010 +0800
@@ -19,6 +19,11 @@ package LJ::S2;
 package LJ::S2;
 
 use Carp;
+
+# these are needed for S2::PROPS
+use DW;
+use lib DW->home . "/src/s2";
+use S2;
 
 sub EntryPage
 {
diff -r e46450388786 -r c63e1636530c cgi-bin/LJ/Widget/CreateAccountProfile.pm
--- a/cgi-bin/LJ/Widget/CreateAccountProfile.pm	Sun Jun 13 22:13:56 2010 -0500
+++ b/cgi-bin/LJ/Widget/CreateAccountProfile.pm	Mon Jun 14 18:01:08 2010 +0800
@@ -16,6 +16,7 @@ use strict;
 use strict;
 use base qw(LJ::Widget);
 use Carp qw(croak);
+use LJ::Constants;
 
 sub need_res { qw( stc/widgets/createaccountprofile.css js/widgets/createaccountprofile.js ) }
 
diff -r e46450388786 -r c63e1636530c cgi-bin/LJ/Widget/IPPU/SettingProd.pm
--- a/cgi-bin/LJ/Widget/IPPU/SettingProd.pm	Sun Jun 13 22:13:56 2010 -0500
+++ b/cgi-bin/LJ/Widget/IPPU/SettingProd.pm	Mon Jun 14 18:01:08 2010 +0800
@@ -18,6 +18,7 @@ use Carp qw(croak);
 use Carp qw(croak);
 use LJ::JSUtil;
 use LJ::Setting;
+use LJ::User;
 
 sub authas { 0 }
 
diff -r e46450388786 -r c63e1636530c cgi-bin/lj-bml-blocks.pl
--- a/cgi-bin/lj-bml-blocks.pl	Sun Jun 13 22:13:56 2010 -0500
+++ b/cgi-bin/lj-bml-blocks.pl	Mon Jun 14 18:01:08 2010 +0800
@@ -17,6 +17,7 @@ use lib "$LJ::HOME/cgi-bin";
 use lib "$LJ::HOME/cgi-bin";
 use LJ::Config;
 LJ::Config->load;
+use Apache::BML;
 
 BML::register_block("DOMAIN", "S", $LJ::DOMAIN);
 BML::register_block("IMGPREFIX", "S", $LJ::IMGPREFIX);
diff -r e46450388786 -r c63e1636530c cgi-bin/lj-bml-init.pl
--- a/cgi-bin/lj-bml-init.pl	Sun Jun 13 22:13:56 2010 -0500
+++ b/cgi-bin/lj-bml-init.pl	Mon Jun 14 18:01:08 2010 +0800
@@ -18,6 +18,7 @@ use Errno qw(ENOENT);
 use Errno qw(ENOENT);
 use LJ::Config;
 LJ::Config->load;
+use Apache::BML;
 
 foreach (@LJ::LANGS, @LJ::LANGS_IN_PROGRESS) {
     BML::register_isocode(substr($_, 0, 2), $_);
diff -r e46450388786 -r c63e1636530c cgi-bin/ljdefaults.pl
--- a/cgi-bin/ljdefaults.pl	Sun Jun 13 22:13:56 2010 -0500
+++ b/cgi-bin/ljdefaults.pl	Mon Jun 14 18:01:08 2010 +0800
@@ -329,4 +329,5 @@
     $LJ::MAX_WT_EDGES_LOAD ||= 50_000;
 }
 
-return 1;
+
+1;
diff -r e46450388786 -r c63e1636530c cgi-bin/ljuserpics.pl
--- a/cgi-bin/ljuserpics.pl	Sun Jun 13 22:13:56 2010 -0500
+++ b/cgi-bin/ljuserpics.pl	Mon Jun 14 18:01:08 2010 +0800
@@ -13,6 +13,7 @@
 
 package LJ;
 use strict;
+use Carp qw/ croak /;
 
 # <LJFUNC>
 # name: LJ::load_userpics
diff -r e46450388786 -r c63e1636530c cgi-bin/modperl_subs.pl
--- a/cgi-bin/modperl_subs.pl	Sun Jun 13 22:13:56 2010 -0500
+++ b/cgi-bin/modperl_subs.pl	Mon Jun 14 18:01:08 2010 +0800
@@ -165,9 +165,9 @@ DirectoryIndex index.html index.bml
 });
 
     # setup child init handler to seed random using a good entropy source
-    Apache2::ServerUtil->server->push_handlers(PerlChildInitHandler => sub {
+    eval { Apache2::ServerUtil->server->push_handlers(PerlChildInitHandler => sub {
         srand(LJ::urandom_int());
-    });
+    }); };
 
     if ($LJ::BML_DENY_CONFIG) {
         LJ::ModPerl::add_httpd_config("PerlSetVar BML_denyconfig \"$LJ::BML_DENY_CONFIG\"\n");
@@ -202,7 +202,7 @@ DirectoryIndex index.html index.bml
 
 sub add_httpd_config {
     my $text = shift;
-    Apache2::ServerUtil->server->add_config( [ split /\n/, $text ] );
+    eval { Apache2::ServerUtil->server->add_config( [ split /\n/, $text ] ); };
 }
 
 setup_start();
diff -r e46450388786 -r c63e1636530c t/00-compile.t
--- a/t/00-compile.t	Sun Jun 13 22:13:56 2010 -0500
+++ b/t/00-compile.t	Mon Jun 14 18:01:08 2010 +0800
@@ -9,33 +9,23 @@ my $dir = File::Temp::tempdir( CLEANUP =
 my $dir = File::Temp::tempdir( CLEANUP => 1 );
 
 # FIXME: fix the modules that are now skipped
-# some of the modules and scripts cannot yet cleanly loaded
+# some of the modules and scripts cannot yet be cleanly loaded
 # instead of waiting them to be fixed we are skipping them for now
-# They should be fixed or makred why they cannot run.
+# They should be fixed or marked why they cannot run.
 my %SKIP = (
     'LJ/PersistentQueue.pm'   => 'bug 1787  needs Data::Queue::Persistent',
     'LJ/LDAP.pm'              => 'bug 1788  needs Net::LDAP',
     'LJ/ConfCheck/General.pm' => 'needs to be integrated into LJ::ConfCheck',
-    'LJ/S2/EntryPage.pm'      => 'definition of S2::PROPS is missing (found in src/s2/S2.pm)',
-    'LJ/Widget/CreateAccountProfile.pm' => 'Bareword "LJ::BMAX_NAME"',
-    'LJ/Widget/IPPU/SettingProd.pm' => 'Bareword "LJ::get_remote"',
-    'DW/User/Edges/CommMembership.pm' => 'Undefined subroutine &DW::User::Edges::define_edge',
-    'DW/User/Edges/WatchTrust.pm'  => 'Bareword "LJ::BMAX_GRPNAME2"',
-    'DW/User/Edges.pm'   => 'Bareword "LJ::BMAX_GRPNAME2"',
-    'DW/External/XPostProtocol/LJXMLRPC.pm' => 'Cant locate object method "new" via package "DW::External::XPostProtocol::LJXMLRPC"',
 
-    'LJ/Test/AtomAPI.pm'      => 'needs Apache/Constants',
-    'Test/FakeApache.pm'      => 'needs Apache/Constants.pm',
-    'Apache/CompressClientFixup.pm' => 'needs Apache/Constants.pm',
+    'LJ/Test/AtomAPI.pm'      => 'fix Test/FakeApache.pm',
+    'Test/FakeApache.pm'      => 'needs Apache::Constants',
+    'Apache/CompressClientFixup.pm' => 'needs Apache::Constants',
 
     'Data/ObjectDriver/Driver/DBD/SQLite.pm' => 'Bareword "DBI::SQL_BLOB"',
     'Data/ObjectDriver/Driver/DBD/Oracle.pm' => 'no Oracle',
 
-    'cgi-bin/ljdefaults.pl' => 'Cant return outside a subroutine at cgi-bin/ljdefaults.pl',    
-    'cgi-bin/modperl.pl'    => 'Cant locate object method "server" via package "Apache2::ServerUtil"',
-    'cgi-bin/lj-bml-init.pl' => 'Undefined subroutine &BML::register_isocode',
-    'cgi-bin/lj-bml-blocks.pl' => 'Undefined subroutine &BML::register_block',
-    'cgi-bin/ljuserpics.pl'  => 'croak is not imported',
+    'cgi-bin/lj-bml-init.pl' => 'BML::register_isocode called from non-conffile context',
+    'cgi-bin/lj-bml-blocks.pl' => 'BML::register_block called from non-lookfile context',
 );
 
 my @scripts = File::Find::Rule->file->name('*.pl')->in('cgi-bin');
--------------------------------------------------------------------------------