]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tests: add file: tests with existing files
authorDan Fandrich <dan@coneharvesters.com>
Wed, 25 Sep 2024 20:30:29 +0000 (13:30 -0700)
committerDan Fandrich <dan@coneharvesters.com>
Thu, 26 Sep 2024 17:10:36 +0000 (10:10 -0700)
Windows sometimes has issues when opening the same file twice, so these
test two situations where that could potentially occur.

Reported-by: ralfjunker on github
Ref: #15043
Closes #15045

tests/data/Makefile.am
tests/data/test1490 [new file with mode: 0644]
tests/data/test1491 [new file with mode: 0644]
tests/data/test205

index f5f903e869adc7ae3993602d73fd2f07a5253c74..90442d80e39ad573840bd531825a31569cae07a3 100644 (file)
@@ -193,7 +193,7 @@ test1455 test1456 test1457 test1458 test1459 test1460 test1461 test1462 \
 test1463 test1464 test1465 test1466 test1467 test1468 test1469 test1470 \
 test1471 test1472 test1473 test1474 test1475 test1476 test1477 test1478 \
 test1479 test1480 test1481 test1482 test1483 test1484 test1485 test1486 \
-test1487 test1488 test1489 \
+test1487 test1488 test1489 test1490 test1491 \
 \
 test1500 test1501 test1502 test1503 test1504 test1505 test1506 test1507 \
 test1508 test1509 test1510 test1511 test1512 test1513 test1514 test1515 \
diff --git a/tests/data/test1490 b/tests/data/test1490
new file mode 100644 (file)
index 0000000..41d4c3a
--- /dev/null
@@ -0,0 +1,43 @@
+<testcase>
+<info>
+<keywords>
+FILE
+</keywords>
+</info>
+
+# no Server-side
+
+# Client-side
+<client>
+<server>
+file
+</server>
+<name>
+"upload" with file:// overwriting existing
+</name>
+<command option="no-include">
+file://localhost%FILE_PWD/%LOGDIR/result%TESTNUMBER.txt -T %LOGDIR/upload%TESTNUMBER.txt
+</command>
+<file name="%LOGDIR/upload%TESTNUMBER.txt">
+data
+in
+file
+to
+write
+</file>
+<file2 name="%LOGDIR/result%TESTNUMBER.txt">
+already existing
+</file2>
+</client>
+
+# Verify data after the test has been "shot"
+<verify>
+<file name="%LOGDIR/result%TESTNUMBER.txt">
+data
+in
+file
+to
+write
+</file>
+</verify>
+</testcase>
diff --git a/tests/data/test1491 b/tests/data/test1491
new file mode 100644 (file)
index 0000000..84d4e94
--- /dev/null
@@ -0,0 +1,37 @@
+<testcase>
+<info>
+<keywords>
+FILE
+</keywords>
+</info>
+
+<reply>
+</reply>
+
+# Client-side
+<client>
+<server>
+file
+</server>
+<name>
+file:// don't overwrite self with --skip-existing
+</name>
+<command option="no-output">
+file://localhost%FILE_PWD/%LOGDIR/test%TESTNUMBER.txt -o %LOGDIR/test%TESTNUMBER.txt --skip-existing
+</command>
+<file name="%LOGDIR/test%TESTNUMBER.txt">
+foo
+   bar
+bar
+   foo
+moo
+</file>
+</client>
+
+# Verify data after the test has been "shot"
+<verify>
+<stderr mode="text">
+Note: skips transfer, "%LOGDIR/test%TESTNUMBER.txt" exists locally
+</stderr>
+</verify>
+</testcase>
index 8239f63222f0ece8e9c84d396164632cb1c796f5..a1b02d8a6e9718a3ce227793909bb01fb2209228 100644 (file)
@@ -14,7 +14,7 @@ FAILURE
 file
 </server>
 <name>
-"upload" with file://
+"upload" nonexisting with file://
 </name>
 <command option="no-include">
 file://localhost/%PWD/%LOGDIR/nonexisting/result%TESTNUMBER.txt -T %LOGDIR/upload%TESTNUMBER.txt