diff options
author | Alexis Lothoré <alexis.lothore@bootlin.com> | 2024-02-26 10:19:20 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-02-27 11:35:43 +0000 |
commit | 9a46657a25bbd2dc084d9e9ce8b5ad2207751182 (patch) | |
tree | fd2186d1a4fdf50bf0683228fb805df60cd11fb5 /meta/lib | |
parent | 3add7b301e38d11a47b55abfb583a648e6a4ac04 (diff) | |
download | poky-9a46657a25bbd2dc084d9e9ce8b5ad2207751182.tar.gz |
oeqa/utils/postactions: isolate directory creation in dedicated action
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.
(From OE-Core rev: 5d796586a9342f4f984494a5b493dbaf77af7026)
Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/utils/postactions.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/meta/lib/oeqa/utils/postactions.py b/meta/lib/oeqa/utils/postactions.py index 09c338ef68..7014b2830a 100644 --- a/meta/lib/oeqa/utils/postactions.py +++ b/meta/lib/oeqa/utils/postactions.py | |||
@@ -9,6 +9,15 @@ | |||
9 | 9 | ||
10 | from oeqa.utils import get_json_result_dir | 10 | from oeqa.utils import get_json_result_dir |
11 | 11 | ||
12 | def create_artifacts_directory(d, tc): | ||
13 | import shutil | ||
14 | |||
15 | local_artifacts_dir = os.path.join(get_json_result_dir(d), "artifacts") | ||
16 | if os.path.isdir(local_artifacts_dir): | ||
17 | shutil.rmtree(local_artifacts_dir) | ||
18 | |||
19 | os.makedirs(local_artifacts_dir) | ||
20 | |||
12 | ################################################################## | 21 | ################################################################## |
13 | # Artifacts retrieval | 22 | # Artifacts retrieval |
14 | ################################################################## | 23 | ################################################################## |
@@ -29,13 +38,7 @@ def get_artifacts_list(target, raw_list): | |||
29 | return result | 38 | return result |
30 | 39 | ||
31 | def retrieve_test_artifacts(target, artifacts_list, target_dir): | 40 | def retrieve_test_artifacts(target, artifacts_list, target_dir): |
32 | import shutil | ||
33 | |||
34 | local_artifacts_dir = os.path.join(target_dir, "artifacts") | 41 | local_artifacts_dir = os.path.join(target_dir, "artifacts") |
35 | if os.path.isdir(local_artifacts_dir): | ||
36 | shutil.rmtree(local_artifacts_dir) | ||
37 | |||
38 | os.makedirs(local_artifacts_dir) | ||
39 | for artifact_path in artifacts_list: | 42 | for artifact_path in artifacts_list: |
40 | if not os.path.isabs(artifact_path): | 43 | if not os.path.isabs(artifact_path): |
41 | bb.warn(f"{artifact_path} is not an absolute path") | 44 | bb.warn(f"{artifact_path} is not an absolute path") |
@@ -61,6 +64,7 @@ def list_and_fetch_failed_tests_artifacts(d, tc): | |||
61 | 64 | ||
62 | def run_failed_tests_post_actions(d, tc): | 65 | def run_failed_tests_post_actions(d, tc): |
63 | post_actions=[ | 66 | post_actions=[ |
67 | create_artifacts_directory, | ||
64 | list_and_fetch_failed_tests_artifacts | 68 | list_and_fetch_failed_tests_artifacts |
65 | ] | 69 | ] |
66 | 70 | ||