diff options
author | Alexis Lothoré <alexis.lothore@bootlin.com> | 2024-02-26 10:19:22 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-02-27 11:35:43 +0000 |
commit | 5018d3a4b6576252fd1f27abb74080eb4348828f (patch) | |
tree | 0b5d135507ef03d7fe7672ea13d43b1742dd2406 | |
parent | d4267a8dce8fde4e415f7a1a93bcc9edb5402077 (diff) | |
download | poky-5018d3a4b6576252fd1f27abb74080eb4348828f.tar.gz |
oeqa/utils/postactions: testimage: add host disk usage stat as post action
Since the target under test can be a virtualized guest, when some tests
fail because of disk usage (see [1]), also fetch disk usage statistics from
host to allow checking whether a host disk space saturation could affect
running tests.
[1] https://bugzilla.yoctoproject.org/show_bug.cgi?id=15220
(From OE-Core rev: 2ab3a0935b1e7a016402f149da1fc01b38d7af55)
Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/lib/oeqa/utils/postactions.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/meta/lib/oeqa/utils/postactions.py b/meta/lib/oeqa/utils/postactions.py index 008968b56a..03cecdc215 100644 --- a/meta/lib/oeqa/utils/postactions.py +++ b/meta/lib/oeqa/utils/postactions.py | |||
@@ -32,6 +32,16 @@ def get_target_disk_usage(d, tc): | |||
32 | except Exception as e: | 32 | except Exception as e: |
33 | bb.warn(f"Can not get target disk usage: {e}") | 33 | bb.warn(f"Can not get target disk usage: {e}") |
34 | 34 | ||
35 | def get_host_disk_usage(d, tc): | ||
36 | import subprocess | ||
37 | |||
38 | output_file = os.path.join(get_json_result_dir(d), "artifacts", "host_disk_usage.txt") | ||
39 | try: | ||
40 | with open(output_file, 'w') as f: | ||
41 | output = subprocess.run(['/usr/bin/df', '-hl'], check=True, text=True, stdout=f) | ||
42 | except Exception as e: | ||
43 | bb.warn(f"Can not get host disk usage: {e}") | ||
44 | |||
35 | ################################################################## | 45 | ################################################################## |
36 | # Artifacts retrieval | 46 | # Artifacts retrieval |
37 | ################################################################## | 47 | ################################################################## |
@@ -80,7 +90,8 @@ def run_failed_tests_post_actions(d, tc): | |||
80 | post_actions=[ | 90 | post_actions=[ |
81 | create_artifacts_directory, | 91 | create_artifacts_directory, |
82 | list_and_fetch_failed_tests_artifacts, | 92 | list_and_fetch_failed_tests_artifacts, |
83 | get_target_disk_usage | 93 | get_target_disk_usage, |
94 | get_host_disk_usage | ||
84 | ] | 95 | ] |
85 | 96 | ||
86 | for action in post_actions: | 97 | for action in post_actions: |