comparison lib/Test/Nginx.pm @ 121:8ac1faaddd2c

Tests: better handle various configure arguments.
author Maxim Dounin <mdounin@mdounin.ru>
date Sat, 26 Dec 2009 16:06:17 +0300
parents 4bf7a819358c
children 342b31c8f3af
comparison
equal deleted inserted replaced
120:598b758c68a9 121:8ac1faaddd2c
49 if ($ENV{TEST_NGINX_CATLOG}) { 49 if ($ENV{TEST_NGINX_CATLOG}) {
50 system("cat $self->{_testdir}/error.log"); 50 system("cat $self->{_testdir}/error.log");
51 } 51 }
52 } 52 }
53 53
54 sub has($) { 54 sub has($;) {
55 my ($self, $feature) = @_; 55 my ($self, @features) = @_;
56 56
57 Test::More::plan(skip_all => "$feature not compiled in") 57 foreach my $feature (@features) {
58 unless $self->has_module($feature); 58 Test::More::plan(skip_all => "$feature not compiled in")
59 unless $self->has_module($feature);
60 }
59 61
60 return $self; 62 return $self;
61 } 63 }
62 64
63 sub has_module($) { 65 sub has_module($) {
64 my ($self, $feature) = @_; 66 my ($self, $feature) = @_;
65 67
66 my %regex = ( 68 my %regex = (
67 mail => '--with-mail', 69 mail => '--with-mail(?!\S)',
68 flv => '--with-http_flv_module', 70 flv => '--with-http_flv_module',
69 perl => '--with-http_perl_module', 71 perl => '--with-http_perl_module',
72 charset => '(?s)^(?!.*--without-http_charset_module)',
73 gzip => '(?s)^(?!.*--without-http_gzip_module)',
74 ssi => '(?s)^(?!.*--without-http_ssi_module)',
75 userid => '(?s)^(?!.*--without-http_userid_module)',
76 access => '(?s)^(?!.*--without-http_access_module)',
77 auth_basic
78 => '(?s)^(?!.*--without-http_auth_basic_module)',
79 autoindex
80 => '(?s)^(?!.*--without-http_autoindex_module)',
81 geo => '(?s)^(?!.*--without-http_geo_module)',
82 map => '(?s)^(?!.*--without-http_map_module)',
83 referer => '(?s)^(?!.*--without-http_referer_module)',
70 rewrite => '(?s)^(?!.*--without-http_rewrite_module)', 84 rewrite => '(?s)^(?!.*--without-http_rewrite_module)',
71 gzip => '(?s)^(?!.*--without-http_gzip_module)', 85 proxy => '(?s)^(?!.*--without-http_proxy_module)',
86 fastcgi => '(?s)^(?!.*--without-http_fastcgi_module)',
87 memcached
88 => '(?s)^(?!.*--without-http_memcached_module)',
89 limit_zone
90 => '(?s)^(?!.*--without-http_limit_zone_module)',
91 limit_req
92 => '(?s)^(?!.*--without-http_limit_req_module)',
93 empty_gif
94 => '(?s)^(?!.*--without-http_empty_gif_module)',
95 browser => '(?s)^(?!.*--without-http_browser_module)',
96 upstream_ip_hash
97 => '(?s)^(?!.*--without-http_upstream_ip_hash_module)',
98 http => '(?s)^(?!.*--without-http(?!\S))',
72 cache => '(?s)^(?!.*--without-http-cache)', 99 cache => '(?s)^(?!.*--without-http-cache)',
73 fastcgi => '(?s)^(?!.*--without-http_fastcgi_module)', 100 pop3 => '(?s)^(?!.*--without-mail_pop3_module)',
74 proxy => '(?s)^(?!.*--without-http_proxy_module)', 101 imap => '(?s)^(?!.*--without-mail_imap_module)',
102 smtp => '(?s)^(?!.*--without-mail_smtp_module)',
103 pcre => '(?s)^(?!.*--without-pcre)',
75 ); 104 );
76 105
77 my $re = $regex{$feature}; 106 my $re = $regex{$feature};
78 $re = $feature if !defined $re; 107 $re = $feature if !defined $re;
79 108