From 23ad91c26ed53722bcaca30c995955f91ada6bde Mon Sep 17 00:00:00 2001 From: Chase Qi Date: Wed, 11 Jan 2017 20:45:33 +0800 Subject: automated: linux: add unixbench test Change-Id: I5d887f97943b92ab84baa315b745bbaf63eee2b3 Signed-off-by: Chase Qi --- automated/linux/unixbench/unixbench.sh | 60 ++++++++++++++++++++++++++++++++ automated/linux/unixbench/unixbench.yaml | 33 ++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100755 automated/linux/unixbench/unixbench.sh create mode 100644 automated/linux/unixbench/unixbench.yaml (limited to 'automated') 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 ]" && 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 -- cgit v1.2.3