diff options
Diffstat (limited to 'automated/linux')
24 files changed, 1276 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..8dbc108 --- /dev/null +++ b/automated/linux/aep-pre-post/lisa-postprocessing.yaml @@ -0,0 +1,29 @@ +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 + +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..a592ec1 --- /dev/null +++ b/automated/linux/aep-pre-post/lisa.sh @@ -0,0 +1,57 @@ +#!/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 installation skipped" +else + PKGS="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}" + pip install --upgrade --quiet pip && hash -r + pip install --upgrade --quiet setuptools + pip install --upgrade --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..c0426c5 --- /dev/null +++ b/automated/linux/aep-pre-post/postprocess_lisa_results.py @@ -0,0 +1,48 @@ +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, "rb") 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 3 cells + name = row[0] + "_" + row[1] + "_" + row[2] + 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() diff --git a/automated/linux/badblocks/badblocks.sh b/automated/linux/badblocks/badblocks.sh new file mode 100755 index 0000000..0698df1 --- /dev/null +++ b/automated/linux/badblocks/badblocks.sh @@ -0,0 +1,53 @@ +#!/bin/sh + +# shellcheck disable=SC1091 +. ../../lib/sh-test-lib +OUTPUT="$(pwd)/output" +RESULT_FILE="${OUTPUT}/result.txt" +export RESULT_FILE +TEST_SUITE="badblocks" +BLOCK_DEVICE="default" + +usage() { + echo "Usage: $0 [-b <block device>] [-p <badblocks params>] [-s <skip install: true|false]" 1>&2 + exit 1 +} + +while getopts "b:h:p:s:" o; do + case "$o" in + b) BLOCK_DEVICE="${OPTARG}" ;; + p) BADBLOCKS_PARAMS="${OPTARG}" ;; + s) SKIP_INSTALL="${OPTARG}" ;; + h|*) usage ;; + esac +done + +install() { + dist_name + # shellcheck disable=SC2154 + case "${dist}" in + debian|ubuntu) install_deps "e2fsprogs" "${SKIP_INSTALL}";; + unknown) warn_msg "Unsupported distro: package install skipped" ;; + esac +} + +if [ "${BLOCK_DEVICE}" = "default" ]; then + BLOCK_DEVICE=$(mount | grep "on \/ type" | cut -d' ' -f 1) +fi + +create_out_dir "${OUTPUT}" +install + +command -v badblocks +exit_on_fail "badblocks-existence-check" + +if [ ! -z "${BLOCK_DEVICE}" ] && [ -e "${BLOCK_DEVICE}" ]; then + info_msg "Running ${TEST_SUITE} test on ${BLOCK_DEVICE}" + LOG_FILE="${OUTPUT}/${TEST_SUITE}-output.txt" + test_cmd="badblocks -v ${BADBLOCKS_PARAMS} ${BLOCK_DEVICE} 2>&1" + pipe0_status "${test_cmd}" "tee ${LOG_FILE}" + check_return "${TEST_SUITE}" +else + info_msg "Skipping ${TEST_SUITE} test on ${BLOCK_DEVICE}" + echo "${TEST_SUITE} skip" | tee -a "${RESULT_FILE}" +fi diff --git a/automated/linux/badblocks/badblocks.yaml b/automated/linux/badblocks/badblocks.yaml new file mode 100644 index 0000000..99eec2f --- /dev/null +++ b/automated/linux/badblocks/badblocks.yaml @@ -0,0 +1,25 @@ +metadata: + name: badblocks + format: "Lava-Test-Shell Test Definition 1.0" + description: "Run a read-only test for bad blocks" + maintainer: + - ryan.harkin@linaro.org + os: + - openembedded + - debian + scope: + - functional + devices: + - imx7s-warp + - sun8i-h2-plus-bananapi-m2-zero + +parameters: + BLOCK_DEVICE: 'default' + BADBLOCKS_PARAMS: '' + SKIP_INSTALL: "False" + +run: + steps: + - cd ./automated/linux/badblocks/ + - ./badblocks.sh -b "${BLOCK_DEVICE}" -p "${BADBLOCKS_PARAMS}" -s "${SKIP_INSTALL}" + - ../../utils/send-to-lava.sh ./output/result.txt diff --git a/automated/linux/gst-validate/README b/automated/linux/gst-validate/README new file mode 100644 index 0000000..78941d2 --- /dev/null +++ b/automated/linux/gst-validate/README @@ -0,0 +1,17 @@ +The gst-validate-launcher uses a set of test cases and media files, the gstreamer +team provides gst-integration-testsuites [1] but you could provide your own. + +To get gst-integration-testsuites uses git-annex to get media: + +$ git clone git://anongit.freedesktop.org/gstreamer/gst-integration-testsuites +$ cd gst-integration-testsuites +$ git checkout 1.12 +$ git annex get + +The gst-integration-testsuites needs to be pre-populated into the rootfs inside +/gst-validate folder, + +$ mkdir /ROOTFS_PATH/gst-validate +$ cp -rf gst-integration-testsuites /ROOTFS_PATH/gst-validate + +[1] https://cgit.freedesktop.org/gstreamer/gst-integration-testsuites diff --git a/automated/linux/gst-validate/gst-validate.yaml b/automated/linux/gst-validate/gst-validate.yaml new file mode 100644 index 0000000..75dfe77 --- /dev/null +++ b/automated/linux/gst-validate/gst-validate.yaml @@ -0,0 +1,47 @@ +metadata: + format: Lava-Test Test Definition 1.0 + name: gst-validate + description: "A suite of tools to run integration tests for Gstreamer, + For more information: https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-validate/html/" + maintainer: + - anibal.limon@linaro.org + os: + - openembedded + scope: + - functional + devices: + - dragonboard410c + +# MAIN_DIR: +# * Directory where gst-validate will run, needs to contain gst-integration-testsuites, +# https://cgit.freedesktop.org/gstreamer/gst-integration-testsuites +# OPTIONS: +# * -nd: To execute without display attached required Xvfb +# * -v: Verbose mode +# * -j: To execute only one job a time, avoid OOM +# GST_INTEGRATION_SUITES: +# * URL with the tarball of Gstreamer integration suites (cases, media), +# https://github.com/GStreamer/gst-integration-testsuites +params: + MAIN_DIR: "/gst-validate" + OPTIONS: "-nd -v -j 1" + GST_INTEGRATION_SUITES: "http://testdata.validation.linaro.org/gst-validate/gst-integration-testsuites_1.12.tar.gz" + GST_IGNORE_TESTS_REPO: "" + GST_IGNORE_TESTS_BRANCH: "master" + GST_IGNORE_TESTS_FILE: "" + +run: + steps: + - . ./automated/lib/sh-test-lib + - cd ./automated/linux/gst-validate + - wget ${GST_INTEGRATION_SUITES} + - tar -xzf $(basename ${GST_INTEGRATION_SUITES}) -C / + - IGNORE_FILE="" + - if [ ! -z "${GST_IGNORE_TESTS_REPO}" ] && [ ! -z "${GST_IGNORE_TESTS_FILE}" ]; then + - repo_path=${PWD}/$(basename ${GST_IGNORE_TESTS_REPO}) + - git clone -b ${GST_IGNORE_TESTS_BRANCH} ${GST_IGNORE_TESTS_REPO} $repo_path + - IGNORE_FILE=${repo_path}/${GST_IGNORE_TESTS_FILE} + - fi + - gst-validate-launcher -M ${MAIN_DIR} ${OPTIONS} > ./gst-validate-raw.log || true + - ./gst_validate_lava_parse.py ./gst-validate-raw.log ${IGNORE_FILE} > ./result.txt + - ../../utils/send-to-lava.sh ./result.txt diff --git a/automated/linux/gst-validate/gst_validate_lava_parse.py b/automated/linux/gst-validate/gst_validate_lava_parse.py new file mode 100755 index 0000000..8845fe6 --- /dev/null +++ b/automated/linux/gst-validate/gst_validate_lava_parse.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 + +# LAVA/OE gst-validate results parse script +# +# Copyright (C) 2018, Linaro Limited. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Author: Aníbal Limón <anibal.limon@linaro.org> +# + +import json +import os +import re +import sys + + +def map_result_to_lava(result): + if result == 'Passed': + result = 'pass' + elif result == 'Failed': + result = 'fail' + elif result == 'Skipped': + result = 'skip' + elif result == 'Timeout': + result = 'fail' + + return result + + +if __name__ == '__main__': + if len(sys.argv) < 2: + print("Usage: %s <result_file> [ignore_file]" % sys.argv[0]) + sys.exit(1) + + ignore_tests = [] + if len(sys.argv) == 3: + with open(sys.argv[2], 'r') as f: + ignore_tests = f.read().split() + + rex = re.compile('^(?P<test_case_id>validate\..*):\s+(?P<result>(Failed|Passed|Skipped|Timeout))') + with open(sys.argv[1], 'r') as f: + for line in f.readlines(): + s = rex.search(line) + if s: + test_case_id = s.group('test_case_id') + result = s.group('result') + + if test_case_id not in ignore_tests: + print("%s %s" % (test_case_id, map_result_to_lava(result))) diff --git a/automated/linux/hci-smoke/hci-smoke-test.sh b/automated/linux/hci-smoke/hci-smoke-test.sh new file mode 100755 index 0000000..454d4fa --- /dev/null +++ b/automated/linux/hci-smoke/hci-smoke-test.sh @@ -0,0 +1,107 @@ +#!/bin/sh +# +# HCI smoke tests +# +# Copyright (C) 2017, Linaro Limited. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Author: Nicolas Dechesne <nicolas.dechesne@linaro.org> +# + +# shellcheck disable=SC1091 +. ../../lib/sh-test-lib +OUTPUT="$(pwd)/output" +RESULT_FILE="${OUTPUT}/result.txt" +export RESULT_FILE +DEVICE="hci0" +BOOT="enabled" + +usage() { + echo "Usage: $0 [-b <enabled|disabled>] [-d <device>]" 1>&2 + exit 1 +} + +while getopts "d:b:" o; do + case "$o" in + d) DEVICE="${OPTARG}" ;; + b) BOOT="${OPTARG}" ;; + *) usage ;; + esac +done + +# sanity test hciconfig config +test_hciconfig() { + info_msg "Running hciconfig test..." + hciconfig "${DEVICE}" + exit_on_fail "hciconfig" +} + +# test HCI device is $BOOT at boot +test_hciconfig_boot() { + info_msg "Running hciconfig_boot test..." + + # rely on distro policy for AutoEnable + if [ "${BOOT}" = "auto" ]; then + # get rid of spaces and comments + sed 's/\s\+//g;/^#/d' /etc/bluetooth/main.conf | grep "^AutoEnable=true" + if [ "$?" -eq 0 ]; then + BOOT="enabled" + else + BOOT="disabled" + fi + fi + + if [ "${BOOT}" = "enabled" ]; then + hciconfig "${DEVICE}" | grep "UP RUNNING" + else + hciconfig "${DEVICE}" | grep "DOWN" + fi + check_return "hciconfig-boot-${BOOT}" +} + +# test HCI device is up +test_hciconfig_up() { + info_msg "Running hciconfig-up test..." + hciconfig "${DEVICE}" up + sleep 1 + hciconfig "${DEVICE}" | grep "UP RUNNING" + check_return "hciconfig-up" +} + +test_hciconfig_down() { + info_msg "Running hciconfig-down test..." + hciconfig "${DEVICE}" down + sleep 1 + hciconfig "${DEVICE}" | grep DOWN + check_return "hciconfig-down" +} + +# Test run. +! check_root && error_msg "This script must be run as root" +create_out_dir "${OUTPUT}" + +info_msg "About to run HCI smoke test..." +info_msg "Output directory: ${OUTPUT}" + +# ensure that device is available at boot +test_hciconfig +test_hciconfig_boot +test_hciconfig_down +test_hciconfig_up + + + + diff --git a/automated/linux/hci-smoke/hci-smoke.yaml b/automated/linux/hci-smoke/hci-smoke.yaml new file mode 100644 index 0000000..47716de --- /dev/null +++ b/automated/linux/hci-smoke/hci-smoke.yaml @@ -0,0 +1,26 @@ +metadata: + format: Lava-Test Test Definition 1.0 + name: hci-smoke + description: "Basic HCI smoke tests" + maintainer: + - nicolas.dechesne@linaro.org + os: + - debian + - ubuntu + - centos + - fedora + scope: + - functional + devices: + - dragonboard410c + +params: + DEVICE: hci0 + # expected state on first boot: <enabled> or <disabled> or <auto> + BOOT: enabled + +run: + steps: + - cd ./automated/linux/hci-smoke + - ./hci-smoke-test.sh -d "${DEVICE}" -b "${BOOT}" + - ../../utils/send-to-lava.sh ./output/result.txt 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 diff --git a/automated/linux/iozone/iozone.yaml b/automated/linux/iozone/iozone.yaml new file mode 100644 index 0000000..d03561f --- /dev/null +++ b/automated/linux/iozone/iozone.yaml @@ -0,0 +1,38 @@ +metadata: + name: iozone + format: "Lava-Test-Shell Test Definition 1.0" + description: "IOzone is a filesystem benchmark tool. The benchmark generates and + measures a variety of file operations." + maintainer: + - chase.qi@linaro.org + os: + - ubuntu + - debian + - centos + - fedora + - openembedded + devices: + - d03 + - d05 + - juno + - beaglebone-black + - hi6220-hikey + - apq8016-sbc + - mustang + - moonshot + - thunderX + - x15 + - x86 + + scope: + - performance + +params: + SKIP_INSTALL: "false" + VERSION: "3_458" + +run: + steps: + - cd automated/linux/iozone + - ./iozone.sh -s "${SKIP_INSTALL}" -v "${VERSION}" + - ../../utils/send-to-lava.sh ./output/result.txt diff --git a/automated/linux/memtester/memtester.sh b/automated/linux/memtester/memtester.sh new file mode 100755 index 0000000..54e80a1 --- /dev/null +++ b/automated/linux/memtester/memtester.sh @@ -0,0 +1,63 @@ +#!/bin/sh -e + +# shellcheck disable=SC1091 +. ../../lib/sh-test-lib +OUTPUT="$(pwd)/output" +RESULT_FILE="${OUTPUT}/result.txt" +export RESULT_FILE +MEMORY='1M' +ITERATIONS=1 + +usage() { + echo "Usage: $0 [-s <true|false>] [-m memory] [-i iterations]" 1>&2 + exit 1 +} + +while getopts "s:m:i:h" o; do + case "$o" in + s) SKIP_INSTALL="${OPTARG}" ;; + m) MEMORY="${OPTARG}" ;; + i) ITERATIONS="${OPTARG}" ;; + *) usage ;; + esac +done + +install() { + dist_name + # shellcheck disable=SC2154 + case "${dist}" in + debian|ubuntu) install_deps "memtester" "${SKIP_INSTALL}";; + unknown) warn_msg "Unsupported distro: package install skipped" ;; + esac +} + +parser() { + test_log="$1" + if [ "${ITERATIONS}" -gt 1 ]; then + suffix="-iter$2" + else + suffix="" + fi + + # The follow lines: + # Remove redundant spaces. + # Replace ok with pass. + # Replace spaces in test case name with minus. + # Save test results like 'Stuck-Address pass' to result file. + grep ': ok' "${test_log}" \ + | sed 's/^ *//g; s/ *: ok/:pass/g; s/ /-/g' \ + | awk -v suffix="${suffix}" -F':' '{printf("%s%s %s\n",$1,suffix,$2)}' \ + | tee -a "$RESULT_FILE" +} + +create_out_dir "${OUTPUT}" +install +for i in $(seq "${ITERATIONS}"); do + output="${OUTPUT}/memtester-iter$i.txt" + + memtester "${MEMORY}" 1 \ + | sed 's/:.*ok/: ok/g' \ + | tee "${output}" + + parser "${output}" "$i" +done diff --git a/automated/linux/memtester/memtester.yaml b/automated/linux/memtester/memtester.yaml new file mode 100644 index 0000000..d5407e7 --- /dev/null +++ b/automated/linux/memtester/memtester.yaml @@ -0,0 +1,29 @@ +metadata: + format: "Lava-Test Test Definition 1.0" + name: memtester + description: "Stress test to find memory subsystem faults" + maintainer: + - chase.qi@linaro.org + os: + - debian + - ubuntu + - openembedded + scope: + - functional + - stress + devices: + - hi6220-hikey + - apq8016-sbc + +parameters: + SKIP_INSTALL: "False" + # The amount of memory to allocate and test. + MEMORY: "1M" + # Number of loops to iterate through. + ITERATIONS: 1 + +run: + steps: + - cd ./automated/linux/memtester/ + - ./memtester.sh -s "${SKIP_INSTALL}" -m "${MEMORY}" -i "${ITERATIONS}" + - ../../utils/send-to-lava.sh ./output/result.txt diff --git a/automated/linux/overlayfs/overlayfs.sh b/automated/linux/overlayfs/overlayfs.sh new file mode 100755 index 0000000..d871cbe --- /dev/null +++ b/automated/linux/overlayfs/overlayfs.sh @@ -0,0 +1,48 @@ +#!/bin/sh -ex + +TEST_DIR=$(dirname "$(realpath "$0")") +OUTPUT="${TEST_DIR}/output" +export RESULT_FILE="${OUTPUT}/result.txt" + +# shellcheck disable=SC1090 +. "${TEST_DIR}/../../lib/sh-test-lib" +create_out_dir "${OUTPUT}" +cd "${OUTPUT}" +# PKG install will be skipped on unsupported distro. +install_deps "git" +git clone http://git.linaro.org/qa/unionmount-testsuite.git +cd unionmount-testsuite + +tests="open-plain open-trunc open-creat open-creat-trunc open-creat-excl + open-creat-excl-trunc noent-plain noent-trunc noent-creat + noent-creat-trunc noent-creat-excl noent-creat-excl-trunc sym1-plain + sym1-trunc sym1-creat sym1-creat-excl sym2-plain sym2-trunc sym2-creat + sym2-creat-excl symx-plain symx-trunc symx-creat symx-creat-excl + symx-creat-trunc truncate dir-open dir-weird-open dir-open-dir + dir-weird-open-dir dir-sym1-open dir-sym1-weird-open dir-sym2-open + dir-sym2-weird-open readlink mkdir rmdir hard-link hard-link-dir + hard-link-sym unlink rename-file rename-empty-dir rename-new-dir + rename-pop-dir rename-new-pop-dir rename-move-dir rename-mass + rename-mass-2 rename-mass-3 rename-mass-4 rename-mass-5 rename-mass-dir + rename-mass-sym impermissible" + +if which python3; then + py_cmd="python3" +else + py_cmd="python2" +fi + +for test in ${tests}; do + for term_slash in 0 1; do + if [ "${term_slash}" -eq 1 ]; then + suffix="-termslash" + else + suffix="" + fi + + test_cmd="${py_cmd} ./run --ov --ts=${term_slash} ${test}" + info_msg "Running $test with command: ${test_cmd}" + # run_test_case() usage: run_test_case test_cmd test_case_id + run_test_case "${test_cmd}" "${test}${suffix}" + done +done diff --git a/automated/linux/overlayfs/overlayfs.yaml b/automated/linux/overlayfs/overlayfs.yaml new file mode 100644 index 0000000..f3d8918 --- /dev/null +++ b/automated/linux/overlayfs/overlayfs.yaml @@ -0,0 +1,35 @@ +metadata: + name: overlayfs + format: "Lava-Test-Shell Test Definition 1.0" + description: "Run overlay filesystem test from unionmount testsuite. Kernel config + CONFIG_OVERLAY_FS=y is required for this test." + maintainer: + - milosz.wasilewski@linaro.org + - chase.qi@linaro.org + os: + - ubuntu + - debian + - centos + - fedora + - openembedded + devices: + - d03 + - d05 + - juno + - beaglebone-black + - hi6220-hikey + - apq8016-sbc + - mustang + - moonshot + - thunderX + - x15 + - x86 + + scope: + - functional + +run: + steps: + - cd automated/linux/overlayfs + - ./overlayfs.sh + - ../../utils/send-to-lava.sh ./output/result.txt diff --git a/automated/linux/piglit/piglit.yaml b/automated/linux/piglit/piglit.yaml new file mode 100644 index 0000000..8b87b7c --- /dev/null +++ b/automated/linux/piglit/piglit.yaml @@ -0,0 +1,58 @@ +metadata: + format: Lava-Test Test Definition 1.0 + name: piglit + description: "Piglit is an open-source test suite for OpenGL implementations. + For more information: https://piglit.freedesktop.org/" + maintainer: + - anibal.limon@linaro.org + os: + - debian + - ubuntu + - centos + - fedora + - openembedded + scope: + - functional + devices: + - dragonboard410c + +# Exclude via OPTIONS: +# * glx, because those are driver specific +# * streaming-texture-leak, because it needs swap, not readily available +params: + DISPLAY: ":0" + PIGLIT_SOURCE_DIR: "/usr/lib64/piglit" + OPTIONS: "-x streaming-texture-leak -x glx" + SUITE: "tests/quick.py" + USE_XVFB: "False" + IGNORE_TESTS_REPO: "" + IGNORE_TESTS_BRANCH: "master" + IGNORE_TESTS_FILE: "" + +run: + steps: + - . ./automated/lib/sh-test-lib + - install_deps piglit + - if [ "${USE_XVFB}" = "True" ]; then + - install_deps xvfb + - export DISPLAY=:9 + - Xvfb ${DISPLAY} -screen 0 1920x1080x24 & + - else + - export DISPLAY=${DISPLAY} + - fi + - export PIGLIT_SOURCE_DIR=${PIGLIT_SOURCE_DIR} + - cd ./automated/linux/piglit + - IGNORE_FILE="" + - if [ ! -z "${IGNORE_TESTS_REPO}" ] && [ ! -z "${IGNORE_TESTS_FILE}" ]; then + - repo_path=${PWD}/$(basename ${IGNORE_TESTS_REPO}) + - git clone -b ${IGNORE_TESTS_BRANCH} ${IGNORE_TESTS_REPO} ${repo_path} + - IGNORE_FILE=${repo_path}/${IGNORE_TESTS_FILE} + - fi + - piglit run ${OPTIONS} ${PIGLIT_SOURCE_DIR}/${SUITE} ./results + - if [ -f ./results/results.json.bz2 ]; then + - bzip2 -d ./results/results.json.bz2 + - ./piglit_lava_parse.py ./results/results.json ${IGNORE_FILE} > ./result.txt + - else + - ./piglit_lava_parse.py ./results/tests ${IGNORE_FILE} > ./result.txt + - fi + - ../../utils/send-to-lava.sh ./result.txt diff --git a/automated/linux/piglit/piglit_lava_parse.py b/automated/linux/piglit/piglit_lava_parse.py new file mode 100755 index 0000000..1e780fa --- /dev/null +++ b/automated/linux/piglit/piglit_lava_parse.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python3 + +# LAVA/OE piglit results parse script +# +# Copyright (C) 2018, Linaro Limited. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Author: Aníbal Limón <anibal.limon@linaro.org> +# + +import json +import os +import re +import sys + + +def map_result_to_lava(result): + if result == 'warn': + result = 'pass' + elif result == 'crash': + result = 'fail' + elif result == 'incomplete': + result = 'fail' + + return result + + +def natural_keys(text): + m = re.search('(\d+)', text) + if m: + return int(m.group(1)) + else: + return text + + +if __name__ == '__main__': + if len(sys.argv) < 2: + print("Usage: %s <result_dir|result_file> [ignore_file]" % sys.argv[0]) + sys.exit(1) + + ignore_tests = [] + if len(sys.argv) == 3: + with open(sys.argv[2], 'r') as f: + ignore_tests = f.read().split() + + if os.path.isdir(sys.argv[1]): + for root, dirs, files in os.walk(sys.argv[1]): + result_types = {} + for name in sorted(files, key=natural_keys): + if name.endswith('.tmp'): + continue + piglit_result = None + full_f = os.path.join(root, name) + with open(full_f, 'r') as f: + piglit_results = json.loads(f.read()) + for test in piglit_results.keys(): + if test in ignore_tests: + continue + result = map_result_to_lava(piglit_results[test]['result']) + print("%s %s" % (test, result)) + else: + with open(sys.argv[1], 'r') as f: + piglit_results = json.loads(f.read()) + for test in sorted(piglit_results['tests'].keys()): + if test in ignore_tests: + continue + result = map_result_to_lava(piglit_results['tests'][test]['result']) + print("%s %s" % (test, result)) diff --git a/automated/linux/ptest/ptest.py b/automated/linux/ptest/ptest.py new file mode 100755 index 0000000..13feb4d --- /dev/null +++ b/automated/linux/ptest/ptest.py @@ -0,0 +1,161 @@ +#!/usr/bin/env python3 + +# LAVA/OE ptest script +# +# Copyright (C) 2017, Linaro Limited. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Author: Aníbal Limón <anibal.limon@linaro.org> +# + +import sys +import argparse +import subprocess +import re +import os + +OUTPUT_LOG = os.path.join(os.getcwd(), 'result.txt') + + +def get_ptest_dir(): + ptest_dirs = ['/usr/lib', '/usr/lib64', '/usr/lib32'] + + for pdir in ptest_dirs: + try: + ptests = subprocess.check_output('ptest-runner -l -d %s' % + pdir, shell=True, + stderr=subprocess.STDOUT) + except subprocess.CalledProcessError: + continue + + return pdir + + return None + + +def get_available_ptests(ptest_dir): + output = subprocess.check_output('ptest-runner -l -d %s' % + ptest_dir, shell=True, + stderr=subprocess.STDOUT) + + ptests = [] + ptest_rex = re.compile("^(?P<ptest_name>.*)\t") + for line in output.decode('utf-8').split('\n'): + m = ptest_rex.search(line) + if m: + ptests.append(m.group('ptest_name')) + + return ptests + + +def filter_ptests(ptests, requested_ptests, exclude): + filter_ptests = [] + + for ptest in exclude: + if ptest in ptests: + ptests.remove(ptest) + + if not requested_ptests: + return ptests + + for ptest_name in ptests: + if ptest_name in requested_ptests: + requested_ptests[ptest_name] = True + filter_ptests.append(ptest_name) + + for request_ptest in requested_ptests.keys(): + if not requested_ptests[request_ptest]: + print("ERROR: Ptest %s was requested and isn't available" % + request_ptest) + sys.exit(1) + + return filter_ptests + + +def check_ptest(ptest_dir, ptest_name, output_log): + status = 'pass' + + try: + output = subprocess.check_call('ptest-runner -d %s %s' % + (ptest_dir, ptest_name), shell=True, + stderr=subprocess.STDOUT) + except subprocess.CalledProcessError: + status = 'fail' + + with open(output_log, 'a+') as f: + f.write("%s %s\n" % (ptest_name, status)) + + +def main(): + parser = argparse.ArgumentParser(description="LAVA/OE ptest script", + add_help=False) + parser.add_argument('-t', '--tests', action='store', nargs='*', + help='Ptests to run') + parser.add_argument('-e', '--exclude', action='store', nargs='*', + help='Ptests to exclude') + parser.add_argument('-d', '--ptest-dir', + help='Directory where ptests are stored (optional)', + action='store') + parser.add_argument('-o', '--output-log', + help='File to output log (optional)', action='store', + default=OUTPUT_LOG) + parser.add_argument('-h', '--help', action='help', + default=argparse.SUPPRESS, + help='show this help message and exit') + args = parser.parse_args() + + if args.ptest_dir: + ptest_dir = args.ptest_dir + else: + ptest_dir = get_ptest_dir() + if not ptest_dir: + print("ERROR: No ptest dir found\n") + return 1 + + ptests = get_available_ptests(ptest_dir) + if not ptests: + print("ERROR: No ptests found in dir: %s\n" % ptest_dir) + return 1 + + # filter empty strings caused by -t "" + tests = [] + if args.tests: + tests = [x for x in args.tests if x] + + # filter empty strings caused by -e "" + exclude = [] + if args.exclude: + exclude = [e for e in args.exclude if e] + + required_ptests = dict.fromkeys(tests, False) + ptests_to_run = filter_ptests(ptests, required_ptests, exclude) + for ptest_name in ptests_to_run: + check_ptest(ptest_dir, ptest_name, args.output_log) + + return 0 + + +if __name__ == '__main__': + try: + ret = main() + except SystemExit as e: + ret = e.code + except: + ret = 1 + import traceback + traceback.print_exc() + + sys.exit(ret) diff --git a/automated/linux/ptest/ptest.yaml b/automated/linux/ptest/ptest.yaml new file mode 100644 index 0000000..854af0b --- /dev/null +++ b/automated/linux/ptest/ptest.yaml @@ -0,0 +1,25 @@ +metadata: + format: Lava-Test Test Definition 1.0 + name: ptest + description: "OpenEmbedded Package tests support (ptest) + The pacakge tests from OpenEmbedded enables the support to run + package unittests into the target device. + For more information: https://wiki.yoctoproject.org/wiki/Ptest" + maintainer: + - anibal.limon@linaro.org + os: + - openembedded + scope: + - functional + devices: + - dragonboard410c + +params: + TESTS: "" + EXCLUDE: "" + +run: + steps: + - cd ./automated/linux/ptest + - ./ptest.py -o ./result.txt -t ${TESTS} -e ${EXCLUDE} + - ../../utils/send-to-lava.sh ./result.txt diff --git a/automated/linux/v4l2/v4l2-compliance.sh b/automated/linux/v4l2/v4l2-compliance.sh new file mode 100755 index 0000000..73a609f --- /dev/null +++ b/automated/linux/v4l2/v4l2-compliance.sh @@ -0,0 +1,60 @@ +#!/bin/sh + +. ../../lib/sh-test-lib +OUTPUT="$(pwd)/output" +RESULT_FILE="${OUTPUT}/result.txt" +TEST_SUITE="v4l2-compliance" + +usage() { + echo "Usage: $0 [-d <video device>" 1>&2 + exit 1 +} + +while getopts "d:h:m:" o; do + case "$o" in + d) VIDEO_DEVICE="${OPTARG}" ;; + m) MEDIA_DEVICE_NUM="${OPTARG}" + MEDIA_DEVICE="/dev/media${OPTARG}" ;; + h|*) usage ;; + esac +done + +echo VIDEO_DEVICE="${VIDEO_DEVICE}" +echo MEDIA_DEVICE="${MEDIA_DEVICE}" +echo MEDIA_DEVICE_NUM="${MEDIA_DEVICE_NUM}" + +# Test run. +create_out_dir "${OUTPUT}" + +command -v v4l2-compliance +exit_on_fail "v4l2-existence-check" + +if [ ! -z "${VIDEO_DEVICE}" ] && [ -e "${VIDEO_DEVICE}" ]; then + info_msg "Running v4l2-compliance device test..." + LOG_FILE="${OUTPUT}/${TEST_SUITE}-output.txt" + test_cmd="v4l2-compliance -v -d ${VIDEO_DEVICE} 2>&1" + pipe0_status "${test_cmd}" "tee ${LOG_FILE}" + check_return "v4l2-compliance" +else + info_msg "Skipping v4l2-compliance device test..." +fi + +if [ ! -z "${MEDIA_DEVICE}" ] && [ -e "${MEDIA_DEVICE}" ]; then + info_msg "Running v4l2-compliance media test..." + LOG_FILE="${OUTPUT}/${TEST_SUITE}-output.txt" + test_cmd="v4l2-compliance -v -m${MEDIA_DEVICE_NUM} 2>&1" + pipe0_status "${test_cmd}" "tee ${LOG_FILE}" + check_return "v4l2-compliance" +else + info_msg "Skipping v4l2-compliance media test..." +fi + +# Parse test log. +grep -e FAIL -e OK "${LOG_FILE}" | \ + sed -e 's/^[ \t]*//' \ + -e 's/test //' \ + -e 's/ (Not Supported)//' \ + -e 's/ /_/g' \ + -e 's/:_/ /' \ + -e 's/ OK/ PASS/' \ + > "${RESULT_FILE}" diff --git a/automated/linux/v4l2/v4l2-compliance.yaml b/automated/linux/v4l2/v4l2-compliance.yaml new file mode 100644 index 0000000..c386d43 --- /dev/null +++ b/automated/linux/v4l2/v4l2-compliance.yaml @@ -0,0 +1,23 @@ +metadata: + name: v4l2-compliance + format: "Lava-Test-Shell Test Definition 1.0" + description: "v4l2 Compliance test suite" + maintainer: + - ryan.harkin@linaro.org + os: + - openembedded + - debian + scope: + - functional + devices: + - imx7s-warp + +params: + VIDEO_DEVICE: "/dev/video0" + MEDIA_DEVICE_NUM: "0" + +run: + steps: + - cd ./automated/linux/v4l2/ + - ./v4l2-compliance.sh -d "${VIDEO_DEVICE}" -m "${MEDIA_DEVICE_NUM}" + - ../../utils/send-to-lava.sh ./output/result.txt diff --git a/automated/linux/wlan-smoke/wlan-smoke-test.sh b/automated/linux/wlan-smoke/wlan-smoke-test.sh new file mode 100755 index 0000000..8bf028a --- /dev/null +++ b/automated/linux/wlan-smoke/wlan-smoke-test.sh @@ -0,0 +1,96 @@ +#!/bin/sh +# +# WLAN smoke tests +# +# Copyright (C) 2017, Linaro Limited. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Author: Nicolas Dechesne <nicolas.dechesne@linaro.org> +# + +# shellcheck disable=SC1091 +. ../../lib/sh-test-lib +OUTPUT="$(pwd)/output" +RESULT_FILE="${OUTPUT}/result.txt" +export RESULT_FILE +DEVICE="wlan0" +BOOT="enabled" + +usage() { + echo "Usage: $0 [-b <enabled|disabled>] [-d <device>]" 1>&2 + exit 1 +} + +while getopts "d:b:" o; do + case "$o" in + d) DEVICE="${OPTARG}" ;; + b) BOOT="${OPTARG}" ;; + *) usage ;; + esac +done + +# sanity test ip command +test_iplink() { + info_msg "Running ip link test..." + ip link show "${DEVICE}" + exit_on_fail "ip-link" +} + +# test WLAN device at boot is $BOOT +test_wlan_boot() { + info_msg "Running wlan boot test..." + if [ "${BOOT}" = "enabled" ]; then + ip link show "${DEVICE}" | grep "${DEVICE}" | grep "UP" + else + ip link show "${DEVICE}" | grep "${DEVICE}" | grep -v "UP" + fi + check_return "wlan-boot" +} + +# test WLAN device is up +test_wlan_up() { + info_msg "Running wlan-up test..." + ip link set "${DEVICE}" up + sleep 1 + ip link show "${DEVICE}" | grep "${DEVICE}" | grep "UP" + check_return "wlan-up" +} + +# test WLAN device is down +test_wlan_down() { + info_msg "Running wlan-down test..." + ip link set "${DEVICE}" down + sleep 1 + ip link show "${DEVICE}" | grep "${DEVICE}" | grep -v "UP" + check_return "wlan-down" +} + +# Test run. +! check_root && error_msg "This script must be run as root" +create_out_dir "${OUTPUT}" + +info_msg "About to run wlan smoke test..." +info_msg "Output directory: ${OUTPUT}" + +# ensure that device is available at boot +test_iplink +test_wlan_boot +test_wlan_down +test_wlan_up + + + + diff --git a/automated/linux/wlan-smoke/wlan-smoke.yaml b/automated/linux/wlan-smoke/wlan-smoke.yaml new file mode 100644 index 0000000..00ade67 --- /dev/null +++ b/automated/linux/wlan-smoke/wlan-smoke.yaml @@ -0,0 +1,26 @@ +metadata: + format: Lava-Test Test Definition 1.0 + name: wlan-smoke + description: "Basic WLAN smoke tests" + maintainer: + - nicolas.dechesne@linaro.org + os: + - debian + - ubuntu + - centos + - fedora + scope: + - functional + devices: + - dragonboard410c + +params: + DEVICE: wlan0 + # expected state on first boot: <enabled> or <disabled> + BOOT: enabled + +run: + steps: + - cd ./automated/linux/wlan-smoke + - ./wlan-smoke-test.sh -d "${DEVICE}" -b "${BOOT}" + - ../../utils/send-to-lava.sh ./output/result.txt |