diff options
author | Chase Qi <chase.qi@linaro.org> | 2017-04-18 17:27:28 +0800 |
---|---|---|
committer | Milosz Wasilewski <milosz.wasilewski@linaro.org> | 2017-05-04 18:06:56 +0000 |
commit | 04703e92503691595a9a441e2a33523d6e7a12bc (patch) | |
tree | a0e874109dd5a87f12a73afcea540f3574bb23d7 /automated | |
parent | c1fb98021774268382b94d5d0ef3f8e46f754f88 (diff) |
automated: linux: add rcutorture test
Change-Id: Idc1506e2025e26a6c6f361f78037a55c0672c974
Signed-off-by: Chase Qi <chase.qi@linaro.org>
Diffstat (limited to 'automated')
-rwxr-xr-x | automated/linux/rcutorture/rcutorture.sh | 76 | ||||
-rw-r--r-- | automated/linux/rcutorture/rcutorture.yaml | 36 |
2 files changed, 112 insertions, 0 deletions
diff --git a/automated/linux/rcutorture/rcutorture.sh b/automated/linux/rcutorture/rcutorture.sh new file mode 100755 index 0000000..a6201e1 --- /dev/null +++ b/automated/linux/rcutorture/rcutorture.sh @@ -0,0 +1,76 @@ +#!/bin/sh -e + +TEST_DIR=$(dirname "$(realpath "$0")") +OUTPUT="${TEST_DIR}/output" +RESULT_FILE="${OUTPUT}/result.txt" +export RESULT_FILE +LOGFILE="${OUTPUT}/dmesg-rcutorture.txt" +SKIP_INSTALL="false" +TORTURE_TIME="600" + +usage() { + echo "Usage: $0 [-s <skip_install>] [-t <rcutorture_time>]" 1>&2 + exit 1 +} + +while getopts ':s:t:' opt; do + case "${opt}" in + s) SKIP_INSTALL="${OPTARG}" ;; + t) TORTURE_TIME="${OPTARG}" ;; + *) usage ;; + esac +done + +# shellcheck disable=SC1090 +. "${TEST_DIR}/../../lib/sh-test-lib" + +! check_root && error_msg "Please run this script as root." +install_deps "gzip" "${SKIP_INSTALL}" +create_out_dir "${OUTPUT}" + +# Check kernel config. +if [ -f "/proc/config.gz" ]; then + test_cmd="gunzip -c /proc/config.gz | grep CONFIG_RCU_TORTURE_TEST=m" +elif [ -f "/boot/config-$(uname -r)" ]; then + test_cmd="grep CONFIG_RCU_TORTURE_TEST=m /boot/config-$(uname -r)" +fi +if [ -n "${test_cmd}" ]; then + tc_id="check-kernel-config" + skip_list="modprobe-rcutorture rctorture-start rmmod-rcutorture rcutorture-end" + run_test_case "${test_cmd}" "${tc_id}" "${skip_list}" +fi + +# Insert rcutoruture kernel module. +dmesg -c > /dev/null +if lsmod | grep rcutorture; then + rmmod rcutorture || true +fi +test_cmd="modprobe rcutorture" +tc_id="modprobe-rcutorture" +skip_list="rctorture-start rmmod-rcutorture rcutorture-end" +run_test_case "${test_cmd}" "${tc_id}" "${skip_list}" + +# Check if rcutoruture started. +sleep 10 +test_cmd="dmesg | grep 'rcu-torture:--- Start of test'" +tc_id="rcutorture-start" +skip_list="rmmod-rcutorture rcutorture-end" +run_test_case "${test_cmd}" "${tc_id}" "${skip_list}" +info_msg "Running rcutorture for ${TORTURE_TIME} seconds..." +sleep "${TORTURE_TIME}" + +# Remove rcutoruture kernel module. +test_cmd="rmmod rcutorture" +tc_id="rmmod-rcutorture" +skip_list="rcutorture-end" +run_test_case "${test_cmd}" "${tc_id}" "${skip_list}" + +# Check if rcutoruture test finished successfully. +sleep 10 +dmesg > "${LOGFILE}" +if grep 'rcu-torture:--- End of test: SUCCESS' "${LOGFILE}"; then + report_pass "rcutorture-end" +else + report_fail "rcutorture-end" + cat "${LOGFILE}" +fi diff --git a/automated/linux/rcutorture/rcutorture.yaml b/automated/linux/rcutorture/rcutorture.yaml new file mode 100644 index 0000000..83bdf9d --- /dev/null +++ b/automated/linux/rcutorture/rcutorture.yaml @@ -0,0 +1,36 @@ +metadata: + name: rcutorture + format: "Lava-Test-Shell Test Definition 1.0" + description: "RCU or Read-Copy Update Torture test for Linux Kernel." + 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 + + scope: + - functional + +params: + SKIP_INSTALL: "false" + TORTURE_TIME: 600 + +run: + steps: + - cd automated/linux/rcutorture + - ./rcutorture.sh -s "${SKIP_INSTALL}" -t "${TORTURE_TIME}" + - ../../utils/send-to-lava.sh ./output/result.txt |