diff options
author | Yongqin Liu <yongqin.liu@linaro.org> | 2018-05-17 19:31:52 +0800 |
---|---|---|
committer | Yongqin Liu <yongqin.liu@linaro.org> | 2018-05-17 19:31:52 +0800 |
commit | 50e0b935cd3c2f51e78d619549123e42fb52b8fc (patch) | |
tree | 7b6aa3d6db0b127d4a0aae516849d0a6526a3bd6 /automated/linux/iozone/iozone.sh | |
parent | efa089e9435eacf202eeffe76b008e8e687585da (diff) |
update with upstream
Change-Id: I62ba6c882a8eb5044c677daf54174f52057c46da
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
Diffstat (limited to 'automated/linux/iozone/iozone.sh')
-rwxr-xr-x | automated/linux/iozone/iozone.sh | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/automated/linux/iozone/iozone.sh b/automated/linux/iozone/iozone.sh new file mode 100755 index 0000000..6c9c005 --- /dev/null +++ b/automated/linux/iozone/iozone.sh @@ -0,0 +1,62 @@ +#!/bin/sh -ex +# shellcheck disable=SC1090 +# shellcheck disable=SC2154 + +TEST_DIR=$(dirname "$(realpath "$0")") +OUTPUT="${TEST_DIR}/output" +LOGFILE="${OUTPUT}/iozone-stdout.txt" +RESULT_FILE="${OUTPUT}/result.txt" + +SKIP_INSTALL="false" +VERSION="3_458" + +usage() { + echo "Usage: $0 [-s <skip_install>] [-v <version>]" 1>&2 + exit 1 +} + +while getopts "s:v:h" opt; do + case "$opt" in + s) SKIP_INSTALL="${OPTARG}" ;; + v) VERSION="${OPTARG}" ;; + *) usage ;; + esac +done + +. "${TEST_DIR}/../../lib/sh-test-lib" +create_out_dir "${OUTPUT}" +cd "${OUTPUT}" + +if [ "$SKIP_INSTALL" = 'true' ] || [ "$SKIP_INSTALL" = 'True' ]; then + warn_msg "Dependencies and iozone installation skipped!" +else + install_deps "wget gcc make" + # Download, compile and install iozone. + wget "http://www.iozone.org/src/stable/iozone${VERSION}.tar" + tar xf "iozone${VERSION}.tar" + cd "iozone${VERSION}/src/current" + detect_abi + case "$abi" in + armeabi|arm64) make linux-arm ;; + x86_64) make linux ;; + *) warn_msg "Unsupported architecture" ;; + esac + export PATH=$PWD:$PATH +fi + +which iozone || error_msg "'iozone' not found, exiting..." +# -a: Auto mode +# -I: Use VxFS VX_DIRECT, O_DIRECT,or O_DIRECTIO for all file operations +iozone -a -I | tee "$LOGFILE" + +# Parse iozone stdout. +field_number=3 +for test in "write" "rewrite" "read" "reread" "random-read" "random-write" "bkwd-read" \ + "record-rewrite" "stride-read" "fwrite" "frewrite" "fread" "freread"; do + awk "/kB reclen/{flag=1; next} /iozone test complete/{flag=0} flag" "$LOGFILE" \ + | sed '/^$/d' \ + | awk -v tc="$test" -v field_number="$field_number" \ + '{printf("%s-%skB-%sreclen pass %s kBytes/sec\n",tc,$1,$2,$field_number)}' \ + | tee -a "$RESULT_FILE" + field_number=$(( field_number + 1 )) +done |