changeset 856:d39e98893265

Tests: use TEST_NGINX_MODULES to find dynamic modules directory. If not specified, fallback to dirname of TEST_NGINX_BINARY. Either way, the path is normalised to an absolute one for use in "load_module".
author Sergey Kandaurov <pluknet@nginx.com>
date Tue, 16 Feb 2016 18:41:31 +0300
parents 47d64d2fd68d
children fcda5bd87ab2
files README lib/Test/Nginx.pm
diffstat 2 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/README
+++ b/README
@@ -18,6 +18,10 @@ TEST_NGINX_BINARY
 
     Sets path to nginx binary to be tested, defaults to "../nginx/objs/nginx".
 
+TEST_NGINX_MODULES
+
+    Sets path to modules directory, defaults to dirname of TEST_NGINX_BINARY.
+
 TEST_NGINX_VERBOSE
 
     Be a bit more verbose (in particular, print requests sent and responses
--- a/lib/Test/Nginx.pm
+++ b/lib/Test/Nginx.pm
@@ -459,7 +459,14 @@ sub test_globals() {
 sub test_globals_modules() {
 	my ($self) = @_;
 
-	my $modules = File::Spec->rel2abs((File::Spec->splitpath($NGINX))[1]);
+	my $modules = $ENV{TEST_NGINX_MODULES};
+
+	if (!defined $modules) {
+		my ($volume, $dir) = File::Spec->splitpath($NGINX);
+		$modules = File::Spec->catpath($volume, $dir, '');
+	}
+
+	$modules = File::Spec->rel2abs($modules);
 	$modules =~ s!\\!/!g if $^O eq 'MSWin32';
 
 	my $s = '';