From 04d06939bf4501d870bc85b4883c9a8909bfb847 Mon Sep 17 00:00:00 2001 From: Arthur She Date: Sun, 5 Oct 2014 09:47:25 -0700 Subject: kselftest: Add in kernel selftests Add cpu-hotplug, efivarfs, memory-hotplug, mqueue, net, ptrace, vm tests for both openembedded and ubuntu Change-Id: Ia0b77e6e287b66b07db295a6c9efcf56027cb969 --- common/scripts/kselftest-mqueue.sh | 31 ++++++++++++++++++++++ common/scripts/kselftest-net.sh | 25 ++++++++++++++++++ common/scripts/kselftest-runner.sh | 23 +++++++++++++++++ openembedded/kselftest-cpu-hotplug.yaml | 37 +++++++++++++++++++++++++++ openembedded/kselftest-efivarfs.yaml | 39 ++++++++++++++++++++++++++++ openembedded/kselftest-memory-hotplug.yaml | 38 +++++++++++++++++++++++++++ openembedded/kselftest-mqueue.yaml | 36 ++++++++++++++++++++++++++ openembedded/kselftest-net.yaml | 33 ++++++++++++++++++++++++ openembedded/kselftest-ptrace.yaml | 34 +++++++++++++++++++++++++ openembedded/kselftest-vm.yaml | 38 +++++++++++++++++++++++++++ ubuntu/kselftest-cpu-hotplug.yaml | 38 +++++++++++++++++++++++++++ ubuntu/kselftest-efivarfs.yaml | 41 ++++++++++++++++++++++++++++++ ubuntu/kselftest-memory-hotplug.yaml | 39 ++++++++++++++++++++++++++++ ubuntu/kselftest-mqueue.yaml | 41 ++++++++++++++++++++++++++++++ ubuntu/kselftest-net.yaml | 37 +++++++++++++++++++++++++++ ubuntu/kselftest-ptrace.yaml | 38 +++++++++++++++++++++++++++ ubuntu/kselftest-vm.yaml | 41 ++++++++++++++++++++++++++++++ 17 files changed, 609 insertions(+) create mode 100755 common/scripts/kselftest-mqueue.sh create mode 100755 common/scripts/kselftest-net.sh create mode 100755 common/scripts/kselftest-runner.sh create mode 100644 openembedded/kselftest-cpu-hotplug.yaml create mode 100644 openembedded/kselftest-efivarfs.yaml create mode 100644 openembedded/kselftest-memory-hotplug.yaml create mode 100644 openembedded/kselftest-mqueue.yaml create mode 100644 openembedded/kselftest-net.yaml create mode 100644 openembedded/kselftest-ptrace.yaml create mode 100644 openembedded/kselftest-vm.yaml create mode 100644 ubuntu/kselftest-cpu-hotplug.yaml create mode 100644 ubuntu/kselftest-efivarfs.yaml create mode 100644 ubuntu/kselftest-memory-hotplug.yaml create mode 100644 ubuntu/kselftest-mqueue.yaml create mode 100644 ubuntu/kselftest-net.yaml create mode 100644 ubuntu/kselftest-ptrace.yaml create mode 100644 ubuntu/kselftest-vm.yaml 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} + diff --git a/openembedded/kselftest-cpu-hotplug.yaml b/openembedded/kselftest-cpu-hotplug.yaml new file mode 100644 index 0000000..6891b4f --- /dev/null +++ b/openembedded/kselftest-cpu-hotplug.yaml @@ -0,0 +1,37 @@ +metadata: + name: kselftest-cpu-hotplug + format: "Lava-Test-Shell Test Definition 1.0" + description: + "These test code were came from kernel source KERNEL_SRC/tools/testing/selftests/ + For running this test, git is required in the rootfs" + maintainer: + - arthur.she@linaro.org + os: + - openembedded + devices: + - arndale + - beaglebone-black + - rtsm_fvp_base-aemv8a + scope: + - functional + +install: + git-repos: + - http://git.linaro.org/qa/kselftest.git + steps: + - 'cd kselftest' + - 'git checkout $BRANCH' + - 'make -C cpu-hotplug' +params: + BRANCH: master + +run: + steps: + - './common/scripts/kselftest-runner.sh cpu-hotplug ./kselftest/cpu-hotplug/on-off-test.sh' + +parse: + pattern: "^(?P[a-z_-]+):\\s\\[(?PPASS|FAIL|SKIP)\\]" + fixupdict: + FAIL: fail + PASS: pass + SKIP: skip diff --git a/openembedded/kselftest-efivarfs.yaml b/openembedded/kselftest-efivarfs.yaml new file mode 100644 index 0000000..ee8cf06 --- /dev/null +++ b/openembedded/kselftest-efivarfs.yaml @@ -0,0 +1,39 @@ +metadata: + name: kselftest-efivarfs + format: "Lava-Test-Shell Test Definition 1.0" + description: + "These test code were came from kernel source KERNEL_SRC/tools/testing/selftests/ + For running this test, git is required in the rootfs" + maintainer: + - arthur.she@linaro.org + os: + - openembedded + devices: + - arndale + - beaglebone-black + - rtsm_fvp_base-aemv8a + scope: + - functional + +install: + git-repos: + - http://git.linaro.org/qa/kselftest.git + steps: + - 'cd kselftest' + - 'git checkout $BRANCH' + - 'make -C efivarfs' + +params: + BRANCH: master + +run: + steps: + - './common/scripts/kselftest-runner.sh efivarfs ./kselftest/efivarfs/efivarfs.sh' + +parse: + pattern: "^(?P[a-z_-]+):\\s\\[(?PPASS|FAIL|SKIP)\\]" + fixupdict: + FAIL: fail + PASS: pass + SKIP: skip + diff --git a/openembedded/kselftest-memory-hotplug.yaml b/openembedded/kselftest-memory-hotplug.yaml new file mode 100644 index 0000000..c9ba063 --- /dev/null +++ b/openembedded/kselftest-memory-hotplug.yaml @@ -0,0 +1,38 @@ +metadata: + name: kselftest-memory-hotplug + format: "Lava-Test-Shell Test Definition 1.0" + description: + "These test code were came from kernel source KERNEL_SRC/tools/testing/selftests/ + For running this test, git is required in the rootfs" + maintainer: + - arthur.she@linaro.org + os: + - openembedded + devices: + - arndale + - beaglebone-black + - rtsm_fvp_base-aemv8a + scope: + - functional + +install: + git-repos: + - http://git.linaro.org/qa/kselftest.git + steps: + - 'cd kselftest' + - 'git checkout $BRANCH' + - 'make -C memory-hotplug' + +params: + BRANCH: master + +run: + steps: + - './common/scripts/kselftest-runner.sh memory-hotplug ./kselftest/memory-hotplug/on-off-test.sh' + +parse: + pattern: "^(?P[a-z_-]+):\\s\\[(?PPASS|FAIL|SKIP)\\]" + fixupdict: + FAIL: fail + PASS: pass + SKIP: skip diff --git a/openembedded/kselftest-mqueue.yaml b/openembedded/kselftest-mqueue.yaml new file mode 100644 index 0000000..e77c604 --- /dev/null +++ b/openembedded/kselftest-mqueue.yaml @@ -0,0 +1,36 @@ +metadata: + name: kselftest-mqueue + format: "Lava-Test-Shell Test Definition 1.0" + description: + "These test code were came from kernel source KERNEL_SRC/tools/testing/selftests/ + For running this test, git is required in the rootfs" + maintainer: + - arthur.she@linaro.org + os: + - openembedded + devices: + - arndale + - beaglebone-black + - rtsm_fvp_base-aemv8a + scope: + - functional + +install: + git-repos: + - http://git.linaro.org/qa/kselftest.git + steps: + - 'cd kselftest' + - 'git checkout $BRANCH' +params: + BRANCH: master + +run: + steps: + - './common/scripts/kselftest-mqueue.sh' + +parse: + pattern: "^(?P[A-Za-z0-9_>=/, ]+):[\\s]+(?PPASS|FAIL)" + fixupdict: + PASS: pass + FAIL: fail + diff --git a/openembedded/kselftest-net.yaml b/openembedded/kselftest-net.yaml new file mode 100644 index 0000000..fd5ccdc --- /dev/null +++ b/openembedded/kselftest-net.yaml @@ -0,0 +1,33 @@ +metadata: + name: kselftest-net + format: "Lava-Test-Shell Test Definition 1.0" + description: + "These test code were came from kernel source KERNEL_SRC/tools/testing/selftests/ + For running this test, git is required in the rootfs" + maintainer: + - arthur.she@linaro.org + os: + - openembedded + devices: + - arndale + - beaglebone-black + - rtsm_fvp_base-aemv8a + scope: + - functional + +install: + git-repos: + - http://git.linaro.org/qa/kselftest.git + steps: + - 'cd kselftest' + - 'git checkout $BRANCH' + - 'make -C net' +params: + BRANCH: master + +run: + steps: + - './common/scripts/kselftest-net.sh' + +parse: + pattern: "^(?P[a-z_]+):\\s(?Ppass|fail)" diff --git a/openembedded/kselftest-ptrace.yaml b/openembedded/kselftest-ptrace.yaml new file mode 100644 index 0000000..3c326bb --- /dev/null +++ b/openembedded/kselftest-ptrace.yaml @@ -0,0 +1,34 @@ +metadata: + name: kselftest-ptrace + format: "Lava-Test-Shell Test Definition 1.0" + description: + "These test code were came from kernel source KERNEL_SRC/tools/testing/selftests/ + For running this test, git is required in the rootfs" + maintainer: + - arthur.she@linaro.org + os: + - openembedded + devices: + - arndale + - beaglebone-black + - rtsm_fvp_base-aemv8a + scope: + - functional + +install: + git-repos: + - http://git.linaro.org/qa/kselftest.git + steps: + - 'cd kselftest' + - 'git checkout $BRANCH' + - 'sed -i "1s/^/CFLAGS = -DPAGE_SIZE=4096\n/" ptrace/Makefile' + - 'make -C ptrace' +params: + BRANCH: master + +run: + steps: + - './kselftest/ptrace/peeksiginfo && echo "peeksiginfo selftests: pass" || echo "peeksiginfo selftests: fail"' + +parse: + pattern: "^(?P[a-z_ ]+):\\s(?Ppass|fail)" diff --git a/openembedded/kselftest-vm.yaml b/openembedded/kselftest-vm.yaml new file mode 100644 index 0000000..d19255b --- /dev/null +++ b/openembedded/kselftest-vm.yaml @@ -0,0 +1,38 @@ +metadata: + name: kselftest-vm + format: "Lava-Test-Shell Test Definition 1.0" + description: + "These test code were came from kernel source KERNEL_SRC/tools/testing/selftests/ + For running this test, git is required in the rootfs" + maintainer: + - arthur.she@linaro.org + os: + - openembedded + devices: + - arndale + - beaglebone-black + - rtsm_fvp_base-aemv8a + scope: + - functional + +install: + git-repos: + - http://git.linaro.org/qa/kselftest.git + steps: + - 'cd kselftest' + - 'git checkout $BRANCH' + - 'make -C vm' +params: + BRANCH: master + +run: + steps: + - './common/scripts/kselftest-runner.sh vm ./kselftest/vm/run_vmtests' + +parse: + pattern: "^(?P[a-z_-]+):\\s\\[(?PPASS|FAIL|SKIP)\\]" + fixupdict: + FAIL: fail + PASS: pass + SKIP: skip + diff --git a/ubuntu/kselftest-cpu-hotplug.yaml b/ubuntu/kselftest-cpu-hotplug.yaml new file mode 100644 index 0000000..5a40ebb --- /dev/null +++ b/ubuntu/kselftest-cpu-hotplug.yaml @@ -0,0 +1,38 @@ +metadata: + name: kselftest-cpu-hotplug + format: "Lava-Test-Shell Test Definition 1.0" + description: + "These test code were came from kernel source KERNEL_SRC/tools/testing/selftests/ + For running this test, git is required in the rootfs" + maintainer: + - arthur.she@linaro.org + os: + - ubuntu + devices: + - arndale + - beaglebone-black + - rtsm_fvp_base-aemv8a + scope: + - functional + +install: + git-repos: + - http://git.linaro.org/qa/kselftest.git + steps: + - 'cd kselftest' + - 'git checkout $BRANCH' + deps: + - git +params: + BRANCH: master + +run: + steps: + - './common/scripts/kselftest-runner.sh cpu-hotplug ./kselftest/cpu-hotplug/on-off-test.sh' + +parse: + pattern: "^(?P[a-z_-]+):\\s\\[(?PPASS|FAIL|SKIP)\\]" + fixupdict: + FAIL: fail + PASS: pass + SKIP: skip diff --git a/ubuntu/kselftest-efivarfs.yaml b/ubuntu/kselftest-efivarfs.yaml new file mode 100644 index 0000000..2803727 --- /dev/null +++ b/ubuntu/kselftest-efivarfs.yaml @@ -0,0 +1,41 @@ +metadata: + name: kselftest-efivarfs + format: "Lava-Test-Shell Test Definition 1.0" + description: + "These test code were came from kernel source KERNEL_SRC/tools/testing/selftests/ + For running this test, git is required in the rootfs" + maintainer: + - arthur.she@linaro.org + os: + - ubuntu + devices: + - arndale + - beaglebone-black + - rtsm_fvp_base-aemv8a + scope: + - functional + +install: + git-repos: + - http://git.linaro.org/qa/kselftest.git + steps: + - 'cd kselftest' + - 'git checkout $BRANCH' + - 'make -C efivarfs' + deps: + - git + - build-essential + +params: + BRANCH: master + +run: + steps: + - './common/scripts/kselftest-runner.sh efivarfs ./kselftest/efivarfs/efivarfs.sh' + +parse: + pattern: "^(?P[a-z_-]+):\\s\\[(?PPASS|FAIL|SKIP)\\]" + fixupdict: + FAIL: fail + PASS: pass + SKIP: skip diff --git a/ubuntu/kselftest-memory-hotplug.yaml b/ubuntu/kselftest-memory-hotplug.yaml new file mode 100644 index 0000000..2ed64f7 --- /dev/null +++ b/ubuntu/kselftest-memory-hotplug.yaml @@ -0,0 +1,39 @@ +metadata: + name: kselftest-memory-hotplug + format: "Lava-Test-Shell Test Definition 1.0" + description: + "These test code were came from kernel source KERNEL_SRC/tools/testing/selftests/ + For running this test, git is required in the rootfs" + maintainer: + - arthur.she@linaro.org + os: + - ubuntu + devices: + - arndale + - beaglebone-black + - rtsm_fvp_base-aemv8a + scope: + - functional + +install: + git-repos: + - http://git.linaro.org/qa/kselftest.git + steps: + - 'cd kselftest' + - 'git checkout $BRANCH' + deps: + - git + +params: + BRANCH: master + +run: + steps: + - './common/scripts/kselftest-runner.sh memory-hotplug ./kselftest/memory-hotplug/on-off-test.sh' + +parse: + pattern: "^(?P[a-z_-]+):\\s\\[(?PPASS|FAIL|SKIP)\\]" + fixupdict: + FAIL: fail + PASS: pass + SKIP: skip diff --git a/ubuntu/kselftest-mqueue.yaml b/ubuntu/kselftest-mqueue.yaml new file mode 100644 index 0000000..6d2b1a7 --- /dev/null +++ b/ubuntu/kselftest-mqueue.yaml @@ -0,0 +1,41 @@ +metadata: + name: kselftest-mqueue + format: "Lava-Test-Shell Test Definition 1.0" + description: + "These test code were came from kernel source KERNEL_SRC/tools/testing/selftests/ + For running this test, git is required in the rootfs" + maintainer: + - arthur.she@linaro.org + os: + - ubuntu + devices: + - arndale + - beaglebone-black + - rtsm_fvp_base-aemv8a + scope: + - functional + +install: + git-repos: + - http://git.linaro.org/qa/kselftest.git + steps: + - 'cd kselftest' + - 'git checkout $BRANCH' + deps: + - git + - build-essential + - wget + +params: + BRANCH: master + +run: + steps: + - './common/scripts/kselftest-mqueue.sh' + +parse: + pattern: "^(?P[A-Za-z0-9_>=/, ]+):[\\s]+(?PPASS|FAIL)" + fixupdict: + PASS: pass + FAIL: fail + diff --git a/ubuntu/kselftest-net.yaml b/ubuntu/kselftest-net.yaml new file mode 100644 index 0000000..30e440d --- /dev/null +++ b/ubuntu/kselftest-net.yaml @@ -0,0 +1,37 @@ +metadata: + name: kselftest-net + format: "Lava-Test-Shell Test Definition 1.0" + description: + "These test code were came from kernel source KERNEL_SRC/tools/testing/selftests/ + For running this test, git is required in the rootfs" + maintainer: + - arthur.she@linaro.org + os: + - ubuntu + devices: + - arndale + - beaglebone-black + - rtsm_fvp_base-aemv8a + scope: + - functional + +install: + git-repos: + - http://git.linaro.org/qa/kselftest.git + steps: + - 'cd kselftest' + - 'git checkout $BRANCH' + - 'make -C net' + deps: + - git + - build-essential + +params: + BRANCH: master + +run: + steps: + - './common/scripts/kselftest-net.sh' + +parse: + pattern: "^(?P[a-z_]+):\\s(?Ppass|fail)" diff --git a/ubuntu/kselftest-ptrace.yaml b/ubuntu/kselftest-ptrace.yaml new file mode 100644 index 0000000..1a63860 --- /dev/null +++ b/ubuntu/kselftest-ptrace.yaml @@ -0,0 +1,38 @@ +metadata: + name: kselftest-ptrace + format: "Lava-Test-Shell Test Definition 1.0" + description: + "These test code were came from kernel source KERNEL_SRC/tools/testing/selftests/ + For running this test, git is required in the rootfs" + maintainer: + - arthur.she@linaro.org + os: + - ubuntu + devices: + - arndale + - beaglebone-black + - rtsm_fvp_base-aemv8a + scope: + - functional + +install: + git-repos: + - http://git.linaro.org/qa/kselftest.git + steps: + - 'cd kselftest' + - 'git checkout $BRANCH' + - 'sed -i "1s/^/CFLAGS = -DPAGE_SIZE=4096\n/" ptrace/Makefile' + - 'make -C ptrace' + deps: + - git + - build-essential + +params: + BRANCH: master + +run: + steps: + - './kselftest/ptrace/peeksiginfo && echo "peeksiginfo selftests: pass" || echo "peeksiginfo selftests: fail"' + +parse: + pattern: "^(?P[a-z_ ]+):\\s(?Ppass|fail)" diff --git a/ubuntu/kselftest-vm.yaml b/ubuntu/kselftest-vm.yaml new file mode 100644 index 0000000..8228ad4 --- /dev/null +++ b/ubuntu/kselftest-vm.yaml @@ -0,0 +1,41 @@ +metadata: + name: kselftest-vm + format: "Lava-Test-Shell Test Definition 1.0" + description: + "These test code were came from kernel source KERNEL_SRC/tools/testing/selftests/ + For running this test, git is required in the rootfs" + maintainer: + - arthur.she@linaro.org + os: + - ubuntu + devices: + - arndale + - beaglebone-black + - rtsm_fvp_base-aemv8a + scope: + - functional + +install: + git-repos: + - http://git.linaro.org/qa/kselftest.git + steps: + - 'cd kselftest' + - 'git checkout $BRANCH' + - 'make -C vm' + deps: + - git + - build-essential + +params: + BRANCH: master + +run: + steps: + - './common/scripts/kselftest-runner.sh vm ./kselftest/vm/run_vmtests' + +parse: + pattern: "^(?P[a-z_-]+):\\s\\[(?PPASS|FAIL|SKIP)\\]" + fixupdict: + FAIL: fail + PASS: pass + SKIP: skip -- cgit v1.2.3