changeset 1027:6ef255ed4bbc

Tests: set "env PERL5LIB" modules paths fallback for perl module. Paths are based on build directory to ease running nginx built with perl module.
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 05 Sep 2016 15:02:17 +0300
parents e74a9342eb96
children 403709429c3b
files lib/Test/Nginx.pm
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lib/Test/Nginx.pm
+++ b/lib/Test/Nginx.pm
@@ -521,6 +521,7 @@ sub test_globals() {
 		if $ENV{TEST_NGINX_GLOBALS};
 
 	$s .= $self->test_globals_modules();
+	$s .= $self->test_globals_perl5lib() if $s !~ /env PERL5LIB/;
 
 	$self->{_test_globals} = $s;
 }
@@ -558,6 +559,21 @@ sub test_globals_modules() {
 	return $s;
 }
 
+sub test_globals_perl5lib() {
+	my ($self) = @_;
+
+	return '' unless $self->has_module('perl');
+
+	my ($volume, $dir) = File::Spec->splitpath($NGINX);
+	my $objs = File::Spec->catpath($volume, $dir, '');
+
+	$objs = File::Spec->rel2abs($objs);
+	$objs =~ s!\\!/!g if $^O eq 'MSWin32';
+
+	return "env PERL5LIB=$objs/src/http/modules/perl:"
+		. "$objs/src/http/modules/perl/blib/arch;\n";
+}
+
 sub test_globals_http() {
 	my ($self) = @_;