]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tests: replace `%PWD` with `%FILE_PWD` for `file://`
authorViktor Szakats <commit@vsz.me>
Sun, 29 Sep 2024 10:01:37 +0000 (12:01 +0200)
committerViktor Szakats <commit@vsz.me>
Mon, 30 Sep 2024 21:48:00 +0000 (23:48 +0200)
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

12 files changed:
tests/data/test1145
tests/data/test1422
tests/data/test1423
tests/data/test1440
tests/data/test1441
tests/data/test1442
tests/data/test201
tests/data/test205
tests/data/test2072
tests/data/test3016
tests/data/test502
tests/servers.pm

index 570197ee97828c6ccbda6fb67b506f82fac5f90b..1a02c031d33cc7e67e06ea8590d75889a5d45c27 100644 (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>
index a865b5e532a41100fa6264efa159ba8648d7f05b..9b45612a9fa07e15b8b649aae3ca88d078216bba 100644 (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>
 
index 04986396ffae929ac7cd715c07e58bcb998fb01d..16a4cf31fcf839b8753fd0fdc2bea6bb301c7616 100644 (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>
 
index dbdfc73619797c929c82d2f0717a3ff30a83ccf2..8ae45753d74b99a878395c9ca8fbc102f6a578e6 100644 (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>
 
index 2ff6be036a979a073037aac2b6885a6341d8d991..16b2a87164c3b800beb9ed92515e5a06fa1ccc87 100644 (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>
 
index 02ecea67f6ffe2d59b793fe679c961b233e543b4..0825a1e0287d0cc7409509ae7d92bb3f1274257c 100644 (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>
 
index aff9ca2b81d2387f0d43f95573178894ff3bd01b..a413ca3ff5d52a0ddb90dd6965e1818072f9f3f9 100644 (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>
 
index a1b02d8a6e9718a3ce227793909bb01fb2209228..d3fbce76bd6a6655eed48fb10c03dc7ae81e2847 100644 (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
index caa8c75c2c5bfb32f8ab28471d1ba6cc3d551c04..7f72b6955ff347be496581aaa9fac47b3832ba9a 100644 (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');"
index d04633c7a11bcd8f017bf750da38274ed39b017f..e1285a325f40ba7f37f3801d4a7c9dc684edf454 100644 (file)
@@ -21,7 +21,7 @@ GET a directory using file://
 !win32
 </features>
 <command>
-file://%PWD/
+file://%FILE_PWD/
 </command>
 </client>
 
index 0bca19c623bc70dc8aec789e128929fbb8888776..4e7ce38ae2c3692f5d52833e7b712ddecd2bfdf7 100644 (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
index 9badf5da1fd19ff5c64e9a19e2bae49dcd94c92b..0be4366a1ec5abf3132d511ac817343c676cdd54 100644 (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";