[nginx-tests] Tests: better binary path handling on Windows.
Maxim Dounin
mdounin at mdounin.ru
Mon Aug 12 03:37:27 UTC 2024
details: http://freenginx.org/hg/nginx-tests/rev/e9235c647f45
branches:
changeset: 1994:e9235c647f45
user: Maxim Dounin <mdounin at mdounin.ru>
date: Fri Aug 09 05:18:51 2024 +0300
description:
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.
diffstat:
lib/Test/Nginx.pm | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diffs (15 lines):
diff --git a/lib/Test/Nginx.pm b/lib/Test/Nginx.pm
--- 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;
}
More information about the nginx-devel
mailing list