diff options
Diffstat (limited to 'bitbake/lib')
9 files changed, 441 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/runqueue-tests/classes/base.bbclass b/bitbake/lib/bb/tests/runqueue-tests/classes/base.bbclass new file mode 100644 index 0000000000..e174c02dd6 --- /dev/null +++ b/bitbake/lib/bb/tests/runqueue-tests/classes/base.bbclass | |||
@@ -0,0 +1,219 @@ | |||
1 | SLOWTASKS ??= "" | ||
2 | SSTATEVALID ??= "" | ||
3 | |||
4 | def stamptask(d): | ||
5 | import time | ||
6 | |||
7 | thistask = d.expand("${PN}:${BB_CURRENTTASK}") | ||
8 | if thistask in d.getVar("SLOWTASKS").split(): | ||
9 | bb.note("Slowing task %s" % thistask) | ||
10 | time.sleep(0.5) | ||
11 | |||
12 | with open(d.expand("${TOPDIR}/task.log"), "a+") as f: | ||
13 | f.write(thistask + "\n") | ||
14 | |||
15 | python do_fetch() { | ||
16 | stamptask(d) | ||
17 | } | ||
18 | python do_unpack() { | ||
19 | stamptask(d) | ||
20 | } | ||
21 | python do_patch() { | ||
22 | stamptask(d) | ||
23 | } | ||
24 | python do_populate_lic() { | ||
25 | stamptask(d) | ||
26 | } | ||
27 | python do_prepare_recipe_sysroot() { | ||
28 | stamptask(d) | ||
29 | } | ||
30 | python do_configure() { | ||
31 | stamptask(d) | ||
32 | } | ||
33 | python do_compile() { | ||
34 | stamptask(d) | ||
35 | } | ||
36 | python do_install() { | ||
37 | stamptask(d) | ||
38 | } | ||
39 | python do_populate_sysroot() { | ||
40 | stamptask(d) | ||
41 | } | ||
42 | python do_package() { | ||
43 | stamptask(d) | ||
44 | } | ||
45 | python do_package_write_ipk() { | ||
46 | stamptask(d) | ||
47 | } | ||
48 | python do_package_write_rpm() { | ||
49 | stamptask(d) | ||
50 | } | ||
51 | python do_packagedata() { | ||
52 | stamptask(d) | ||
53 | } | ||
54 | python do_package_qa() { | ||
55 | stamptask(d) | ||
56 | } | ||
57 | python do_build() { | ||
58 | stamptask(d) | ||
59 | } | ||
60 | do_prepare_recipe_sysroot[deptask] = "do_populate_sysroot" | ||
61 | do_package[deptask] += "do_packagedata" | ||
62 | do_build[recrdeptask] += "do_deploy" | ||
63 | do_build[recrdeptask] += "do_package_write_ipk" | ||
64 | do_build[recrdeptask] += "do_package_write_rpm" | ||
65 | do_package_qa[rdeptask] = "do_packagedata" | ||
66 | do_populate_lic_deploy[recrdeptask] += "do_populate_lic do_deploy" | ||
67 | |||
68 | DEBIANRDEP = "do_packagedata" | ||
69 | oo_package_write_ipk[rdeptask] = "${DEBIANRDEP}" | ||
70 | do_package_write_rpm[rdeptask] = "${DEBIANRDEP}" | ||
71 | |||
72 | addtask fetch | ||
73 | addtask unpack after do_fetch | ||
74 | addtask patch after do_unpack | ||
75 | addtask prepare_recipe_sysroot after do_patch | ||
76 | addtask configure after do_prepare_recipe_sysroot | ||
77 | addtask compile after do_configure | ||
78 | addtask install after do_compile | ||
79 | addtask populate_sysroot after do_install | ||
80 | addtask package after do_install | ||
81 | addtask package_write_ipk after do_packagedata do_package | ||
82 | addtask package_write_rpm after do_packagedata do_package | ||
83 | addtask packagedata after do_package | ||
84 | addtask package_qa after do_package | ||
85 | addtask build after do_package_qa do_package_write_rpm do_package_write_ipk do_populate_sysroot | ||
86 | |||
87 | python do_package_setscene() { | ||
88 | stamptask(d) | ||
89 | } | ||
90 | python do_package_qa_setscene() { | ||
91 | stamptask(d) | ||
92 | } | ||
93 | python do_package_write_ipk_setscene() { | ||
94 | stamptask(d) | ||
95 | } | ||
96 | python do_package_write_rpm_setscene() { | ||
97 | stamptask(d) | ||
98 | } | ||
99 | python do_packagedata_setscene() { | ||
100 | stamptask(d) | ||
101 | } | ||
102 | python do_populate_lic_setscene() { | ||
103 | stamptask(d) | ||
104 | } | ||
105 | python do_populate_sysroot_setscene() { | ||
106 | stamptask(d) | ||
107 | } | ||
108 | |||
109 | addtask package_setscene | ||
110 | addtask package_qa_setscene | ||
111 | addtask package_write_ipk_setscene | ||
112 | addtask package_write_rpm_setscene | ||
113 | addtask packagedata_setscene | ||
114 | addtask populate_lic_setscene | ||
115 | addtask populate_sysroot_setscene | ||
116 | |||
117 | BB_SETSCENE_DEPVALID = "setscene_depvalid" | ||
118 | |||
119 | def setscene_depvalid(task, taskdependees, notneeded, d, log=None): | ||
120 | # taskdependees is a dict of tasks which depend on task, each being a 3 item list of [PN, TASKNAME, FILENAME] | ||
121 | # task is included in taskdependees too | ||
122 | # Return - False - We need this dependency | ||
123 | # - True - We can skip this dependency | ||
124 | import re | ||
125 | |||
126 | def logit(msg, log): | ||
127 | if log is not None: | ||
128 | log.append(msg) | ||
129 | else: | ||
130 | bb.debug(2, msg) | ||
131 | |||
132 | logit("Considering setscene task: %s" % (str(taskdependees[task])), log) | ||
133 | |||
134 | def isNativeCross(x): | ||
135 | return x.endswith("-native") or "-cross-" in x or "-crosssdk" in x or x.endswith("-cross") | ||
136 | |||
137 | # We only need to trigger populate_lic through direct dependencies | ||
138 | if taskdependees[task][1] == "do_populate_lic": | ||
139 | return True | ||
140 | |||
141 | # We only need to trigger packagedata through direct dependencies | ||
142 | # but need to preserve packagedata on packagedata links | ||
143 | if taskdependees[task][1] == "do_packagedata": | ||
144 | for dep in taskdependees: | ||
145 | if taskdependees[dep][1] == "do_packagedata": | ||
146 | return False | ||
147 | return True | ||
148 | |||
149 | for dep in taskdependees: | ||
150 | logit(" considering dependency: %s" % (str(taskdependees[dep])), log) | ||
151 | if task == dep: | ||
152 | continue | ||
153 | if dep in notneeded: | ||
154 | continue | ||
155 | # do_package_write_* and do_package doesn't need do_package | ||
156 | if taskdependees[task][1] == "do_package" and taskdependees[dep][1] in ['do_package', 'do_package_write_ipk', 'do_package_write_rpm', 'do_packagedata', 'do_package_qa']: | ||
157 | continue | ||
158 | # do_package_write_* need do_populate_sysroot as they're mainly postinstall dependencies | ||
159 | if taskdependees[task][1] == "do_populate_sysroot" and taskdependees[dep][1] in ['do_package_write_ipk', 'do_package_write_rpm']: | ||
160 | return False | ||
161 | # do_package/packagedata/package_qa don't need do_populate_sysroot | ||
162 | if taskdependees[task][1] == "do_populate_sysroot" and taskdependees[dep][1] in ['do_package', 'do_packagedata', 'do_package_qa']: | ||
163 | continue | ||
164 | # Native/Cross packages don't exist and are noexec anyway | ||
165 | if isNativeCross(taskdependees[dep][0]) and taskdependees[dep][1] in ['do_package_write_ipk', 'do_package_write_rpm', 'do_packagedata', 'do_package', 'do_package_qa']: | ||
166 | continue | ||
167 | |||
168 | # This is due to the [depends] in useradd.bbclass complicating matters | ||
169 | # The logic *is* reversed here due to the way hard setscene dependencies are injected | ||
170 | if (taskdependees[task][1] == 'do_package' or taskdependees[task][1] == 'do_populate_sysroot') and taskdependees[dep][0].endswith(('shadow-native', 'shadow-sysroot', 'base-passwd', 'pseudo-native')) and taskdependees[dep][1] == 'do_populate_sysroot': | ||
171 | continue | ||
172 | |||
173 | # Consider sysroot depending on sysroot tasks | ||
174 | if taskdependees[task][1] == 'do_populate_sysroot' and taskdependees[dep][1] == 'do_populate_sysroot': | ||
175 | # Native/Cross populate_sysroot need their dependencies | ||
176 | if isNativeCross(taskdependees[task][0]) and isNativeCross(taskdependees[dep][0]): | ||
177 | return False | ||
178 | # Target populate_sysroot depended on by cross tools need to be installed | ||
179 | if isNativeCross(taskdependees[dep][0]): | ||
180 | return False | ||
181 | # Native/cross tools depended upon by target sysroot are not needed | ||
182 | # Add an exception for shadow-native as required by useradd.bbclass | ||
183 | if isNativeCross(taskdependees[task][0]) and taskdependees[task][0] != 'shadow-native': | ||
184 | continue | ||
185 | # Target populate_sysroot need their dependencies | ||
186 | return False | ||
187 | |||
188 | |||
189 | if taskdependees[dep][1] == "do_populate_lic": | ||
190 | continue | ||
191 | |||
192 | # Safe fallthrough default | ||
193 | logit(" Default setscene dependency fall through due to dependency: %s" % (str(taskdependees[dep])), log) | ||
194 | return False | ||
195 | return True | ||
196 | |||
197 | BB_HASHCHECK_FUNCTION = "sstate_checkhashes" | ||
198 | |||
199 | def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d, siginfo=False, *, sq_unihash=None): | ||
200 | |||
201 | ret = [] | ||
202 | missed = [] | ||
203 | |||
204 | valid = d.getVar("SSTATEVALID").split() | ||
205 | |||
206 | for task in range(len(sq_fn)): | ||
207 | n = os.path.basename(sq_fn[task]).rsplit(".", 1)[0] + ":" + sq_task[task] | ||
208 | if n in valid: | ||
209 | bb.note("SState: Found valid sstate for %s" % n) | ||
210 | ret.append(task) | ||
211 | else: | ||
212 | missed.append(task) | ||
213 | bb.note("SState: Found no valid sstate for %s" % n) | ||
214 | |||
215 | if hasattr(bb.parse.siggen, "checkhashes"): | ||
216 | bb.parse.siggen.checkhashes(missed, ret, sq_fn, sq_task, sq_hash, sq_hashfn, d) | ||
217 | |||
218 | return ret | ||
219 | |||
diff --git a/bitbake/lib/bb/tests/runqueue-tests/classes/image.bbclass b/bitbake/lib/bb/tests/runqueue-tests/classes/image.bbclass new file mode 100644 index 0000000000..da9ff11064 --- /dev/null +++ b/bitbake/lib/bb/tests/runqueue-tests/classes/image.bbclass | |||
@@ -0,0 +1,5 @@ | |||
1 | do_rootfs[recrdeptask] += "do_package_write_deb do_package_qa" | ||
2 | do_rootfs[recrdeptask] += "do_package_write_ipk do_package_qa" | ||
3 | do_rootfs[recrdeptask] += "do_package_write_rpm do_package_qa | ||
4 | do_rootfs[recrdeptask] += "do_packagedata" | ||
5 | do_rootfs[recrdeptask] += "do_populate_lic" | ||
diff --git a/bitbake/lib/bb/tests/runqueue-tests/classes/native.bbclass b/bitbake/lib/bb/tests/runqueue-tests/classes/native.bbclass new file mode 100644 index 0000000000..7eaaee54ad --- /dev/null +++ b/bitbake/lib/bb/tests/runqueue-tests/classes/native.bbclass | |||
@@ -0,0 +1,2 @@ | |||
1 | RECIPERDEPTASK = "do_populate_sysroot" | ||
2 | do_populate_sysroot[rdeptask] = "${RECIPERDEPTASK}" | ||
diff --git a/bitbake/lib/bb/tests/runqueue-tests/conf/bitbake.conf b/bitbake/lib/bb/tests/runqueue-tests/conf/bitbake.conf new file mode 100644 index 0000000000..8c7b754dab --- /dev/null +++ b/bitbake/lib/bb/tests/runqueue-tests/conf/bitbake.conf | |||
@@ -0,0 +1,11 @@ | |||
1 | CACHE = "${TOPDIR}/cache" | ||
2 | THISDIR = "${@os.path.dirname(d.getVar('FILE'))}" | ||
3 | COREBASE := "${@os.path.normpath(os.path.dirname(d.getVar('FILE')+'/../../'))}" | ||
4 | BBFILES = "${COREBASE}/recipes/*.bb" | ||
5 | PROVIDES = "${PN}" | ||
6 | PN = "${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[0]}" | ||
7 | PF = "${BB_CURRENT_MC}:${PN}" | ||
8 | export PATH | ||
9 | STAMP = "${TOPDIR}/stamps/${PN}" | ||
10 | T = "${TOPDIR}/workdir/${PN}/temp" | ||
11 | BB_NUMBER_THREADS = "4" | ||
diff --git a/bitbake/lib/bb/tests/runqueue-tests/recipes/a1.bb b/bitbake/lib/bb/tests/runqueue-tests/recipes/a1.bb new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/bitbake/lib/bb/tests/runqueue-tests/recipes/a1.bb | |||
diff --git a/bitbake/lib/bb/tests/runqueue-tests/recipes/b1.bb b/bitbake/lib/bb/tests/runqueue-tests/recipes/b1.bb new file mode 100644 index 0000000000..c0b288e5bc --- /dev/null +++ b/bitbake/lib/bb/tests/runqueue-tests/recipes/b1.bb | |||
@@ -0,0 +1 @@ | |||
DEPENDS = "a1" \ No newline at end of file | |||
diff --git a/bitbake/lib/bb/tests/runqueue-tests/recipes/c1.bb b/bitbake/lib/bb/tests/runqueue-tests/recipes/c1.bb new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/bitbake/lib/bb/tests/runqueue-tests/recipes/c1.bb | |||
diff --git a/bitbake/lib/bb/tests/runqueue-tests/recipes/d1.bb b/bitbake/lib/bb/tests/runqueue-tests/recipes/d1.bb new file mode 100644 index 0000000000..5ba197515b --- /dev/null +++ b/bitbake/lib/bb/tests/runqueue-tests/recipes/d1.bb | |||
@@ -0,0 +1,3 @@ | |||
1 | DEPENDS = "a1" | ||
2 | |||
3 | do_package_setscene[depends] = "a1:do_populate_sysroot_setscene" | ||
diff --git a/bitbake/lib/bb/tests/runqueue.py b/bitbake/lib/bb/tests/runqueue.py new file mode 100644 index 0000000000..4a65b5b6e7 --- /dev/null +++ b/bitbake/lib/bb/tests/runqueue.py | |||
@@ -0,0 +1,200 @@ | |||
1 | # | ||
2 | # BitBake Tests for runqueue task processing | ||
3 | # | ||
4 | # Copyright (C) 2019 Richard Purdie | ||
5 | # | ||
6 | # SPDX-License-Identifier: GPL-2.0-only | ||
7 | # | ||
8 | |||
9 | import unittest | ||
10 | import bb | ||
11 | import os | ||
12 | import tempfile | ||
13 | import subprocess | ||
14 | |||
15 | # | ||
16 | # TODO: | ||
17 | # Add tests on task ordering (X happens before Y after Z) | ||
18 | # | ||
19 | |||
20 | class RunQueueTests(unittest.TestCase): | ||
21 | |||
22 | alltasks = ['package', 'fetch', 'unpack', 'patch', 'prepare_recipe_sysroot', 'configure', | ||
23 | 'compile', 'install', 'packagedata', 'package_qa', 'package_write_rpm', 'package_write_ipk', | ||
24 | 'populate_sysroot', 'build'] | ||
25 | a1_sstatevalid = "a1:do_package a1:do_package_qa a1:do_packagedata a1:do_package_write_ipk a1:do_package_write_rpm a1:do_populate_lic a1:do_populate_sysroot" | ||
26 | b1_sstatevalid = "b1:do_package b1:do_package_qa b1:do_packagedata b1:do_package_write_ipk b1:do_package_write_rpm b1:do_populate_lic b1:do_populate_sysroot" | ||
27 | |||
28 | def run_bitbakecmd(self, cmd, builddir, sstatevalid="", slowtasks="", extraenv=None): | ||
29 | env = os.environ.copy() | ||
30 | env["BBPATH"] = os.path.realpath(os.path.join(os.path.dirname(__file__), "runqueue-tests")) | ||
31 | env["BB_ENV_EXTRAWHITE"] = "SSTATEVALID SLOWTASKS" | ||
32 | env["SSTATEVALID"] = sstatevalid | ||
33 | env["SLOWTASKS"] = slowtasks | ||
34 | if extraenv: | ||
35 | for k in extraenv: | ||
36 | env[k] = extraenv[k] | ||
37 | env["BB_ENV_EXTRAWHITE"] = env["BB_ENV_EXTRAWHITE"] + " " + k | ||
38 | try: | ||
39 | output = subprocess.check_output(cmd, env=env, stderr=subprocess.STDOUT,universal_newlines=True, cwd=builddir) | ||
40 | except subprocess.CalledProcessError as e: | ||
41 | self.fail("Command %s failed with %s" % (cmd, e.output)) | ||
42 | tasks = [] | ||
43 | with open(builddir + "/task.log", "r") as f: | ||
44 | tasks = [line.rstrip() for line in f] | ||
45 | return tasks | ||
46 | |||
47 | def test_no_setscenevalid(self): | ||
48 | with tempfile.TemporaryDirectory(prefix="runqueuetest") as tempdir: | ||
49 | cmd = ["bitbake", "a1"] | ||
50 | sstatevalid = "" | ||
51 | tasks = self.run_bitbakecmd(cmd, tempdir, sstatevalid) | ||
52 | expected = ['a1:' + x for x in self.alltasks] | ||
53 | self.assertEqual(set(tasks), set(expected)) | ||
54 | |||
55 | def test_single_setscenevalid(self): | ||
56 | with tempfile.TemporaryDirectory(prefix="runqueuetest") as tempdir: | ||
57 | cmd = ["bitbake", "a1"] | ||
58 | sstatevalid = "a1:do_package" | ||
59 | tasks = self.run_bitbakecmd(cmd, tempdir, sstatevalid) | ||
60 | expected = ['a1:package_setscene', 'a1:fetch', 'a1:unpack', 'a1:patch', 'a1:prepare_recipe_sysroot', 'a1:configure', | ||
61 | 'a1:compile', 'a1:install', 'a1:packagedata', 'a1:package_qa', 'a1:package_write_rpm', 'a1:package_write_ipk', | ||
62 | 'a1:populate_sysroot', 'a1:build'] | ||
63 | self.assertEqual(set(tasks), set(expected)) | ||
64 | |||
65 | def test_intermediate_setscenevalid(self): | ||
66 | with tempfile.TemporaryDirectory(prefix="runqueuetest") as tempdir: | ||
67 | cmd = ["bitbake", "a1"] | ||
68 | sstatevalid = "a1:do_package a1:do_populate_sysroot" | ||
69 | tasks = self.run_bitbakecmd(cmd, tempdir, sstatevalid) | ||
70 | expected = ['a1:package_setscene', 'a1:packagedata', 'a1:package_qa', 'a1:package_write_rpm', 'a1:package_write_ipk', | ||
71 | 'a1:populate_sysroot_setscene', 'a1:build'] | ||
72 | self.assertEqual(set(tasks), set(expected)) | ||
73 | |||
74 | def test_intermediate_notcovered(self): | ||
75 | with tempfile.TemporaryDirectory(prefix="runqueuetest") as tempdir: | ||
76 | cmd = ["bitbake", "a1"] | ||
77 | sstatevalid = "a1:do_package_qa a1:do_packagedata a1:do_package_write_ipk a1:do_package_write_rpm a1:do_populate_lic a1:do_populate_sysroot" | ||
78 | tasks = self.run_bitbakecmd(cmd, tempdir, sstatevalid) | ||
79 | expected = ['a1:package_write_ipk_setscene', 'a1:package_write_rpm_setscene', 'a1:packagedata_setscene', | ||
80 | 'a1:package_qa_setscene', 'a1:build', 'a1:populate_sysroot_setscene'] | ||
81 | self.assertEqual(set(tasks), set(expected)) | ||
82 | |||
83 | def test_all_setscenevalid(self): | ||
84 | with tempfile.TemporaryDirectory(prefix="runqueuetest") as tempdir: | ||
85 | cmd = ["bitbake", "a1"] | ||
86 | sstatevalid = self.a1_sstatevalid | ||
87 | tasks = self.run_bitbakecmd(cmd, tempdir, sstatevalid) | ||
88 | expected = ['a1:package_write_ipk_setscene', 'a1:package_write_rpm_setscene', 'a1:packagedata_setscene', | ||
89 | 'a1:package_qa_setscene', 'a1:build', 'a1:populate_sysroot_setscene'] | ||
90 | self.assertEqual(set(tasks), set(expected)) | ||
91 | |||
92 | def test_no_settasks(self): | ||
93 | with tempfile.TemporaryDirectory(prefix="runqueuetest") as tempdir: | ||
94 | cmd = ["bitbake", "a1", "-c", "patch"] | ||
95 | sstatevalid = self.a1_sstatevalid | ||
96 | tasks = self.run_bitbakecmd(cmd, tempdir, sstatevalid) | ||
97 | expected = ['a1:fetch', 'a1:unpack', 'a1:patch'] | ||
98 | self.assertEqual(set(tasks), set(expected)) | ||
99 | |||
100 | # Test targets with intermediate setscene tasks alongside a target with no intermediate setscene tasks | ||
101 | def test_mixed_direct_tasks_setscene_tasks(self): | ||
102 | with tempfile.TemporaryDirectory(prefix="runqueuetest") as tempdir: | ||
103 | cmd = ["bitbake", "c1:do_patch", "a1"] | ||
104 | sstatevalid = self.a1_sstatevalid | ||
105 | tasks = self.run_bitbakecmd(cmd, tempdir, sstatevalid) | ||
106 | expected = ['c1:fetch', 'c1:unpack', 'c1:patch', 'a1:package_write_ipk_setscene', 'a1:package_write_rpm_setscene', 'a1:packagedata_setscene', | ||
107 | 'a1:package_qa_setscene', 'a1:build', 'a1:populate_sysroot_setscene'] | ||
108 | self.assertEqual(set(tasks), set(expected)) | ||
109 | |||
110 | # This test slows down the execution of do_package_setscene until after other real tasks have | ||
111 | # started running which tests for a bug where tasks were being lost from the buildable list of real | ||
112 | # tasks if they weren't in tasks_covered or tasks_notcovered | ||
113 | def test_slow_setscene(self): | ||
114 | with tempfile.TemporaryDirectory(prefix="runqueuetest") as tempdir: | ||
115 | cmd = ["bitbake", "a1"] | ||
116 | sstatevalid = "a1:do_package" | ||
117 | slowtasks = "a1:package_setscene" | ||
118 | tasks = self.run_bitbakecmd(cmd, tempdir, sstatevalid, slowtasks) | ||
119 | expected = ['a1:package_setscene', 'a1:fetch', 'a1:unpack', 'a1:patch', 'a1:prepare_recipe_sysroot', 'a1:configure', | ||
120 | 'a1:compile', 'a1:install', 'a1:packagedata', 'a1:package_qa', 'a1:package_write_rpm', 'a1:package_write_ipk', | ||
121 | 'a1:populate_sysroot', 'a1:build'] | ||
122 | self.assertEqual(set(tasks), set(expected)) | ||
123 | |||
124 | def test_setscenewhitelist(self): | ||
125 | with tempfile.TemporaryDirectory(prefix="runqueuetest") as tempdir: | ||
126 | cmd = ["bitbake", "a1"] | ||
127 | extraenv = { | ||
128 | "BB_SETSCENE_ENFORCE" : "1", | ||
129 | "BB_SETSCENE_ENFORCE_WHITELIST" : "a1:do_package_write_rpm a1:do_build" | ||
130 | } | ||
131 | sstatevalid = "a1:do_package a1:do_package_qa a1:do_packagedata a1:do_package_write_ipk a1:do_populate_lic a1:do_populate_sysroot" | ||
132 | tasks = self.run_bitbakecmd(cmd, tempdir, sstatevalid, extraenv=extraenv) | ||
133 | expected = ['a1:packagedata_setscene', 'a1:package_qa_setscene', 'a1:package_write_ipk_setscene', | ||
134 | 'a1:populate_sysroot_setscene', 'a1:package_setscene'] | ||
135 | self.assertEqual(set(tasks), set(expected)) | ||
136 | |||
137 | # Tests for problems with dependencies between setscene tasks | ||
138 | def test_no_setscenevalid_harddeps(self): | ||
139 | with tempfile.TemporaryDirectory(prefix="runqueuetest") as tempdir: | ||
140 | cmd = ["bitbake", "d1"] | ||
141 | sstatevalid = "" | ||
142 | tasks = self.run_bitbakecmd(cmd, tempdir, sstatevalid) | ||
143 | expected = ['a1:package', 'a1:fetch', 'a1:unpack', 'a1:patch', 'a1:prepare_recipe_sysroot', 'a1:configure', | ||
144 | 'a1:compile', 'a1:install', 'a1:packagedata', 'a1:package_write_rpm', 'a1:package_write_ipk', | ||
145 | 'a1:populate_sysroot', 'd1:package', 'd1:fetch', 'd1:unpack', 'd1:patch', 'd1:prepare_recipe_sysroot', 'd1:configure', | ||
146 | 'd1:compile', 'd1:install', 'd1:packagedata', 'd1:package_qa', 'd1:package_write_rpm', 'd1:package_write_ipk', | ||
147 | 'd1:populate_sysroot', 'd1:build'] | ||
148 | self.assertEqual(set(tasks), set(expected)) | ||
149 | |||
150 | def test_no_setscenevalid_withdeps(self): | ||
151 | with tempfile.TemporaryDirectory(prefix="runqueuetest") as tempdir: | ||
152 | cmd = ["bitbake", "b1"] | ||
153 | sstatevalid = "" | ||
154 | tasks = self.run_bitbakecmd(cmd, tempdir, sstatevalid) | ||
155 | expected = ['a1:' + x for x in self.alltasks] + ['b1:' + x for x in self.alltasks] | ||
156 | expected.remove('a1:build') | ||
157 | expected.remove('a1:package_qa') | ||
158 | self.assertEqual(set(tasks), set(expected)) | ||
159 | |||
160 | def test_single_a1_setscenevalid_withdeps(self): | ||
161 | with tempfile.TemporaryDirectory(prefix="runqueuetest") as tempdir: | ||
162 | cmd = ["bitbake", "b1"] | ||
163 | sstatevalid = "a1:do_package" | ||
164 | tasks = self.run_bitbakecmd(cmd, tempdir, sstatevalid) | ||
165 | expected = ['a1:package_setscene', 'a1:fetch', 'a1:unpack', 'a1:patch', 'a1:prepare_recipe_sysroot', 'a1:configure', | ||
166 | 'a1:compile', 'a1:install', 'a1:packagedata', 'a1:package_write_rpm', 'a1:package_write_ipk', | ||
167 | 'a1:populate_sysroot'] + ['b1:' + x for x in self.alltasks] | ||
168 | self.assertEqual(set(tasks), set(expected)) | ||
169 | |||
170 | def test_single_b1_setscenevalid_withdeps(self): | ||
171 | with tempfile.TemporaryDirectory(prefix="runqueuetest") as tempdir: | ||
172 | cmd = ["bitbake", "b1"] | ||
173 | sstatevalid = "b1:do_package" | ||
174 | tasks = self.run_bitbakecmd(cmd, tempdir, sstatevalid) | ||
175 | expected = ['a1:package', 'a1:fetch', 'a1:unpack', 'a1:patch', 'a1:prepare_recipe_sysroot', 'a1:configure', | ||
176 | 'a1:compile', 'a1:install', 'a1:packagedata', 'a1:package_write_rpm', 'a1:package_write_ipk', | ||
177 | 'a1:populate_sysroot', 'b1:package_setscene'] + ['b1:' + x for x in self.alltasks] | ||
178 | expected.remove('b1:package') | ||
179 | self.assertEqual(set(tasks), set(expected)) | ||
180 | |||
181 | def test_intermediate_setscenevalid_withdeps(self): | ||
182 | with tempfile.TemporaryDirectory(prefix="runqueuetest") as tempdir: | ||
183 | cmd = ["bitbake", "b1"] | ||
184 | sstatevalid = "a1:do_package a1:do_populate_sysroot b1:do_package" | ||
185 | tasks = self.run_bitbakecmd(cmd, tempdir, sstatevalid) | ||
186 | expected = ['a1:package_setscene', 'a1:packagedata', 'a1:package_write_rpm', 'a1:package_write_ipk', | ||
187 | 'a1:populate_sysroot_setscene', 'b1:package_setscene'] + ['b1:' + x for x in self.alltasks] | ||
188 | expected.remove('b1:package') | ||
189 | self.assertEqual(set(tasks), set(expected)) | ||
190 | |||
191 | def test_all_setscenevalid_withdeps(self): | ||
192 | with tempfile.TemporaryDirectory(prefix="runqueuetest") as tempdir: | ||
193 | cmd = ["bitbake", "b1"] | ||
194 | sstatevalid = self.a1_sstatevalid + " " + self.b1_sstatevalid | ||
195 | tasks = self.run_bitbakecmd(cmd, tempdir, sstatevalid) | ||
196 | expected = ['a1:package_write_ipk_setscene', 'a1:package_write_rpm_setscene', 'a1:packagedata_setscene', | ||
197 | 'b1:build', 'a1:populate_sysroot_setscene', 'b1:package_write_ipk_setscene', 'b1:package_write_rpm_setscene', | ||
198 | 'b1:packagedata_setscene', 'b1:package_qa_setscene', 'b1:populate_sysroot_setscene'] | ||
199 | self.assertEqual(set(tasks), set(expected)) | ||
200 | |||