[PATCH] Support FreeBSD jails for testing

Steven Hartland steven.hartland at multiplay.co.uk
Fri Oct 16 00:09:49 UTC 2015


# HG changeset patch
# User Steven Hartland <steven.hartland at multiplay.co.uk>
# Date 1444954080 0
#      Fri Oct 16 00:08:00 2015 +0000
# Node ID c22d8299e7040e0de6f85b4e96d0dd953f7af644
# Parent  78b4e12e6efe642aff591234db0f0b040cae9b5e
Support FreeBSD jails for testing

Ensure the test directory is read and writable to the test user.

If you request 127.0.0.1 in a FreeBSD jail without specific access
to 127.0.0.1 then the socket binds to the interface address to
maintain compatibility. This results in the log entries being
from the bound interface address. To prevent failure compare
with the bound IP when requesting 127.0.0.1 in combined test.

diff -r 78b4e12e6efe -r c22d8299e704 access_log.t
--- a/access_log.t	Mon Oct 12 12:57:03 2015 +0300
+++ b/access_log.t	Fri Oct 16 00:08:00 2015 +0000
@@ -155,11 +155,17 @@ SKIP: {
 
 # verify that by default, 'combined' format is used, 'off' disables logging
 
-$log = $t->read_file('combined.log');
-like($log,
-	qr!^\Q127.0.0.1 - - [\E .*
-		\Q] "GET /combined HTTP/1.0" 200 2 "-" "-"\E$!x,
-	'default log format');
+SKIP: {
+	my $sock = IO::Socket::INET->new(LocalAddr => '127.0.0.1');
+	skip('127.0.0.1 local address required', 1) unless defined $sock;
+
+	$log = $t->read_file('combined.log');
+	my $addr = $sock->sockhost;
+	like($log,
+		qr!^\Q$addr - - [\E .*
+			\Q] "GET /combined HTTP/1.0" 200 2 "-" "-"\E$!x,
+		'default log format');
+}
 
 # verify that log filtering works
 
diff -r 78b4e12e6efe -r c22d8299e704 lib/Test/Nginx.pm
--- a/lib/Test/Nginx.pm	Mon Oct 12 12:57:03 2015 +0300
+++ b/lib/Test/Nginx.pm	Fri Oct 16 00:08:00 2015 +0000
@@ -43,6 +43,9 @@ sub new {
 		TMPDIR => 1
 	)
 		or die "Can't create temp directory: $!\n";
+
+	chmod(0777, $self->{_testdir})
+		or die "Can't chmod temp directory: $!\n";
 	$self->{_testdir} =~ s!\\!/!g if $^O eq 'MSWin32';
 	mkdir "$self->{_testdir}/logs"
 		or die "Can't create logs directory: $!\n";



More information about the nginx-devel mailing list