diff options
author | Naresh Kamboju <naresh.kamboju@linaro.org> | 2018-06-26 12:24:31 +0530 |
---|---|---|
committer | Naresh Kamboju <naresh.kamboju@linaro.org> | 2018-06-27 15:19:20 +0530 |
commit | 08fb5d99b9a338f2067085698b973439b0c50da8 (patch) | |
tree | 9f5793838345ba6e8ee2b23e9b95fbdd7e0d87a8 | |
parent | c2abada6f067f67b045cca7cc671f97ab03ce035 (diff) |
LTP: Adding LTP open posix test suite
Change-Id: I23e2c83965e7c69f553b4b25700073308b758246
Signed-off-by: Naresh Kamboju <naresh.kamboju@linaro.org>
-rwxr-xr-x | automated/linux/ltp-open-posix/ltp-open-posix.sh | 105 | ||||
-rw-r--r-- | automated/linux/ltp-open-posix/ltp-open-posix.yaml | 30 |
2 files changed, 135 insertions, 0 deletions
diff --git a/automated/linux/ltp-open-posix/ltp-open-posix.sh b/automated/linux/ltp-open-posix/ltp-open-posix.sh new file mode 100755 index 0000000..a74a0c4 --- /dev/null +++ b/automated/linux/ltp-open-posix/ltp-open-posix.sh @@ -0,0 +1,105 @@ +#!/bin/bash + +set -x + +# shellcheck disable=SC1091 +. ../../lib/sh-test-lib +OUTPUT="$(pwd)/output" +RESULT_FILE="${OUTPUT}/result.txt" +# Absolute path to this script. /home/user/bin/foo.sh +SCRIPT="$(readlink -f "${0}")" +# Absolute path this script is in. /home/user/bin +SCRIPTPATH="$(dirname "${SCRIPT}")" +echo "Script path is: ${SCRIPTPATH}" +SKIP_INSTALL="true" +# List of test cases +TEST="conformance functional stress" +# LTP version +LTP_VERSION="20180515" + +LTP_PRE_INSTALL=/opt/ltp +LTP_PATH=/opt/ltp/testcases/open_posix_testsuite + +while getopts "s:v:" arg; do + case "$arg" in + s) SKIP_INSTALL="${OPTARG}";; + v) LTP_VERSION="${OPTARG}";; + esac +done + +# Install LTP open posix test suite +install_ltp_open_posix() { + rm -rf "${LTP_PRE_INSTALL}" + mkdir -p "${LTP_PRE_INSTALL}" + # shellcheck disable=SC2164 + cd "${LTP_PRE_INSTALL}" + # shellcheck disable=SC2140 + wget https://github.com/linux-test-project/ltp/releases/download/"${LTP_VERSION}"/ltp-full-"${LTP_VERSION}".tar.xz + tar --strip-components=1 -Jxf ltp-full-"${LTP_VERSION}".tar.xz + ./configure --with-open-posix-testsuite + # shellcheck disable=SC2164 + cd "${LTP_PATH}" + make generate-makefiles || true + + for EACH_TEST in ${TEST} + do + make "${EACH_TEST}"-all || true + done +} + +# Parse LTP open posix output +parse_ltp_output() { + for EACH_TEST in ${TEST} + do + sed -i -e "s/\// /g" logfile."${EACH_TEST}"-test + grep -E ": PASS" logfile."${EACH_TEST}"-test \ + | awk '{print $(NF-2)" "$(NF)}' \ + | sed 's/://g; s/PASS/pass/' >> "${RESULT_FILE}" + grep -E ": FAILED|: SKIPPED|: UNSUPPORTED|: UNTESTED|: UNRESOLVED|: HUNG" logfile."${EACH_TEST}"-test \ + | awk '{print $(NF-3)" "$(NF-1)}' \ + | sed 's/://g; s/FAILED/fail/; s/SKIPPED/skip/; s/UNSUPPORTED/skip/; s/UNTESTED/skip/; s/UNRESOLVED/skip/; s/HUNG/skip/' >> "${RESULT_FILE}" + done + +} + +# Run LTP test suite +run_ltp_open_posix() { + # shellcheck disable=SC2164 + cd "${LTP_PATH}" + for EACH_TEST in ${TEST} + do + make "${EACH_TEST}"-test || true + done + parse_ltp_output +} + +# Test run. +! check_root && error_msg "This script must be run as root" +create_out_dir "${OUTPUT}" + +info_msg "About to run ltp test..." +info_msg "Output directory: ${OUTPUT}" + +if [ "${SKIP_INSTALL}" = "True" ] || [ "${SKIP_INSTALL}" = "true" ]; then + info_msg "install-ltp-open-posix skipped" +else + dist_name + # shellcheck disable=SC2154 + case "${dist}" in + debian|ubuntu) + pkgs="xz-utils flex bison build-essential wget curl net-tools sudo libaio-dev expect automake acl" + install_deps "${pkgs}" "${SKIP_INSTALL}" + ;; + centos|fedora) + pkgs="xz flex bison make automake gcc gcc-c++ kernel-devel wget curl net-tools sudo libaio expect acl" + install_deps "${pkgs}" "${SKIP_INSTALL}" + ;; + *) + warn_msg "Unsupported distribution: package install skipped" + esac + + info_msg "Run install-ltp-open-posix" + install_ltp_open_posix +fi +info_msg "Running run-ltp-open-posix" +run_ltp_open_posix diff --git a/automated/linux/ltp-open-posix/ltp-open-posix.yaml b/automated/linux/ltp-open-posix/ltp-open-posix.yaml new file mode 100644 index 0000000..da6f98d --- /dev/null +++ b/automated/linux/ltp-open-posix/ltp-open-posix.yaml @@ -0,0 +1,30 @@ +metadata: + name: ltp-open-posix + format: "Lava-Test-Shell Test Definition 1.0" + description: "Run LTP open posix test suite" + maintainer: + - naresh.kamboju@linaro.org + os: + - debian + - fedora + - openembedded + scope: + - functional + devices: + - dragonboard410c + - hi6220-hikey + - juno + - x15 + - x86 + environment: + - lava-test-shell +params: + # LTP version + LTP_VERSION: 20180515 + SKIP_INSTALL: true + +run: + steps: + - cd ./automated/linux/ltp-open-posix/ + - ./ltp-open-posix.sh -s "${SKIP_INSTALL}" -v "${LTP_VERSION}" + - ../../utils/send-to-lava.sh ./output/result.txt |