changeset 1238:e35cc79ed4a1

Tests: show try_run() errors in verbose mode.
author Sergey Kandaurov <pluknet@nginx.com>
date Tue, 14 Nov 2017 15:34:18 +0300
parents e4974af3fb12
children 4a825ec85c8d
files lib/Test/Nginx.pm
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lib/Test/Nginx.pm
+++ b/lib/Test/Nginx.pm
@@ -287,7 +287,19 @@ sub try_run($$) {
 		open STDERR, ">&", \*OLDERR;
 	};
 
-	Test::More::plan(skip_all => $message) if $@;
+	return $self unless $@;
+
+	if ($ENV{TEST_NGINX_VERBOSE}) {
+		$self->{_configure_args} =~ m!--error-log-path=(\S+)!;
+		my $path = $1 || 'logs/error.log';
+		$path = "$self->{_testdir}/$path" if index($path, '/');
+
+		open F, '<', $path or die "Can't open $path: $!";
+		log_core($_) while (<F>);
+		close F;
+	}
+
+	Test::More::plan(skip_all => $message);
 	return $self;
 }