You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-dev@httpd.apache.org by Joe Schaefer <jo...@sunstarsys.com> on 2003/05/19 05:17:21 UTC

[apreq-2] passing arguments to apxs via Apache::Test

I'd like to use Apache::Test* for testing the 
apreq-2 filter independently of the perl glue,
and am planning to put such tests into env/t. 

The first problem I keep running into is that
I don't know how to get Apache::Test to pass
arguments (like -I, -L -l, etc) to apxs before
it compiles my c-modules in env/c-modules.
These arguments are really a necessity in order
to link the c-modules against the (uninstalled)
apreq-2 library, which is built in src/.libs.

I doubt what follows is the recommended approach, but
the workaround I came up with was to do something like

  % perl Makefile.PL -apxs '"path/to/apxs -I../../src ..."'

which works if Apache/TestMM.pm and Apache/TestRun.pm
are patched as below.  Does anyone have of a better way
to do this?  Maybe I should just write a custom Makefile for
the env/c-modules directory?

Anyways, here's the patch for httpd-test:

Index: Apache-Test/lib/Apache/TestMM.pm
===================================================================
RCS file: /home/cvspublic/httpd-test/perl-framework/Apache-Test/lib/Apache/TestMM.pm,v
retrieving revision 1.27
diff -u -r1.27 TestMM.pm
--- Apache-Test/lib/Apache/TestMM.pm    14 May 2003 22:57:40 -0000      1.27
+++ Apache-Test/lib/Apache/TestMM.pm    19 May 2003 02:54:05 -0000
@@ -77,7 +77,9 @@
     $body .= Apache::TestConfig->modperl_2_inc_fixup;

     if (@Apache::TestMM::Argv) {
-        $body .= "\n\%Apache::TestConfig::Argv = qw(@Apache::TestMM::Argv);\n";
+        local $" = '","';
+        $body .= qq{\n\%Apache::TestConfig::Argv = ("@Apache::TestMM::Argv");\n};
     }

     my $in = Symbol::gensym();
Index: Apache-Test/lib/Apache/TestRun.pm
===================================================================
RCS file: /home/cvspublic/httpd-test/perl-framework/Apache-Test/lib/Apache/TestRun.pm,v
retrieving revision 1.110
diff -u -r1.110 TestRun.pm
--- Apache-Test/lib/Apache/TestRun.pm   14 May 2003 02:53:54 -0000      1.110
+++ Apache-Test/lib/Apache/TestRun.pm   19 May 2003 02:54:06 -0000
@@ -846,7 +846,8 @@
     $body .= Apache::TestConfig->modperl_2_inc_fixup;

     if (@Apache::TestMM::Argv) {
-        $body .= "\n\%Apache::TestConfig::Argv = qw(@Apache::TestMM::Argv);\n";
+        local $" = '","';
+        $body .= qq{\n\%Apache::TestConfig::Argv = ("@Apache::TestMM::Argv");\n};
     }

     my $header = Apache::TestConfig->perlscript_header;


-- 
Joe Schaefer


Re: [apreq-2] passing arguments to apxs via Apache::Test

Posted by Stas Bekman <st...@stason.org>.
Joe Schaefer wrote:
> Stas Bekman <st...@stason.org> writes:

>>>- $body .= "\n\%Apache::TestConfig::Argv = qw(@Apache::TestMM::Argv);\n";
>>>+ local $" = '","';
>>>+ $body .= qq{\n\%Apache::TestConfig::Argv = ("@Apache::TestMM::Argv");\n};
>>
> 
> I don't see what you're getting at... AFAICT all the patch does is
> whitespace-protect the elements in @Apache::TestMM::Argv by
> surrounding them with quotes, instead of just placing them in qw().

Oops... I've missed the $" adjustment. You are right.

However the approach is not right, since apxs might be expected to the be only 
the path to the executable.

>>Also, I remember that apxs doesn't work on winFU. If that's true how
>>do these things are going to work these?
> 
> Randy already committed a build system for Windows, which
> looked a lot like a perl script to me.  Once we get it working
> on *nix, I hope it's not much trouble to port the changes to
> his win32 build script.


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: [apreq-2] passing arguments to apxs via Apache::Test

Posted by Joe Schaefer <jo...@sunstarsys.com>.
Stas Bekman <st...@stason.org> writes:

> Joe Schaefer wrote:

[...]

> > which works if Apache/TestMM.pm and Apache/TestRun.pm
> > are patched as below.  Does anyone have of a better way
> > to do this?
> 
> Does using env vars help?
> 
> % CCFLAGS="-I../../src ..." perl Makefile.PL -apxs path/to/apxs

Nope,that seems to make no difference at all.

> 
> > Maybe I should just write a custom Makefile for
> > the env/c-modules directory?
> > Anyways, here's the patch for httpd-test:
> 
> that will break other code, since the usage is:
> 
>     while (my($key, $val) = each %Apache::TestConfig::Argv) {
> 
> > - $body .= "\n\%Apache::TestConfig::Argv = qw(@Apache::TestMM::Argv);\n";
> > + local $" = '","';
> > + $body .= qq{\n\%Apache::TestConfig::Argv = ("@Apache::TestMM::Argv");\n};

I don't see what you're getting at... AFAICT all the patch does is
whitespace-protect the elements in @Apache::TestMM::Argv by
surrounding them with quotes, instead of just placing them in qw().

> This feature is only relevant for cmodules_write_makefile in
> Apache/TestConfigC.pm, isn't it? so an immediate workaround would be
> to override this function.

OK- that seems like a good approach, at least for now.

[...]

> Also, I remember that apxs doesn't work on winFU. If that's true how
> do these things are going to work these?

Randy already committed a build system for Windows, which
looked a lot like a perl script to me.  Once we get it working
on *nix, I hope it's not much trouble to port the changes to
his win32 build script.

-- 
Joe Schaefer

Re: [apreq-2] passing arguments to apxs via Apache::Test

Posted by Stas Bekman <st...@stason.org>.
Joe Schaefer wrote:
> I'd like to use Apache::Test* for testing the 
> apreq-2 filter independently of the perl glue,
> and am planning to put such tests into env/t. 
> 
> The first problem I keep running into is that
> I don't know how to get Apache::Test to pass
> arguments (like -I, -L -l, etc) to apxs before
> it compiles my c-modules in env/c-modules.
> These arguments are really a necessity in order
> to link the c-modules against the (uninstalled)
> apreq-2 library, which is built in src/.libs.
> 
> I doubt what follows is the recommended approach, but
> the workaround I came up with was to do something like
> 
>   % perl Makefile.PL -apxs '"path/to/apxs -I../../src ..."'

> which works if Apache/TestMM.pm and Apache/TestRun.pm
> are patched as below.  Does anyone have of a better way
> to do this?  

Does using env vars help?

% CCFLAGS="-I../../src ..." perl Makefile.PL -apxs path/to/apxs

> Maybe I should just write a custom Makefile for
> the env/c-modules directory?
> 
> Anyways, here's the patch for httpd-test:

that will break other code, since the usage is:

     while (my($key, $val) = each %Apache::TestConfig::Argv) {

> -        $body .= "\n\%Apache::TestConfig::Argv = qw(@Apache::TestMM::Argv);\n";
> +        local $" = '","';
> +        $body .= qq{\n\%Apache::TestConfig::Argv = ("@Apache::TestMM::Argv");\n};

This feature is only relevant for cmodules_write_makefile in 
Apache/TestConfigC.pm, isn't it? so an immediate workaround would be to 
override this function.

Then we can think of how to make the original function accept these 
customizations, via arguments. Originally I thought that we could just add a 
new option: -apxs_args, but I don't think it's a good idea, since it may break 
other usages unrelated to the build of c-modules. So may be something like 
c_modules_apxs_args will be a better idea.

Also, I remember that apxs doesn't work on winFU. If that's true how do these 
things are going to work these?

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com