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:40 +0000 |
commit | 2ab3a0935b1e7a016402f149da1fc01b38d7af55 (patch) | |
tree | 89073eff12788738ceeca862680b06f1ed3e44e0 /meta/lib/oeqa | |
parent | 637e216b0e5191571270aa07e1f50a6e41a8c08f (diff) | |
download | openembedded-core-2ab3a0935b1e7a016402f149da1fc01b38d7af55.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
Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
-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): except Exception as e: bb.warn(f"Can not get target disk usage: {e}") +def get_host_disk_usage(d, tc): + import subprocess + + output_file = os.path.join(get_json_result_dir(d), "artifacts", "host_disk_usage.txt") + try: + with open(output_file, 'w') as f: + output = subprocess.run(['/usr/bin/df', '-hl'], check=True, text=True, stdout=f) + except Exception as e: + bb.warn(f"Can not get host disk usage: {e}") + ################################################################## # Artifacts retrieval ################################################################## @@ -80,7 +90,8 @@ def run_failed_tests_post_actions(d, tc): post_actions=[ create_artifacts_directory, list_and_fetch_failed_tests_artifacts, - get_target_disk_usage + get_target_disk_usage, + get_host_disk_usage ] for action in post_actions: |