From 893f33a90e3aec1c31024adf14ee49817821cdc9 Mon Sep 17 00:00:00 2001 From: CyberLeo Date: Sat, 30 Mar 2013 18:34:28 -0500 Subject: [PATCH] Add zpool handling --- bench | 13 +++++++++++++ tests/zpool-0 | 7 +------ tests/zpool-mirror-01 | 7 +------ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/bench b/bench index b4c7760..135c6e3 100755 --- a/bench +++ b/bench @@ -17,10 +17,23 @@ logs="${_root}/log" [ -d "${logs}" ] || mkdir -p "${logs}" run_log="${logs}/bench-$(date +%Y-%m-%d_%H:%M:%S).log" +# Zpool handling +zpool_name="test" +zpool_create() { + echo zpool create -O mountpoint="${scratch}" "${zpool_name}" "${@}" + zpool create -O mountpoint="${scratch}" "${zpool_name}" "${@}" || wtf "Couldn't create zpool!" + zpool status + zpool list +} +zpool_destroy() { + zpool list -Ho name | grep -q "^${zpool_name}$" && zpool destroy "${zpool_name}" +} + # Scratch directory maintenance scratch="/bonnie" clean_scratch() { [ -d "${scratch}" ] || mkdir -p "${scratch}" + zpool_destroy mount | grep -q ' on '"${scratch}"' ' && umount "${scratch}" || true find "${scratch}" ${bonnie_uid:+-uid "${bonnie_uid}"} -xdev -delete } diff --git a/tests/zpool-0 b/tests/zpool-0 index 6e50bb1..fd700d0 100644 --- a/tests/zpool-0 +++ b/tests/zpool-0 @@ -1,9 +1,4 @@ vdevs="/dev/label/zp/test/[${test##*zpool-}]" setup() { - zpool create -O mountpoint="${scratch}" test ${vdevs} - zpool status -} -teardown() { - zpool destroy test - clean_scratch + zpool_create ${vdevs} } diff --git a/tests/zpool-mirror-01 b/tests/zpool-mirror-01 index b13bb7d..e21832f 100644 --- a/tests/zpool-mirror-01 +++ b/tests/zpool-mirror-01 @@ -1,9 +1,4 @@ vdevs="/dev/label/zp/test/[${test##*zpool-mirror-}]" setup() { - zpool create -O mountpoint="${scratch}" test mirror ${vdevs} - zpool status -} -teardown() { - zpool destroy test - clean_scratch + zpool_create mirror ${vdevs} } -- 2.42.0