3 _root="$(dirname "${0}")"; . "${_root}/lib/sh/env.sh"
6 [ "$(hostname -s)" = "nabihinew" ] || wtf "Run this on nabihinew only!"
12 # Environment and needed stuff
13 tests="${_root}/tests"
17 [ -d "${logs}" ] || mkdir -p "${logs}"
18 run_log="${logs}/bench-$(date +%Y-%m-%d_%H:%M:%S).log"
23 echo zpool create -O mountpoint="${scratch}" "${zpool_name}" "${@}"
24 zpool create -O mountpoint="${scratch}" "${zpool_name}" "${@}" || wtf "Couldn't create zpool!"
29 zpool list -Ho name | grep -q "^${zpool_name}$" && zpool destroy "${zpool_name}"
32 # Scratch directory maintenance
35 [ -d "${scratch}" ] || mkdir -p "${scratch}"
37 mount | grep -q ' on '"${scratch}"' ' && umount "${scratch}" || true
38 find "${scratch}" ${bonnie_uid:+-uid "${bonnie_uid}"} -xdev -delete
44 bonnie_opts="-q -d /bonnie -u ${bonnie_uid} -s 12288 -n 16:16384:0 -f 0"
45 bonnie_log="${logs}/bonnie-%s-$(date +%Y-%m-%d_%H:%M:%S).csv"
47 chown "${bonnie_uid}" "${scratch}"
48 /usr/local/sbin/bonnie++ ${bonnie_opts} -m "${test}" >> "$(printf "${bonnie_log}" "${test}")"
65 log "Considering tests: $(cd "${tests}"; echo *)" | tee -a "${run_log}"
66 script -a "${run_log}" sh -c "( cd '${tests}'; ls -1 ) | xargs -L1 '${0}'"
69 testfile="${tests}/${test}"
70 [ -f "${testfile}" ] || wtf "Test '${test}' does not exist"
71 ( log "Preparing test: ${test}"
75 trap "teardown" EXIT HUP INT TERM KILL
76 log "$(stopwatch run start)"
78 log "$(stopwatch run stop) Test result ${result}"
79 trap - EXIT HUP INT TERM KILL