OK, I've written the missing spec for the A-T custom config (it's in the at the end of Apache::TestRun pod), please check that it's sane and that I haven't missed some possible cases. This is a top level spec with many details explained in the code.

Next I did another iteration on the code, changing a lot of logic, since there were several problems. And also making code more robust were needed.

I think that this time there should be little or no problems at all. I've looked at the problems you have reported before and I think they are all covered now. Please correct me if I'm wrong.

Also I tested many different cases (but not all), so here is what I've done. I'm not sure whether it's a good idea to save this test somewhere.:


1. 'make test' from Apache-Test.

  cd Apache-Test

  make clean
  rm -rf blib lib/Apache/TestConfigData.pm \
  /home/stas/perl/5.8.3-ithread/lib/site_perl/5.8.3/Apache/TestConfigData.pm \

/home/stas/perl/5.8.3-ithread/lib/site_perl/5.8.3/i686-linux-thread-multi/Apache/TestConfigData.pm
  perl-5.8.3-ithread Makefile.PL
  make

  # interactive config kicks in,
  # pass:
  # /home/stas/httpd/prefork/bin/httpd
  # /home/stas/httpd/prefork/bin/apxs
  make test

  # interactive config does not kick in
  make test

  # install the custom config globally and remove the local config
  make install
  rm -rf blib lib/Apache/TestConfigData.pm

  # interactive config does not kick in
  t/TEST

# remove the global config (local config was already removed)
rm -f /home/stas/perl/5.8.3-ithread/lib/site_perl/5.8.3/Apache/TestConfigData.pm \


/home/stas/perl/5.8.3-ithread/lib/site_perl/5.8.3/i686-linux-thread-multi/Apache/TestConfigData.pm

  #  interactive config does not kick in
  t/TEST -httpd /home/stas/httpd/1.3-dynamic/bin/httpd




2. t/TEST from Apache-Test and overriding

  cd Apache-Test

  make clean
  rm -rf blib lib/Apache/TestConfigData.pm \
  /home/stas/perl/5.8.3-ithread/lib/site_perl/5.8.3/Apache/TestConfigData.pm \

/home/stas/perl/5.8.3-ithread/lib/site_perl/5.8.3/i686-linux-thread-multi/Apache/TestConfigData.pm
  perl-5.8.3-ithread Makefile.PL
  make

  # interactive config kicks in,
  # pass:
  # /home/stas/httpd/prefork/bin/httpd
  # /home/stas/httpd/prefork/bin/apxs
  t/TEST

  # interactive config does not kick in
  t/TEST

  # now it should use a different server
  # (/home/stas/httpd/1.3-dynamic/bin/httpd)
  t/TEST -httpd /home/stas/httpd/1.3-dynamic/bin/httpd

  # now it should use the server from the last run
  # (/home/stas/httpd/1.3-dynamic/bin/httpd)
  # custom config shouldn't interfere
  t/TEST

  # now it should use a different server again
  # (/home/stas/httpd/prefork/bin/httpd)
  t/TEST -apxs /home/stas/httpd/prefork/bin/apxs



3. 'make test' from modperl-2.0,

  cd modperl-2.0

  make clean
  rm -rf blib lib/Apache/TestConfigData.pm \
  /home/stas/perl/5.8.3-ithread/lib/site_perl/5.8.3/Apache/TestConfigData.pm \

/home/stas/perl/5.8.3-ithread/lib/site_perl/5.8.3/i686-linux-thread-multi/Apache/TestConfigData.pm
  perl-5.8.3-ithread  Makefile.PL \
  MP_INST_APACHE2=1                         \
  MP_GENERATE_XS=1                          \
  MP_USE_DSO=1                              \
  MP_DEBUG=1                                \
  MP_TRACE=1                                \
  MP_USE_GTOP=1                             \
  MP_APXS=/home/stas/httpd/prefork/bin/apxs \
  MP_MAINTAINER=1                           \
  MP_CCOPTS='-Wall -Werror'
  make

  # interactive config does not kick in
  # since mp2 explicitly passes -httpd behind the scenes
  make test

  # install A-T and the custom config globally
  # note that make install puts Apache/Test* files under a different
  # tree compared to when it's installed from inside Apache-Test
  make install

  # now build mod_perl against a different httpd path, make sure
  # that 'make test' uses that different httpd path and not the one
  # from the custom config
  make clean
  rm -rf blib lib/Apache/TestConfigData.pm \
  /home/stas/perl/5.8.3-ithread/lib/site_perl/5.8.3/Apache/TestConfigData.pm \

/home/stas/perl/5.8.3-ithread/lib/site_perl/5.8.3/i686-linux-thread-multi/Apache/TestConfigData.pm

perl-5.8.3-ithread  Makefile.PL \
  MP_INST_APACHE2=1                         \
  MP_GENERATE_XS=1                          \
  MP_USE_DSO=1                              \
  MP_DEBUG=1                                \
  MP_TRACE=1                                \
  MP_USE_GTOP=1                             \
  MP_APXS=/home/stas/httpd/worker/bin/apxs \
  MP_MAINTAINER=1                           \
  MP_CCOPTS='-Wall -Werror'
  make
  make test

4. third party module

  cd Apache-Filter-HTTPHeadersFixup

  # custom config wasn't done during install of Apache-Test or mp2
  # (e.g. rpm binary package).
  rm -f  \
  /home/stas/perl/5.8.3-ithread/lib/site_perl/5.8.3/Apache/TestConfigData.pm \

/home/stas/perl/5.8.3-ithread/lib/site_perl/5.8.3/i686-linux-thread-multi/Apache/TestConfigData.pm

  #
  make clean
  perl-5.8.3-ithread Makefile.PL
  make

  # custom config should not kick in
  t/TEST -apxs /home/stas/httpd/prefork/bin/apxs

  # assuming that perl-5.8.3-ithread libs are writable by the user
  # running t/TEST. the last operation should have created
  # Apache/TestConfigData.pm next to Apache/TestRun.pm in the perl
  # libs

  # cleanup
  rm -f  \
  /home/stas/perl/5.8.3-ithread/lib/site_perl/5.8.3/Apache/TestConfigData.pm \

/home/stas/perl/5.8.3-ithread/lib/site_perl/5.8.3/i686-linux-thread-multi/Apache/TestConfigData.pm

  # now use perl whose libs are writable only by root and run the test
  # as normal user
  make clean
  perl Makefile.PL
  make

  t/TEST -apxs /home/stas/httpd/prefork/bin/apxs
  # this time ~/.apache-test/Apache/TestConfigData.pm should have been
  # created

  # cleanup
  rm -f ~/.apache-test/Apache/TestConfigData.pm \
  /home/stas/perl/5.8.3-ithread/lib/site_perl/5.8.3/Apache/TestConfigData.pm \

/home/stas/perl/5.8.3-ithread/lib/site_perl/5.8.3/i686-linux-thread-multi/Apache/TestConfigData.pm

  # make sure that 'make clean' runs t/TEST -clean (if not run it
  # explicitly)
  make clean
  perl-5.8.3-ithread Makefile.PL
  make

  # unless modperl 2.0 is found (which stores apxs/httpd in its own
  # Apache/BuildConfig.pm and A-T uses that data if none was passed)
  # interactive custom config kicks in. pass:
  # /home/stas/httpd/prefork/bin/httpd
  # /home/stas/httpd/prefork/bin/apxs
  make test

  # as before this should result in either
  # ~/.apache-test/Apache/TestConfigData.pm or the global
  # Apache/TestConfigData.pm be written

  # custom config already exists (from the last stage)

   pick some module which uses Apache-Test

todo:

5. -save option (test to be written) main issue is to avoid the situation
when 'Apache/TestConfigData.pm' was written to a root owned directory
and a non-root user is trying to -save (need to save into
~/.apache-test/Apache/TestConfigData.pm, if the custom_config_path
returns a path owned by root).



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



Reply via email to