[Fuego] [PATCH] kselftest: add linux kernel selftests to fuego
Daniel Sangorrin
daniel.sangorrin at toshiba.co.jp
Mon May 22 09:03:51 UTC 2017
This test has a very similar format to kernel_build but it
skips the build of the whole kernel and only builds the tests.
The test is working for me in docker.
Next, I want to cover corner cases such as support for different
kernel versions, support for build/run only specs, and improve
the specs by adding more cases and separating tests that
need root privileges from those that do not.
Signed-off-by: Daniel Sangorrin <daniel.sangorrin at toshiba.co.jp>
---
engine/tests/Functional.kselftest/fuego_test.sh | 41 +++++++++++++++++++++++++
engine/tests/Functional.kselftest/spec.json | 24 +++++++++++++++
2 files changed, 65 insertions(+)
create mode 100755 engine/tests/Functional.kselftest/fuego_test.sh
create mode 100644 engine/tests/Functional.kselftest/spec.json
diff --git a/engine/tests/Functional.kselftest/fuego_test.sh b/engine/tests/Functional.kselftest/fuego_test.sh
new file mode 100755
index 0000000..9ab08f5
--- /dev/null
+++ b/engine/tests/Functional.kselftest/fuego_test.sh
@@ -0,0 +1,41 @@
+function test_build {
+ # default architecture
+ if [ -z ${FUNCTIONAL_KSELFTEST_ARCH+x} ]; then
+ FUNCTIONAL_KSELFTEST_ARCH="x86_64"
+ fi
+
+ # cross-compiler platform
+ if [ ! -z ${FUNCTIONAL_KSELFTEST_PLATFORM+x} ]; then
+ OLD_PLATFORM=$PLATFORM
+ PLATFORM=$FUNCTIONAL_KSELFTEST_PLATFORM
+ source $FUEGO_RO/toolchains/tools.sh
+ PLATFORM=$OLD_PLATFORM
+ fi
+
+ make ARCH=$FUNCTIONAL_KSELFTEST_ARCH defconfig
+ make ARCH=$FUNCTIONAL_KSELFTEST_ARCH headers_install
+ make ARCH=$FUNCTIONAL_KSELFTEST_ARCH -C tools/testing/selftests
+}
+
+function test_deploy {
+ pushd tools/testing/selftests
+ mkdir fuego
+ # kselftest targets (see tools/testing/selftests/Makefile)
+ if [ ! -z ${FUNCTIONAL_KSELFTEST_TARGETS+x} ]; then
+ INSTALL_PATH=fuego make TARGETS="$FUNCTIONAL_KSELFTEST_TARGETS" install
+ else
+ INSTALL_PATH=fuego make install
+ fi
+ put ./fuego/* $BOARD_TESTDIR/fuego.$TESTDIR/
+ rm -rf fuego
+ popd
+}
+
+function test_run {
+ report "cd $BOARD_TESTDIR/fuego.$TESTDIR; ./run_kselftest.sh"
+}
+
+function test_processing {
+ echo "Processing kselftest log"
+ log_compare "$TESTDIR" "0" "^selftests: .* \[FAIL\]" "n"
+}
diff --git a/engine/tests/Functional.kselftest/spec.json b/engine/tests/Functional.kselftest/spec.json
new file mode 100644
index 0000000..c1d64ec
--- /dev/null
+++ b/engine/tests/Functional.kselftest/spec.json
@@ -0,0 +1,24 @@
+{
+ "testName": "Functional.kselftest",
+ "specs": {
+ "default": {
+ "gitrepo": "https://github.com/torvalds/linux.git"
+ },
+ "cip-x86": {
+ "gitrepo": "https://github.com/cip-project/linux-cip.git",
+ "targets": "memfd"
+ },
+ "cip-arm64": {
+ "gitrepo": "https://github.com/cip-project/linux-cip.git",
+ "platform": "aarch64",
+ "arch": "arm64"
+ },
+ "template": {
+ "gitrepo": "https://xxx/yyy.git",
+ "gitref": "my_tag_branch_or_commit_id",
+ "platform": "aarch64",
+ "arch": "arm64",
+ "targets": "breakpoints cpu-hotplug efivarfs exec firmware ftrace futex kcmp lib membarrier memfd memory-hotplug mount mqueue net powerpc pstore ptrace seccomp size static_keys sysctl timers user vm x86 zram"
+ }
+ }
+}
--
2.7.4
More information about the Fuego
mailing list