diff 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
line wrap: on
line diff
--- a/http_disable_symlinks.t
+++ b/http_disable_symlinks.t
@@ -154,13 +154,6 @@ http {
 
 EOF
 
-eval {
-	open OLDERR, ">&", \*STDERR; close STDERR;
-	$t->run();
-	open STDERR, ">&", \*OLDERR;
-};
-plan(skip_all => 'no disable_symlinks') if $@;
-
 my $uid = getuid();
 my ($extfile) = grep { -f "$_" && $uid != (stat($_))[4] }
 	('/etc/resolv.conf', '/etc/protocols', '/etc/host.conf');
@@ -168,9 +161,9 @@ my ($extfile) = grep { -f "$_" && $uid !
 plan(skip_all => 'no external file found')
 	if !defined $extfile;
 
-my $d = $t->testdir();
+$t->try_run('no disable_symlinks')->plan(28);
 
-$t->plan(28);
+my $d = $t->testdir();
 
 mkdir("$d/on");
 mkdir("$d/not_owner");