changeset 219:ce2e23daa1da

Tests: minimal win32 support.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 01 Jun 2012 21:34:28 +0400
parents 7f4a913d7504
children f6f60780f758
files lib/Test/Nginx.pm
diffstat 1 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lib/Test/Nginx.pm
+++ b/lib/Test/Nginx.pm
@@ -39,6 +39,7 @@ sub new {
 		CLEANUP => not $ENV{TEST_NGINX_LEAVE}
 	)
 		or die "Can't create temp directory: $!\n";
+	$self->{_testdir} =~ s!\\!/!g if $^O eq 'MSWin32';
 
 	return $self;
 }
@@ -199,7 +200,19 @@ sub stop() {
 
 	return $self unless $self->{_started};
 
-	kill 'QUIT', `cat $self->{_testdir}/nginx.pid`;
+	if ($^O eq 'MSWin32') {
+		my $testdir = $self->{_testdir};
+		my @globals = $self->{_test_globals} ?
+			() : ('-g', "pid $testdir/nginx.pid; "
+			. "error_log $testdir/error.log debug;");
+		exec($NGINX, '-c', "$testdir/nginx.conf", '-s', 'stop',
+			@globals)
+			or die "Unable to exec(): $!\n";
+
+	} else {
+		kill 'QUIT', `cat $self->{_testdir}/nginx.pid`;
+	}
+
 	wait;
 
 	$self->{_started} = 0;