]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tests: use a more portable null device path
authorJay Satiro <raysatiro@yahoo.com>
Thu, 3 Apr 2025 03:16:49 +0000 (23:16 -0400)
committerJay Satiro <raysatiro@yahoo.com>
Fri, 4 Apr 2025 07:40:47 +0000 (03:40 -0400)
- Use File::Spec->devnull() to get the null device path.

Prior to this change we used NUL for Windows native perl and /dev/null
otherwise.

Bug: https://github.com/curl/curl/pull/16929#discussion_r2025718160
Reported-by: Viktor Szakats
Closes https://github.com/curl/curl/pull/16930

tests/certs/genserv.pl
tests/globalconfig.pm
tests/http2-server.pl
tests/http3-server.pl

index 4517d2b641604c4d9a35a847d1bec11d81b9e64c..2e722396acae152d54931da87bca6dc8176e1f58 100755 (executable)
@@ -42,7 +42,7 @@ if(-f '/usr/local/ssl/bin/openssl') {
 
 my $SRCDIR = dirname(__FILE__);
 my $fh;
-my $dev_null = $^O eq 'MSWin32' ? 'NUL' : '/dev/null';
+my $dev_null = File::Spec->devnull();
 
 my $KEYSIZE = 'prime256v1';
 my $DURATION;
index c9384673de3ecb88afbf06cd27648c9bbdda6819..da174e1b05cdf8fe8a18c5608f21fa51e6fd4694 100644 (file)
@@ -81,6 +81,9 @@ use Cwd qw(getcwd);
 use testutil qw(
     shell_quote
 );
+use File::Spec qw(
+    devnull
+);
 
 
 #######################################################################
@@ -119,7 +122,7 @@ our $VCURL=$CURL;  # what curl binary to use to verify the servers with
 our $memanalyze="$perl " . shell_quote("$srcdir/memanalyze.pl");
 our $valgrind;     # path to valgrind, or empty if disabled
 our $bundle = 0;   # use bundled server, libtest, unit binaries
-our $dev_null = ($^O eq 'MSWin32' ? 'NUL' : '/dev/null');
+our $dev_null = File::Spec->devnull();   # null device path, eg: /dev/null
 
 # paths in $LOGDIR
 our $LOCKDIR = "lock";          # root of the server directory with lock files
index 074c54c1def6dd8a1ebd73de5fe719531b999d3b..f1d9dbf3107ebb246304753daa623a60e7828031 100755 (executable)
@@ -28,6 +28,7 @@
 use Cwd;
 use Cwd 'abs_path';
 use File::Basename;
+use File::Spec;
 
 my $logdir = "log";
 my $pidfile = "$logdir/nghttpx.pid";
@@ -38,7 +39,7 @@ my $listenport2 = 9016;
 my $connect = "127.0.0.1,8990";
 my $conf = "nghttpx.conf";
 my $cert = "test-localhost";
-my $dev_null = ($^O eq 'MSWin32' ? 'NUL' : '/dev/null');
+my $dev_null = File::Spec->devnull();
 
 #***************************************************************************
 # Process command line options
index 3b1a6b46ee5a95531d30ef936796905620a6c52b..b78d712b32016c5a62f2ab0460130306c243f7cc 100755 (executable)
@@ -29,6 +29,7 @@
 use Cwd;
 use Cwd 'abs_path';
 use File::Basename;
+use File::Spec;
 
 my $logdir = "log";
 my $pidfile = "$logdir/nghttpx.pid";
@@ -38,7 +39,7 @@ my $listenport = 9017;
 my $connect = "127.0.0.1,8990";
 my $cert = "test-localhost";
 my $conf = "nghttpx.conf";
-my $dev_null = ($^O eq 'MSWin32' ? 'NUL' : '/dev/null');
+my $dev_null = File::Spec->devnull();
 
 #***************************************************************************
 # Process command line options