From 5850561b05bd5bd16b2d02d0c4c4efc705543139 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 9 Mar 2023 22:00:08 +0000 Subject: [PATCH] core-image-ptest: Switch to BBCLASSEXTEND parallel execution 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. (From OE-Core rev: f3f63ff01971df7d67213a7e7b1294489a5d3c0f) Signed-off-by: Richard Purdie --- .../images/core-image-ptest-all.bb | 38 +++++++++--------- .../images/core-image-ptest-fast.bb | 24 ++---------- meta/recipes-core/images/core-image-ptest.bb | 39 +++++++++++++++++++ 3 files changed, 61 insertions(+), 40 deletions(-) create mode 100644 meta/recipes-core/images/core-image-ptest.bb diff --git a/meta/recipes-core/images/core-image-ptest-all.bb b/meta/recipes-core/images/core-image-ptest-all.bb index 1472451675..81c9b2d68a 100644 --- a/meta/recipes-core/images/core-image-ptest-all.bb +++ b/meta/recipes-core/images/core-image-ptest-all.bb @@ -1,25 +1,25 @@ -inherit features_check -REQUIRED_DISTRO_FEATURES = "ptest" - -require core-image-minimal.bb -require conf/distro/include/ptest-packagelists.inc - -DESCRIPTION += "Also includes ptest packages." +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 conf/distro/include/ptest-packagelists.inc + # Include the full set of ptests -IMAGE_INSTALL += "${PTESTS_FAST} ${PTESTS_SLOW}" +PTESTS = "${PTESTS_FAST} ${PTESTS_SLOW}" -# 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_testimage[noexec] = "1" +do_testimage[depends] = "${@' '.join(['core-image-ptest-'+x.replace('-ptest', '')+':do_testimage' 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" +do_build[depends] = "${@' '.join(['core-image-ptest-'+x.replace('-ptest', '')+':do_build' for x in d.getVar('PTESTS').split()])}" -# Sadly at the moment the full set of ptests is not robust enough and sporadically fails in random places -PTEST_EXPECT_FAILURE = "1" +# 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/recipes-core/images/core-image-ptest-fast.bb b/meta/recipes-core/images/core-image-ptest-fast.bb index 40df274c4c..e768afb302 100644 --- a/meta/recipes-core/images/core-image-ptest-fast.bb +++ b/meta/recipes-core/images/core-image-ptest-fast.bb @@ -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 index 0000000000..0c67943b05 --- /dev/null +++ b/meta/recipes-core/images/core-image-ptest.bb @@ -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") +} +