From c8f3ad65efe648a19b8fd08b2b4bfc2d407a2777 Mon Sep 17 00:00:00 2001 From: Naresh Kamboju Date: Thu, 29 Sep 2016 04:16:31 +0530 Subject: after review Signed-off-by: Naresh Kamboju --- automated/linux/ltp/ltp.sh | 42 +++++++++++++++++++++++++----------------- automated/linux/ltp/ltp.yaml | 11 +++++++---- 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/automated/linux/ltp/ltp.sh b/automated/linux/ltp/ltp.sh index 5e9db18..b909d92 100755 --- a/automated/linux/ltp/ltp.sh +++ b/automated/linux/ltp/ltp.sh @@ -17,13 +17,16 @@ LTP_PATH=/opt/ltp usage() { echo "Usage: $0 [-T mm,math,syscalls] [-S skipfile-lsk-juno] [-s ]" 1>&2 - exit 1 + exit 0 } while getopts "T:S:s:" arg; do case "$arg" in - T) TST_CMDFILES="${OPTARG}" - LOG_FILE=$(echo "${OPTARG}"| sed 's,\/,_,');; - S) OPT=$(echo "${OPTARG}" | grep "http") + T) + TST_CMDFILES="${OPTARG}" + LOG_FILE=$(echo "${OPTARG}"| sed 's,\/,_,') + ;; + S) + OPT=$(echo "${OPTARG}" | grep "http") if [ -z "${OPT}" ] ; then # LTP skipfile SKIPFILE="-S "${SCRIPTPATH}"/"${OPTARG}"" @@ -31,27 +34,36 @@ while getopts "T:S:s:" arg; do # Download LTP skipfile from speficied URL wget "${OPTARG}" SKIPFILE=$(echo "${OPTARG##*/}") - SKIPFILE="-S $(pwd)/"${SKIPFILE}"" + SKIPFILE="-S $(pwd)/${SKIPFILE}" fi ;; - # SKIP_INSTALL is true in case of OE builds + # SKIP_INSTALL is true in case of Open Embedded builds # SKIP_INSTALL is flase in case of Debian builds s) SKIP_INSTALL="${OPTARG}";; + v) LTP_VERSION="${OPTARG}";; esac done # Install LTP test suite install_ltp() { - VERSION=20160510 rm -rf /opt/ltp mkdir -p /opt/ltp cd /opt/ltp - wget https://github.com/linux-test-project/ltp/releases/download/"${VERSION}"/ltp-full-"${VERSION}".tar.xz - tar --strip-components=1 -Jxf ltp-full-"${VERSION}".tar.xz + 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 make -j8 all make SKIP_IDCHECK=1 install } + +parse_ltp_summary() { + for TEST in "Total Tests" "Total Skipped Tests" "Total Failures"; do + NO_OF_TESTS="$(grep "$TEST" "$1" | awk '{print $NF}')" + TEST=$(echo "$TEST" | tr -s ' ' '-') + add_metric "$TEST" "pass" "${NO_OF_TESTS}" "testcases" + done +} + # Parse LTP output parse_ltp_output() { egrep "PASS|FAIL|CONF" "$1" | awk '{print $1" "$2}' | sed s/CONF/SKIP/ > "${RESULT_FILE}" @@ -60,7 +72,6 @@ parse_ltp_output() { # Run LTP test suite run_ltp() { cd "${LTP_PATH}" - RESULT=pass exec 4>&1 error_statuses="$(((./runltp -p -q -f "${TST_CMDFILES}" \ @@ -70,10 +81,8 @@ run_ltp() { || echo "1:$?" >&3)) 3>&1 >&4)" exec 4>&- - ! echo "${error_statuses}" | grep '0:' >/dev/null - if [ $? -ne 0 ]; then - RESULT=fail - fi + echo "${error_statuses}" + parse_ltp_summary "${SCRIPTPATH}"/LTP_"${LOG_FILE}".log parse_ltp_output "${SCRIPTPATH}"/LTP_"${LOG_FILE}".log } @@ -87,12 +96,11 @@ info_msg "Output directory: ${OUTPUT}" if [ "${SKIP_INSTALL}" = "True" ] || [ "${SKIP_INSTALL}" = "true" ]; then info_msg "install_ltp skipped" - info_msg "Running run_ltp" - run_ltp else pkgs="xz-utils flex bison build-essential wget curl" install_deps "${pkgs}" "${SKIP_INSTALL}" info_msg "Run install_ltp" install_ltp - run_ltp fi +info_msg "Running run_ltp" +run_ltp diff --git a/automated/linux/ltp/ltp.yaml b/automated/linux/ltp/ltp.yaml index af8e8c7..f48d4f3 100644 --- a/automated/linux/ltp/ltp.yaml +++ b/automated/linux/ltp/ltp.yaml @@ -17,20 +17,23 @@ metadata: - vexpress-tc2 - ifc6410 params: - TST_CMDFILES: syscalls + # LTP version + LTP_VERSION: 20160510 + TST_CMDFILES: syscalls,mm,math,timers,fcntl-locktests,ipc,fsx,fs,hugetlb,io,nptl,pty,containers,fs_bind,filecaps,admin_tools,connectors + # TST_CMDFILES: math,timers # SKIPFILE can be a filename from dir ./automated/linux/ltp/ or an open URL - SKIPFILE: "skipfile-lsk-juno" + # SKIPFILE: "skipfile-lsk-juno" # "skipfile-lsk-juno" is a known file present in dir ./automated/linux/ltp/ # or # SKIPFILE: "http://people.linaro.org/~naresh.kamboju/skipfile" # NOTE: busybox wget may not work with https link so pefer to use http # SKIPFILE: "" - SKIP_INSTALL: "false" + SKIP_INSTALL: false run: steps: - cd ./automated/linux/ltp/ - - ./ltp.sh -T "${TST_CMDFILES}" -S "${SKIPFILE}" -s "${SKIP_INSTALL}" + - ./ltp.sh -T "${TST_CMDFILES}" -S "${SKIPFILE}" -s "${SKIP_INSTALL}" -v "${LTP_VERSION}" - ../../utils/send-to-lava.sh ./output/result.txt parse: -- cgit v1.2.3