summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorArthur She <arthur.she@linaro.org>2014-10-05 09:47:25 -0700
committerMilosz Wasilewski <milosz.wasilewski@linaro.org>2014-10-15 11:16:58 +0000
commit04d06939bf4501d870bc85b4883c9a8909bfb847 (patch)
treea5a7742629b871769c1b8ea7380514254beade22 /common
parent162ae95f869984b1a5cc13fee402261d27913b90 (diff)
kselftest: Add in kernel selftests
Add cpu-hotplug, efivarfs, memory-hotplug, mqueue, net, ptrace, vm tests for both openembedded and ubuntu Change-Id: Ia0b77e6e287b66b07db295a6c9efcf56027cb969
Diffstat (limited to 'common')
-rwxr-xr-xcommon/scripts/kselftest-mqueue.sh31
-rwxr-xr-xcommon/scripts/kselftest-net.sh25
-rwxr-xr-xcommon/scripts/kselftest-runner.sh23
3 files changed, 79 insertions, 0 deletions
diff --git a/common/scripts/kselftest-mqueue.sh b/common/scripts/kselftest-mqueue.sh
new file mode 100755
index 0000000..546a596
--- /dev/null
+++ b/common/scripts/kselftest-mqueue.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+cd $(dirname $0)
+BASEDIR=$(pwd)
+LAVA_ROOT="${BASEDIR}/../.."
+TEST_DIR="${LAVA_ROOT}/kselftest/mqueue"
+
+#### Test mq_open_tests ########
+echo
+echo "Test mq_open_tests"
+echo
+cd ${TEST_DIR}
+gcc -O2 mq_open_tests.c -o mq_open_tests -lrt
+./mq_open_tests /test1 || echo "mq_open_tests: FAIL"
+
+#### Test mq_perf_tests ########
+echo
+echo "Test mq_perf_tests"
+echo
+# Build libpopt
+cd ${LAVA_ROOT}
+wget http://rpm5.org/files/popt/popt-1.16.tar.gz -O - | tar zxf -
+cd popt-1.16
+# Due to the config.guess doesn't support aarch64 yet. We have to specify system type
+[ `uname -m` = "aarch64" ] && BUILD="--build=aarch64-unknown-linux-gnu"
+./configure ${BUILD} --prefix=/usr
+make install
+cd ${TEST_DIR}
+gcc -O2 -o mq_perf_tests mq_perf_tests.c -lrt -lpthread -lpopt
+./mq_perf_tests || echo "mq_perf_tests: FAIL"
+
diff --git a/common/scripts/kselftest-net.sh b/common/scripts/kselftest-net.sh
new file mode 100755
index 0000000..a19696a
--- /dev/null
+++ b/common/scripts/kselftest-net.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+cd $(dirname $0)
+BASEDIR=$(pwd)
+LAVA_ROOT="${BASEDIR}/../.."
+TEST_DIR="${LAVA_ROOT}/kselftest/net"
+TESTS="socket psock_fanout psock_tpacket"
+
+cd ${TEST_DIR}
+
+if /sbin/modprobe test_bpf; then
+ /sbin/rmmod test_bpf;
+ echo "test_bpf: pass";
+else
+ echo "test_bpf: fail";
+fi
+
+for t in $TESTS
+do
+ echo
+ echo "Running $t";
+ ./$t;
+ [ $? -ne 0 ] && echo "$t: fail" || echo "$t: pass";
+done
+
diff --git a/common/scripts/kselftest-runner.sh b/common/scripts/kselftest-runner.sh
new file mode 100755
index 0000000..f1526ac
--- /dev/null
+++ b/common/scripts/kselftest-runner.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+TEST_NAME=$1
+COMMAND=$(basename $2)
+DIR=$(dirname $2)
+LOG="result.log";
+
+cd ${DIR}
+chmod a+x ${COMMAND}
+(./${COMMAND} 2>&1 || echo "${TEST_NAME}: [FAIL]") | tee ${LOG}
+if [ -n "`grep \"skip\" ${LOG}`" ]; then
+ echo "${TEST_NAME}: [SKIP]";
+elif [ -z "`grep \"SKIP\|FAIL\" ${LOG}`" ]; then
+ echo "${TEST_NAME}: [PASS]"
+fi
+
+while read l;
+do
+ [ -n "`echo $l|grep 'running'`" ] && test="`echo $l|sed 's/running //'`"
+ [ -n "`echo $l|grep \"\[PASS\|FAIL\|SKIP\"`" ] && result=$l
+ [ "${test}" -a "${result}" ] && echo "${test}: ${result}" && unset test && unset result
+done < ${LOG}
+