summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaresh Kamboju <naresh.kamboju@linaro.org>2016-09-20 19:31:00 +0530
committerNaresh Kamboju <naresh.kamboju@linaro.org>2016-09-30 00:40:53 +0000
commitad19d88c2ff9210931b374ddafa89afd6885a1d6 (patch)
tree44cba874ebb2a7fbec76e601628039c9c0e6e32d
parent66a0233d64dcd838d7250932806b40a9594ec97d (diff)
v2: linux: Adding LTP test
Change-Id: Ia43e606df296a2e72d443e8ad12713e2a16be8b8 Signed-off-by: Naresh Kamboju <naresh.kamboju@linaro.org>
-rwxr-xr-xautomated/linux/ltp/ltp.sh119
-rw-r--r--automated/linux/ltp/ltp.yaml44
-rw-r--r--automated/linux/ltp/skipfile-lsk-juno57
3 files changed, 220 insertions, 0 deletions
diff --git a/automated/linux/ltp/ltp.sh b/automated/linux/ltp/ltp.sh
new file mode 100755
index 0000000..e72d6a3
--- /dev/null
+++ b/automated/linux/ltp/ltp.sh
@@ -0,0 +1,119 @@
+#!/bin/bash
+
+. ../../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}""
+# List of test cases
+TST_CMDFILES=""
+# List of test cases to be skipped
+SKIPFILE=""
+# LTP version
+LTP_VERSION="20160510"
+
+LTP_PATH=/opt/ltp
+
+usage() {
+ echo "Usage: $0 [-T mm,math,syscalls] [-S skipfile-lsk-juno] [-s <flase>] [-v LTP_VERSION]" 1>&2
+ exit 0
+}
+
+while getopts "T:S:s:v:" arg; do
+ case "$arg" in
+ 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}""
+ else
+ # Download LTP skipfile from speficied URL
+ wget "${OPTARG}"
+ SKIPFILE=$(echo "${OPTARG##*/}")
+ SKIPFILE="-S $(pwd)/${SKIPFILE}"
+ fi
+ ;;
+ # 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() {
+ rm -rf /opt/ltp
+ mkdir -p /opt/ltp
+ cd /opt/ltp
+ 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}"
+}
+
+# Run LTP test suite
+run_ltp() {
+ cd "${LTP_PATH}"
+
+ exec 4>&1
+ error_statuses="$(((./runltp -p -q -f "${TST_CMDFILES}" \
+ -l "${OUTPUT}/LTP_${LOG_FILE}.log" \
+ -C "${OUTPUT}/LTP_${LOG_FILE}.failed" "${SKIPFILE}" \
+ || echo "0:$?" >&3) | (tee "${OUTPUT}/LTP_${LOG_FILE}.out" \
+ || echo "1:$?" >&3)) 3>&1 >&4)"
+ exec 4>&-
+
+ echo "${error_statuses}"
+ parse_ltp_summary "${OUTPUT}/LTP_${LOG_FILE}.log"
+ parse_ltp_output "${OUTPUT}/LTP_${LOG_FILE}.log"
+}
+
+# Test run.
+! check_root && error_msg "This script must be run as root"
+[ -d "${OUTPUT}" ] && mv "${OUTPUT}" "${OUTPUT}_$(date +%Y%m%d%H%M%S)"
+mkdir -p "${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 skipped"
+else
+ dist_name
+ case "${dist}" in
+ Debian|Ubuntu)
+ pkgs="xz-utils flex bison build-essential wget curl"
+ ;;
+ CentOS|Fedora)
+ pkgs="xz flex bison make automake gcc gcc-c++ kernel-devel wget curl"
+ ;;
+ *)
+ error_msg "Unsupported distribution!"
+ esac
+ install_deps "${pkgs}" "${SKIP_INSTALL}"
+ info_msg "Run install_ltp"
+ install_ltp
+fi
+info_msg "Running run_ltp"
+run_ltp
diff --git a/automated/linux/ltp/ltp.yaml b/automated/linux/ltp/ltp.yaml
new file mode 100644
index 0000000..f48d4f3
--- /dev/null
+++ b/automated/linux/ltp/ltp.yaml
@@ -0,0 +1,44 @@
+metadata:
+ name: ltp
+ format: "Lava-Test-Shell Test Definition 1.0"
+ description: "Run LTP test suite on Ubuntu"
+ maintainer:
+ - milosz.wasilewski@linaro.org
+ - fathi.boudra@linaro.org
+ os:
+ - ubuntu
+ scope:
+ - functional
+ devices:
+ - panda
+ - panda-es
+ - arndale
+ - vexpress-a9
+ - vexpress-tc2
+ - ifc6410
+params:
+ # 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-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
+
+run:
+ steps:
+ - cd ./automated/linux/ltp/
+ - ./ltp.sh -T "${TST_CMDFILES}" -S "${SKIPFILE}" -s "${SKIP_INSTALL}" -v "${LTP_VERSION}"
+ - ../../utils/send-to-lava.sh ./output/result.txt
+
+parse:
+ pattern: "^(?!.+ED)(?P<test_case_id>\\w+)\\s+(?P<result>PASS|FAIL|CONF)\\s+\\d+"
+ fixupdict:
+ FAIL: fail
+ PASS: pass
+ CONF: skip
diff --git a/automated/linux/ltp/skipfile-lsk-juno b/automated/linux/ltp/skipfile-lsk-juno
new file mode 100644
index 0000000..9419e83
--- /dev/null
+++ b/automated/linux/ltp/skipfile-lsk-juno
@@ -0,0 +1,57 @@
+# Blacklist or skip tests list
+
+chdir01A symlink01 -T chdir01
+fork13 fork13 -i 1000000
+msgctl10 msgctl10
+msgctl11 msgctl11
+# chdir01 is failed due to the way LAVA mounted /tmp file system
+
+sysfs01 sysfs01
+sysfs02 sysfs02
+sysfs03 sysfs03
+sysfs04 sysfs04
+sysfs05 sysfs05
+sysfs06 sysfs06
+# sysfs01 sysfs02 sysfs03 sysfs04 sysfs05 and sysfs06 no more valid.
+# sysfs system call is obsolete; don't use it.
+# This test can only run on kernels that support the sysfs system call
+
+syslog01 syslog01
+syslog02 syslog02
+syslog03 syslog03
+syslog04 syslog04
+syslog05 syslog05
+syslog06 syslog06
+syslog07 syslog07
+syslog08 syslog08
+syslog09 syslog09
+syslog10 syslog10
+# The syslog tests are not valuable for us
+
+ustat01 ustat01
+ustat02 ustat02
+# ustat01 and ustat02 failed only on Juno, because this syscall not implemented on arm-64 architecture.
+# ustat(2) failed and setthe errno to 38 : Function not implemented
+
+overcommit_memory02 overcommit_memory -R 0
+# The testcase seems to be broken unless you have big enough swap so that
+# CommitLimit (which depends on size of the swap) is greater than
+# Commit_AS. In your case the swap size was not big enough to be greater
+# than the amount of currently overcommited memory (Commit_AS).
+
+# The test should be changed to skip the particular testcase and give a
+# beteter message if there is no room to alloace any memory in this case.
+# https://www.mail-archive.com/ltp-list@lists.sourceforge.net/msg19476.html
+# https://www.mail-archive.com/ltp-list@lists.sourceforge.net/msg19551.html
+
+cron02 cron02
+cron_deny01 cron_deny01
+cron_allow01 cron_allow01
+cron_dirs_checks01 cron_dirs_checks01
+# crontab: command not found
+# External package cron not installed on rootfs.
+# This test case comes under admin_tools, which is not critical for us
+
+acl_test01 acl_test01
+# acl test cases comes under admin_tools
+# setfacl: /tmp/ltp-UH9jbROZVN/tacl/mount-ext3/test_file_link: Operation not supported