[PATCH 1/1] testsuite: add parameter to emit bitbake dependency graph

7 views
Skip to first unread message

Felix Moessbauer

unread,
Dec 15, 2025, 8:00:32 AM (2 days ago) Dec 15
to isar-...@googlegroups.com, cedric.h...@siemens.com, Felix Moessbauer
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.mo...@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

Felix Moessbauer

unread,
Dec 15, 2025, 12:11:03 PM (2 days ago) Dec 15
to isar-...@googlegroups.com, cedric.h...@siemens.com, Felix Moessbauer
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.mo...@siemens.com>
---
Changes since v1:
- working version. v1 was the wrong commit. Sorry

Felix

testsuite/README.md | 3 +++
testsuite/cibase.py | 14 ++++++++++++++
testsuite/cibuilder.py | 4 +++-
3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/testsuite/README.md b/testsuite/README.md
index 3b2be5af..7c11bfb8 100644
--- a/testsuite/README.md
+++ b/testsuite/README.md
@@ -27,6 +27,9 @@ $ 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
+# The output will be in build_dir/{task-depends-<testname>.dot, pn-buildlist-<testname>}
+$ 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..190a0b7d 100755
--- a/testsuite/cibase.py
+++ b/testsuite/cibase.py
@@ -17,10 +17,24 @@ 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...")
+
+ self.bitbake(targets, should_fail=should_fail,
+ bitbake_extra_args=["-g"], **kwargs)
+ self.move_in_build_dir('task-depends.dot', f"task-depends-{self.name}.dot")
+ self.move_in_build_dir('pn-buildlist', f"pn-buildlist-{self.name}")
+
def perform_wic_partition_test(self, targets, wic_deploy_parts, **kwargs):
self.configure(wic_deploy_parts=wic_deploy_parts, **kwargs)
self.bitbake(targets, **kwargs)
diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
index 366f6a1f..46bfc546 100755
--- a/testsuite/cibuilder.py
+++ b/testsuite/cibuilder.py
@@ -282,7 +282,7 @@ class CIBuilder(Test):
shutil.move(self.build_dir + '/' + src, self.build_dir + '/' + dst)

def bitbake(self, target, bitbake_cmd=None, should_fail=False,
- sig_handler=None, **kwargs):
+ sig_handler=None, bitbake_extra_args=[], **kwargs):
self.check_init()
self.log.info("===================================================")
self.log.info(f"Building {str(target)}")
@@ -297,6 +297,8 @@ class CIBuilder(Test):
if sig_handler:
cmdline.append('-S')
cmdline.append(sig_handler)
+ if bitbake_extra_args:
+ cmdline.extend(bitbake_extra_args)
if isinstance(target, list):
cmdline.extend(target)
else:
--
2.51.0

MOESSBAUER, Felix

unread,
Dec 16, 2025, 4:11:54 AM (yesterday) Dec 16
to isar-...@googlegroups.com, Hombourger, Cedric
Here we potentially configure twice, but this time without passing the
kwargs. Will be fixed in a v3.

Felix

--
Siemens AG
Linux Expert Center
Friedrich-Ludwig-Bauer-Str. 3
85748 Garching, Germany

Felix Moessbauer

unread,
7:33 AM (8 hours ago) 7:33 AM
to isar-...@googlegroups.com, cedric.h...@siemens.com, Felix Moessbauer
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.mo...@siemens.com>
---
Changes since v2:
- do not reconfigure job if not explicitly requested
- if reconfiguring, also pass kwargs
- copy out the pn-tasklist as well

Changes since v1:
- working version. v1 was the wrong commit. Sorry

Felix

testsuite/README.md | 3 +++
testsuite/cibase.py | 19 +++++++++++++++++++
testsuite/cibuilder.py | 4 +++-
3 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/testsuite/README.md b/testsuite/README.md
index 3b2be5af..7c11bfb8 100644
--- a/testsuite/README.md
+++ b/testsuite/README.md
@@ -27,6 +27,9 @@ $ 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
+# The output will be in build_dir/{task-depends-<testname>.dot, pn-buildlist-<testname>}
+$ 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..e59653a2 100755
--- a/testsuite/cibase.py
+++ b/testsuite/cibase.py
@@ -17,10 +17,29 @@ 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, reconfigure=False, **kwargs)
+
self.log.info("Starting build...")

self.bitbake(targets, should_fail=should_fail, **kwargs)

+ def generate_dependency_graph(self,
+ targets,
+ should_fail=False,
+ reconfigure=True,
+ **kwargs):
+ """Debug helper to better understand test task graphs."""
+ if reconfigure:
Reply all
Reply to author
Forward
0 new messages