]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
test475: verify a 72K ASCII FTP upload
authorDaniel Stenberg <daniel@haxx.se>
Thu, 29 Aug 2024 07:53:28 +0000 (09:53 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 29 Aug 2024 18:24:23 +0000 (20:24 +0200)
Extended the test format and runtest.pl so that the verify/upload part
can be marked using crlf newlines even when the client/file does not
have it.

Closes #14717

tests/FILEFORMAT.md
tests/data/Makefile.am
tests/data/test475 [new file with mode: 0644]
tests/runtests.pl

index d7e04d267fb4edd164f6acefe73a32f421e6549d..a9ae97ff0bac5bff2f5acc5c93c366e600d90442 100644 (file)
@@ -692,8 +692,11 @@ content
 
 ### `<stripfile4>`
 
-### `<upload>`
+### `<upload [crlf="yes"]>`
 the contents of the upload data curl should have sent
 
+`crlf=yes` forces *upload* newlines to become CRLF even if not written so in
+the source file.
+
 ### `<valgrind>`
 disable - disables the valgrind log check for this test
index 619a97d8f041995dbd7b30b7dcf98bf8570f7b78..d572c6bf0f941b696c12caf55ad773d141adfde3 100644 (file)
@@ -77,7 +77,7 @@ test435 test436 test437 test438 test439 test440 test441 test442 test443 \
 test444 test445 test446 test447 test448 test449 test450 test451 test452 \
 test453 test454 test455 test456 test457 test458 test459 test460 test461 \
 test462 test463 test467 test468 test469 test470 test471 test472 test473 \
-test474 \
+test474 test475 \
 \
 test490 test491 test492 test493 test494 test495 test496 test497 test498 \
 test499 test500 test501 test502 test503 test504 test505 test506 test507 \
diff --git a/tests/data/test475 b/tests/data/test475
new file mode 100644 (file)
index 0000000..b0e4c2c
--- /dev/null
@@ -0,0 +1,45 @@
+<testcase>
+<info>
+<keywords>
+FTP
+EPSV
+STOR
+TYPE A
+</keywords>
+</info>
+
+# Client-side
+<client>
+<server>
+ftp
+</server>
+<name>
+FTP PASV upload ASCII file
+</name>
+<file name="%LOGDIR/test%TESTNUMBER.txt">
+%repeat[1750 x a line of text used for verifying this !%0a]%
+</file>
+<command>
+"ftp://%HOSTIP:%FTPPORT/%TESTNUMBER;type=a" -T %LOGDIR/test%TESTNUMBER.txt
+</command>
+</client>
+
+# Verify data after the test has been "shot"
+<verify>
+<strip>
+QUIT
+</strip>
+<upload crlf="yes">
+%repeat[1750 x a line of text used for verifying this !%0a]%
+</upload>
+<protocol>
+USER anonymous\r
+PASS ftp@example.com\r
+PWD\r
+EPSV\r
+TYPE A\r
+STOR %TESTNUMBER\r
+QUIT\r
+</protocol>
+</verify>
+</testcase>
index c0c71881123fd374a96bb3e7e61cc2507c13246f..293d6d38ed6eb9f149e5669db2c296cbfe176148 100755 (executable)
@@ -1489,6 +1489,9 @@ sub singletest_check {
                 eval $strip;
             }
         }
+        if($hash{'crlf'}) {
+            subnewlines(1, \$_) for @upload;
+        }
 
         $res = compare($runnerid, $testnum, $testname, "upload", \@out, \@upload);
         if ($res) {