diff options
| -rw-r--r-- | meta/lib/oeqa/selftest/devtool.py | 40 | ||||
| -rw-r--r-- | scripts/lib/devtool/standard.py | 5 |
2 files changed, 43 insertions, 2 deletions
diff --git a/meta/lib/oeqa/selftest/devtool.py b/meta/lib/oeqa/selftest/devtool.py index 33f2e91607..8caf07aaec 100644 --- a/meta/lib/oeqa/selftest/devtool.py +++ b/meta/lib/oeqa/selftest/devtool.py | |||
| @@ -136,6 +136,46 @@ class DevtoolTests(oeSelfTest): | |||
| 136 | bindir = bindir[1:] | 136 | bindir = bindir[1:] |
| 137 | self.assertTrue(os.path.isfile(os.path.join(installdir, bindir, 'pv')), 'pv binary not found in D') | 137 | self.assertTrue(os.path.isfile(os.path.join(installdir, bindir, 'pv')), 'pv binary not found in D') |
| 138 | 138 | ||
| 139 | def test_devtool_add_library(self): | ||
| 140 | # Check preconditions | ||
| 141 | workspacedir = os.path.join(self.builddir, 'workspace') | ||
| 142 | self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory') | ||
| 143 | # We don't have the ability to pick up this dependency automatically yet... | ||
| 144 | bitbake('libusb1') | ||
| 145 | # Fetch source | ||
| 146 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | ||
| 147 | self.track_for_cleanup(tempdir) | ||
| 148 | url = 'http://www.intra2net.com/en/developer/libftdi/download/libftdi1-1.1.tar.bz2' | ||
| 149 | result = runCmd('wget %s' % url, cwd=tempdir) | ||
| 150 | result = runCmd('tar xfv libftdi1-1.1.tar.bz2', cwd=tempdir) | ||
| 151 | srcdir = os.path.join(tempdir, 'libftdi1-1.1') | ||
| 152 | self.assertTrue(os.path.isfile(os.path.join(srcdir, 'CMakeLists.txt')), 'Unable to find CMakeLists.txt in source directory') | ||
| 153 | # Test devtool add | ||
| 154 | self.track_for_cleanup(workspacedir) | ||
| 155 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | ||
| 156 | result = runCmd('devtool add libftdi %s' % srcdir) | ||
| 157 | self.assertTrue(os.path.exists(os.path.join(workspacedir, 'conf', 'layer.conf')), 'Workspace directory not created') | ||
| 158 | # Test devtool status | ||
| 159 | result = runCmd('devtool status') | ||
| 160 | self.assertIn('libftdi', result.output) | ||
| 161 | self.assertIn(srcdir, result.output) | ||
| 162 | # Clean up anything in the workdir/sysroot/sstate cache (have to do this *after* devtool add since the recipe only exists then) | ||
| 163 | bitbake('libftdi -c cleansstate') | ||
| 164 | # Test devtool build | ||
| 165 | result = runCmd('devtool build libftdi') | ||
| 166 | staging_libdir = get_bb_var('STAGING_LIBDIR', 'libftdi') | ||
| 167 | self.assertTrue(staging_libdir, 'Could not query STAGING_LIBDIR variable') | ||
| 168 | self.assertTrue(os.path.isfile(os.path.join(staging_libdir, 'libftdi1.so.2.1.0')), 'libftdi binary not found in STAGING_LIBDIR') | ||
| 169 | # Test devtool reset | ||
| 170 | stampprefix = get_bb_var('STAMP', 'libftdi') | ||
| 171 | result = runCmd('devtool reset libftdi') | ||
| 172 | result = runCmd('devtool status') | ||
| 173 | self.assertNotIn('libftdi', result.output) | ||
| 174 | self.assertTrue(stampprefix, 'Unable to get STAMP value for recipe libftdi') | ||
| 175 | matches = glob.glob(stampprefix + '*') | ||
| 176 | self.assertFalse(matches, 'Stamp files exist for recipe libftdi that should have been cleaned') | ||
| 177 | self.assertFalse(os.path.isfile(os.path.join(staging_libdir, 'libftdi1.so.2.1.0')), 'libftdi binary still found in STAGING_LIBDIR after cleaning') | ||
| 178 | |||
| 139 | def test_devtool_modify(self): | 179 | def test_devtool_modify(self): |
| 140 | # Check preconditions | 180 | # Check preconditions |
| 141 | workspacedir = os.path.join(self.builddir, 'workspace') | 181 | workspacedir = os.path.join(self.builddir, 'workspace') |
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index 763177de1c..9b5a0855b2 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py | |||
| @@ -502,7 +502,8 @@ def build(args, config, basepath, workspace): | |||
| 502 | if not args.recipename in workspace: | 502 | if not args.recipename in workspace: |
| 503 | logger.error("no recipe named %s in your workspace" % args.recipename) | 503 | logger.error("no recipe named %s in your workspace" % args.recipename) |
| 504 | return -1 | 504 | return -1 |
| 505 | exec_build_env_command(config.init_path, basepath, 'bitbake -c install %s' % args.recipename, watch=True) | 505 | build_task = config.get('Build', 'build_task', 'populate_sysroot') |
| 506 | exec_build_env_command(config.init_path, basepath, 'bitbake -c %s %s' % (build_task, args.recipename), watch=True) | ||
| 506 | 507 | ||
| 507 | return 0 | 508 | return 0 |
| 508 | 509 | ||
| @@ -551,7 +552,7 @@ def register_commands(subparsers, context): | |||
| 551 | parser_status.set_defaults(func=status) | 552 | parser_status.set_defaults(func=status) |
| 552 | 553 | ||
| 553 | parser_build = subparsers.add_parser('build', help='Build a recipe', | 554 | parser_build = subparsers.add_parser('build', help='Build a recipe', |
| 554 | description='Builds the specified recipe using bitbake (up to do_install)', | 555 | description='Builds the specified recipe using bitbake', |
| 555 | formatter_class=argparse.ArgumentDefaultsHelpFormatter) | 556 | formatter_class=argparse.ArgumentDefaultsHelpFormatter) |
| 556 | parser_build.add_argument('recipename', help='Recipe to build') | 557 | parser_build.add_argument('recipename', help='Recipe to build') |
| 557 | parser_build.set_defaults(func=build) | 558 | parser_build.set_defaults(func=build) |
