#!/bin/bash require-lib bcache-test-libs.sh require-kernel-config DYNAMIC_FAULT config-cache 2G config-tier 4G config-bucket-size 32k config-block-size 4k config-timeout 300 config-volume 1600M main() { setup_tracing 'bcache:*' if [ $NR_REBOOTS = 0 ]; then setup_bcache echo readonly > /sys/fs/bcache/*/errors setup_fs ext4 test_antagonist test_dbench & test_bonnie & sleep 10 do_reboot else for id in {0..99}; do control=/sys/kernel/debug/dynamic_fault/control fault=cache_set_init_$id grep -q $fault $control || exit 0 echo "TESTING FAULT $id" echo "func $fault +f" > $control echo /dev/sdb > /sys/fs/bcache/register || true echo /dev/sdc > /sys/fs/bcache/register || true sleep 2 echo "func $fault -f" > $control sleep 2 if test -e /sys/fs/bcache/*-*-*-*-*; then echo "Registration should have failed" false fi done fi }