Apache-Test

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

Add check for automated testing environment variable before prompting
with EU::MM to quit the test suite.  Some automated smoke tests were
failed because the EU::MM prompt was timing out.
[Adam Prime, Fred Moyer]

https://rt.cpan.org/Public/Bug/Display.html?id=32993
use TAP::Harness for Apache::TestHarnessPHP
[Mark A. Hershberger]

https://rt.cpan.org/Public/Bug/Display.html?id=54476
Fix error where non root user gets test failure with httpd suexec and mod_fcgid
[Peter (Stig) Edwards]

=item 1.32 April 15, 2010

Fix issue with recent feature where lack of libapreq resulted in test failure.
[Philippe M. Chiasson]

Added t_{start,read,finish}_file_watch to Apache::TestUtil [Torsten Foertsch]

=item 1.31 February 24, 2010

Modify need_cgi so that it looks for cgi.c instead of cgi.  This is a fix
for the case insensitive filesystem correction listed below.
[Phillipe M. Chiasson]

t/next_available_port.t doesn't need mod_cgid, use need_cgi instead
of need_module('mod_cgi.c')
[Philippe M. Chiasson]

PR: 21554
Load mod_apreq2.so if it is available
[Derek Price, <derek@ximbiot.com>]

Add conditional to ignore IfVersion directive if mod_version is not built.
[Adam Prime <adam.prime@utoronto.ca>, Fred Moyer <phred@apache.org>]

PR: 41239
t/TEST -ping does not return a valid return code to the calling shell
[ozw1z5rd <alessio.palma@staff.dada.net>]

Prevent infinite loop when no default apxs or httpd is present and repeated
attempts to run the test suite under an automated harness (such as a cpan 
smoke test).  Issue reported by CORION and ANDK, PR: 12911
[Fred Moyer <phred@apache.org>]

Use need_module('mod_cgi.c') and need_module('mod_cgid.c') in 
t/next_available_port.t instead of need_cgi.  On case insensitive file
systems such as OS X, need_cgi will fulfill the requirement with cgi.pm,
when mod_cgi.c is the desired requirement.
[Fred Moyer <phred@apache.org>]

Fix overridden get_basic_credentials test when using NTLM authentication
[Rick Frankel <cpan@rickster.com>]

Work around a bug introduced in libwww-perl in version
5.820 for httpd's credentials

Changes  view on Meta::CPAN

Adjust Apache::TestConfig::add_inc to add lib/ in separate call to
lib::->import at the very end of @INC manipulation to ensure it'll be
on top of @INC. For some reason lib has changed to add directories in
a different order than it did before. [Stas]



=item 1.27 - October 20, 2005

localize ScriptSock directive to always point to t/logs/cgisock
regardless of inherited and custom mod_cgid settings
[Geoffrey Young]

Prevent the config file from being overwritten
on platforms such as WIN32 under certain conditions.
[Randy Kobes]

make sure that the TESTS Makefile.PL parameter is properly
recognized ["Christopher H. Laco" <apache-test chrislaco.com>]

Add the output of ldd(unix/cygwin) and otool -L (darwin)

lib/Apache/Test.pm  view on Meta::CPAN


    # support dev versions like 0.18_01
    return 1
        if eval { no warnings qw(numeric); $module->VERSION($version) };

    push @SkipReasons, "$module version $version or higher is required";
    return 0;
}

sub need_cgi {
    return _need_multi(qw(cgi.c cgid.c));
}

sub need_cache_disk {
    return _need_multi(qw(cache_disk.c disk_cache.c));
}


sub need_php {
    return _need_multi(qw(php4 php5 sapi_apache2.c));
}

lib/Apache/Test.pm  view on Meta::CPAN

=item need_lwp

  plan tests => 5, need_lwp;

Require LWP support.

=item need_cgi

  plan tests => 5, need_cgi;

Requires mod_cgi or mod_cgid to be installed.

=item need_cache_disk

  plan tests => 5, need_cache_disk

Requires mod_cache_disk or mod_disk_cache to be installed.


=item need_php

lib/Apache/Test.pm  view on Meta::CPAN

requires Perl 5.8.1 or higher.

=item need_fork

Requires the perl built-in function C<fork> to be implemented.

=item need_module

  plan tests => 5, need_module 'CGI';
  plan tests => 5, need_module qw(CGI Find::File);
  plan tests => 5, need_module ['CGI', 'Find::File', 'cgid'];

Requires Apache C and Perl modules. The function accept a list of
arguments or a reference to a list.

In case of C modules, depending on how the module name was passed it
may pass through the following completions:

=over

=item 1 need_module 'proxy_http.c'

lib/Apache/Test.pm  view on Meta::CPAN


=item need

  plan tests => 5,
      need 'LWP',
           { "perl >= 5.8.0 and w/ithreads is required" =>
             ($Config{useperlio} && $] >= 5.008) },
           { "not Win32"                 => sub { $^O eq 'MSWin32' },
             "foo is disabled"           => \&is_foo_enabled,
           },
           'cgid';

need() is more generic function which can impose multiple requirements
at once. All requirements must be satisfied.

need()'s argument is a list of things to test. The list can include
scalars, which are passed to need_module(), and hash references. If
hash references are used, the keys, are strings, containing a reason
for a failure to satisfy this particular entry, the values are the
condition, which are satisfaction if they return true. If the value is
0 or 1, it used to decide whether the requirements very satisfied, so

lib/Apache/Test.pm  view on Meta::CPAN

  plan tests => 1, need 'Compress::Zlib', 'deflate',
      need_min_apache_version("2.0.49");

If the scalar value is a string, different from 0 or 1, it's passed to
I<need_module()>.  If the value is a code reference, it gets executed
at the time of check and its return value is used to check the
condition. If the condition check fails, the provided (in a key)
reason is used to tell user why the test was skipped.

In the presented example, we require the presence of the C<LWP> Perl
module, C<mod_cgid>, that we run under perl E<gt>= 5.7.3 on Win32.

It's possible to put more than one requirement into a single hash
reference, but be careful that the keys will be different.

It's also important to mention to avoid using:

  plan tests => 1, requirement1 && requirement2;

technique. While test-wise that technique is equivalent to:

lib/Apache/TestConfig.pm  view on Meta::CPAN

        Apache::TestRun::exit_perl(1);

    }
    else {
        debug "Using httpd: $vars->{httpd}";
    }

    $self->inherit_config; #see TestConfigParse.pm
    $self->configure_httpd_eapi; #must come after inherit_config

    $self->default_module(cgi    => [qw(mod_cgi mod_cgid)]);
    $self->default_module(thread => [qw(worker threaded)]);
    $self->default_module(ssl    => [qw(mod_ssl)]);
    $self->default_module(access => [qw(mod_access mod_authz_host)]);
    $self->default_module(auth   => [qw(mod_auth mod_auth_basic)]);
    $self->default_module(php    => [qw(sapi_apache2 mod_php4 mod_php5)]);

    $self->{server}->post_config;

    return $self;
}

lib/Apache/TestConfig.pm  view on Meta::CPAN

    shift->add_config_hooks_run(postamble => @_);
}

sub preamble_run {
    shift->add_config_hooks_run(preamble => @_);
}

sub default_group {
    return if WINFU;

    my $gid = $);

    #use only first value if $) contains more than one
    $gid =~ s/^(\d+).*$/$1/;

    my $group = $ENV{APACHE_TEST_GROUP} || (getgrgid($gid) || "#$gid");

    if ($group eq 'root') {
        # similar to default_user, we want to avoid perms problems,
        # when the server is started with group 'root'. When running
        # under group root it may fail to create dirs and files,
        # writable only by user
        my $user = default_user();
        my $gid = $user ? (getpwnam($user))[3] : '';
        $group = (getgrgid($gid) || "#$gid") if $gid;
    }

    $group;
}

sub default_user {
    return if WINFU;

    my $uid = $>;

lib/Apache/TestConfig.pm  view on Meta::CPAN

<IfDirective DefaultStateDir>
    DefaultStateDir "@t_state@"
</IfDirective>
</IfVersion>
</IfModule>

<IfModule mod_log_config.c>
    TransferLog @t_logs@/access_log
</IfModule>

<IfModule mod_cgid.c>
    ScriptSock @t_logs@/cgisock
</IfModule>

ServerAdmin @ServerAdmin@

#needed for http/1.1 testing
KeepAlive       On

HostnameLookups Off

lib/Apache/TestConfigPHP.pm  view on Meta::CPAN

short_open_tag = Off
asp_tags = Off
precision    =  14
y2k_compliance = On
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func=
serialize_precision = 100
allow_call_time_pass_reference = Off
safe_mode = Off
safe_mode_gid = Off
safe_mode_include_dir =
safe_mode_exec_dir =
safe_mode_allowed_env_vars = PHP_
safe_mode_protected_env_vars = LD_LIBRARY_PATH
disable_functions =
disable_classes =
expose_php = On
max_execution_time = 30     ; Maximum execution time of each script, in seconds
max_input_time = 60	; Maximum amount of time each script may spend parsing request data
memory_limit = 128M      ; Maximum amount of memory a script may consume (128MB)

lib/Apache/TestConfigParse.pm  view on Meta::CPAN

    'mod_proxy_balancer.c' => 'proxy_balancer.c',
    'mod_proxy_connect.c'  => 'proxy_connect.c',
    'mod_modperl.c'        => 'mod_perl.c',
);

# Block modules which inhibit testing:
# - mod_jk requires JkWorkerFile or JkWorker to be configured
#   skip it for now, tomcat has its own test suite anyhow.
# - mod_casp2 requires other settings in addition to LoadModule
# - mod_bwshare and mod_evasive20 block fast requests that tests are doing
# - mod_fcgid causes https://rt.cpan.org/Public/Bug/Display.html?id=54476
# - mod_modnss.c and mod_rev.c require further configuration
my @autoconfig_skip_module = qw(mod_jk.c mod_casp2.c mod_bwshare.c
    mod_fcgid.c mod_evasive20.c mod_modnss.c mod_rev.c);

# add modules to be not inherited from the existing config.
# e.g. prevent from LoadModule perl_module to be included twice, when
# mod_perl already configures LoadModule and it's certainly found in
# the existing httpd.conf installed system-wide.
sub autoconfig_skip_module_add {
    push @autoconfig_skip_module, @_;
}

sub should_skip_module {

lib/Apache/TestUtil.pm  view on Meta::CPAN

    die "must pass a dirname" unless defined $_[0];
    File::Path::rmtree((@_ > 1 ? \@_ : $_[0]), 0, 1);
}

#chown a file or directory to the test User/Group
#noop if chown is unsupported

sub t_chown {
    my $file = shift;
    my $config = Apache::Test::config();
    my($uid, $gid);

    eval {
        #XXX cache this lookup
        ($uid, $gid) = (getpwnam($config->{vars}->{user}))[2,3];
    };

    if ($@) {
        if ($@ =~ /^The getpwnam function is unimplemented/) {
            #ok if unsupported, e.g. win32
            return 1;
        }
        else {
            die $@;
        }
    }

    CORE::chown($uid, $gid, $file) || die "chown $file: $!";
}

# $string = struct_as_string($indent_level, $var);
#
# return any nested datastructure via Data::Dumper or ala Data::Dumper
# as a string. undef() is a valid arg.
#
# $indent_level should be 0 (used for nice indentation during
# recursive datastructure traversal)
sub struct_as_string{



( run in 2.860 seconds using v1.01-cache-2.11-cpan-ceb78f64989 )