public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'Felix Moessbauer' via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: cedric.hombourger@siemens.com,
	Felix Moessbauer <felix.moessbauer@siemens.com>
Subject: [PATCH 1/1] testsuite: add parameter to emit bitbake dependency graph
Date: Mon, 15 Dec 2025 14:00:10 +0100	[thread overview]
Message-ID: <20251215130010.630400-1-felix.moessbauer@siemens.com> (raw)

When running with this avocado parameter, bitbake is called with "-g"
prior to executing the build. By that, a dependency graph of what
bitbake will execute is dumped that tremendously helps in identifying
what we test. This further helps developers to strip down tests to the
features that should be tested by locating unwanted tasks that are
pulled in via transitive dependencies.

The feature is modeled as a test function itself, so it can later be
extended to write parser-only tests or graph analysis tests.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 testsuite/README.md |  2 ++
 testsuite/cibase.py | 15 +++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/testsuite/README.md b/testsuite/README.md
index 3b2be5af..b1a75b04 100644
--- a/testsuite/README.md
+++ b/testsuite/README.md
@@ -27,6 +27,8 @@ $ avocado run ../testsuite/citest.py -t dev --max-parallel-tasks=1
 
 ```
 $ avocado run ../testsuite/citest.py -t single --max-parallel-tasks=1 -p machine=qemuamd64 -p distro=bullseye
+# Generate bitbake dependency graph as well
+$ avocado run ../testsuite/citest.py -t single --max-parallel-tasks=1 -p machine=qemuamd64 -p distro=bullseye -p depgraph=1
 ```
 
 ## Fast build test
diff --git a/testsuite/cibase.py b/testsuite/cibase.py
index 0a006a21..70964c6d 100755
--- a/testsuite/cibase.py
+++ b/testsuite/cibase.py
@@ -17,10 +17,25 @@ class CIBaseTest(CIBuilder):
     def perform_build_test(self, targets, should_fail=False, **kwargs):
         self.configure(**kwargs)
 
+        if bool(int(self.params.get('depgraph', default=0))):
+            self.generate_dependency_graph(targets)
+
         self.log.info("Starting build...")
 
         self.bitbake(targets, should_fail=should_fail, **kwargs)
 
+    def generate_dependency_graph(self, targets, should_fail=False, **kwargs):
+        """Debug helper to better understand test task graphs."""
+        self.configure(**kwargs)
+
+        self.log.info("Generating dependency graph...")
+
+        bb_args = ["-g"]
+        bb_args.extend(self.bitbake_args or [])
+        self.bitbake(targets, should_fail=should_fail,
+                     bitbake_args=bb_args, **kwargs)
+        self.move_in_build_dir('task-depends.dot', f"dep-{self.name}.dot")
+
     def perform_wic_partition_test(self, targets, wic_deploy_parts, **kwargs):
         self.configure(wic_deploy_parts=wic_deploy_parts, **kwargs)
         self.bitbake(targets, **kwargs)
-- 
2.51.0

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20251215130010.630400-1-felix.moessbauer%40siemens.com.

                 reply	other threads:[~2025-12-15 13:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20251215130010.630400-1-felix.moessbauer@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=cedric.hombourger@siemens.com \
    --cc=felix.moessbauer@siemens.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