diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-08-12 15:53:06 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-08-13 15:47:55 +0100 |
commit | 5226f46342cae47cb96fafb725dc082ef206f9e8 (patch) | |
tree | f48ab32e3419d2a947e2309c5a4981dbd85abc8c /bitbake/lib/bb/tests/parse.py | |
parent | 36f98fc1f27015a1724f1677495227927341b0ff (diff) | |
download | poky-5226f46342cae47cb96fafb725dc082ef206f9e8.tar.gz |
bitbake: BBHandler/ast: Improve addtask handling
The recent addtask improvement to handle comments complicated the regex significantly
and there are already a number of corner cases in that code which aren't handled well.
Instead of trying to complicate the regex further, switch to code logic instead. This
means the following cases are now handled:
* addtask with multiple task names
* addtask with multiple before constraints
* addtask with multiple after constraints
The testcase is updated to match the improvements.
(Bitbake rev: 417016b83c21fca7616b2ee768d5d08e1edd1e06)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/tests/parse.py')
-rw-r--r-- | bitbake/lib/bb/tests/parse.py | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/bitbake/lib/bb/tests/parse.py b/bitbake/lib/bb/tests/parse.py index d076fcc208..97df2c4590 100644 --- a/bitbake/lib/bb/tests/parse.py +++ b/bitbake/lib/bb/tests/parse.py | |||
@@ -177,7 +177,7 @@ python () { | |||
177 | 177 | ||
178 | addtask_deltask = """ | 178 | addtask_deltask = """ |
179 | addtask do_patch after do_foo after do_unpack before do_configure before do_compile | 179 | addtask do_patch after do_foo after do_unpack before do_configure before do_compile |
180 | addtask do_fetch do_patch | 180 | addtask do_fetch2 do_patch2 |
181 | 181 | ||
182 | addtask do_myplaintask | 182 | addtask do_myplaintask |
183 | addtask do_myplaintask2 | 183 | addtask do_myplaintask2 |
@@ -194,18 +194,11 @@ deltask do_fetch ${MYVAR} ${EMPTYVAR} | |||
194 | deltask ${EMPTYVAR} | 194 | deltask ${EMPTYVAR} |
195 | """ | 195 | """ |
196 | def test_parse_addtask_deltask(self): | 196 | def test_parse_addtask_deltask(self): |
197 | import sys | ||
198 | 197 | ||
199 | with self.assertLogs() as logs: | 198 | f = self.parsehelper(self.addtask_deltask) |
200 | f = self.parsehelper(self.addtask_deltask) | 199 | d = bb.parse.handle(f.name, self.d)[''] |
201 | d = bb.parse.handle(f.name, self.d)[''] | ||
202 | 200 | ||
203 | output = "".join(logs.output) | 201 | self.assertEqual(['do_fetch2', 'do_patch2', 'do_myplaintask', 'do_mytask', 'do_mytask2'], d.getVar("__BBTASKS")) |
204 | self.assertTrue("addtask contained multiple 'before' keywords" in output) | ||
205 | self.assertTrue("addtask contained multiple 'after' keywords" in output) | ||
206 | self.assertTrue('addtask ignored: " do_patch"' in output) | ||
207 | self.assertEqual(['do_myplaintask', 'do_mytask', 'do_mytask2'], d.getVar("__BBTASKS")) | ||
208 | #self.assertTrue('dependent task do_foo for do_patch does not exist' in output) | ||
209 | 202 | ||
210 | broken_multiline_comment = """ | 203 | broken_multiline_comment = """ |
211 | # First line of comment \\ | 204 | # First line of comment \\ |