strace/tests/btrfs-wX.test
Eugene Syromyatnikov 321f9be806 tests: add btrfs tests with verbose xlat decoding
* tests/btrfs-X.test: New test.
* tests/btrfs-vX.test: Likewise.
* tests/btrfs-vwX.test: Likewise.
* tests/btrfs-wX.test: Likewise.
* tests/Makefile.am (DECODER_TESTS): Add them.
* tests/btrfs.c (verbose_xlat): New static variable.
(prfl_btrfs, prxval_btrfs): New function.
(btrfs_print_qgroup_inherit, btrfs_print_vol_args_v2,
btrfs_print_balance_args, btrfs_test_balance_ioctls,
btrfs_test_clone_ioctls, btrfs_test_defrag_ioctls,
btrfs_test_space_info_ioctl, btrfs_print_defrag_range_args,
btrfs_test_scrub_ioctls, btrfs_test_ino_path_ioctls,
btrfs_test_send_ioctl, btrfs_test_send_ioctl,
btrfs_test_quota_ctl_ioctl, btrfs_test_get_dev_stats_ioctl,
btrfs_test_get_dev_stats_ioctl, btrfs_test_dev_replace_ioctl,
btrfs_test_dev_replace_ioctl, btrfs_print_features): Use prfl_btrfs and
prxval_btrfs instead of printflags and printxval, respectively.
(btrfs_test_balance_ioctls, btrfs_test_ino_path_ioctls,
btrfs_test_quota_ctl_ioctl, btrfs_test_dev_replace_ioctl,
btrfs_test_dev_replace_ioctl): Update expected output based on
verbose_xlat setting.
(btrfs_print_defrag_range_args): Add compress_type_known arg, pass it
to prxval_btrfs.
(main): Handle -X option.
2018-04-20 12:39:05 +00:00

26 lines
665 B
Bash
Executable File

#!/bin/sh
# Check verbose xlat 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-wX"
# 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
check_prog grep
run_prog ../btrfs -w -X "${BTRFS_MOUNTPOINT}" > /dev/null
run_strace -a16 -Xverbose -eioctl $args > "$EXP"
grep -v '^ioctl([012],' < "$LOG" > "$OUT"
match_diff "$OUT" "$EXP"