[PATCH 4/5] tests: check decoding of btrfs RDWR ioctls returned data
jeffm at suse.com
jeffm at suse.com
Fri May 27 03:33:06 UTC 2016
From: Jeff Mahoney <jeffm at suse.com>
* tests/btrfs-vw.test: New file.
* tests/btrfs-w.test: New file.
* tests/Makefile.am (DECODER_TESTS): Add btrfs-w.test and btrfs-vw.test.
---
tests/Makefile.am | 2 ++
tests/btrfs-vw.test | 29 +++++++++++++++++++++++++++++
tests/btrfs-w.test | 29 +++++++++++++++++++++++++++++
3 files changed, 60 insertions(+)
create mode 100755 tests/btrfs-vw.test
create mode 100755 tests/btrfs-w.test
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4c1ecdc..d52b270 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -372,6 +372,8 @@ DECODER_TESTS = \
brk.test \
btrfs.test \
btrfs-v.test \
+ btrfs-w.test \
+ btrfs-vw.test \
caps.test \
chmod.test \
chown.test \
diff --git a/tests/btrfs-vw.test b/tests/btrfs-vw.test
new file mode 100755
index 0000000..c7e40ad
--- /dev/null
+++ b/tests/btrfs-vw.test
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# Check verbose decoding of btrfs ioctl w/ live ioctls.
+
+# WARNING: USE OF THIS TEST WILL MODIFY AN EXISTING BTRFS FILE SYSTEM
+
+# Typical usage:
+# mkfs.btrfs <dev>
+# mount <dev> /mnt
+# BTRFS_MOUNTPOINT=/mnt make check TESTS="btrfs-vw"
+# umount /mnt
+
+. "${srcdir=.}/init.sh"
+
+if [ -z "${BTRFS_MOUNTPOINT}" ]; then
+ skip_ "\$BTRFS_MOUNTPOINT not set"
+elif [ ! -d "${BTRFS_MOUNTPOINT}" ]; then
+ skip_ "\$BTRFS_MOUNTPOINT does not point to a directory"
+fi
+
+run_prog ./btrfs -v -w "${BTRFS_MOUNTPOINT}" > /dev/null
+run_strace -a16 -veioctl $args > "$EXP"
+check_prog grep
+grep -v '^ioctl([012],' < "$LOG" > "$OUT"
+match_diff "$OUT" "$EXP"
+
+rm -f "$EXP" "$OUT"
+
+exit 0
diff --git a/tests/btrfs-w.test b/tests/btrfs-w.test
new file mode 100755
index 0000000..6238dca
--- /dev/null
+++ b/tests/btrfs-w.test
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# Check decoding of btrfs ioctl w/ live ioctls.
+
+# WARNING: USE OF THIS TEST WILL MODIFY AN EXISTING BTRFS FILE SYSTEM
+
+# Typical usage:
+# mkfs.btrfs <dev>
+# mount <dev> /mnt
+# BTRFS_MOUNTPOINT=/mnt make check TESTS="btrfs-w"
+# umount /mnt
+
+. "${srcdir=.}/init.sh"
+
+if [ -z "${BTRFS_MOUNTPOINT}" ]; then
+ skip_ "\$BTRFS_MOUNTPOINT not set"
+elif [ ! -d "${BTRFS_MOUNTPOINT}" ]; then
+ skip_ "\$BTRFS_MOUNTPOINT does not point to a directory"
+fi
+
+run_prog ./btrfs -w "${BTRFS_MOUNTPOINT}" > /dev/null
+run_strace -a16 -eioctl $args > "$EXP"
+check_prog grep
+grep -v '^ioctl([012],' < "$LOG" > "$OUT"
+match_diff "$OUT" "$EXP"
+
+rm -f "$EXP" "$OUT"
+
+exit 0
--
2.7.1
More information about the Strace-devel
mailing list