summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xopenembedded/scripts/fuzz-test.sh28
-rw-r--r--openembedded/trinity.yaml33
2 files changed, 61 insertions, 0 deletions
diff --git a/openembedded/scripts/fuzz-test.sh b/openembedded/scripts/fuzz-test.sh
new file mode 100755
index 0000000..386d2a8
--- /dev/null
+++ b/openembedded/scripts/fuzz-test.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+#set -x
+
+DURATION=$1
+LOGFILE=$2
+RESULT_PASS_FILE="./trinity-result-pass"
+
+if [ -f ${RESULT_PASS_FILE} ]; then
+ rm -f ${RESULT_PASS_FILE}
+fi
+if [ -f zip_log ]; then
+ rm -f zip_log
+fi
+mkfifo zip_log
+(gzip -c < zip_log > ${LOGFILE}) &
+
+echo -e "DURATION: ${DURATION}"
+# Send SIGKILL to trinity processes after DURATION seconds
+(sleep ${DURATION} ; for p in `pgrep trinity`;do [ ! -f ${RESULT_PASS_FILE} ] && touch ${RESULT_PASS_FILE} ; kill -9 $p; done) &
+# Remove non-printable ASCII characters by tr
+./trinity/trinity -m --dangerous | tr -cd '\11\12\15\40-\176' | tee zip_log
+
+if [ -f ${RESULT_PASS_FILE} ]; then
+ exit 0
+else
+ exit 1
+fi
diff --git a/openembedded/trinity.yaml b/openembedded/trinity.yaml
new file mode 100644
index 0000000..71d87b7
--- /dev/null
+++ b/openembedded/trinity.yaml
@@ -0,0 +1,33 @@
+metadata:
+ name: trinity
+ format: "Lava-Test-Shell Test Definition 1.0"
+ description:
+ "Trinity Test (http://codemonkey.org.uk/projects/trinity/)
+ It will test syscalls randomly with random arguments.
+ We will run the test for DURATION seconds. If the kernel
+ didn't crash or taint, it passes the test, otherwise, it failed.
+ IT MIGHT DAMAGE THE PLATFORM, SO IT'S BETTER TO RUN IT ON EMULATOR."
+ maintainer:
+ - arthur.she@linaro.org
+ os:
+ - openembedded
+ devices:
+ - rtsm_fvp_base-aemv8a
+ scope:
+ - functional
+
+install:
+ git-repos:
+ - https://github.com/kernelslacker/trinity.git
+
+params:
+ DURATION: 3600 # 1 hour
+
+run:
+ steps:
+ - 'cd trinity'
+ - './configure.sh'
+ - 'make'
+ - 'cd ..'
+ - 'lava-test-case trinity --shell ./openembedded/scripts/fuzz-test.sh $DURATION trinity.log.gz'
+ - 'lava-test-case-attach trinity trinity.log.gz'