changeset 1994:e9235c647f45

Tests: better binary path handling on Windows. The ".exe" extension is no longer required, and testing is allowed if it is omitted. Additionally, forward slashes in the binary path are automatically replaced with reverse slashes, since CMD cannot properly handle relative paths with forward slashes, and such paths previously resulted in various issues, including non-working $t->has() and $t->has_version(). In particular, with these changes the default binary path, which is "../nginx/objs/nginx", works properly, and testing can be done without any additional options.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 09 Aug 2024 05:18:51 +0300
parents 6b1222de8286
children d329b05e20fa
files lib/Test/Nginx.pm
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lib/Test/Nginx.pm
+++ b/lib/Test/Nginx.pm
@@ -49,8 +49,10 @@ sub new {
 		or die "Can't create temp directory: $!\n";
 	$self->{_testdir} =~ s!\\!/!g if $^O eq 'MSWin32';
 
+	$NGINX =~ s!/!\\!g if $^O eq 'MSWin32';
+
 	Test::More::BAIL_OUT("no $NGINX binary found")
-		unless -x $NGINX;
+		unless -x $NGINX or ($^O eq 'MSWin32' and -x "$NGINX.exe");
 
 	return $self;
 }