summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChase Qi <chase.qi@linaro.org>2018-05-03 17:14:27 +0800
committerChase Qi <chase.qi@linaro.org>2018-05-03 19:41:26 +0800
commit7852364a89a23b8c0dffd7dd472efda2b20aba07 (patch)
tree83f33abc8753ac68581e27ff2a41798831a80b4a
parent0a100863cbcb1c31543c607d5df36f009c499a3b (diff)
automated/linux: add memtester
* Migrated from android/memtester.yaml * Add memory size and test iteration params * Rewrite test parser to catch all tests Change-Id: Ie534e88ab125fe9f6c57f99afb68ad1d42932d42 Signed-off-by: Chase Qi <chase.qi@linaro.org>
-rwxr-xr-xautomated/linux/memtester/memtester.sh63
-rw-r--r--automated/linux/memtester/memtester.yaml29
2 files changed, 92 insertions, 0 deletions
diff --git a/automated/linux/memtester/memtester.sh b/automated/linux/memtester/memtester.sh
new file mode 100755
index 0000000..54e80a1
--- /dev/null
+++ b/automated/linux/memtester/memtester.sh
@@ -0,0 +1,63 @@
+#!/bin/sh -e
+
+# shellcheck disable=SC1091
+. ../../lib/sh-test-lib
+OUTPUT="$(pwd)/output"
+RESULT_FILE="${OUTPUT}/result.txt"
+export RESULT_FILE
+MEMORY='1M'
+ITERATIONS=1
+
+usage() {
+ echo "Usage: $0 [-s <true|false>] [-m memory] [-i iterations]" 1>&2
+ exit 1
+}
+
+while getopts "s:m:i:h" o; do
+ case "$o" in
+ s) SKIP_INSTALL="${OPTARG}" ;;
+ m) MEMORY="${OPTARG}" ;;
+ i) ITERATIONS="${OPTARG}" ;;
+ *) usage ;;
+ esac
+done
+
+install() {
+ dist_name
+ # shellcheck disable=SC2154
+ case "${dist}" in
+ debian|ubuntu) install_deps "memtester" "${SKIP_INSTALL}";;
+ unknown) warn_msg "Unsupported distro: package install skipped" ;;
+ esac
+}
+
+parser() {
+ test_log="$1"
+ if [ "${ITERATIONS}" -gt 1 ]; then
+ suffix="-iter$2"
+ else
+ suffix=""
+ fi
+
+ # The follow lines:
+ # Remove redundant spaces.
+ # Replace ok with pass.
+ # Replace spaces in test case name with minus.
+ # Save test results like 'Stuck-Address pass' to result file.
+ grep ': ok' "${test_log}" \
+ | sed 's/^ *//g; s/ *: ok/:pass/g; s/ /-/g' \
+ | awk -v suffix="${suffix}" -F':' '{printf("%s%s %s\n",$1,suffix,$2)}' \
+ | tee -a "$RESULT_FILE"
+}
+
+create_out_dir "${OUTPUT}"
+install
+for i in $(seq "${ITERATIONS}"); do
+ output="${OUTPUT}/memtester-iter$i.txt"
+
+ memtester "${MEMORY}" 1 \
+ | sed 's/:.*ok/: ok/g' \
+ | tee "${output}"
+
+ parser "${output}" "$i"
+done
diff --git a/automated/linux/memtester/memtester.yaml b/automated/linux/memtester/memtester.yaml
new file mode 100644
index 0000000..d5407e7
--- /dev/null
+++ b/automated/linux/memtester/memtester.yaml
@@ -0,0 +1,29 @@
+metadata:
+ format: "Lava-Test Test Definition 1.0"
+ name: memtester
+ description: "Stress test to find memory subsystem faults"
+ maintainer:
+ - chase.qi@linaro.org
+ os:
+ - debian
+ - ubuntu
+ - openembedded
+ scope:
+ - functional
+ - stress
+ devices:
+ - hi6220-hikey
+ - apq8016-sbc
+
+parameters:
+ SKIP_INSTALL: "False"
+ # The amount of memory to allocate and test.
+ MEMORY: "1M"
+ # Number of loops to iterate through.
+ ITERATIONS: 1
+
+run:
+ steps:
+ - cd ./automated/linux/memtester/
+ - ./memtester.sh -s "${SKIP_INSTALL}" -m "${MEMORY}" -i "${ITERATIONS}"
+ - ../../utils/send-to-lava.sh ./output/result.txt