blob: a09e750e270721f21a980e0fd8979da6301ee522 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#!/bin/sh -e
. ../../lib/sh-test-lib
OUTPUT="$(pwd)/output"
RESULT_FILE="${OUTPUT}/result.txt"
LOG_FILE="${OUTPUT}/blogbench.txt"
ITERATION="30"
PARTITION=""
usage() {
echo "Usage: $0 [-i <iterations>] [-p </dev/sda1>]" 1>&2
exit 1
}
while getopts "i:p:h" o; do
case "$o" in
i) ITERATION="${OPTARG}" ;;
p) PARTITION="${OPTARG}" ;;
h|*) usage ;;
esac
done
! check_root && error_msg "You need to be root to run this script."
create_out_dir "${OUTPUT}"
# Set the directory for blogbench test.
if [ -n "${PARTITION}" ]; then
if mount | grep -q "${PARTITION}"; then
mount "${PARTITION}" /mnt
cd /mnt/
else
mount_point=$(mount | grep "${PARTITION}" | awk '{print $3}')
cd "${mount_point}"
fi
fi
mkdir ./bench
# Run blogbench test.
detect_abi
# shellcheck disable=SC2154
./bin/"${abi}"/blogbench -i "${ITERATION}" -d ./bench 2>&1 | tee "${LOG_FILE}"
# Parse test result.
for i in writes reads; do
grep "Final score for $i" "${LOG_FILE}" \
| awk -v i="$i" '{printf("blogbench-%s pass %s blogs\n", i, $NF)}' \
| tee -a "${RESULT_FILE}"
done
rm -rf ./bench
|