Milosz Wasilewski | da7e542 | 2018-05-08 11:38:25 +0100 | [diff] [blame] | 1 | #!/bin/bash -ex |
| 2 | # shellcheck disable=SC1090 |
| 3 | |
| 4 | TEST_DIR=$(dirname "$(realpath "$0")") |
| 5 | OUTPUT="${TEST_DIR}/output" |
| 6 | SKIP_INSTALL="false" |
| 7 | LISA_REPOSITORY="https://github.com/ARM-software/lisa" |
| 8 | LISA_REF="master" |
| 9 | LISA_SCRIPT="ipynb/wltests/sched-evaluation-full.py" |
| 10 | |
| 11 | usage() { |
| 12 | echo "Usage: $0 [-t <lisa_repository_ref>] [-r <lisa_repository>] [-s <lisa_script>] [-S <skip_install>]" 1>&2 |
| 13 | exit 1 |
| 14 | } |
| 15 | |
| 16 | while getopts ":t:r:s:S:" opt; do |
| 17 | case "${opt}" in |
| 18 | t) LISA_REF="${OPTARG}" ;; |
| 19 | r) LISA_REPOSITORY="${OPTARG}" ;; |
| 20 | s) LISA_SCRIPT="${OPTARG}" ;; |
| 21 | S) SKIP_INSTALL="${OPTARG}" ;; |
| 22 | *) usage ;; |
| 23 | esac |
| 24 | done |
| 25 | |
| 26 | . "${TEST_DIR}/../../lib/sh-test-lib" |
| 27 | |
| 28 | ! check_root && error_msg "Please run this test as root." |
| 29 | cd "${TEST_DIR}" |
| 30 | create_out_dir "${OUTPUT}" |
| 31 | RESULT_FILE="${OUTPUT}/result.txt" |
| 32 | export RESULT_FILE |
| 33 | |
| 34 | if [ "${SKIP_INSTALL}" = "true" ] || [ "${SKIP_INSTALL}" = "True" ]; then |
Chase Qi | 2d6d836 | 2018-07-24 11:47:17 +0800 | [diff] [blame] | 35 | info_msg "Dependency and python2 venv installation skipped" |
| 36 | test -d .venv || error_msg "python2 venv for LISA is required, but not found!" |
| 37 | . .venv/bin/activate |
Milosz Wasilewski | da7e542 | 2018-05-08 11:38:25 +0100 | [diff] [blame] | 38 | else |
Chase Qi | 2d6d836 | 2018-07-24 11:47:17 +0800 | [diff] [blame] | 39 | 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" |
Milosz Wasilewski | da7e542 | 2018-05-08 11:38:25 +0100 | [diff] [blame] | 40 | install_deps "${PKGS}" |
Chase Qi | 2d6d836 | 2018-07-24 11:47:17 +0800 | [diff] [blame] | 41 | virtualenv --python=python2 .venv |
| 42 | . .venv/bin/activate |
| 43 | pip install --quiet matplotlib numpy nose Cython trappy bart-py devlib psutil wrapt scipy IPython |
Milosz Wasilewski | da7e542 | 2018-05-08 11:38:25 +0100 | [diff] [blame] | 44 | git clone "${LISA_REPOSITORY}" lisa |
| 45 | ( |
| 46 | cd lisa |
| 47 | git checkout "${LISA_REF}" |
| 48 | ) |
| 49 | fi |
| 50 | # TODO: check if lisa directory exists |
| 51 | cd lisa |
| 52 | . init_env |
| 53 | lisa-update submodules |
| 54 | python "${LISA_SCRIPT}" |
| 55 | ls |
| 56 | for FILE in *.csv |
| 57 | do |
| 58 | python "${TEST_DIR}/postprocess_lisa_results.py" -f "${FILE}" -o "${RESULT_FILE}" |
| 59 | done |