Openembedded Bitbake Development
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: bitbake-devel <bitbake-devel@lists.openembedded.org>
Subject: [PATCH] tests/parse: Add BBCLASSEXTEND multiple data store corruption reproducer
Date: Wed, 22 Jul 2015 23:29:40 +0100	[thread overview]
Message-ID: <1437604180.821.81.camel@linuxfoundation.org> (raw)

One data store changing a variable poked through into a different data
store. This test case replicates that issue where the value 'B' would 
become unset/disappear.

We also enhance parsehelper to generate files with an optional suffix
such as bbclass.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

diff --git a/bitbake/lib/bb/tests/parse.py b/bitbake/lib/bb/tests/parse.py
index 21fd78a..6beb76a 100644
--- a/bitbake/lib/bb/tests/parse.py
+++ b/bitbake/lib/bb/tests/parse.py
@@ -47,9 +47,9 @@ C = "3"
         self.d = bb.data.init()
         bb.parse.siggen = bb.siggen.init(self.d)
 
-    def parsehelper(self, content):
+    def parsehelper(self, content, suffix = ".bb"):
 
-        f = tempfile.NamedTemporaryFile(suffix = ".bb")
+        f = tempfile.NamedTemporaryFile(suffix = suffix)
         f.write(content)
         f.flush()
         os.chdir(os.path.dirname(f.name))
@@ -113,3 +113,35 @@ PN = "bc"
         d.setVar("OVERRIDES", "bc-dev")
         self.assertEqual(d.getVar("DESCRIPTION", True), "C D")
 
+
+    classextend = """
+VAR_var_override1 = "B"
+EXTRA = ":override1"
+OVERRIDES = "nothing${EXTRA}"
+
+BBCLASSEXTEND = "###CLASS###"
+"""
+    classextend_bbclass = """
+EXTRA = ""
+python () {
+    d.renameVar("VAR_var", "VAR_var2")
+}
+"""
+
+    #
+    # Test based upon a real world data corruption issue. One
+    # data store changing a variable poked through into a different data
+    # store. This test case replicates that issue where the value 'B' would 
+    # become unset/disappear.
+    #
+    def test_parse_classextend_contamination(self):
+        cls = self.parsehelper(self.classextend_bbclass, suffix=".bbclass")
+        #clsname = os.path.basename(cls.name).replace(".bbclass", "")
+        self.classextend = self.classextend.replace("###CLASS###", cls.name)
+        f = self.parsehelper(self.classextend)
+        alldata = bb.parse.handle(f.name, self.d)
+        d1 = alldata['']
+        d2 = alldata[cls.name]
+        self.assertEqual(d1.getVar("VAR_var", True), "B")
+        self.assertEqual(d2.getVar("VAR_var", True), None)
+




                 reply	other threads:[~2015-07-22 22:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1437604180.821.81.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=bitbake-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox