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

Daniel Istrate daniel.alexandrux.istrate at intel.com
Mon Feb 15 16:49:22 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 | 32 +++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/selftest/buildoptions.py b/meta/lib/oeqa/selftest/buildoptions.py
index 6167fb2..80b59bd 100644
--- a/meta/lib/oeqa/selftest/buildoptions.py
+++ b/meta/lib/oeqa/selftest/buildoptions.py
@@ -1,7 +1,7 @@
 import os
 import re
 import glob as g
-
+import shutil
 from oeqa.selftest.base import oeSelfTest
 from oeqa.selftest.buildhistory import BuildhistoryBase
 from oeqa.utils.commands import runCmd, bitbake, get_bb_var
@@ -103,6 +103,36 @@ class SanityOptionsTest(oeSelfTest):
         self.assertTrue("WARNING: QA Issue: gzip" in res.output, "WARNING: QA Issue: gzip message is not present in bitbake's output: %s" % res.output)
         self.assertTrue("WARNING: QA Issue: nfs-utils" in res.output, "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>
+        """
+
+        test_recipe = 'ed'
+        corebase = get_bb_var('COREBASE')
+        git_dir = os.path.join(corebase, '.git')
+        git_dir_tmp = os.path.join(corebase, '.git_tmp')
+
+        bitbake('-n %s' % test_recipe)
+        shutil.move(git_dir, git_dir_tmp)
+
+        self.add_command_to_tearDown('mv %s %s' % (git_dir_tmp, git_dir))
+
+        ret = bitbake('-n %s' % test_recipe)
+
+        patt = r'fatal: Not a git repository \(or any parent up to mount point /home\)\n' \
+               r'Stopping at filesystem boundary \(GIT_DISCOVERY_ACROSS_FILESYSTEM not set\)\.'
+
+        found_err = re.search(patt, ret.output)
+
+        self.assertIsNone(found_err, 'Fatal errors found. Output: %s' % ret.output)
+
+
 class BuildhistoryTests(BuildhistoryBase):
 
     @testcase(293)
-- 
2.1.0




More information about the Openembedded-core mailing list