From f6cb707b6a578bbf6be236f9df2dc471b2b0d68c Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sun, 29 Sep 2024 12:01:37 +0200 Subject: [PATCH] tests: replace `%PWD` with `%FILE_PWD` for `file://` Before this patch not all tests used `%FILE_PWD` with the `file://` protocol. Keep `%PWD` for test1145, to keep it fail on Windows like the test expects. Cherry-picked from #14949 Closes #15090 --- tests/data/test1145 | 2 ++ tests/data/test1422 | 2 +- tests/data/test1423 | 2 +- tests/data/test1440 | 2 +- tests/data/test1441 | 2 +- tests/data/test1442 | 2 +- tests/data/test201 | 2 +- tests/data/test205 | 2 +- tests/data/test2072 | 2 +- tests/data/test3016 | 2 +- tests/data/test502 | 2 +- tests/servers.pm | 2 ++ 12 files changed, 14 insertions(+), 10 deletions(-) diff --git a/tests/data/test1145 b/tests/data/test1145 index 570197ee97..1a02c031d3 100644 --- a/tests/data/test1145 +++ b/tests/data/test1145 @@ -18,6 +18,8 @@ file:// bad host # This command should not succeed since we only accept # file:/// file://localhost/ file://127.0.0.1/ +# Pass %PWD instead of %FILE_PWD to trigger the expected +# error code with native Windows curl. file://bad-host%PWD/%LOGDIR/test%TESTNUMBER.txt diff --git a/tests/data/test1422 b/tests/data/test1422 index a865b5e532..9b45612a9f 100644 --- a/tests/data/test1422 +++ b/tests/data/test1422 @@ -40,7 +40,7 @@ HTTP GET with -O -J and Content-Disposition (empty file) CURL_TESTDIR=%LOGDIR -http://%HOSTIP:%HTTPPORT/%TESTNUMBER -J -O file://%PWD/%LOGDIR/name%TESTNUMBER +http://%HOSTIP:%HTTPPORT/%TESTNUMBER -J -O file://%FILE_PWD/%LOGDIR/name%TESTNUMBER diff --git a/tests/data/test1423 b/tests/data/test1423 index 04986396ff..16a4cf31fc 100644 --- a/tests/data/test1423 +++ b/tests/data/test1423 @@ -30,7 +30,7 @@ file HTTP GET -o fname without Content-Disposition (empty file) -http://%HOSTIP:%HTTPPORT/%TESTNUMBER -o %LOGDIR/outfile%TESTNUMBER file://%PWD/%LOGDIR/outfile%TESTNUMBER +http://%HOSTIP:%HTTPPORT/%TESTNUMBER -o %LOGDIR/outfile%TESTNUMBER file://%FILE_PWD/%LOGDIR/outfile%TESTNUMBER diff --git a/tests/data/test1440 b/tests/data/test1440 index dbdfc73619..8ae45753d7 100644 --- a/tests/data/test1440 +++ b/tests/data/test1440 @@ -19,7 +19,7 @@ file Check --write-out with trailing %{ -file://localhost/%PWD/%LOGDIR/non-existent-file.txt --write-out '%{' +file://localhost/%FILE_PWD/%LOGDIR/non-existent-file.txt --write-out '%{' diff --git a/tests/data/test1441 b/tests/data/test1441 index 2ff6be036a..16b2a87164 100644 --- a/tests/data/test1441 +++ b/tests/data/test1441 @@ -19,7 +19,7 @@ file Check --write-out with trailing % -file://localhost/%PWD/%LOGDIR/non-existent-file.txt --write-out '%' +file://localhost/%FILE_PWD/%LOGDIR/non-existent-file.txt --write-out '%' diff --git a/tests/data/test1442 b/tests/data/test1442 index 02ecea67f6..0825a1e028 100644 --- a/tests/data/test1442 +++ b/tests/data/test1442 @@ -19,7 +19,7 @@ file Check --write-out with trailing \ -file://localhost/%PWD/%LOGDIR/non-existent-file.txt --write-out '\' +file://localhost/%FILE_PWD/%LOGDIR/non-existent-file.txt --write-out '\' diff --git a/tests/data/test201 b/tests/data/test201 index aff9ca2b81..a413ca3ff5 100644 --- a/tests/data/test201 +++ b/tests/data/test201 @@ -21,7 +21,7 @@ file missing file:// file -file://localhost/%PWD/%LOGDIR/non-existent-file.txt +file://localhost/%FILE_PWD/%LOGDIR/non-existent-file.txt diff --git a/tests/data/test205 b/tests/data/test205 index a1b02d8a6e..d3fbce76bd 100644 --- a/tests/data/test205 +++ b/tests/data/test205 @@ -17,7 +17,7 @@ file "upload" nonexisting with file:// -file://localhost/%PWD/%LOGDIR/nonexisting/result%TESTNUMBER.txt -T %LOGDIR/upload%TESTNUMBER.txt +file://localhost/%FILE_PWD/%LOGDIR/nonexisting/result%TESTNUMBER.txt -T %LOGDIR/upload%TESTNUMBER.txt data diff --git a/tests/data/test2072 b/tests/data/test2072 index caa8c75c2c..7f72b6955f 100644 --- a/tests/data/test2072 +++ b/tests/data/test2072 @@ -24,7 +24,7 @@ file file:// with Unix path resolution behavior for the case of extra slashes -file:////%PWD/%LOGDIR/test%TESTNUMBER.txt +file:////%FILE_PWD/%LOGDIR/test%TESTNUMBER.txt perl -e "print 'Test requires a Unix system' if ( $^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'dos' || $^O eq 'msys');" diff --git a/tests/data/test3016 b/tests/data/test3016 index d04633c7a1..e1285a325f 100644 --- a/tests/data/test3016 +++ b/tests/data/test3016 @@ -21,7 +21,7 @@ GET a directory using file:// !win32 -file://%PWD/ +file://%FILE_PWD/ diff --git a/tests/data/test502 b/tests/data/test502 index 0bca19c623..4e7ce38ae2 100644 --- a/tests/data/test502 +++ b/tests/data/test502 @@ -30,7 +30,7 @@ lib%TESTNUMBER simple multi file:// get -file://%PWD/%LOGDIR/test%TESTNUMBER.txt +file://%FILE_PWD/%LOGDIR/test%TESTNUMBER.txt foo diff --git a/tests/servers.pm b/tests/servers.pm index 9badf5da1f..0be4366a1e 100644 --- a/tests/servers.pm +++ b/tests/servers.pm @@ -3104,6 +3104,8 @@ sub subvariables { $$thing =~ s/${prefix}DATE/$DATE/g; $$thing =~ s/${prefix}TESTNUMBER/$testnum/g; + # POSIX/MSYS/Cygwin curl needs: file://localhost/d/path/to + # Windows native curl needs: file://localhost/D:/path/to my $file_pwd = $pwd; if($file_pwd !~ /^\//) { $file_pwd = "/$file_pwd";