[OE-core] [PATCHv3] oeqa/selftest/buildoptions: Test build does not fail without git rev

Daniel Istrate daniel.alexandrux.istrate at intel.com
Fri Mar 4 10:41:47 UTC 2016


Test that layer git revisions are displayed and
do not fail without git repository.

fix for [YOCTO #8852]

Signed-off-by: Daniel Istrate <daniel.alexandrux.istrate at intel.com>
---
 meta/lib/oeqa/selftest/buildoptions.py | 43 +++++++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/selftest/buildoptions.py b/meta/lib/oeqa/selftest/buildoptions.py
index e2d12c3..ee2a101 100644
--- a/meta/lib/oeqa/selftest/buildoptions.py
+++ b/meta/lib/oeqa/selftest/buildoptions.py
@@ -1,7 +1,8 @@
 import os
 import re
 import glob as g
-
+import shutil
+import tempfile
 from oeqa.selftest.base import oeSelfTest
 from oeqa.selftest.buildhistory import BuildhistoryBase
 from oeqa.utils.commands import runCmd, bitbake, get_bb_var
@@ -111,6 +112,46 @@ class SanityOptionsTest(oeSelfTest):
         line = self.getline(res, "QA Issue: nfs-utils")
         self.assertTrue(line and line.startswith("WARNING:"), "WARNING: QA Issue: nfs-utils message is not present in bitbake's output: %s" % res.output)
 
+    @testcase(1421)
+    def test_layer_git_revisions_are_displayed_and_do_not_fail_without_git_repo(self):
+        """
+        Summary:     Test that layer git revisions are displayed and do not fail without git repository
+        Expected:    The build to be successful and without "fatal" errors
+        Product:     oe-core
+        Author:      Daniel Istrate <daniel.alexandrux.istrate at intel.com>
+        AutomatedBy: Daniel Istrate <daniel.alexandrux.istrate at intel.com>
+        """
+
+        dirpath = tempfile.mkdtemp()
+
+        dummy_layer_name = 'meta-dummy'
+        dummy_layer_path = os.path.join(dirpath, dummy_layer_name)
+        dummy_layer_conf_dir = os.path.join(dummy_layer_path, 'conf')
+        os.makedirs(dummy_layer_conf_dir)
+        dummy_layer_conf_path = os.path.join(dummy_layer_conf_dir, 'layer.conf')
+
+        dummy_layer_content = 'BBPATH .= ":${LAYERDIR}"\n'
+        dummy_layer_content += 'BBFILES += "${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bbappend"\n'
+        dummy_layer_content += 'BBFILE_COLLECTIONS += "%s"\n' % dummy_layer_name
+        dummy_layer_content += 'BBFILE_PATTERN_%s = "^${LAYERDIR}/"\n' % dummy_layer_name
+        dummy_layer_content += 'BBFILE_PRIORITY_%s = "6"\n' % dummy_layer_name
+
+        ftools.write_file(dummy_layer_conf_path, dummy_layer_content)
+
+        bblayers_conf = 'BBLAYERS += "%s"\n' % dummy_layer_path
+        self.write_bblayers_config(bblayers_conf)
+
+        test_recipe = 'ed'
+
+        ret = bitbake('-n %s' % test_recipe)
+
+        err = 'fatal: Not a git repository'
+
+        shutil.rmtree(dirpath)
+
+        self.assertNotIn(err, ret.output)
+
+
 class BuildhistoryTests(BuildhistoryBase):
 
     @testcase(293)
-- 
2.1.0




More information about the Openembedded-core mailing list