mirror of
https://github.com/coreutils/coreutils.git
synced 2026-10-28 09:44:34 +08:00
tests: dd: check that files are opened with O_TRUNC
* tests/dd/misc.sh: Add the test case.
This commit is contained in:
1 parent
17e6bfcc2b
commit
57fe9ecd69
1 file changed
+12
@@ -19,6 +19,7 @@
|
||||
|
||||
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
|
||||
print_ver_ dd
|
||||
uses_strace_
|
||||
export LC_ALL=C
|
||||
|
||||
tmp_in=dd-in
|
||||
@@ -129,5 +130,16 @@ if test -c /dev/tty && >/dev/tty; then
|
||||
dd if=/dev/null of=/dev/tty || fail=1
|
||||
fi
|
||||
|
||||
# Ensure that the output file is opened with O_TRUNC.
|
||||
if strace -o /dev/null -e inject=truncate,ftruncate:error=EIO true; then
|
||||
echo a > $tmp_out || framework_failure_
|
||||
strace --quiet=all -o /dev/null \
|
||||
-e inject=truncate,ftruncate:error=EIO -P $tmp_out \
|
||||
dd if=/dev/null of=$tmp_out status=none skip=1B >out 2>err || fail=1
|
||||
compare /dev/null out || fail=1
|
||||
compare /dev/null err || fail=1
|
||||
compare /dev/null $tmp_out || fail=1
|
||||
fi
|
||||
|
||||
|
||||
Exit $fail
|
||||
Reference in new issue
Block a user