Skip to contentSkip to conversation

testimage: enable artifacts retrieval for failed tests

PATCH In review Alexis Lothoré 4 participants 12 messages Feb 5, 2024 – Feb 6, 2024

lore
Share & tools
lore
#0 lore raw

v3 cover testimage: enable artifacts retrieval for failed tests

Hello,
this small series is a new version of failed ptests artifacts retrieval series.
The previous version can be found in [1]. This new version just fixes commit message as well as a patchtest error (commit subject length). With this series:
- "standard" images running tests leads to default artifact list being stored whenever a test fails
- if the image has ptest feature enabled, failed ptests directories will be retrieved
- artifacts lists can be customized: TESTIMAGE_FAILED_QA_ARTIFACTS:append = " <file1> <file2>..."

The feature has been tested with core-image-sato and core-image-ptest-fast (running only a subtests of configured tests)

[1] https://lore.kernel.org/openembedded-core/[email protected]/

Alexis Lothoré (2):
testimage: move TESTIMAGE_FAILED_QA_ARTIFACTS default to core-image
core-image-ptest: retrieve ptests directory when ptests fail

 meta/classes-recipe/core-image.bbclass       | 8 ++++++++
 meta/classes-recipe/testimage.bbclass        | 9 ---------
 meta/recipes-core/images/core-image-ptest.bb | 2 ++
 3 files changed, 10 insertions(+), 9 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH v3 1/2 testimage: move TESTIMAGE_FAILED_QA_ARTIFACTS default to core-image

From: Alexis Lothoré <[email protected]>

TESTIMAGE_FAILED_QA_ARTIFACTS currently sets a default list of files to be saved whenever some tests fail. Unfortunately, this default value is very easily discarded, because TESTIMAGE_FAILED_QA_ARTIFACTS is expected to be enriched by some core recipes (example: ptest images) which are often parsed before testimage.bbclass. Those core recipes could still manage to get the default value AND add some files by using override syntax, but then it makes it difficult for downstream recipes or bbappend files to tune this variable.

Allow to set this default value and make sure it is not overwritten by recipes wanting to tune it, by setting the default value in core-image, which is parsed early enough. While doing so, set it as a default value instead of a weak default value.

---
Changes in v3:
- fix commit subject length and content

Changes in v2:
- set the default value in core-image instead of core-image-minimal

---
 meta/classes-recipe/core-image.bbclass | 8 ++++++++
 meta/classes-recipe/testimage.bbclass  | 9 ---------
 2 files changed, 8 insertions(+), 9 deletions(-)
meta/classes-recipe/core-image.bbclass +8 -0
index 40fc15cb04f2..8ca64a95a318 100644
@@ -83,4 +83,12 @@ CORE_IMAGE_EXTRA_INSTALL ?= ""
 
 IMAGE_INSTALL ?= "${CORE_IMAGE_BASE_INSTALL}"
 
+# When any test fails, TESTIMAGE_FAILED_QA_ARTIFACTS will be parsed and for
+# each entry in it, if artifact pointed by path description exists on target,
+# it will be retrieved onto host
+TESTIMAGE_FAILED_QA_ARTIFACTS ?= "\
+    ${localstatedir}/log \
+    ${sysconfdir}/version \
+    ${sysconfdir}/os-release"
+
 inherit image
meta/classes-recipe/testimage.bbclass +0 -9
index f36d9418914f..cfda5b631ba8 100644
@@ -18,15 +18,6 @@ inherit image-artifact-names
 
 TESTIMAGE_AUTO ??= "0"
 
-# When any test fails, TESTIMAGE_FAILED_QA ARTIFACTS will be parsed and for
-# each entry in it, if artifact pointed by path description exists on target,
-# it will be retrieved onto host
-
-TESTIMAGE_FAILED_QA_ARTIFACTS ??= "\
-    ${localstatedir}/log \
-    ${sysconfdir}/version \
-    ${sysconfdir}/os-release"
-
 # You can set (or append to) TEST_SUITES in local.conf to select the tests
 # which you want to run for your target.
 # The test names are the module names in meta/lib/oeqa/runtime/cases.
Signature · 1 line
2.43.0
#2 lore raw

Patchtest results for [OE-Core][PATCH v3 1/2] testimage: move TESTIMAGE_FAILED_QA_ARTIFACTS default to core-image

Thank you for your submission. Patchtest identified one or more issues with the patch. Please see the log below for more information:

---

Testing patch /home/patchtest/share/mboxes/v3-1-2-testimage-move-TESTIMAGE_FAILED_QA_ARTIFACTS-default-to-core-image.patch

PASS: test Signed-off-by presence (test_mbox.TestMbox.test_signed_off_by_presence)
PASS: test author valid (test_mbox.TestMbox.test_author_valid)
PASS: test commit message presence (test_mbox.TestMbox.test_commit_message_presence)
PASS: test max line length (test_metadata.TestMetadata.test_max_line_length)
PASS: test mbox format (test_mbox.TestMbox.test_mbox_format)
PASS: test non-AUH upgrade (test_mbox.TestMbox.test_non_auh_upgrade)
PASS: test shortlog format (test_mbox.TestMbox.test_shortlog_format)
PASS: test shortlog length (test_mbox.TestMbox.test_shortlog_length)

SKIP: pretest pylint: No python related patches, skipping test (test_python_pylint.PyLint.pretest_pylint)
SKIP: pretest src uri left files: No modified recipes, skipping pretest (test_metadata.TestMetadata.pretest_src_uri_left_files)
SKIP: test CVE check ignore: No modified recipes, skipping test (test_metadata.TestMetadata.test_cve_check_ignore)
SKIP: test CVE tag format: No new CVE patches introduced (test_patch.TestPatch.test_cve_tag_format)
SKIP: test Signed-off-by presence: No new CVE patches introduced (test_patch.TestPatch.test_signed_off_by_presence)
SKIP: test Upstream-Status presence: No new CVE patches introduced (test_patch.TestPatch.test_upstream_status_presence_format)
SKIP: test bugzilla entry format: No bug ID found (test_mbox.TestMbox.test_bugzilla_entry_format)
SKIP: test lic files chksum modified not mentioned: No modified recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_modified_not_mentioned)
SKIP: test lic files chksum presence: No added recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_presence)
SKIP: test license presence: No added recipes, skipping test (test_metadata.TestMetadata.test_license_presence)
SKIP: test pylint: No python related patches, skipping test (test_python_pylint.PyLint.test_pylint)
SKIP: test series merge on head: Merge test is disabled for now (test_mbox.TestMbox.test_series_merge_on_head)
SKIP: test src uri left files: No modified recipes, skipping pretest (test_metadata.TestMetadata.test_src_uri_left_files)
SKIP: test summary presence: No added recipes, skipping test (test_metadata.TestMetadata.test_summary_presence)
SKIP: test target mailing list: Series merged, no reason to check other mailing lists (test_mbox.TestMbox.test_target_mailing_list)

---

Please address the issues identified and
submit a new revision of the patch, or alternatively, reply to this email with an explanation of why the patch should be accepted. If you believe these results are due to an error in patchtest, please submit a bug at https://bugzilla.yoctoproject.org/ (use the 'Patchtest' category under 'Yocto Project Subprojects'). For more information on specific failures, see: https://wiki.yoctoproject.org/wiki/Patchtest. Thank you!

#3 lore raw

Re: Patchtest results for [OE-Core][PATCH v3 1/2] testimage: move TESTIMAGE_FAILED_QA_ARTIFACTS default to core-image

Quoted 17 lines · Patchtest

Thank you for your submission. Patchtest identified one or more issues with the patch. Please see the log below for more information:

---

Testing patch /home/patchtest/share/mboxes/v3-1-2-testimage-move-TESTIMAGE_FAILED_QA_ARTIFACTS-default-to-core-image.patch

PASS: test Signed-off-by presence (test_mbox.TestMbox.test_signed_off_by_presence)
PASS: test author valid (test_mbox.TestMbox.test_author_valid)
PASS: test commit message presence (test_mbox.TestMbox.test_commit_message_presence)
PASS: test max line length (test_metadata.TestMetadata.test_max_line_length)
PASS: test mbox format (test_mbox.TestMbox.test_mbox_format)
PASS: test non-AUH upgrade (test_mbox.TestMbox.test_non_auh_upgrade)
PASS: test shortlog format (test_mbox.TestMbox.test_shortlog_format)
PASS: test shortlog length (test_mbox.TestMbox.test_shortlog_length)

Quoted 15 lines

SKIP: pretest pylint: No python related patches, skipping test (test_python_pylint.PyLint.pretest_pylint)
SKIP: pretest src uri left files: No modified recipes, skipping pretest (test_metadata.TestMetadata.pretest_src_uri_left_files)
SKIP: test CVE check ignore: No modified recipes, skipping test (test_metadata.TestMetadata.test_cve_check_ignore)
SKIP: test CVE tag format: No new CVE patches introduced (test_patch.TestPatch.test_cve_tag_format)
SKIP: test Signed-off-by presence: No new CVE patches introduced (test_patch.TestPatch.test_signed_off_by_presence)
SKIP: test Upstream-Status presence: No new CVE patches introduced (test_patch.TestPatch.test_upstream_status_presence_format)
SKIP: test bugzilla entry format: No bug ID found (test_mbox.TestMbox.test_bugzilla_entry_format)
SKIP: test lic files chksum modified not mentioned: No modified recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_modified_not_mentioned)
SKIP: test lic files chksum presence: No added recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_presence)
SKIP: test license presence: No added recipes, skipping test (test_metadata.TestMetadata.test_license_presence)
SKIP: test pylint: No python related patches, skipping test (test_python_pylint.PyLint.test_pylint)
SKIP: test series merge on head: Merge test is disabled for now (test_mbox.TestMbox.test_series_merge_on_head)
SKIP: test src uri left files: No modified recipes, skipping pretest (test_metadata.TestMetadata.test_src_uri_left_files)
SKIP: test summary presence: No added recipes, skipping test (test_metadata.TestMetadata.test_summary_presence)
SKIP: test target mailing list: Series merged, no reason to check other mailing lists (test_mbox.TestMbox.test_target_mailing_list)

This is odd. I think your patch is OK - patchtest looks for "FAIL" in the patch body, and must've gotten snagged on the subject line.

Quoted 20 lines

---

Please address the issues identified and
submit a new revision of the patch, or alternatively, reply to this email with an explanation of why the patch should be accepted. If you believe these results are due to an error in patchtest, please submit a bug at https://bugzilla.yoctoproject.org/ (use the 'Patchtest' category under 'Yocto Project Subprojects'). For more information on specific failures, see: https://wiki.yoctoproject.org/wiki/Patchtest. Thank you!

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#194944): https://lists.openembedded.org/g/openembedded-core/message/194944
Mute This Topic: https://lists.openembedded.org/mt/104177178/7611679
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#4 lore raw

Re: Patchtest results for [OE-Core][PATCH v3 1/2] testimage: move TESTIMAGE_FAILED_QA_ARTIFACTS default to core-image

Hello Trevor,

Quoted 2 lines · Trevor Gamblin

On 2024-02-05 09:50, Patchtest wrote:

[...]

Quoted 31 lines
Quoted 23 lines

SKIP: pretest pylint: No python related patches, skipping test (test_python_pylint.PyLint.pretest_pylint)
SKIP: pretest src uri left files: No modified recipes, skipping pretest (test_metadata.TestMetadata.pretest_src_uri_left_files)
SKIP: test CVE check ignore: No modified recipes, skipping test (test_metadata.TestMetadata.test_cve_check_ignore)
SKIP: test CVE tag format: No new CVE patches introduced (test_patch.TestPatch.test_cve_tag_format)
SKIP: test Signed-off-by presence: No new CVE patches introduced (test_patch.TestPatch.test_signed_off_by_presence)
SKIP: test Upstream-Status presence: No new CVE patches introduced (test_patch.TestPatch.test_upstream_status_presence_format)
SKIP: test bugzilla entry format: No bug ID found (test_mbox.TestMbox.test_bugzilla_entry_format)
SKIP: test lic files chksum modified not mentioned: No modified recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_modified_not_mentioned)
SKIP: test lic files chksum presence: No added recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_presence)
SKIP: test license presence: No added recipes, skipping test (test_metadata.TestMetadata.test_license_presence)
SKIP: test pylint: No python related patches, skipping test (test_python_pylint.PyLint.test_pylint)

Quoted 8 lines

SKIP: test series merge on head: Merge test is disabled for now (test_mbox.TestMbox.test_series_merge_on_head)
SKIP: test src uri left files: No modified recipes, skipping pretest (test_metadata.TestMetadata.test_src_uri_left_files)
SKIP: test summary presence: No added recipes, skipping test (test_metadata.TestMetadata.test_summary_presence)
SKIP: test target mailing list: Series merged, no reason to check other mailing lists (test_mbox.TestMbox.test_target_mailing_list)

Quoted 2 lines

This is odd. I think your patch is OK - patchtest looks for "FAIL" in the patch body, and must've gotten snagged on the subject line.

Yes, that is also my conclusion, and I have sent a small patch to address this:

https://lore.kernel.org/openembedded-core/[email protected]/T/#t

I realize that it would have been smart to Cc you on this patch, sorry for the miss.

Signature · 3 lines
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#5 lore raw

Re: [OE-Core][PATCH v3 1/2] testimage: move TESTIMAGE_FAILED_QA_ARTIFACTS default to core-image

In reply to Alexis Lothoré
Quoted 55 lines · Alexis Lothoré via lists.openembedded.org

From: Alexis Lothoré <[email protected]>

TESTIMAGE_FAILED_QA_ARTIFACTS currently sets a default list of files to be saved whenever some tests fail. Unfortunately, this default value is very easily discarded, because TESTIMAGE_FAILED_QA_ARTIFACTS is expected to be enriched by some core recipes (example: ptest images) which are often parsed before testimage.bbclass. Those core recipes could still manage to get the default value AND add some files by using override syntax, but then it makes it difficult for downstream recipes or bbappend files to tune this variable.

Allow to set this default value and make sure it is not overwritten by recipes wanting to tune it, by setting the default value in core-image, which is parsed early enough. While doing so, set it as a default value instead of a weak default value.

---
Changes in v3:
- fix commit subject length and content

Changes in v2:
- set the default value in core-image instead of core-image-minimal

---
 meta/classes-recipe/core-image.bbclass | 8 ++++++++
 meta/classes-recipe/testimage.bbclass  | 9 ---------
 2 files changed, 8 insertions(+), 9 deletions(-)
meta/classes-recipe/core-image.bbclass +8 -0
index 40fc15cb04f2..8ca64a95a318 100644
@@ -83,4 +83,12 @@ CORE_IMAGE_EXTRA_INSTALL ?= ""
 
 IMAGE_INSTALL ?= "${CORE_IMAGE_BASE_INSTALL}"
 
+# When any test fails, TESTIMAGE_FAILED_QA_ARTIFACTS will be parsed and for
+# each entry in it, if artifact pointed by path description exists on target,
+# it will be retrieved onto host
+TESTIMAGE_FAILED_QA_ARTIFACTS ?= "\
+    ${localstatedir}/log \
+    ${sysconfdir}/version \
+    ${sysconfdir}/os-release"
+
 inherit image
meta/classes-recipe/testimage.bbclass +0 -2
index f36d9418914f..cfda5b631ba8 100644
@@ -18,15 +18,6 @@ inherit image-artifact-names
 
 TESTIMAGE_AUTO ??= "0"
 
-# When any test fails, TESTIMAGE_FAILED_QA ARTIFACTS will be parsed and for
-# each entry in it, if artifact pointed by path description exists on target,

meta/classes-recipe/testimage.bbclass inherit image-artifact-names · line 23

Quoted 10 lines
meta/classes-recipe/testimage.bbclass +0 -7
-# it will be retrieved onto host
-
-TESTIMAGE_FAILED_QA_ARTIFACTS ??= "\
-    ${localstatedir}/log \
-    ${sysconfdir}/version \
-    ${sysconfdir}/os-release"
-
 # You can set (or append to) TEST_SUITES in local.conf to select the tests
 # which you want to run for your target.
 # The test names are the module names in meta/lib/oeqa/runtime/cases.

I can imagine why ??= breaks if you use +=.

Does this work if you change it from ??= to just = ?

I'd really prefer to keep this in testimage.bbclass. Recipes should be able to use += if it is set with = and the addition is after the class inherit.

Cheers,

Richard

#6 lore raw

Re: [OE-Core][PATCH v3 1/2] testimage: move TESTIMAGE_FAILED_QA_ARTIFACTS default to core-image

Hello Richard, thanks for the fast review

Quoted 2 lines · Richard Purdie

On Mon, 2024-02-05 at 15:37 +0100, Alexis Lothoré via lists.openembedded.org wrote:

[...]

Quoted 11 lines

meta/classes-recipe/testimage.bbclass inherit image-artifact-names · line 23

Quoted 8 lines
meta/classes-recipe/testimage.bbclass +0 -5
-TESTIMAGE_FAILED_QA_ARTIFACTS ??= "\
-    ${localstatedir}/log \
-    ${sysconfdir}/version \
-    ${sysconfdir}/os-release"
-
 # You can set (or append to) TEST_SUITES in local.conf to select the tests
 # which you want to run for your target.
 # The test names are the module names in meta/lib/oeqa/runtime/cases.

I can imagine why ??= breaks if you use +=.

Quoted 1 line

Does this work if you change it from ??= to just = ?

I've indeed given a try to this before moving TESTIMAGE_FAILED_QA_ARTIFACTS to core-image, but when using "=" instead of "?=" or "??=", I observe that the part affecting TESTIMAGE_FAILED_QA_ARTIFACTS in core-image-ptest is not taken, so we are missing the ptests artifacts (but we still get the generic artifacts defined in testimage.bbclass). So to summarize:
- "??=" or "?=" : we only get ptests artifacts, not the "generic" one (/etc/version, /var/log, etc)
- "=": we only get the generic artifacts, not the ptests one.
It is not clear for me why the second one fails, and TESTIMAGE_FAILED_QA_ARTIFACTS does not appear at all in 'bitbake -e" output, which makes it even more cryptic to me.

Quoted 3 lines

I'd really prefer to keep this in testimage.bbclass.Recipes should be able to use += if it is set with = and the addition is after the class inherit.

Based on my understanding of bitbake manual, I theoretically agree with you, yet, as mentioned above this is not the behavior I observe, so I may be missing something important here. Maybe the parsing order is not the one I think I am observing, maybe its multiconfig, maybe something else.
I can try to dig this further and clarify why it does not work as expected with "="

Alexis

Quoted 6 lines

Cheers,

Richard

Signature · 3 lines
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#7 lore raw

Re: [OE-Core][PATCH v3 1/2] testimage: move TESTIMAGE_FAILED_QA_ARTIFACTS default to core-image

Quoted 37 lines · Alexis Lothoré

Hello Richard, thanks for the fast review

Quoted 2 lines · Richard Purdie

On Mon, 2024-02-05 at 15:37 +0100, Alexis Lothoré via lists.openembedded.org wrote:

[...]

Quoted 11 lines

meta/classes-recipe/testimage.bbclass inherit image-artifact-names · line 23

Quoted 8 lines
meta/classes-recipe/testimage.bbclass +0 -5
-TESTIMAGE_FAILED_QA_ARTIFACTS ??= "\
-    ${localstatedir}/log \
-    ${sysconfdir}/version \
-    ${sysconfdir}/os-release"
-
 # You can set (or append to) TEST_SUITES in local.conf to select the tests
 # which you want to run for your target.
 # The test names are the module names in meta/lib/oeqa/runtime/cases.

I can imagine why ??= breaks if you use +=.

Quoted 1 line

Does this work if you change it from ??= to just = ?

I've indeed given a try to this before moving TESTIMAGE_FAILED_QA_ARTIFACTS to core-image, but when using "=" instead of "?=" or "??=", I observe that the part affecting TESTIMAGE_FAILED_QA_ARTIFACTS in core-image-ptest is not taken, so we are missing the ptests artifacts (but we still get the generic artifacts defined in testimage.bbclass). So to summarize:
- "??=" or "?=" : we only get ptests artifacts, not the "generic" one (/etc/version, /var/log, etc)
- "=": we only get the generic artifacts, not the ptests one.
It is not clear for me why the second one fails, and TESTIMAGE_FAILED_QA_ARTIFACTS does not appear at all in 'bitbake -e" output, which makes it even more cryptic to me.

Quoted 3 lines

I'd really prefer to keep this in testimage.bbclass.Recipes should be able to use += if it is set with = and the addition is after the class inherit.

Quoted 5 lines

Based on my understanding of bitbake manual, I theoretically agree with you, yet, as mentioned above this is not the behavior I observe, so I may be missing something important here. Maybe the parsing order is not the one I think I am observing, maybe its multiconfig, maybe something else.
I can try to dig this further and clarify why it does not work as expected with "="

I would like to better understand why this isn't doing what we expect...

Cheers,

Richard

#8 lore raw

Re: [OE-Core][PATCH v3 1/2] testimage: move TESTIMAGE_FAILED_QA_ARTIFACTS default to core-image

In reply to Alexis Lothoré
Quoted 37 lines · Alexis Lothoré

Hello Richard, thanks for the fast review

Quoted 2 lines · Richard Purdie

On Mon, 2024-02-05 at 15:37 +0100, Alexis Lothoré via lists.openembedded.org wrote:

[...]

Quoted 11 lines

Review

Quoted 8 lines
(quoted diff) +0 -5
-TESTIMAGE_FAILED_QA_ARTIFACTS ??= "\
-    ${localstatedir}/log \
-    ${sysconfdir}/version \
-    ${sysconfdir}/os-release"
-
 # You can set (or append to) TEST_SUITES in local.conf to select the tests
 # which you want to run for your target.
 # The test names are the module names in meta/lib/oeqa/runtime/cases.

I can imagine why ??= breaks if you use +=.

Quoted 1 line

Does this work if you change it from ??= to just = ?

I've indeed given a try to this before moving TESTIMAGE_FAILED_QA_ARTIFACTS to core-image, but when using "=" instead of "?=" or "??=", I observe that the part affecting TESTIMAGE_FAILED_QA_ARTIFACTS in core-image-ptest is not taken, so we are missing the ptests artifacts (but we still get the generic artifacts defined in testimage.bbclass). So to summarize:
- "??=" or "?=" : we only get ptests artifacts, not the "generic" one (/etc/version, /var/log, etc)
- "=": we only get the generic artifacts, not the ptests one.
It is not clear for me why the second one fails, and TESTIMAGE_FAILED_QA_ARTIFACTS does not appear at all in 'bitbake -e" output, which makes it even more cryptic to me.

Quoted 3 lines

I'd really prefer to keep this in testimage.bbclass.Recipes should be able to use += if it is set with = and the addition is after the class inherit.

Quoted 5 lines

Based on my understanding of bitbake manual, I theoretically agree with you, yet, as mentioned above this is not the behavior I observe, so I may be missing something important here. Maybe the parsing order is not the one I think I am observing, maybe its multiconfig, maybe something else.
I can try to dig this further and clarify why it does not work as expected with "="

So I've did multiple attempts to make this work, and I see no way to define the default value in testimage.bbclass with "=", and add content to it in core-image-ptest.bbwith "+=". My understanding is that testimage is always parsed after core-image-ptest.bb, so there is no nice way to set its default value in there:
- "=" will always overwrite ptests artifacts set with "+="
- "?=" or "??=" will always be overwritten by ptests artifacts set with "+=" My configuration relies on IMAGE_CLASSES += 'testimage', which is also done in CI.

Still, I understand your concern about keeping default value in testimage.bbclass. The only compromise I see here to both keep the default value in testimage and be able to override it at user level is not to enrich it in core-image-ptest but to redefine it:

(quoted diff) +0 -0

b/meta/recipes-core/images/core-image-ptest.bb
index fb96c542c0a3..4a90181afd83 100644

meta/recipes-core/images/core-image-ptest.bb +5 -2
@@ -43,5 +43,8 @@ python () {
         raise bb.parse.SkipRecipe("No class extension set")
 }
 
-# Include ptest directory in artifacts to retrieve if there is a failed test
-TESTIMAGE_FAILED_QA_ARTIFACTS += "${libdir}/${MCNAME}/ptest"
+TESTIMAGE_FAILED_QA_ARTIFACTS = "\
+    ${localstatedir}/log \
+    ${sysconfdir}/version \
+    ${sysconfdir}/os-release \
+    ${libdir}/${MCNAME}/ptest"

That's for example what is done with TEST_SUITES. In this setup, we can keep a default value in testimage, and override it as needed with append/prepend/remove syntax at user level.

I'll wait a bit in case there's any comment or concern about this approach, and then send a new version.

Signature · 3 lines
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#9 lore raw

Re: [OE-Core][PATCH v3 1/2] testimage: move TESTIMAGE_FAILED_QA_ARTIFACTS default to core-image

Quoted 8 lines · Alexis Lothoré

So I've did multiple attempts to make this work, and I see no way to define the default value in testimage.bbclass with "=", and add content to it in core-image-ptest.bbwith "+=". My understanding is that testimage is always parsed after core-image-ptest.bb, so there is no nice way to set its default value in there:
- "=" will always overwrite ptests artifacts set with "+="
- "?=" or "??=" will always be overwritten by ptests artifacts set with "+=" My configuration relies on IMAGE_CLASSES += 'testimage', which is also done in CI.

The issue is this:

classes-recipe/image.bbclass:inherit_defer ${IMGCLASSES}

since this is deferred to after the recipe is parsed.

Quoted 22 lines

Still, I understand your concern about keeping default value in testimage.bbclass. The only compromise I see here to both keep the default value in testimage and be able to override it at user level is not to enrich it in core-image-ptest but to redefine it:

meta/recipes-core/images/core-image-ptest.bb +5 -2
index fb96c542c0a3..4a90181afd83 100644
@@ -43,5 +43,8 @@ python () {
         raise bb.parse.SkipRecipe("No class extension set")
 }
 
-# Include ptest directory in artifacts to retrieve if there is a failed test
-TESTIMAGE_FAILED_QA_ARTIFACTS += "${libdir}/${MCNAME}/ptest"
+TESTIMAGE_FAILED_QA_ARTIFACTS = "\
+    ${localstatedir}/log \
+    ${sysconfdir}/version \
+    ${sysconfdir}/os-release \
+    ${libdir}/${MCNAME}/ptest"
Quoted 6 lines

That's for example what is done with TEST_SUITES. In this setup, we can keep a default value in testimage, and override it as needed with append/prepend/remove syntax at user level.

I'll wait a bit in case there's any comment or concern about this approach, and then send a new version.

I see two options:

a) Make testimage.bbclass a +=

or

b) Put the new entry into testimage.bbclass even if it is ptest specific.

I'm leaning to doing both, make it a += and just put it there by default in case someone includes ptests in a non ptest image.

Cheers,

Richard

#10 lore raw

Re: [OE-Core][PATCH v3 1/2] testimage: move TESTIMAGE_FAILED_QA_ARTIFACTS default to core-image

Quoted 10 lines · Richard Purdie
Quoted 8 lines · Alexis Lothoré

So I've did multiple attempts to make this work, and I see no way to define the default value in testimage.bbclass with "=", and add content to it in core-image-ptest.bbwith "+=". My understanding is that testimage is always parsed after core-image-ptest.bb, so there is no nice way to set its default value in there:
- "=" will always overwrite ptests artifacts set with "+="
- "?=" or "??=" will always be overwritten by ptests artifacts set with "+=" My configuration relies on IMAGE_CLASSES += 'testimage', which is also done in CI.

Quoted 5 lines

The issue is this:

classes-recipe/image.bbclass:inherit_defer ${IMGCLASSES}

since this is deferred to after the recipe is parsed.

Ah, thank you for the explanation, I was not aware of this defer mechanism.

Quoted 33 lines
Quoted 22 lines

Still, I understand your concern about keeping default value in testimage.bbclass. The only compromise I see here to both keep the default value in testimage and be able to override it at user level is not to enrich it in core-image-ptest but to redefine it:

meta/recipes-core/images/core-image-ptest.bb +5 -2
index fb96c542c0a3..4a90181afd83 100644
@@ -43,5 +43,8 @@ python () {
         raise bb.parse.SkipRecipe("No class extension set")
 }
 
-# Include ptest directory in artifacts to retrieve if there is a failed test
-TESTIMAGE_FAILED_QA_ARTIFACTS += "${libdir}/${MCNAME}/ptest"
+TESTIMAGE_FAILED_QA_ARTIFACTS = "\
+    ${localstatedir}/log \
+    ${sysconfdir}/version \
+    ${sysconfdir}/os-release \
+    ${libdir}/${MCNAME}/ptest"
Quoted 6 lines

That's for example what is done with TEST_SUITES. In this setup, we can keep a default value in testimage, and override it as needed with append/prepend/remove syntax at user level.

I'll wait a bit in case there's any comment or concern about this approach, and then send a new version.

I see two options:

a) Make testimage.bbclass a +=

Quoted 8 lines

or

b) Put the new entry into testimage.bbclass even if it is ptest specific.

I'm leaning to doing both, make it a += and just put it there by default in case someone includes ptests in a non ptest image.

Ok, sounds good to me too and ptests artifact retrieval seems to behave properly even when defined in testimage. I'll submit a new version which keeps the default artifact list in testimage, and adds immediately ptests artifacts to it.

Thanks for the guidance :)

Alexis

Signature · 3 lines
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#11 lore raw

PATCH v3 2/2 core-image-ptest: retrieve ptests directory when ptests fail

In reply to Alexis Lothoré

From: Alexis Lothoré <[email protected]>

TESTIMAGE_FAILED_QA_ARTIFACTS is set with a default, minimal list of files to retrieve whenever a runtime test fails. By appending the ptest directory only in core-image-ptest.bb, thanks to multiconfig feature used in the recipe, only failing ptests will lead to corresponding ptest artifacts retrieval, instead of all ptests artifacts retrieval.

---
This patch was present in the original artifacts series ([1])

Changes in v3:
- slightly reword commit message body

Changes in v1 (since being picked in new series)
- use += instead of append syntax

[1] https://lore.kernel.org/openembedded-core/[email protected]/

---
 meta/recipes-core/images/core-image-ptest.bb | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-core/images/core-image-ptest.bb +2 -0
index b6f5c2fd6049..fb96c542c0a3 100644
@@ -43,3 +43,5 @@ python () {
         raise bb.parse.SkipRecipe("No class extension set")
 }
 
+# Include ptest directory in artifacts to retrieve if there is a failed test
+TESTIMAGE_FAILED_QA_ARTIFACTS += "${libdir}/${MCNAME}/ptest"
Signature · 1 line
2.43.0