aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bb/tests
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2020-06-05 22:15:35 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-06-08 21:33:27 +0100
commit513fc2dddf13d5e344162c26d89d2dde2fe85634 (patch)
tree461f619beea39298570792063106da6b1e91fbca /lib/bb/tests
parent3c5c7346adf4ca7ec761c08738f12401ba75b7c8 (diff)
downloadbitbake-513fc2dddf13d5e344162c26d89d2dde2fe85634.tar.gz
bitbake: tests: Add tests for BBMASK in multiconfig
Adds a test to validate that multiconfigs can independently mask off recipes by setting BBMASK. See the test description for further information about how the test works. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/tests')
-rw-r--r--lib/bb/tests/runqueue-tests/conf/bitbake.conf3
-rw-r--r--lib/bb/tests/runqueue-tests/conf/multiconfig/mc1.conf1
-rw-r--r--lib/bb/tests/runqueue-tests/conf/multiconfig/mc2.conf1
-rw-r--r--lib/bb/tests/runqueue-tests/recipes/fails-mc/fails-mc1.bb5
-rw-r--r--lib/bb/tests/runqueue-tests/recipes/fails-mc/fails-mc2.bb4
-rw-r--r--lib/bb/tests/runqueue.py15
6 files changed, 28 insertions, 1 deletions
diff --git a/lib/bb/tests/runqueue-tests/conf/bitbake.conf b/lib/bb/tests/runqueue-tests/conf/bitbake.conf
index 5e451fc2c..efebf001a 100644
--- a/lib/bb/tests/runqueue-tests/conf/bitbake.conf
+++ b/lib/bb/tests/runqueue-tests/conf/bitbake.conf
@@ -1,7 +1,8 @@
CACHE = "${TOPDIR}/cache"
THISDIR = "${@os.path.dirname(d.getVar('FILE'))}"
COREBASE := "${@os.path.normpath(os.path.dirname(d.getVar('FILE')+'/../../'))}"
-BBFILES = "${COREBASE}/recipes/*.bb"
+EXTRA_BBFILES ?= ""
+BBFILES = "${COREBASE}/recipes/*.bb ${EXTRA_BBFILES}"
PROVIDES = "${PN}"
PN = "${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[0]}"
PF = "${BB_CURRENT_MC}:${PN}"
diff --git a/lib/bb/tests/runqueue-tests/conf/multiconfig/mc1.conf b/lib/bb/tests/runqueue-tests/conf/multiconfig/mc1.conf
index ecf23e1c7..f34b8dccc 100644
--- a/lib/bb/tests/runqueue-tests/conf/multiconfig/mc1.conf
+++ b/lib/bb/tests/runqueue-tests/conf/multiconfig/mc1.conf
@@ -1 +1,2 @@
TMPDIR = "${TOPDIR}/mc1/"
+BBMASK += "recipes/fails-mc/fails-mc1.bb"
diff --git a/lib/bb/tests/runqueue-tests/conf/multiconfig/mc2.conf b/lib/bb/tests/runqueue-tests/conf/multiconfig/mc2.conf
index eef338e4c..c3360fc5c 100644
--- a/lib/bb/tests/runqueue-tests/conf/multiconfig/mc2.conf
+++ b/lib/bb/tests/runqueue-tests/conf/multiconfig/mc2.conf
@@ -1 +1,2 @@
TMPDIR = "${TOPDIR}/mc2/"
+BBMASK += "recipes/fails-mc/fails-mc2.bb"
diff --git a/lib/bb/tests/runqueue-tests/recipes/fails-mc/fails-mc1.bb b/lib/bb/tests/runqueue-tests/recipes/fails-mc/fails-mc1.bb
new file mode 100644
index 000000000..17a181fff
--- /dev/null
+++ b/lib/bb/tests/runqueue-tests/recipes/fails-mc/fails-mc1.bb
@@ -0,0 +1,5 @@
+python () {
+ if d.getVar("BB_CURRENT_MC") == "mc1":
+ bb.fatal("Multiconfig is mc1")
+}
+
diff --git a/lib/bb/tests/runqueue-tests/recipes/fails-mc/fails-mc2.bb b/lib/bb/tests/runqueue-tests/recipes/fails-mc/fails-mc2.bb
new file mode 100644
index 000000000..cc69e7b82
--- /dev/null
+++ b/lib/bb/tests/runqueue-tests/recipes/fails-mc/fails-mc2.bb
@@ -0,0 +1,4 @@
+python () {
+ if d.getVar("BB_CURRENT_MC") == "mc2":
+ bb.fatal("Multiconfig is mc2")
+}
diff --git a/lib/bb/tests/runqueue.py b/lib/bb/tests/runqueue.py
index 4ba12a077..091b5e41e 100644
--- a/lib/bb/tests/runqueue.py
+++ b/lib/bb/tests/runqueue.py
@@ -232,6 +232,21 @@ class RunQueueTests(unittest.TestCase):
expected.remove(x)
self.assertEqual(set(tasks), set(expected))
+ def test_multiconfig_bbmask(self):
+ # This test validates that multiconfigs can independently mask off
+ # recipes they do not want with BBMASK. It works by having recipes
+ # that will fail to parse for mc1 and mc2, then making each multiconfig
+ # build the one that does parse. This ensures that the recipes are in
+ # each multiconfigs BBFILES, but each is masking only the one that
+ # doesn't parse
+ with tempfile.TemporaryDirectory(prefix="runqueuetest") as tempdir:
+ extraenv = {
+ "BBMULTICONFIG" : "mc1 mc2",
+ "BB_SIGNATURE_HANDLER" : "basic",
+ "EXTRA_BBFILES": "${COREBASE}/recipes/fails-mc/*.bb",
+ }
+ cmd = ["bitbake", "mc:mc1:fails-mc2", "mc:mc2:fails-mc1"]
+ self.run_bitbakecmd(cmd, tempdir, "", extraenv=extraenv)
@unittest.skipIf(sys.version_info < (3, 5, 0), 'Python 3.5 or later required')
def test_hashserv_single(self):