On 02/13/2012 07:50 AM, Bernhard Voelker wrote: > On 02/10/2012 05:21 PM, Jérémy Compostella wrote: > > Sorry, this is a bit late, but I have 2 notes about the > new dd/bytes test: > >> diff --git a/tests/dd/bytes b/tests/dd/bytes >> new file mode 100755 >> index 0000000..6038742 >> --- /dev/null >> +++ b/tests/dd/bytes >> @@ -0,0 +1,57 @@ > >> +# seek bytes >> +echo abcdefghijklm | >> + dd bs=5 seek=8 oflag=seek_bytes > out 2> /dev/null || fail=1 >> +echo abcdefghijklm | >> + dd bs=4 seek=2 > expected 2> /dev/null || fail=1 >> +compare expected out || fail=1 > > I don't know why, but I somehow do not have a good feeling > about a test comparing the result of the program to be tested > with another run. If something cowardly fails, then this test > would succeed.
Fair point. >> +# seek bytes on empty file >> +echo abcdefghijklm | >> + dd bs=5 seek=8 oflag=seek_bytes > out2 2> /dev/null || fail=1 >> +compare expected out2 || fail=1 > > The comment is wrong here, isn't it? Well out2 will be a new empty file. Though the case is no different to the previous (since conv=notrunc was not specified). So I'll just remove it. cheers, Pádraig. diff --git a/tests/dd/bytes b/tests/dd/bytes index 6038742..10f3618 100755 --- a/tests/dd/bytes +++ b/tests/dd/bytes @@ -45,13 +45,7 @@ esac # seek bytes echo abcdefghijklm | dd bs=5 seek=8 oflag=seek_bytes > out 2> /dev/null || fail=1 -echo abcdefghijklm | - dd bs=4 seek=2 > expected 2> /dev/null || fail=1 +printf '\0\0\0\0\0\0\0\0abcdefghijklm\n' > expected compare expected out || fail=1 -# seek bytes on empty file -echo abcdefghijklm | - dd bs=5 seek=8 oflag=seek_bytes > out2 2> /dev/null || fail=1 -compare expected out2 || fail=1 - Exit $fail
