summaryrefslogtreecommitdiff
path: root/automated
diff options
context:
space:
mode:
authorChase Qi <chase.qi@linaro.org>2017-01-11 20:45:33 +0800
committerMilosz Wasilewski <milosz.wasilewski@linaro.org>2017-01-18 19:46:23 +0000
commit23ad91c26ed53722bcaca30c995955f91ada6bde (patch)
treec5d323154c99faf732a8c2002b1ea0f74a967b35 /automated
parent54b2e3a1d945e04852d1182c450a19814a60b057 (diff)
downloadtest-definitions-pipe-23ad91c26ed53722bcaca30c995955f91ada6bde.tar.gz
automated: linux: add unixbench test
Change-Id: I5d887f97943b92ab84baa315b745bbaf63eee2b3 Signed-off-by: Chase Qi <chase.qi@linaro.org>
Diffstat (limited to 'automated')
-rwxr-xr-xautomated/linux/unixbench/unixbench.sh60
-rw-r--r--automated/linux/unixbench/unixbench.yaml33
2 files changed, 93 insertions, 0 deletions
diff --git a/automated/linux/unixbench/unixbench.sh b/automated/linux/unixbench/unixbench.sh
new file mode 100755
index 0000000..e81aa52
--- /dev/null
+++ b/automated/linux/unixbench/unixbench.sh
@@ -0,0 +1,60 @@
+#!/bin/sh -e
+
+# The purpose of UnixBench is to provide a basic indicator of the
+# performance of a Unix-like system
+
+# shellcheck disable=SC1091
+. ../../lib/sh-test-lib
+
+OUTPUT="$(pwd)/output"
+RESULT_FILE="${OUTPUT}/result.txt"
+
+while getopts 's:h' opt; do
+ case "${opt}" in
+ s) SKIP_INSTALL="${OPTARG}" ;;
+ h|*) echo "Usage: $0 [-s <true|false>]" && exit 1 ;;
+ esac
+done
+
+! check_root && error_msg "Please run this script as root."
+[ -d "${OUTPUT}" ] && mv "${OUTPUT}" "${OUTPUT}_$(date +%Y%m%d%H%M%S)"
+mkdir -p "${OUTPUT}"
+cd "${OUTPUT}"
+
+install_deps "git gcc perl" "${SKIP_INSTALL}"
+# We need the recent fixes in master branch. Once they are included in the next
+# release, we can switch to release version.
+git clone https://github.com/kdlucas/byte-unixbench
+cd "byte-unixbench/UnixBench/"
+# -march=native and -mtune=native are not included in Linaro ARM toolchian
+# that older than v6. Comment they out here.
+cp Makefile Makefile.bak
+sed -i 's/OPTON += -march=native -mtune=native/#OPTON += -march=native -mtune=native/' Makefile
+
+log_parser() {
+ prefix="$1"
+ logfile="$2"
+
+ # Test Result.
+ egrep "[0-9.]+ [a-zA-Z]+ +\([0-9.]+ s," "${logfile}" \
+ | awk -v prefix="${prefix}" '{printf(prefix)};{for (i=1;i<=(NF-6);i++) printf("-%s",$i)};{printf(" pass %s %s\n"),$(NF-5),$(NF-4)}' \
+ | tee -a "${RESULT_FILE}"
+
+ # Index Values.
+ egrep "[0-9]+\.[0-9] +[0-9]+\.[0-9] +[0-9]+\.[0-9]" "${logfile}" \
+ | awk -v prefix="${prefix}" '{printf(prefix)};{for (i=1;i<=(NF-3);i++) printf("-%s",$i)};{printf(" pass %s index\n"),$NF}' \
+ | tee -a "${RESULT_FILE}"
+
+ ms=$(grep "System Benchmarks Index Score" "${logfile}" | awk '{print $NF}')
+ add_metric "${prefix}-System-Benchmarks-Index-Score" "pass" "${ms}" "index"
+}
+
+# Run a single copy.
+./Run -c "1" | tee "${OUTPUT}/unixbench-single.txt"
+log_parser "single" "${OUTPUT}/unixbench-single.txt"
+
+# Run the number of CPUs copies.
+if [ "$(nproc)" -gt 1 ]; then
+ ./Run -c "$(nproc)" | tee "${OUTPUT}/unixbench-multiple.txt"
+ log_parser "multiple" "${OUTPUT}/unixbench-single.txt"
+fi
diff --git a/automated/linux/unixbench/unixbench.yaml b/automated/linux/unixbench/unixbench.yaml
new file mode 100644
index 0000000..a5acdd4
--- /dev/null
+++ b/automated/linux/unixbench/unixbench.yaml
@@ -0,0 +1,33 @@
+metadata:
+ name: unixbench
+ format: "Lava-Test-Shell Test Definition 1.0"
+ description: "The purpose of UnixBench is to provide a basic
+ indicator of the performance of a Unix-like system."
+ maintainer:
+ - chase.qi@linaro.org
+ os:
+ - debian
+ - ubuntu
+ - fedora
+ - centos
+ scope:
+ - performance
+ environment:
+ - lava-test-shell
+ devices:
+ - hi6220-hikey
+ - apq8016-sbc
+ - mustang
+ - moonshot
+ - thunderX
+ - d03
+ - d05
+
+params:
+ SKIP_INSTALL: "false"
+
+run:
+ steps:
+ - cd ./automated/linux/unixbench/
+ - ./unixbench.sh -s "${SKIP_INSTALL}"
+ - ../../utils/send-to-lava.sh ./output/result.txt