diff options
| author | Yoann Congal <yoann.congal@smile.fr> | 2023-07-05 17:30:00 +0200 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2023-08-02 04:47:13 -1000 |
| commit | d97c5782beb9481bbfc2528c5def45214e5abf06 (patch) | |
| tree | 74d4edb45c770061f7aea215babca0042c390644 /meta | |
| parent | a22efd037306af72d7ad264e4fc7f0a0928bd52e (diff) | |
| download | poky-d97c5782beb9481bbfc2528c5def45214e5abf06.tar.gz | |
oeqa/selftest/devtool: add unit test for "devtool add -b"
Fix [Yocto #15085]
Co-authored-by: Fawzi KHABER <fawzi.khaber@smile.fr>
(From OE-Core rev: ea1592b49c6b45495fe9243339fc4dc9cea9ef12)
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit d5eedf8ca689ccb433c2f5d0b324378f966dd627)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta')
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/devtool.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py index 64179d4004..aea2ad6561 100644 --- a/meta/lib/oeqa/selftest/cases/devtool.py +++ b/meta/lib/oeqa/selftest/cases/devtool.py | |||
| @@ -348,6 +348,38 @@ class DevtoolAddTests(DevtoolBase): | |||
| 348 | bindir = bindir[1:] | 348 | bindir = bindir[1:] |
| 349 | self.assertTrue(os.path.isfile(os.path.join(installdir, bindir, 'pv')), 'pv binary not found in D') | 349 | self.assertTrue(os.path.isfile(os.path.join(installdir, bindir, 'pv')), 'pv binary not found in D') |
| 350 | 350 | ||
| 351 | def test_devtool_add_binary(self): | ||
| 352 | # Create a binary package containing a known test file | ||
| 353 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | ||
| 354 | self.track_for_cleanup(tempdir) | ||
| 355 | pn = 'tst-bin' | ||
| 356 | pv = '1.0' | ||
| 357 | test_file_dir = "var/lib/%s/" % pn | ||
| 358 | test_file_name = "test_file" | ||
| 359 | test_file_content = "TEST CONTENT" | ||
| 360 | test_file_package_root = os.path.join(tempdir, pn) | ||
| 361 | test_file_dir_full = os.path.join(test_file_package_root, test_file_dir) | ||
| 362 | bb.utils.mkdirhier(test_file_dir_full) | ||
| 363 | with open(os.path.join(test_file_dir_full, test_file_name), "w") as f: | ||
| 364 | f.write(test_file_content) | ||
| 365 | bin_package_path = os.path.join(tempdir, "%s.tar.gz" % pn) | ||
| 366 | runCmd("tar czf %s -C %s ." % (bin_package_path, test_file_package_root)) | ||
| 367 | |||
| 368 | # Test devtool add -b on the binary package | ||
| 369 | self.track_for_cleanup(self.workspacedir) | ||
| 370 | self.add_command_to_tearDown('bitbake -c cleansstate %s' % pn) | ||
| 371 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | ||
| 372 | result = runCmd('devtool add -b %s %s' % (pn, bin_package_path)) | ||
| 373 | self.assertExists(os.path.join(self.workspacedir, 'conf', 'layer.conf'), 'Workspace directory not created') | ||
| 374 | |||
| 375 | # Build the resulting recipe | ||
| 376 | result = runCmd('devtool build %s' % pn) | ||
| 377 | installdir = get_bb_var('D', pn) | ||
| 378 | self.assertTrue(installdir, 'Could not query installdir variable') | ||
| 379 | |||
| 380 | # Check that a known file from the binary package has indeed been installed | ||
| 381 | self.assertTrue(os.path.isfile(os.path.join(installdir, test_file_dir, test_file_name)), '%s not found in D' % test_file_name) | ||
| 382 | |||
| 351 | def test_devtool_add_git_local(self): | 383 | def test_devtool_add_git_local(self): |
| 352 | # We need dbus built so that DEPENDS recognition works | 384 | # We need dbus built so that DEPENDS recognition works |
| 353 | bitbake('dbus') | 385 | bitbake('dbus') |
