summaryrefslogtreecommitdiff
path: root/automated
diff options
context:
space:
mode:
authorNaresh Kamboju <naresh.kamboju@linaro.org>2017-01-11 16:26:30 +0530
committerNaresh Kamboju <naresh.kamboju@linaro.org>2017-04-04 14:25:52 +0530
commitc646273248c63374e5ceabc6b0d5cfa7cef29e43 (patch)
tree9c56075d046e0287ee4620cc3b7abec991a4a298 /automated
parentcb398178245d7377ed45e63478aac34be57e9570 (diff)
downloadtest-definitions-pipe-c646273248c63374e5ceabc6b0d5cfa7cef29e43.tar.gz
automated: linux: add kselftest test
Kselftest test definitions detects pre-built tests on target rootfs. if not found then, download kselftest and run tests. Change-Id: Ie88860d79aef7cf7aa526f95f1f4803e30a4b899 Signed-off-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Diffstat (limited to 'automated')
-rwxr-xr-xautomated/linux/kselftest/kselftest.sh64
-rw-r--r--automated/linux/kselftest/kselftest.yaml28
2 files changed, 92 insertions, 0 deletions
diff --git a/automated/linux/kselftest/kselftest.sh b/automated/linux/kselftest/kselftest.sh
new file mode 100755
index 0000000..96f122e
--- /dev/null
+++ b/automated/linux/kselftest/kselftest.sh
@@ -0,0 +1,64 @@
+#!/bin/sh
+# Linux kernel self test
+
+# shellcheck disable=SC1091
+. ../../lib/sh-test-lib
+OUTPUT="$(pwd)/output"
+RESULT_FILE="${OUTPUT}/result.txt"
+LOGFILE="${OUTPUT}/kselftest.txt"
+TESTPROG="kselftest_armhf.tar.gz"
+KSELFTEST_PATH="/usr/bin/kselftests"
+
+usage() {
+ echo "Usage: $0 [-t kselftest_aarch64.tar.gz | kselftest_armhf.tar.gz] [-s true|false]" 1>&2
+ exit 1
+}
+
+while getopts "t:s:h" opt; do
+ case "${opt}" in
+ t) TESTPROG="${OPTARG}" ;;
+ s) SKIP_INSTALL="${OPTARG}" ;;
+ h|*) usage ;;
+ esac
+done
+
+parse_output() {
+ grep "selftests:" "${LOGFILE}" 2>&1 | tee -a "${RESULT_FILE}"
+ sed -i -e 's/: /-/g' "${RESULT_FILE}"
+ sed -i -e 's/\[//g' "${RESULT_FILE}"
+ sed -i -e 's/]//g' "${RESULT_FILE}"
+ sed -i -e 's/selftests//g' "${RESULT_FILE}"
+}
+
+install() {
+ dist_name
+ # shellcheck disable=SC2154
+ case "${dist}" in
+ debian|ubuntu) install_deps "sed wget xz-utils" "${SKIP_INSTALL}" ;;
+ centos|fedora) install_deps "sed wget xz" "${SKIP_INSTALL}" ;;
+ unknown) warn_msg "Unsupported distro: package install skipped" ;;
+ esac
+}
+
+! check_root && error_msg "You need to be root to run this script."
+create_out_dir "${OUTPUT}"
+# shellcheck disable=SC2164
+cd "${OUTPUT}"
+
+install
+
+if [ -d "${KSELFTEST_PATH}" ]; then
+ echo "kselftests found on rootfs"
+ # shellcheck disable=SC2164
+ cd "${KSELFTEST_PATH}"
+else
+ # Download and extract kselftest tarball.
+ wget http://testdata.validation.linaro.org/tests/kselftest/"${TESTPROG}" -O kselftest.tar.gz
+ tar xf "kselftest.tar.gz"
+ # shellcheck disable=SC2164
+ cd "kselftest"
+fi
+
+# run_kselftest.sh file generated by kselftest Makefile and included in tarball
+./run_kselftest.sh 2>&1 | tee "${LOGFILE}"
+parse_output
diff --git a/automated/linux/kselftest/kselftest.yaml b/automated/linux/kselftest/kselftest.yaml
new file mode 100644
index 0000000..323d3d2
--- /dev/null
+++ b/automated/linux/kselftest/kselftest.yaml
@@ -0,0 +1,28 @@
+metadata:
+ name: kselftest
+ format: "Lava-Test-Shell Test Definition 1.0"
+ description: "Linux kernel self test"
+ maintainer:
+ - naresh.kamboju@linaro.org
+ os:
+ - debian
+ - ubuntu
+ - fedora
+ - centos
+ scope:
+ - functional
+ devices:
+ - all
+
+params:
+ # Specify Linux kernel self test pre-build tarball name from below location
+ # http://testdata.validation.linaro.org/tests/kselftest/
+ # TESTPROG: kselftest_aarch64.tar.gz
+ TESTPROG: kselftest_armhf.tar.gz
+ SKIP_INSTALL: "false"
+
+run:
+ steps:
+ - cd ./automated/linux/kselftest/
+ - ./kselftest.sh -t "${TESTPROG}" -s "${SKIP_INSTALL}"
+ - ../../utils/send-to-lava.sh ./output/result.txt