aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2016-07-07 21:48:33 -0700
committerRob Landley <rob@landley.net>2016-07-08 00:03:57 -0500
commitd5088a059649daf34e729995bb3daa3eb64fa432 (patch)
tree792e43241ddd494ad12c44cd2b36f025579ea7b7 /tests
parent008fb6444d7d960a9c96236334ad3e71f218d54c (diff)
downloadtoybox-d5088a059649daf34e729995bb3daa3eb64fa432.tar.gz
dd improvements.
Support hex (requested by users). Support status=noxfer and status=none (requested by users). Fix status output. Clarify large numbers in --help output. Use O_TRUNC rather than ftruncate unless we're also seeking. New tests. Also partial cleanup (reuse of existing code, removal of non-GLOBALS globals, and merge dd_main and do_dd).
Diffstat (limited to 'tests')
-rwxr-xr-xtests/dd.test13
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/dd.test b/tests/dd.test
index 42cd170a..82214506 100755
--- a/tests/dd.test
+++ b/tests/dd.test
@@ -10,6 +10,12 @@ opt="2>/dev/null"
#testing "name" "command" "result" "infile" "stdin"
+# Test suffixed number parsing; `count` is representative.
+testing "count=2" "dd if=input count=2 ibs=1 $opt" "hi" "high\n" ""
+testing "count= 2" "dd if=input 'count= 2' ibs=1 $opt" "hi" "high\n" ""
+testing "count=0x2" "dd if=input 'count=0x2' ibs=1 $opt" "hi" "high\n" ""
+testing "count=-2" "dd if=input 'count=-2' ibs=1 2>&1" "dd: invalid number '-2'\n" "" ""
+
testing "if=(file)" "dd if=input $opt" "I WANT\n" "I WANT\n" ""
testing "of=(file)" "dd of=file $opt && cat file" "I WANT\n" "" "I WANT\n"
testing "if=file of=file" "dd if=input of=foo $opt && cat foo && rm -f foo" \
@@ -61,9 +67,6 @@ testing "with skip if" "dd skip=0 if=input $opt" "I WANT\n" "I WANT\n" ""
testing "with seek" "dd seek=0 $opt" "I WANT\n" "" "I WANT\n"
testing "with seek if" "dd seek=0 if=input $opt" "I WANT\n" "I WANT\n" ""
-# These type of conv is not supported in toybox: 'ascii', 'ebcdic', 'ibm',
-# 'block', 'unblock', 'nocreat', 'notronc', 'lcase', 'ucase', 'excl', 'swab'
-
# Testing only 'notrunc', 'noerror', 'fsync', 'sync'
testing "conv=notrunc" "dd conv=notrunc $opt" "I WANT\n" "" "I WANT\n"
@@ -81,3 +84,7 @@ testing "conv=fsync with IF" "dd conv=fsync if=input $opt" "I WANT\n" \
testing "conv=sync" "dd conv=sync $opt | head -n 1" "I WANT\n" "" "I WANT\n"
testing "conv=sync with IF" "dd conv=sync if=input $opt | head -n 1" "I WANT\n" \
"I WANT\n" ""
+
+# status=noxfer|none
+testing "status=noxfer" "dd if=input status=noxfer ibs=1 2>&1" "input\n6+0 records in\n0+1 records out\n" "input\n" ""
+testing "status=none" "dd if=input status=none ibs=1 2>&1" "input\n" "input\n" ""