comparison http_disable_symlinks.t @ 392:c28ecaef065f

Tests: try_run() introduced. This method replaces multiple ad-hoc solutions to grecefully skip tests if nginx startup fails, e.g., due to no support for a particular directive.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 18 Apr 2014 18:36:26 +0400
parents 6a0d934950bc
children 2cd00179f4b2
comparison
equal deleted inserted replaced
391:915ef26ac6eb 392:c28ecaef065f
152 } 152 }
153 } 153 }
154 154
155 EOF 155 EOF
156 156
157 eval {
158 open OLDERR, ">&", \*STDERR; close STDERR;
159 $t->run();
160 open STDERR, ">&", \*OLDERR;
161 };
162 plan(skip_all => 'no disable_symlinks') if $@;
163
164 my $uid = getuid(); 157 my $uid = getuid();
165 my ($extfile) = grep { -f "$_" && $uid != (stat($_))[4] } 158 my ($extfile) = grep { -f "$_" && $uid != (stat($_))[4] }
166 ('/etc/resolv.conf', '/etc/protocols', '/etc/host.conf'); 159 ('/etc/resolv.conf', '/etc/protocols', '/etc/host.conf');
167 160
168 plan(skip_all => 'no external file found') 161 plan(skip_all => 'no external file found')
169 if !defined $extfile; 162 if !defined $extfile;
170 163
164 $t->try_run('no disable_symlinks')->plan(28);
165
171 my $d = $t->testdir(); 166 my $d = $t->testdir();
172
173 $t->plan(28);
174 167
175 mkdir("$d/on"); 168 mkdir("$d/on");
176 mkdir("$d/not_owner"); 169 mkdir("$d/not_owner");
177 mkdir("$d/try_on"); 170 mkdir("$d/try_on");
178 mkdir("$d/try_not_owner"); 171 mkdir("$d/try_not_owner");