diff options
author | Yoann Congal <yoann.congal@smile.fr> | 2023-07-05 17:30:00 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-07-10 11:36:34 +0100 |
commit | a43fa36614977745fcbd6441d1c3c20321a8201d (patch) | |
tree | e3973c568e1bbf4c2f01b38e619a86d1c6c7dfb5 | |
parent | 7e0152220475cab4e0bad07e93b2a8ed5531f915 (diff) | |
download | poky-a43fa36614977745fcbd6441d1c3c20321a8201d.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: d5eedf8ca689ccb433c2f5d0b324378f966dd627)
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-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 4c8e375d00..14a80d5ff4 100644 --- a/meta/lib/oeqa/selftest/cases/devtool.py +++ b/meta/lib/oeqa/selftest/cases/devtool.py | |||
@@ -366,6 +366,38 @@ class DevtoolAddTests(DevtoolBase): | |||
366 | bindir = bindir[1:] | 366 | bindir = bindir[1:] |
367 | self.assertTrue(os.path.isfile(os.path.join(installdir, bindir, 'pv')), 'pv binary not found in D') | 367 | self.assertTrue(os.path.isfile(os.path.join(installdir, bindir, 'pv')), 'pv binary not found in D') |
368 | 368 | ||
369 | def test_devtool_add_binary(self): | ||
370 | # Create a binary package containing a known test file | ||
371 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | ||
372 | self.track_for_cleanup(tempdir) | ||
373 | pn = 'tst-bin' | ||
374 | pv = '1.0' | ||
375 | test_file_dir = "var/lib/%s/" % pn | ||
376 | test_file_name = "test_file" | ||
377 | test_file_content = "TEST CONTENT" | ||
378 | test_file_package_root = os.path.join(tempdir, pn) | ||
379 | test_file_dir_full = os.path.join(test_file_package_root, test_file_dir) | ||
380 | bb.utils.mkdirhier(test_file_dir_full) | ||
381 | with open(os.path.join(test_file_dir_full, test_file_name), "w") as f: | ||
382 | f.write(test_file_content) | ||
383 | bin_package_path = os.path.join(tempdir, "%s.tar.gz" % pn) | ||
384 | runCmd("tar czf %s -C %s ." % (bin_package_path, test_file_package_root)) | ||
385 | |||
386 | # Test devtool add -b on the binary package | ||
387 | self.track_for_cleanup(self.workspacedir) | ||
388 | self.add_command_to_tearDown('bitbake -c cleansstate %s' % pn) | ||
389 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | ||
390 | result = runCmd('devtool add -b %s %s' % (pn, bin_package_path)) | ||
391 | self.assertExists(os.path.join(self.workspacedir, 'conf', 'layer.conf'), 'Workspace directory not created') | ||
392 | |||
393 | # Build the resulting recipe | ||
394 | result = runCmd('devtool build %s' % pn) | ||
395 | installdir = get_bb_var('D', pn) | ||
396 | self.assertTrue(installdir, 'Could not query installdir variable') | ||
397 | |||
398 | # Check that a known file from the binary package has indeed been installed | ||
399 | self.assertTrue(os.path.isfile(os.path.join(installdir, test_file_dir, test_file_name)), '%s not found in D' % test_file_name) | ||
400 | |||
369 | def test_devtool_add_git_local(self): | 401 | def test_devtool_add_git_local(self): |
370 | # We need dbus built so that DEPENDS recognition works | 402 | # We need dbus built so that DEPENDS recognition works |
371 | bitbake('dbus') | 403 | bitbake('dbus') |