diff options
| -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) | ||
