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> </name>
# This command should not succeed since we only accept # This command should not succeed since we only accept
# file:/// file://localhost/ file://127.0.0.1/ # 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> <command>
file://bad-host%PWD/%LOGDIR/test%TESTNUMBER.txt file://bad-host%PWD/%LOGDIR/test%TESTNUMBER.txt
</command> </command>

View File

@ -40,7 +40,7 @@ HTTP GET with -O -J and Content-Disposition (empty file)
CURL_TESTDIR=%LOGDIR CURL_TESTDIR=%LOGDIR
</setenv> </setenv>
<command option="no-output,no-include"> <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> </command>
</client> </client>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3104,6 +3104,8 @@ sub subvariables {
$$thing =~ s/${prefix}DATE/$DATE/g; $$thing =~ s/${prefix}DATE/$DATE/g;
$$thing =~ s/${prefix}TESTNUMBER/$testnum/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; my $file_pwd = $pwd;
if($file_pwd !~ /^\//) { if($file_pwd !~ /^\//) {
$file_pwd = "/$file_pwd"; $file_pwd = "/$file_pwd";