diff options
| author | Antonin Godard <antonin.godard@bootlin.com> | 2025-09-05 14:23:58 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-09-08 18:02:40 +0100 |
| commit | 20a1e4e401e9f4c189779843fb4e1820b59f57e0 (patch) | |
| tree | 7b0a774c3e6e8ea0ca4ea418f4dcb8b6fd450998 | |
| parent | 3b1a9693b632a8340958727a8e6dc1677c9b69c8 (diff) | |
| download | poky-20a1e4e401e9f4c189779843fb4e1820b59f57e0.tar.gz | |
oeqa/bblayers.py: add a test case for bitbake-config-build show-fragment
Add a test case for 'bitbake-config-build show-fragment' and use
'bitbake-config-build list-fragments' to get the path to the fragment.
(From OE-Core rev: 09468f352994a05b59911b2fe7412d3540cdb3cb)
Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/bblayers.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/bblayers.py b/meta/lib/oeqa/selftest/cases/bblayers.py index 68b0377720..8c05ec5d3d 100644 --- a/meta/lib/oeqa/selftest/cases/bblayers.py +++ b/meta/lib/oeqa/selftest/cases/bblayers.py | |||
| @@ -271,3 +271,29 @@ class BitbakeConfigBuild(OESelftestTestCase): | |||
| 271 | runCmd('bitbake-config-build disable-fragment selftest/more-fragments-here/test-another-fragment') | 271 | runCmd('bitbake-config-build disable-fragment selftest/more-fragments-here/test-another-fragment') |
| 272 | self.assertEqual(get_bb_var('SELFTEST_FRAGMENT_VARIABLE'), None) | 272 | self.assertEqual(get_bb_var('SELFTEST_FRAGMENT_VARIABLE'), None) |
| 273 | self.assertEqual(get_bb_var('SELFTEST_FRAGMENT_ANOTHER_VARIABLE'), None) | 273 | self.assertEqual(get_bb_var('SELFTEST_FRAGMENT_ANOTHER_VARIABLE'), None) |
| 274 | |||
| 275 | def test_show_fragment(self): | ||
| 276 | """ | ||
| 277 | Test that bitbake-config-build show-fragment returns the expected | ||
| 278 | output. Use bitbake-config-build list-fragments --verbose to get the | ||
| 279 | path to the fragment. | ||
| 280 | """ | ||
| 281 | result = runCmd('bitbake-config-build --quiet list-fragments --verbose') | ||
| 282 | test_fragment_re = re.compile(r'^Path: .*conf/fragments/test-fragment.conf$') | ||
| 283 | fragment_path, fragment_content = '', '' | ||
| 284 | |||
| 285 | for line in result.output.splitlines(): | ||
| 286 | m = re.match(test_fragment_re, line) | ||
| 287 | if m: | ||
| 288 | fragment_path = ' '.join(line.split()[1:]) | ||
| 289 | break | ||
| 290 | |||
| 291 | if not fragment_path: | ||
| 292 | raise Exception("Couldn't find the fragment") | ||
| 293 | |||
| 294 | with open(fragment_path, 'r') as f: | ||
| 295 | fragment_content = f'{fragment_path}:\n\n{f.read()}'.strip() | ||
| 296 | |||
| 297 | result = runCmd('bitbake-config-build --quiet show-fragment selftest/test-fragment') | ||
| 298 | |||
| 299 | self.assertEqual(result.output.strip(), fragment_content) | ||
