]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
core-image-ptest: Switch to BBCLASSEXTEND parallel execution
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 9 Mar 2023 22:00:08 +0000 (22:00 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 14 Mar 2023 07:16:29 +0000 (07:16 +0000)
Replace the two images where tests are run serially with an image
per ptest in the form core-image-ptest-XXX using class extensions.

The original two images are then replaced with dependencies on these
images. 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 indvidually.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/images/core-image-ptest-all.bb
meta/recipes-core/images/core-image-ptest-fast.bb
meta/recipes-core/images/core-image-ptest.bb [new file with mode: 0644]

index 1472451675e41f8af83cc598ed34e2f5c6c67807..81c9b2d68a1ab5f9f7e9220c0a6290e7460440e7 100644 (file)
@@ -1,25 +1,25 @@
-inherit features_check
+DESCRIPTION = "Recipe to trigger execution of all ptest images."
+HOMEPAGE = "https://www.yoctoproject.org/"
+
+LICENSE = "MIT"
+
+inherit features_check nopackages
 REQUIRED_DISTRO_FEATURES = "ptest"
 
-require core-image-minimal.bb
 require conf/distro/include/ptest-packagelists.inc
 
-DESCRIPTION += "Also includes ptest packages."
-HOMEPAGE = "https://www.yoctoproject.org/"
-
 # Include the full set of ptests
-IMAGE_INSTALL += "${PTESTS_FAST} ${PTESTS_SLOW}"
+PTESTS = "${PTESTS_FAST} ${PTESTS_SLOW}"
+
+do_testimage[noexec] = "1"
+do_testimage[depends] = "${@' '.join(['core-image-ptest-'+x.replace('-ptest', '')+':do_testimage' for x in d.getVar('PTESTS').split()])}"
 
-# This image is 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 just 1100MB.
-# strace-ptest in particular needs more than 500MB
-IMAGE_OVERHEAD_FACTOR = "1.0"
-IMAGE_ROOTFS_EXTRA_SPACE = "1124288"
+do_build[depends] = "${@' '.join(['core-image-ptest-'+x.replace('-ptest', '')+':do_build' for x in d.getVar('PTESTS').split()])}"
 
-# ptests need more memory than standard to avoid the OOM killer
-# also lttng-tools needs /tmp that has at least 2G
-QB_MEM = "-m 4096"
+# normally image.bbclass would do this
+EXCLUDE_FROM_WORLD = "1"
 
-# 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 bb.utils.contains('IMAGE_CLASSES', 'testimage', True, False, d):
+        bb.build.addtask("do_testimage", "", "", d)
+}
index 40df274c4c1587edb510ffe574d4f1053a164925..e768afb302b5c0de97d45c859b77d64510746e2b 100644 (file)
@@ -1,24 +1,6 @@
-inherit features_check
-REQUIRED_DISTRO_FEATURES = "ptest"
+require core-image-ptest-all.bb
 
-require core-image-minimal.bb
-require conf/distro/include/ptest-packagelists.inc
+DESCRIPTION = "Recipe to trigger execution of all fast ptest images."
 
-# Include only fast (< 30 sec) ptests
-IMAGE_INSTALL += "${PTESTS_FAST}"
+PTESTS = "${PTESTS_FAST}"
 
-DESCRIPTION += "Also includes ptest packages with fast execution times to allow for more automated QA."
-HOMEPAGE = "https://www.yoctoproject.org/"
-
-# This image is sufficiently large (~1.8GB) that it can't actually fit in a live
-# image (which has a 4GB limit), so nullify the overhead factor (1.3x out of the
-# box) and explicitly add just 1500MB.
-# strace-ptest in particular needs more than 500MB
-IMAGE_OVERHEAD_FACTOR = "1.0"
-IMAGE_ROOTFS_EXTRA_SPACE = "1524288"
-
-# ptests need more memory than standard to avoid the OOM killer
-QB_MEM = "-m 1024"
-
-# Sadly at the moment the fast set of ptests is not robust enough and sporadically fails in a couple of places
-PTEST_EXPECT_FAILURE = "1"
diff --git a/meta/recipes-core/images/core-image-ptest.bb b/meta/recipes-core/images/core-image-ptest.bb
new file mode 100644 (file)
index 0000000..0c67943
--- /dev/null
@@ -0,0 +1,39 @@
+inherit features_check
+REQUIRED_DISTRO_FEATURES = "ptest"
+
+require core-image-minimal.bb
+require conf/distro/include/ptest-packagelists.inc
+
+DESCRIPTION += "Also including the ${MCNAME} ptest package."
+HOMEPAGE = "https://www.yoctoproject.org/"
+
+PTESTS = "${PTESTS_SLOW} ${PTESTS_FAST}"
+
+IMAGE_INSTALL:append = " ${MCNAME}-ptest openssh"
+
+BBCLASSEXTEND = "${@' '.join(['mcextend:'+x.replace('-ptest', '') for x in d.getVar('PTESTS').split()])}"
+
+# The image can 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.
+# strace-ptest in particular needs more than 500MB
+IMAGE_OVERHEAD_FACTOR = "1.0"
+IMAGE_ROOTFS_EXTRA_SPACE = "324288"
+IMAGE_ROOTFS_EXTRA_SPACE:virtclass-mcextend-strace = "1024288"
+IMAGE_ROOTFS_EXTRA_SPACE:virtclass-mcextend-lttng-tools = "1524288"
+
+# ptests need more memory than standard to avoid the OOM killer
+QB_MEM = "-m 1024"
+QB_MEM:virtclass-mcextend-lttng-tools = "-m 4096"
+QB_MEM:virtclass-mcextend-python3-cryptography = "-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")
+}
+