annotate scripts/test/dd.test @ 1364:94677e7b6d97 draft

I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
author Divya Kothari <divya.s.kothari@gmail.com>
date Thu, 26 Jun 2014 07:25:20 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1364
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
1 #!/bin/bash
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
2
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
3 # Copyright 2013 Robin Mittal <robinmittal.it@gmail.com>
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
4 # Copyright 2013 Divya Kothari <divya.s.kothari@gmail.com>
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
5
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
6 [ -f testing.sh ] && . testing.sh
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
7
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
8 # 'dd' command, stderr prints redirecting to /dev/null
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
9 opt="2>/dev/null"
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
10
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
11 #testing "name" "command" "result" "infile" "stdin"
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
12
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
13 testing "dd if=(file)" "dd if=input $opt" "I WANT\n" "I WANT\n" ""
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
14 testing "dd of=(file)" "dd of=file $opt && cat file" "I WANT\n" "" "I WANT\n"
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
15 testing "dd if=file of=file" "dd if=input of=foo $opt && cat foo && rm -f foo" \
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
16 "I WANT\n" "I WANT\n" ""
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
17 testing "dd if=file | dd of=file" "dd if=input $opt | dd of=foo $opt &&
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
18 cat foo && rm -f foo" "I WANT\n" "I WANT\n" ""
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
19 testing "dd (stdout)" "dd $opt" "I WANT\n" "" "I WANT\n"
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
20 testing "dd sync,noerror" \
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
21 "dd if=input of=outFile seek=8860 bs=1M conv=sync,noerror $opt &&
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
22 stat -c \"%s\" outFile && rm -f outFile" "9291431936\n" "I WANT\n" ""
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
23 testing "dd if=file of=(null)" \
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
24 "dd if=input of=/dev/null $opt && echo 'yes'" "yes\n" "I WANT\n" ""
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
25 testing "dd with if of bs" \
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
26 "dd if=/dev/zero of=sda.txt bs=512 count=1 $opt &&
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
27 stat -c '%s' sda.txt && rm -f sda.txt" "512\n" "" ""
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
28 testing "dd with if of ibs obs" \
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
29 "dd if=/dev/zero of=sda.txt ibs=512 obs=256 count=1 $opt &&
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
30 stat -c '%s' sda.txt && rm -f sda.txt" "512\n" "" ""
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
31 testing "dd with if of ibs obs count" \
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
32 "dd if=/dev/zero of=sda.txt ibs=512 obs=256 count=3 $opt &&
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
33 stat -c '%s' sda.txt && rm -f sda.txt" "1536\n" "" ""
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
34
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
35 ln -s input softlink
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
36 testing "dd if=softlink" "dd if=softlink $opt" "I WANT\n" "I WANT\n" ""
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
37 unlink softlink
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
38
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
39 ln -s file softlink
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
40 testing "dd if=file of=softlink" "dd if=input of=softlink $opt &&
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
41 [ -f file -a -L softlink ] && cat softlink" "I WANT\n" "I WANT\n" ""
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
42 unlink softlink && rm -f file
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
43
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
44 testing "dd if=file of=file (same file)" "dd if=input of=input $opt &&
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
45 [ -f input ] && cat input && echo 'yes'" "yes\n" "I WANT\n" ""
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
46
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
47 testing "dd with ibs obs bs" "dd ibs=2 obs=5 bs=9 $opt" "I WANT\n" "" "I WANT\n"
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
48 testing "dd with ibs obs bs if" "dd ibs=2 obs=5 bs=9 if=input $opt" \
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
49 "I WANT\n" "I WANT\n" ""
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
50
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
51 testing "dd with ibs obs count" "dd ibs=1 obs=1 count=1 $opt" "I" "" "I WANT\n"
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
52 testing "dd with ibs obs count if" "dd ibs=1 obs=1 count=3 if=input $opt" \
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
53 "I W" "I WANT\n" ""
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
54
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
55 testing "dd with count" "dd count=1 $opt" "I WANT\n" "" "I WANT\n"
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
56 testing "dd with count if" "dd count=1 if=input $opt" "I WANT\n" "I WANT\n" ""
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
57
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
58 testing "dd with skip" "dd skip=0 $opt" "I WANT\n" "" "I WANT\n"
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
59 testing "dd with skip if" "dd skip=0 if=input $opt" "I WANT\n" "I WANT\n" ""
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
60
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
61 testing "dd with seek" "dd seek=0 $opt" "I WANT\n" "" "I WANT\n"
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
62 testing "dd with seek if" "dd seek=0 if=input $opt" "I WANT\n" "I WANT\n" ""
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
63
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
64 # These type of conv is not supported in toybox: 'ascii', 'ebcdic', 'ibm',
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
65 # 'block', 'unblock', 'nocreat', 'notronc', 'lcase', 'ucase', 'excl', 'swab'
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
66
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
67 # Testing only 'notrunc', 'noerror', 'fsync', 'sync'
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
68
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
69 testing "dd conv=notrunc" "dd conv=notrunc $opt" "I WANT\n" "" "I WANT\n"
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
70 testing "dd conv=notrunc with IF" "dd conv=notrunc if=input $opt" "I WANT\n" \
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
71 "I WANT\n" ""
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
72
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
73 testing "dd conv=noerror" "dd conv=noerror $opt" "I WANT\n" "" "I WANT\n"
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
74 testing "dd conv=noerror with IF" "dd conv=noerror if=input $opt" "I WANT\n" \
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
75 "I WANT\n" ""
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
76
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
77 testing "dd conv=fsync" "dd conv=fsync $opt" "I WANT\n" "" "I WANT\n"
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
78 testing "dd conv=fsync with IF" "dd conv=fsync if=input $opt" "I WANT\n" \
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
79 "I WANT\n" ""
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
80
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
81 testing "dd conv=sync" "dd conv=sync $opt | head -n 1" "I WANT\n" "" "I WANT\n"
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
82 testing "dd conv=sync with IF" "dd conv=sync if=input $opt | head -n 1" "I WANT\n" \
94677e7b6d97 I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
83 "I WANT\n" ""