diff options
author | Georgi Djakov <georgi.djakov@linaro.org> | 2019-12-19 17:22:56 +0200 |
---|---|---|
committer | Georgi Djakov <georgi.djakov@linaro.org> | 2019-12-19 17:22:56 +0200 |
commit | 7d0db43dcc7287818d233bb984d21c212e4755bb (patch) | |
tree | 73941b5e167d019606866bf8304fcd773561ccca | |
parent | e8c5acd0fc0edbf2a8ff24e08aba1eb16fd12f65 (diff) |
automated: Import lisa post processing stuff
Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
-rw-r--r-- | automated/linux/aep-pre-post/lisa-postprocessing.yaml | 31 | ||||
-rwxr-xr-x | automated/linux/aep-pre-post/lisa.sh | 59 | ||||
-rw-r--r-- | automated/linux/aep-pre-post/postprocess_lisa_results.py | 50 |
3 files changed, 140 insertions, 0 deletions
diff --git a/automated/linux/aep-pre-post/lisa-postprocessing.yaml b/automated/linux/aep-pre-post/lisa-postprocessing.yaml new file mode 100644 index 0000000..86c5cde --- /dev/null +++ b/automated/linux/aep-pre-post/lisa-postprocessing.yaml @@ -0,0 +1,31 @@ +metadata: + format: Lava-Test Test Definition 1.0 + name: lisa-postprocessing + description: "Post-processing of results generated by + Workload Automation v3." + maintainer: + - lisa.nguyen@linaro.org + - milosz.wasilewski@linaro.org + os: + - ubuntu + devices: + - hi6220-hikey + - hi960-hikey + - juno + - dragonboard-410c + - dragonboard-845c + +params: + LISA_REPOSITORY: https://github.com/ARM-software/lisa + LISA_REF: master + # LISA_SCRIPT is a path relative to LISA top directory + LISA_SCRIPT: ipynb/wltests/sched-evaluation-full.py + SKIP_INSTALL: false + +run: + steps: + - cd ./automated/linux/aep-pre-post + - export LISA_SHELL_DISABLE_COLORS=true + - export TERM=xterm + - ./lisa.sh -r "${LISA_REPOSITORY}" -t "${LISA_REF}" -s "${LISA_SCRIPT}" -S "${SKIP_INSTALL}" + - ../../utils/send-to-lava.sh ./output/result.txt diff --git a/automated/linux/aep-pre-post/lisa.sh b/automated/linux/aep-pre-post/lisa.sh new file mode 100755 index 0000000..961a10d --- /dev/null +++ b/automated/linux/aep-pre-post/lisa.sh @@ -0,0 +1,59 @@ +#!/bin/bash -ex +# shellcheck disable=SC1090 + +TEST_DIR=$(dirname "$(realpath "$0")") +OUTPUT="${TEST_DIR}/output" +SKIP_INSTALL="false" +LISA_REPOSITORY="https://github.com/ARM-software/lisa" +LISA_REF="master" +LISA_SCRIPT="ipynb/wltests/sched-evaluation-full.py" + +usage() { + echo "Usage: $0 [-t <lisa_repository_ref>] [-r <lisa_repository>] [-s <lisa_script>] [-S <skip_install>]" 1>&2 + exit 1 +} + +while getopts ":t:r:s:S:" opt; do + case "${opt}" in + t) LISA_REF="${OPTARG}" ;; + r) LISA_REPOSITORY="${OPTARG}" ;; + s) LISA_SCRIPT="${OPTARG}" ;; + S) SKIP_INSTALL="${OPTARG}" ;; + *) usage ;; + esac +done + +. "${TEST_DIR}/../../lib/sh-test-lib" + +! check_root && error_msg "Please run this test as root." +cd "${TEST_DIR}" +create_out_dir "${OUTPUT}" +RESULT_FILE="${OUTPUT}/result.txt" +export RESULT_FILE + +if [ "${SKIP_INSTALL}" = "true" ] || [ "${SKIP_INSTALL}" = "True" ]; then + info_msg "Dependency and python2 venv installation skipped" + test -d .venv || error_msg "python2 venv for LISA is required, but not found!" + . .venv/bin/activate +else + PKGS="virtualenv build-essential autoconf automake libtool pkg-config trace-cmd sshpass kernelshark nmap net-tools tree libfreetype6-dev libpng12-dev python-pip python-dev python-tk" + install_deps "${PKGS}" + virtualenv --python=python2 .venv + . .venv/bin/activate + pip install --quiet matplotlib numpy nose Cython trappy bart-py devlib psutil wrapt scipy IPython + git clone "${LISA_REPOSITORY}" lisa + ( + cd lisa + git checkout "${LISA_REF}" + ) +fi +# TODO: check if lisa directory exists +cd lisa +. init_env +lisa-update submodules +python "${LISA_SCRIPT}" +ls +for FILE in *.csv +do + python "${TEST_DIR}/postprocess_lisa_results.py" -f "${FILE}" -o "${RESULT_FILE}" +done diff --git a/automated/linux/aep-pre-post/postprocess_lisa_results.py b/automated/linux/aep-pre-post/postprocess_lisa_results.py new file mode 100644 index 0000000..a313c5c --- /dev/null +++ b/automated/linux/aep-pre-post/postprocess_lisa_results.py @@ -0,0 +1,50 @@ +import argparse +import csv + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("-f", + "--file", + help="CSV file for postprocessing", + dest="source_filename") + parser.add_argument("-o", + "--output-file", + help="Results file", + dest="results_filename") + args = parser.parse_args() + + row_index = 0 + headers = [] + measurements = {} + with open(args.source_filename, "r") as f: + reader = csv.reader(f) + for row in reader: + if row_index == 0: + headers = row + elif row_index > 0 and row_index <= 2: + item_index = 0 + for item in row: + if len(item) > 0: + headers[item_index] = headers[item_index] + "_" + item + item_index = item_index + 1 + else: + # concatenate first 2 cells + # 3rd cell contains git commit which changes often + name = row[0] + "_" + row[1] + # start from column 4 (indexed from 0) + item_index = 3 + for item in row[item_index:]: + if item != "": + measurement_name = name + "_" + headers[item_index] + measurements.update({measurement_name: item}) + item_index = item_index + 1 + row_index = row_index + 1 + with open(args.results_filename, "a") as results: + for key, value in measurements.items(): + # key is test name + # value is measurement to be recorded + results.write("%s pass %s _\r\n" % (key, value)) + +if __name__ == "__main__": + main() |