[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] tests: dd: check that files are opened with O_TRUNC
|
From: |
Collin Funk |
|
Subject: |
[PATCH] tests: dd: check that files are opened with O_TRUNC |
|
Date: |
Sun, 21 Jun 2026 20:46:13 -0700 |
* tests/dd/misc.sh: Add the test case.
---
tests/dd/misc.sh | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/tests/dd/misc.sh b/tests/dd/misc.sh
index aa776b137..c84fb3e97 100755
--- a/tests/dd/misc.sh
+++ b/tests/dd/misc.sh
@@ -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,15 @@ 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=ftruncate:error=EIO true; then
+ echo a > $tmp_out || framework_failure_
+ strace --quiet=all -o /dev/null -e inject=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
--
2.54.0
| [Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] tests: dd: check that files are opened with O_TRUNC,
Collin Funk <=