oeqa/selftest/kernelmodulesplit: test cross-recipe kernel module dependencies
PATCH 1/1 oeqa/selftest/kernelmodulesplit: test cross-recipe kernel module dependencies
Add a selftest that exercises kernel module dependency generation across recipes. Two external module recipes are added to meta-selftest:
kernel-module-testfoo exports a symbol and kernel-module-testbar consumes it (DEPENDS on testfoo). The test builds both and asserts that the consumer's real, KERNEL_VERSION-suffixed package RDEPENDS the exporter's suffixed package - and not the empty unsuffixed kernel-module-testfoo package - and that the suffixed package RPROVIDES the unsuffixed virtual.
This is the failure mode originally reported in [YOCTO #12290], where the generated dependency resolved to the empty package after the KERNEL_VERSION suffix was introduced. It works on current master; this test guards against regressing it again.
The kernel version is derived from the produced package list rather than KERNEL_VERSION, which is unset at parse time when the modules are restored from sstate.
--- .../kernel-module-cross/files/Makefile.bar | 14 ++++ .../kernel-module-cross/files/Makefile.foo | 14 ++++ .../kernel-module-cross/files/testbar.c | 19 +++++ .../kernel-module-cross/files/testfoo.c | 23 ++++++ .../kernel-module-testbar_0.1.bb | 20 ++++++ .../kernel-module-testfoo_0.1.bb | 16 +++++ .../oeqa/selftest/cases/kernelmodulesplit.py | 72 +++++++++++++++++++ 7 files changed, 178 insertions(+) create mode 100644 meta-selftest/recipes-test/kernel-module-cross/files/Makefile.bar create mode 100644 meta-selftest/recipes-test/kernel-module-cross/files/Makefile.foo create mode 100644 meta-selftest/recipes-test/kernel-module-cross/files/testbar.c create mode 100644 meta-selftest/recipes-test/kernel-module-cross/files/testfoo.c create mode 100644 meta-selftest/recipes-test/kernel-module-cross/kernel-module-testbar_0.1.bb create mode 100644 meta-selftest/recipes-test/kernel-module-cross/kernel-module-testfoo_0.1.bb create mode 100644 meta/lib/oeqa/selftest/cases/kernelmodulesplit.py
meta-selftest/recipes-test/kernel-module-cross/files/Makefile.bar new file +14 -0
@@ -0,0 +1,14 @@ +obj-m := testbar.o + +SRC := $(shell pwd) + +all: + $(MAKE) -C $(KERNEL_SRC) M=$(SRC) + +modules_install: + $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install + +clean: + rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c *.mod + rm -f Module.markers Module.symvers modules.order + rm -rf .tmp_versions Modules.symvers
meta-selftest/recipes-test/kernel-module-cross/files/Makefile.foo new file +14 -0
@@ -0,0 +1,14 @@ +obj-m := testfoo.o + +SRC := $(shell pwd) + +all: + $(MAKE) -C $(KERNEL_SRC) M=$(SRC) + +modules_install: + $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install + +clean: + rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c *.mod + rm -f Module.markers Module.symvers modules.order + rm -rf .tmp_versions Modules.symvers
meta-selftest/recipes-test/kernel-module-cross/files/testbar.c new file +19 -0
@@ -0,0 +1,19 @@ +#include <linux/module.h> +#include <linux/init.h> + +extern int testfoo_value (void ); + +static int __init testbar_init (void ) +{ +pr_info ("testbar loaded, foo says %d\n" ,testfoo_value ()); +return 0 ; +} + +static void __exit testbar_exit(void) +{ +pr_info ("testbar unloaded\n" ); +} + +module_init (testbar_init); +module_exit (testbar_exit); +MODULE_LICENSE ("GPL" );
meta-selftest/recipes-test/kernel-module-cross/files/testfoo.c new file +23 -0
@@ -0,0 +1,23 @@ +#include <linux/module.h> +#include <linux/init.h> + +int testfoo_value (void ) +{ +return 42 ; +} +EXPORT_SYMBOL (testfoo_value); + +static int __init testfoo_init (void ) +{ +pr_info ("testfoo loaded\n" ); +return 0 ; +} + +static void __exit testfoo_exit(void) +{ +pr_info ("testfoo unloaded\n" ); +} + +module_init (testfoo_init); +module_exit (testfoo_exit); +MODULE_LICENSE ("GPL" );
meta-selftest/recipes-test/kernel-module-cross/kernel-module-testbar_0.1.bb new file +20 -0
@@ -0,0 +1,20 @@ +SUMMARY = "Cross-recipe kernel module dependency test: consumer (Bug 12290)" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6" + +inherit module + +# This pulls in foo's Module.symvers via KBUILD_EXTRA_SYMBOLS (module.bbclass +# __anonymous) so modpost records testfoo as a dependency of testbar. +DEPENDS = "kernel-module-testfoo" + +SRC_URI = "\ + file://testbar.c \ + file://Makefile.bar \ +" + +S = "${UNPACKDIR}" + +do_configure:prepend() { + cp ${UNPACKDIR}/Makefile.bar ${UNPACKDIR}/Makefile +}
meta-selftest/recipes-test/kernel-module-cross/kernel-module-testfoo_0.1.bb new file +16 -0
@@ -0,0 +1,16 @@ +SUMMARY = "Cross-recipe kernel module dependency test: exporter (Bug 12290)" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6" + +inherit module + +SRC_URI = "\ + file://testfoo.c \ + file://Makefile.foo \ +" + +S = "${UNPACKDIR}" + +do_configure:prepend() { + cp ${UNPACKDIR}/Makefile.foo ${UNPACKDIR}/Makefile +}
meta/lib/oeqa/selftest/cases/kernelmodulesplit.py new file +72 -0
72 lines not on this page · raw message
Signature · 1 line
2.34.1