public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: "Alexis Lothoré" <alexis.lothore@bootlin.com>
To: <Openembedded-core@lists.openembedded.org>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>
Subject: [OE-Core][PATCH v3 4/5] oeqa/utils/postactions: add target disk usage stat as post action
Date: Fri, 23 Feb 2024 16:16:47 +0100	[thread overview]
Message-ID: <20240223151648.1453027-5-alexis.lothore@bootlin.com> (raw)
In-Reply-To: <20240223151648.1453027-1-alexis.lothore@bootlin.com>

From: Alexis Lothoré <alexis.lothore@bootlin.com>

In order to debug issues related to disk space (see [1]),  add a failed
tests post action to retrieve disk usage on the target. Rely on the test
context object to run the corresponding command onto the target

[1] https://bugzilla.yoctoproject.org/show_bug.cgi?id=15220

Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
---
Changes in v2:
- - use new shared helper get_json_result_dir()
---
 meta/lib/oeqa/utils/postactions.py | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/utils/postactions.py b/meta/lib/oeqa/utils/postactions.py
index 7014b2830a9c..008968b56a3f 100644
--- a/meta/lib/oeqa/utils/postactions.py
+++ b/meta/lib/oeqa/utils/postactions.py
@@ -18,6 +18,20 @@ def create_artifacts_directory(d, tc):
 
     os.makedirs(local_artifacts_dir)
 
+##################################################################
+# Host/target statistics
+##################################################################
+
+def get_target_disk_usage(d, tc):
+    output_file = os.path.join(get_json_result_dir(d), "artifacts", "target_disk_usage.txt")
+    try:
+        (status, output) = tc.target.run('df -hl')
+        with open(output_file, 'w') as f:
+            f.write(output)
+            f.write("\n")
+    except Exception as e:
+        bb.warn(f"Can not get target disk usage: {e}")
+
 ##################################################################
 # Artifacts retrieval
 ##################################################################
@@ -65,7 +79,8 @@ 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
+        list_and_fetch_failed_tests_artifacts,
+        get_target_disk_usage
     ]
 
     for action in post_actions:
-- 
2.43.1



  parent reply	other threads:[~2024-02-23 15:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-23 15:16 [OE-Core][PATCH v3 0/5] testimage: add failed test post actions and fetch more data Alexis Lothoré
2024-02-23 15:16 ` [OE-Core][PATCH v3 1/5] lib/oeqa: share get_json_result_dir helper Alexis Lothoré
2024-02-23 17:27   ` Richard Purdie
2024-02-23 17:36     ` Alexis Lothoré
2024-02-23 15:16 ` [OE-Core][PATCH v3 2/5] testimage: create a list of failed test post actions Alexis Lothoré
2024-02-23 15:16 ` [OE-Core][PATCH v3 3/5] oeqa/utils/postactions: isolate directory creation in dedicated action Alexis Lothoré
2024-02-23 15:16 ` Alexis Lothoré [this message]
2024-02-23 15:16 ` [OE-Core][PATCH v3 5/5] oeqa/utils/postactions: testimage: add host disk usage stat as post action Alexis Lothoré

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240223151648.1453027-5-alexis.lothore@bootlin.com \
    --to=alexis.lothore@bootlin.com \
    --cc=Openembedded-core@lists.openembedded.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox