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
This commit is contained in:
Viktor Szakats 2024-09-29 12:01:37 +02:00
parent 18143579ba
commit f6cb707b6a
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201
12 changed files with 14 additions and 10 deletions

View File

@ -18,6 +18,8 @@ file:// bad host
</name>
# 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.
<command>
file://bad-host%PWD/%LOGDIR/test%TESTNUMBER.txt
</command>

View File

@ -40,7 +40,7 @@ HTTP GET with -O -J and Content-Disposition (empty file)
CURL_TESTDIR=%LOGDIR
</setenv>
<command option="no-output,no-include">
http://%HOSTIP:%HTTPPORT/%TESTNUMBER -J -O file://%PWD/%LOGDIR/name%TESTNUMBER
http://%HOSTIP:%HTTPPORT/%TESTNUMBER -J -O file://%FILE_PWD/%LOGDIR/name%TESTNUMBER
</command>
</client>

View File

@ -30,7 +30,7 @@ file
HTTP GET -o fname without Content-Disposition (empty file)
</name>
<command option="no-output,no-include">
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
</command>
</client>

View File

@ -19,7 +19,7 @@ file
Check --write-out with trailing %{
</name>
<command>
file://localhost/%PWD/%LOGDIR/non-existent-file.txt --write-out '%{'
file://localhost/%FILE_PWD/%LOGDIR/non-existent-file.txt --write-out '%{'
</command>
</client>

View File

@ -19,7 +19,7 @@ file
Check --write-out with trailing %
</name>
<command>
file://localhost/%PWD/%LOGDIR/non-existent-file.txt --write-out '%'
file://localhost/%FILE_PWD/%LOGDIR/non-existent-file.txt --write-out '%'
</command>
</client>

View File

@ -19,7 +19,7 @@ file
Check --write-out with trailing \
</name>
<command>
file://localhost/%PWD/%LOGDIR/non-existent-file.txt --write-out '\'
file://localhost/%FILE_PWD/%LOGDIR/non-existent-file.txt --write-out '\'
</command>
</client>

View File

@ -21,7 +21,7 @@ file
missing file:// file
</name>
<command>
file://localhost/%PWD/%LOGDIR/non-existent-file.txt
file://localhost/%FILE_PWD/%LOGDIR/non-existent-file.txt
</command>
</client>

View File

@ -17,7 +17,7 @@ file
"upload" nonexisting with file://
</name>
<command option="no-include">
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
</command>
<file name="%LOGDIR/upload%TESTNUMBER.txt">
data

View File

@ -24,7 +24,7 @@ file
file:// with Unix path resolution behavior for the case of extra slashes
</name>
<command option="no-include">
file:////%PWD/%LOGDIR/test%TESTNUMBER.txt
file:////%FILE_PWD/%LOGDIR/test%TESTNUMBER.txt
</command>
<precheck>
perl -e "print 'Test requires a Unix system' if ( $^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'dos' || $^O eq 'msys');"

View File

@ -21,7 +21,7 @@ GET a directory using file://
!win32
</features>
<command>
file://%PWD/
file://%FILE_PWD/
</command>
</client>

View File

@ -30,7 +30,7 @@ lib%TESTNUMBER
simple multi file:// get
</name>
<command>
file://%PWD/%LOGDIR/test%TESTNUMBER.txt
file://%FILE_PWD/%LOGDIR/test%TESTNUMBER.txt
</command>
<file name="%LOGDIR/test%TESTNUMBER.txt">
foo

View File

@ -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";