Mercurial > hg > nginx-tests
comparison lib/Test/Nginx.pm @ 854:b237eda210e3
Tests: added support for dynamic modules.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 11 Feb 2016 11:54:32 +0300 |
parents | 51d3243a762f |
children | d39e98893265 |
comparison
equal
deleted
inserted
replaced
853:b5c8739961c9 | 854:b237eda210e3 |
---|---|
18 ); | 18 ); |
19 | 19 |
20 ############################################################################### | 20 ############################################################################### |
21 | 21 |
22 use File::Path qw/ rmtree /; | 22 use File::Path qw/ rmtree /; |
23 use File::Spec qw//; | |
23 use File::Temp qw/ tempdir /; | 24 use File::Temp qw/ tempdir /; |
24 use IO::Socket; | 25 use IO::Socket; |
25 use POSIX qw/ waitpid WNOHANG /; | 26 use POSIX qw/ waitpid WNOHANG /; |
26 use Socket qw/ CRLF /; | 27 use Socket qw/ CRLF /; |
27 use Test::More qw//; | 28 use Test::More qw//; |
93 sub has_module($) { | 94 sub has_module($) { |
94 my ($self, $feature) = @_; | 95 my ($self, $feature) = @_; |
95 | 96 |
96 my %regex = ( | 97 my %regex = ( |
97 sni => 'TLS SNI support enabled', | 98 sni => 'TLS SNI support enabled', |
98 mail => '--with-mail(?!\S)', | 99 mail => '--with-mail((?!\S)|=dynamic)', |
99 flv => '--with-http_flv_module', | 100 flv => '--with-http_flv_module', |
100 perl => '--with-http_perl_module', | 101 perl => '--with-http_perl_module', |
101 auth_request | 102 auth_request |
102 => '--with-http_auth_request_module', | 103 => '--with-http_auth_request_module', |
103 charset => '(?s)^(?!.*--without-http_charset_module)', | 104 charset => '(?s)^(?!.*--without-http_charset_module)', |
142 imap => '(?s)^(?!.*--without-mail_imap_module)', | 143 imap => '(?s)^(?!.*--without-mail_imap_module)', |
143 smtp => '(?s)^(?!.*--without-mail_smtp_module)', | 144 smtp => '(?s)^(?!.*--without-mail_smtp_module)', |
144 pcre => '(?s)^(?!.*--without-pcre)', | 145 pcre => '(?s)^(?!.*--without-pcre)', |
145 split_clients | 146 split_clients |
146 => '(?s)^(?!.*--without-http_split_clients_module)', | 147 => '(?s)^(?!.*--without-http_split_clients_module)', |
147 stream => '--with-stream(?!\S)', | 148 stream => '--with-stream((?!\S)|=dynamic)', |
148 stream_access => '(?s)^(?!.*--without-stream_access_module)', | 149 stream_access => '(?s)^(?!.*--without-stream_access_module)', |
149 stream_limit_conn | 150 stream_limit_conn |
150 => '(?s)^(?!.*--without-stream_limit_conn_module)', | 151 => '(?s)^(?!.*--without-stream_limit_conn_module)', |
151 stream_upstream_hash | 152 stream_upstream_hash |
152 => '(?s)^(?!.*--without-stream_upstream_hash_module)', | 153 => '(?s)^(?!.*--without-stream_upstream_hash_module)', |
448 $s .= "error_log $self->{_testdir}/error.log debug;\n"; | 449 $s .= "error_log $self->{_testdir}/error.log debug;\n"; |
449 | 450 |
450 $s .= $ENV{TEST_NGINX_GLOBALS} | 451 $s .= $ENV{TEST_NGINX_GLOBALS} |
451 if $ENV{TEST_NGINX_GLOBALS}; | 452 if $ENV{TEST_NGINX_GLOBALS}; |
452 | 453 |
454 $s .= $self->test_globals_modules(); | |
455 | |
453 $self->{_test_globals} = $s; | 456 $self->{_test_globals} = $s; |
457 } | |
458 | |
459 sub test_globals_modules() { | |
460 my ($self) = @_; | |
461 | |
462 my $modules = File::Spec->rel2abs((File::Spec->splitpath($NGINX))[1]); | |
463 $modules =~ s!\\!/!g if $^O eq 'MSWin32'; | |
464 | |
465 my $s = ''; | |
466 | |
467 $s .= "load_module $modules/ngx_http_image_filter_module.so;\n" | |
468 if $self->has_module('image_filter\S+=dynamic'); | |
469 | |
470 $s .= "load_module $modules/ngx_http_xslt_filter_module.so;\n" | |
471 if $self->has_module('xslt\S+=dynamic'); | |
472 | |
473 $s .= "load_module $modules/ngx_mail_module.so;\n" | |
474 if $self->has_module('mail=dynamic'); | |
475 | |
476 $s .= "load_module $modules/ngx_stream_module.so;\n" | |
477 if $self->has_module('stream=dynamic'); | |
478 | |
479 return $s; | |
454 } | 480 } |
455 | 481 |
456 sub test_globals_http() { | 482 sub test_globals_http() { |
457 my ($self) = @_; | 483 my ($self) = @_; |
458 | 484 |