[SRU][U/F/E/B][PATCH 1/1] UBUNTU: [Packaging] add support to compile/run selftests

Kleber Sacilotto de Souza kleber.souza at canonical.com
Wed Apr 22 16:40:39 UTC 2020


BugLink: https://bugs.launchpad.net/bugs/1874286

Add some simple debian/rules targets that will keep a list of the
selftests that Ubuntu cares about, compile and run them. This can be
plugged into our test build infrastructure in order to compile the
testcases before we close and package a release.

Signed-off-by: Kleber Sacilotto de Souza <kleber.souza at canonical.com>
---
 debian/rules.d/0-common-vars.mk |  3 +++
 debian/rules.d/1-maintainer.mk  | 13 +++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/debian/rules.d/0-common-vars.mk b/debian/rules.d/0-common-vars.mk
index bcab5749f8aa..bcfbc497d78c 100644
--- a/debian/rules.d/0-common-vars.mk
+++ b/debian/rules.d/0-common-vars.mk
@@ -255,3 +255,6 @@ LN = ln -sf
 # flavour as arguments.
 custom_override = \
  $(shell if [ -n "$($(1)_$(2))" ]; then echo "$($(1)_$(2))"; else echo "$($(1))"; fi)
+
+# selftests that Ubuntu cares about
+ubuntu_selftests = breakpoints bpf cpu-hotplug efivarfs memfd memory-hotplug mount net ptrace seccomp timers powerpc user ftrace
diff --git a/debian/rules.d/1-maintainer.mk b/debian/rules.d/1-maintainer.mk
index 828e47bc1330..339fe9c8953e 100644
--- a/debian/rules.d/1-maintainer.mk
+++ b/debian/rules.d/1-maintainer.mk
@@ -26,6 +26,10 @@ help:
 	@echo
 	@echo "  diffupstream    : Diff stock kernel code against upstream (git)"
 	@echo
+	@echo "  compileselftests : Only compile the selftests listed on ubuntu_selftests variable"
+	@echo
+	@echo "  runselftests    : Run the selftests listed on ubuntu_selftests variable"
+	@echo
 	@echo "  help            : If you are kernel hacking, you need the professional"
 	@echo "                    version of this"
 	@echo
@@ -68,6 +72,7 @@ printenv:
 	@echo "skipdbg           = $(skipdbg)"
 	@echo "ubuntu_log_opts   = $(ubuntu_log_opts)"
 	@echo "CONCURRENCY_LEVEL = $(CONCURRENCY_LEVEL)"
+	@echo "ubuntu_selftests  = $(ubuntu_selftests)"
 	@echo "bin package name  = $(bin_pkg_name)"
 	@echo "hdr package name  = $(hdrs_pkg_name)"
 	@echo "doc package name  = $(doc_pkg_name)"
@@ -159,3 +164,11 @@ startnewrelease:
 	cat $(DEBIAN)/changelog >> $(DEBIAN)/changelog.new; \
 	mv $(DEBIAN)/changelog.new $(DEBIAN)/changelog
 
+compileselftests:
+	# a loop is needed here to fail on errors
+	for test in $(ubuntu_selftests); do \
+		$(kmake) -C tools/testing/selftests TARGETS="$$test"; \
+	done;
+
+runselftests:
+	$(kmake) -C tools/testing/selftests TARGETS="$(ubuntu_selftests)" run_tests
-- 
2.20.1




More information about the kernel-team mailing list