[Toybox] [PATCH 2/2] tests/dd: Add conv=nocreat test cases

Jeffery Miller jefferymiller at google.com
Wed Apr 16 16:54:02 PDT 2025


Check that conv=nocreat errors out and does not
not create a file.

Test: make test_dd
---
 tests/dd.test | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/dd.test b/tests/dd.test
index 9d8d7abf..11e869c9 100644
--- a/tests/dd.test
+++ b/tests/dd.test
@@ -100,6 +100,11 @@ testcmd "conv=sync" "conv=sync | head -n 1" "I WANT\n" "" "I WANT\n"
 testcmd "conv=sync with IF" "conv=sync if=input | head -n 1" "I WANT\n" \
   "I WANT\n" ""
 
+testcmd "conv=nocreat" "conv=nocreat of=./noexist || ( [ ! -e ./noexist ] && echo DOESNOTEXIST )" \
+  "DOESNOTEXIST\n" "" "anything at all"
+testcmd "conv=nocreat no OF" "conv=nocreat if=input" "anything" "anything" ""
+testing "conv=nocreat exists" "dd conv=nocreat of=input && cat input" "results" "existing" "results"
+
 # status=noxfer|none
 testcmd "status=noxfer" "if=input status=noxfer ibs=1 2>&1" \
   "input\n6+0 records in\n0+1 records out\n" "input\n" ""
-- 
2.49.0.805.g082f7c87e0-goog



More information about the Toybox mailing list