From: Alexis Lothoré <alexis.loth...@bootlin.com> In order to be able to create actions that could store new files during failed test post actions, we need to split artifacts directory creation from artifacts retrieval.
Create a new dedicated action to create artifacts main directory so we can add actions creating files in this new directory, without worrying about actions order if at least this action is set first. Signed-off-by: Alexis Lothoré <alexis.loth...@bootlin.com> --- .../failed-tests-post-actions.bbclass | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/meta/classes-recipe/failed-tests-post-actions.bbclass b/meta/classes-recipe/failed-tests-post-actions.bbclass index 7c7d3391298f..eaf08fb792f3 100644 --- a/meta/classes-recipe/failed-tests-post-actions.bbclass +++ b/meta/classes-recipe/failed-tests-post-actions.bbclass @@ -9,6 +9,15 @@ # Artifacts retrieval ################################################################## +def create_artifacts_directory(d, tc): + import shutil + + local_artifacts_dir = os.path.join(get_testimage_json_result_dir(d), "artifacts") + if os.path.isdir(local_artifacts_dir): + shutil.rmtree(local_artifacts_dir) + + os.makedirs(local_artifacts_dir) + def get_artifacts_list(target, raw_list): result = [] # Passed list may contains patterns in paths, expand them directly on target @@ -25,13 +34,7 @@ def get_artifacts_list(target, raw_list): return result def retrieve_test_artifacts(target, artifacts_list, target_dir): - import shutil - local_artifacts_dir = os.path.join(target_dir, "artifacts") - if os.path.isdir(local_artifacts_dir): - shutil.rmtree(local_artifacts_dir) - - os.makedirs(local_artifacts_dir) for artifact_path in artifacts_list: if not os.path.isabs(artifact_path): bb.warn(f"{artifact_path} is not an absolute path") @@ -57,6 +60,7 @@ def list_and_fetch_failed_tests_artifacts(d, tc): def run_failed_tests_post_actions(d, tc): post_actions=[ + create_artifacts_directory, list_and_fetch_failed_tests_artifacts ] -- 2.43.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#195926): https://lists.openembedded.org/g/openembedded-core/message/195926 Mute This Topic: https://lists.openembedded.org/mt/104474967/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-