]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
oeqa/selftest: add test case to cover 'devtool modify -n' for a git recipe
authorChen Qi <Qi.Chen@windriver.com>
Mon, 22 Jan 2024 05:29:26 +0000 (13:29 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 26 Jan 2024 15:06:01 +0000 (15:06 +0000)
Add a test case to ensure the following error does not happen again for
'devtool modify -n'.

Traceback (most recent call last):
  File "/buildarea2/chenqi/poky/scripts/devtool", line 349, in <module>
    ret = main()
  File "/buildarea2/chenqi/poky/scripts/devtool", line 336, in main
    ret = args.func(args, config, basepath, workspace)
  File "/buildarea2/chenqi/poky/scripts/lib/devtool/standard.py", line 924, in modify
    if not initial_revs["."]:
KeyError: '.'

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/selftest/cases/devtool.py

index 6ed51d7a452030e2919bb09a6ffa2036819d46ca..15249b70fdda91fa34705928e19291cd6ece9e7d 100644 (file)
@@ -917,6 +917,28 @@ class DevtoolModifyTests(DevtoolBase):
         # Try building
         bitbake(testrecipe)
 
+    def test_devtool_modify_git_no_extract(self):
+        # Check preconditions
+        testrecipe = 'psplash'
+        src_uri = get_bb_var('SRC_URI', testrecipe)
+        self.assertIn('git://', src_uri, 'This test expects the %s recipe to be a git recipe' % testrecipe)
+        # Clean up anything in the workdir/sysroot/sstate cache
+        bitbake('%s -c cleansstate' % testrecipe)
+        # Try modifying a recipe
+        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        self.track_for_cleanup(tempdir)
+        self.track_for_cleanup(self.workspacedir)
+        self.add_command_to_tearDown('bitbake -c clean %s' % testrecipe)
+        self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
+        result = runCmd('git clone https://git.yoctoproject.org/psplash %s && devtool modify -n %s %s' % (tempdir, testrecipe, tempdir))
+        self.assertExists(os.path.join(self.workspacedir, 'conf', 'layer.conf'), 'Workspace directory not created. devtool output: %s' % result.output)
+        matches = glob.glob(os.path.join(self.workspacedir, 'appends', 'psplash_*.bbappend'))
+        self.assertTrue(matches, 'bbappend not created')
+        # Test devtool status
+        result = runCmd('devtool status')
+        self.assertIn(testrecipe, result.output)
+        self.assertIn(tempdir, result.output)
+
     def test_devtool_modify_git_crates_subpath(self):
         # This tests two things in devtool context:
         #   - that we support local git dependencies for cargo based recipe