diff mbox series

[meta-perl,11/11] meta-perl-ptest*-image: enable BBCLASSEXTEND parallel execution

Message ID 6ce55616d1db9dbd490032581f89e1033aad9bb3.1680473253.git.tim.orling@konsulko.com
State New
Headers show
Series [meta-oe,01/11] cli11: do not inherit ptest | expand

Commit Message

Tim Orling April 2, 2023, 10:29 p.m. UTC
Similar to "core-image-ptest: Switch to BBCLASSEXTEND parallel execution"

Refactor meta-perl-ptest-image.bb for an image per ptest in the form of
meta-perl-ptest-image-XXX using class extensions.

* Add meta-perl-ptest-all-image.bb depends on ALL meta-perl-ptest-image-XXX in meta-perl
* Add meta-perl-ptest-fast-image.bb depends on meta-perl ptests which take less than ~30s

This allows parallel execution of the tests.

The downside to this approach is the parsing time of an image generating
this number of class extensions is slow but making it easier to execute
and collect test data should outweigh that.

A useful advantage is that the dependencies of each ptest package are
checked/tested individually.

Add to local.conf:
IMAGE_CLASSES += "testimage"

All the meta-perl-ptest-image-XXX can be built with:
$ bitbake meta-perl-ptest-all-image

Subsequently, all the ptest images can be run with:
$ bitbake -c testimage meta-perl-ptest-all-image

You will likely want to limit the number of parallel image tests:

BB_NUMBER_THREADS = "4"

based on the number of TAP devices you have defined or the number of simultaneous
QEMU sessions your server can support.

Results can be summarized with:

$ resulttool report tmp/log/oeqa/testresults.json

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
---
 .../images/meta-perl-ptest-all-image.bb       | 25 ++++++++++++
 .../images/meta-perl-ptest-fast-image.bb      |  6 +++
 .../images/meta-perl-ptest-image.bb           | 38 +++++++++++++++++--
 3 files changed, 66 insertions(+), 3 deletions(-)
 create mode 100644 meta-perl/recipes-core/images/meta-perl-ptest-all-image.bb
 create mode 100644 meta-perl/recipes-core/images/meta-perl-ptest-fast-image.bb
diff mbox series

Patch

diff --git a/meta-perl/recipes-core/images/meta-perl-ptest-all-image.bb b/meta-perl/recipes-core/images/meta-perl-ptest-all-image.bb
new file mode 100644
index 000000000..236043c22
--- /dev/null
+++ b/meta-perl/recipes-core/images/meta-perl-ptest-all-image.bb
@@ -0,0 +1,25 @@ 
+DESCRIPTION = "Recipe to trigger execution of all meta-perl ptest images."
+HOMEPAGE = "https://www.openembedded.org/"
+
+LICENSE = "MIT"
+
+inherit features_check nopackages
+REQUIRED_DISTRO_FEATURES = "ptest"
+
+require conf/include/ptest-packagelists-meta-perl.inc
+
+# Include the full set of ptests
+PTESTS_META_PERL = "${PTESTS_FAST_META_PERL} ${PTESTS_SLOW_META_PERL}"
+
+do_testimage[noexec] = "1"
+do_testimage[depends] = "${@' '.join(['meta-perl-ptest-image-'+x+':do_testimage' for x in d.getVar('PTESTS_META_PERL').split()])}"
+
+do_build[depends] = "${@' '.join(['meta-perl-ptest-image-'+x+':do_build' for x in d.getVar('PTESTS_META_PERL').split()])}"
+
+# normally image.bbclass would do this
+EXCLUDE_FROM_WORLD = "1"
+
+python () {
+    if bb.utils.contains('IMAGE_CLASSES', 'testimage', True, False, d):
+        bb.build.addtask("do_testimage", "", "", d)
+}
diff --git a/meta-perl/recipes-core/images/meta-perl-ptest-fast-image.bb b/meta-perl/recipes-core/images/meta-perl-ptest-fast-image.bb
new file mode 100644
index 000000000..5d8afa08e
--- /dev/null
+++ b/meta-perl/recipes-core/images/meta-perl-ptest-fast-image.bb
@@ -0,0 +1,6 @@ 
+require meta-perl-ptest-all-image.bb
+
+DESCRIPTION = "Recipe to trigger execution of all fast meta-perl ptest images."
+
+PTESTS_META_PERL = "${PTESTS_FAST_META_PERL}"
+
diff --git a/meta-perl/recipes-core/images/meta-perl-ptest-image.bb b/meta-perl/recipes-core/images/meta-perl-ptest-image.bb
index a9b4cc3c7..7cca6402b 100644
--- a/meta-perl/recipes-core/images/meta-perl-ptest-image.bb
+++ b/meta-perl/recipes-core/images/meta-perl-ptest-image.bb
@@ -1,9 +1,41 @@ 
+inherit features_check
+REQUIRED_DISTRO_FEATURES += "ptest"
+
 require  meta-perl-base.bb
 
 SUMMARY = "meta-perl build ptest image"
 
-inherit features_check
+require conf/include/ptest-packagelists-meta-perl.inc
 
-REQUIRED_DISTRO_FEATURES += "ptest"
+DESCRIPTION += "Also including the ${MCNAME} ptest package."
+HOMEPAGE = "https://www.openembedded.org/"
+
+PTESTS_META_PERL = "${PTESTS_SLOW_META_PERL} ${PTESTS_FAST_META_PERL}"
+
+IMAGE_INSTALL:append = " ${MCNAME}-ptest openssh"
+
+BBCLASSEXTEND = "${@' '.join(['mcextend:'+x for x in d.getVar('PTESTS_META_PERL').split()])}"
+
+# The image can be sufficiently large (~1.8GB) that we need to be careful that it fits in a live
+# image (which has a 4GB limit), so nullify the overhead factor (1.3x out of the
+# box) and explicitly add up to 1500MB.
+IMAGE_OVERHEAD_FACTOR = "1.0"
+IMAGE_ROOTFS_EXTRA_SPACE = "324288"
+# If a particular ptest needs more space, it can be customized:
+#IMAGE_ROOTFS_EXTRA_SPACE:virtclass-mcextend-<pn> = "1024288"
+
+# ptests need more memory than standard to avoid the OOM killer
+QB_MEM = "-m 1024"
+# If a particular ptest needs more memory, it can be customized:
+#QB_MEM:virtclass-mcextend-<pn> = "-m 4096"
+
+TEST_SUITES = "ping ssh parselogs ptest"
+
+# Sadly at the moment the full set of ptests is not robust enough and sporadically fails in random places
+PTEST_EXPECT_FAILURE = "1"
+
+python () {
+    if not d.getVar("MCNAME"):
+        raise bb.parse.SkipRecipe("No class extension set")
+}
 
-IMAGE_INSTALL += "packagegroup-meta-perl-ptest"