[ 
https://issues.apache.org/jira/browse/LUCY-34?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Marvin Humphrey updated LUCY-34:
--------------------------------

    Attachment: Test.pm

Test.pm, to be installed as trunk/perl/lib/Lucy/Test.pm, follows the pattern
for Perl modules described at
[https://issues.apache.org/jira/browse/LUCY-27?focusedCommentId=12751265&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_12751265]:
The meaningful pure-Perl code in the module itself simply loads Lucy.pm, which
then loads the XS shared object and initializes everything under the Lucy
hierarchy -- including the arbitrary XS binding code embedded within Test.pm
defining the XS routine Lucy::Test::TestCharmonizer::run_test().

Invoking Lucy::Test::TestCharmonizer::run_test($test_name) will now run code
from Charmonizer's test suite.

{code:none}
use Lucy::Test;
Lucy::Test::TestCharmonizer::run_test($test_name);
{code}

In order to make this work, the object files for all C test code have to be
linked into the Lucy shared object, bloating it up.  The bloat won't cause
meaningful problems for a while, but it's definitely undesirable and we'd like
to do away with it.

Under Unixen, we can automatically export C symbols via the core DynaLoader
module, so that they become visible to other shared objects.  See DynaLoader's
docs for an explanation of how the following incantation works:

{code:none}
require DynaLoader;
__PACKAGE__->bootstrap($VERSION);
sub dl_load_flags {0x01}
{code}

If that worked everywhere, we could simply divvy up our object files into a
core shared object and a dedicated testing shared object; the testing code 
would then be able to resolve Lucy core symbols at runtime.

Unfortunately, that's not portable to all platforms.  I brought this topic up
a while ago on PerlMonks ([http://www.perlmonks.org/?node_id=691130]) and was
advised to use a brute force technique of storing symbol names and addresses
in a global Perl hash.  That's the approach taken by Time::HiRes and now by my
module Lingua::Stem::Snowball, and it works OK when you only have a handful of
symbols to export -- but it's impractical for Lucy, where there will be
thousands.

So, in the meantime, we'll just dump everything into the Lucy shared object.

> Update Perl binding build tools to use Boilerplater
> ---------------------------------------------------
>
>                 Key: LUCY-34
>                 URL: https://issues.apache.org/jira/browse/LUCY-34
>             Project: Lucy
>          Issue Type: Sub-task
>          Components: Boilerplater, Perl bindings
>            Reporter: Marvin Humphrey
>            Assignee: Marvin Humphrey
>         Attachments: Test.pm
>
>
> Up till now, Boilerplater has existed in isolation, running its own test suite
> but not integrated with other parts of Lucy.  We'll address that by changing
> over the Charmonizer tests to run via the Boilerplater framework within the
> Perl bindings.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to