Commit Graph

24 Commits

Author SHA1 Message Date
Mark Hatle
8ed26544f9 bitbake: bitbake: runqueue: Verify mcdepends are valid
In order to avoid a potentially confusing backtrace, check that the mcdepend
is valid when we add it.

Add a test case to ensure invalid configurations are caught and trigger an
error.

[RP: Reworked test case to simplify and improve code]
(Bitbake rev: ff523497270f37b484b44a4445c2194791bcb6ff)

Signed-off-by: Mark Hatle <mark.hatle@amd.com>
Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-03-03 21:38:57 +00:00
Richard Purdie
a40875b727 bitbake: siggen: Drop non-multiconfig aware siggen support
All siggens in common use should now support multiconfig, drop the
compatibility code.

(Bitbake rev: b36545b4df6d935ed312ff407d4e0474c3ed8d1a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-12-11 23:21:27 +00:00
Scott Murray
3c971c0400 bitbake: bitbake: Rename setscene enforce filtering variable
In line with the inclusive language migration defined at:

https://wiki.yoctoproject.org/wiki/Inclusive_language

rename:

BB_SETSCENE_ENFORCE_WHITELIST -> BB_SETSCENE_ENFORCE_IGNORE_TASKS

(Bitbake rev: 2e243ac06581c4de8c6e697dfba460ca017d067c)

(Bitbake rev: f8f7b80a0df4646247e58238a52a7d85a37116d4)

Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-02-21 23:37:26 +00:00
Scott Murray
8e5a8a2b53 bitbake: bitbake: Rename environment filtering variables
In line with the inclusive language migration defined at:

https://wiki.yoctoproject.org/wiki/Inclusive_language

rename:

BB_ENV_WHITELIST -> BB_ENV_PASSTHROUGH
BB_ENV_EXTRAWHITE -> BB_ENV_PASSTHROUGH_ADDITIONS

(Bitbake rev: fe60627839d4280cf0117ed1afbfccdff1181b6a)

(Bitbake rev: 87104b6a167188921da157c7dba45938849fb22a)

Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-02-21 23:37:26 +00:00
Richard Purdie
7c0266a248 bitbake: tests/runqueue: Improve lockfile handling race
Internal bitbake shutdown timings must have changed recently as we're
seeing race issues on the autobuilder around the removal of the bitbake.lock
file. Improve the lockfile race code to cover bitbake's lockfile too
and use it in all the tests.

[YOCTO #14658]
[YOCTO #14652]

(Bitbake rev: bd1912bed64424f9fb28396b71bb49b6090ed087)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-12-14 22:47:04 +00:00
Richard Purdie
9e4b20119e bitbake: tests/runqueue: Set TOPDIR in test
It was clear with testing that we're asuming bitbake sets TOPDIR correctly
when running these tests. Remove that implict assumption and make it
explicit.

(Bitbake rev: c8f1eb377ceb1fc78cbfaed976107720ad78c075)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-11-15 11:03:25 +00:00
Richard Purdie
75e63f41a8 bitbake: tests/runqueue: Drop python version test decorators
Our minimum python version is 3.6 so these are now unneeded.

(Bitbake rev: 15f16bf973666807e94f3b356095f8265af0282a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-10-27 09:49:02 +01:00
Richard Purdie
663a7d6574 bitbake: tests/runqueue: Ensure hashserv exits before deleting files
We've seen races where the socket may be gone but the server is still writing
out it's database. Handle that case too to avoid cleanup tracebacks.

[YOCTO #14440]

(Bitbake rev: b9e4fb843cb9d3a4d4404af093a781fab5520465)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-10-16 17:43:00 +01:00
Joshua Watt
40f5a289d5 bitbake: event: Fix broken builds when multiconfig has a hyphen in the name
5f7fdf7b2d ("bitbake: event: Prevent bitbake from executing event
handler for wrong multiconfig target") broke multiconfig builds contain
a hyphen, since it's attempt to use the multiconfig as part of a
function name and python functions are not allowed to contain a hyphen.

Rework the bitbake multiconfig test to test a multiconfig with a hyphen
and one with an underscore to validate this doesn't break in the future.

(Bitbake rev: c3168df330a4563cbd03ba74de55a22217d823ed)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-02-21 22:02:01 +00:00
Joshua Watt
26ae42ded7 bitbake: bitbake: tests: Add mcdepends test
Adds a test to validate that mcdepends causes the dependent tasks to
build, and also that a change in the dependent task causes the dependee
task to re-execute.

(Bitbake rev: f2062c41693f9f684bdaf2df0a2a08b7f3871026)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-06-12 17:03:15 +01:00
Joshua Watt
c90dd50939 bitbake: 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.

(Bitbake rev: 513fc2dddf13d5e344162c26d89d2dde2fe85634)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-06-10 12:30:01 +01:00
Frazer Clews
0ac5174c7d bitbake: lib: remove unused imports
removed unused imports which made the code harder to read, and slightly
but less efficient

(Bitbake rev: 4367692a932ac135c5aa4f9f2a4e4f0150f76697)

Signed-off-by: Frazer Clews <frazer.clews@codethink.co.uk>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-01-19 13:31:05 +00:00
Richard Purdie
11902d93e4 bitbake: tests/runqueue: Fix to match recent task migration fixes
(Bitbake rev: 35784582fdbb2092eddec094deb6ab9c87666b5e)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-11-27 11:03:31 +00:00
Richard Purdie
562de41ce7 bitbake: tests/runqueue: Fix hashserve shutdown race
The hashserve can delete its socket whilst the cleanup us happening leading to
backtraces and test failures.

Add code to avoid this race condition.

[YOCTO #13542]

(Bitbake rev: efd7b025cee25d0ee668c09476395d08fcf5ae1a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-10-02 14:18:59 +01:00
Richard Purdie
ff872fdda5 bitbake: runqueue: Change task migration behaviour for rerunning setscene tasks
Currently runqueue will rerun setscene tasks multiple times as hashes
change. This has caused numerous problems since a setscene task may
become "unavailable" for some future signature combination and the code
then can't easily "unskip" tasks its already passed into the execution
queue.

At least for now, only run setscene once and assume they're equivalent
at that point. In practise that has been much more stable in testing.

Tweak the test to match the change in behaviour.

(Bitbake rev: 4205a3ef23834f317642bba155d67cd772176fb6)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-09-30 17:23:35 +01:00
Richard Purdie
d0b7471ba8 bitbake: runqueue: Fix task migration problems
Tasks were not migrating consistently, particularly:

* if a task was rehashed which had already run
* if a task which was valid became invalid due to a rehash

We need to always run the migration code for rehashed tasks and then
reprocess them for hash validity. This means rearranging the code.

It also means several tests are no longer correct and can't be written
correctly to work on all possible workflows so those are removed.

(Bitbake rev: 8443989ee41e9b162972935513e437b5c66ea74d)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-09-30 17:23:35 +01:00
Joshua Watt
20f032338f bitbake: bitbake: Rework hash equivalence
Reworks the hash equivalence server to address performance issues that
were encountered with the REST mechanism used previously, particularly
during the heavy request load encountered during signature generation.
Notable changes are:

1) The server protocol is no longer HTTP based. Instead, it uses a
   simpler JSON over a streaming protocol link. This protocol has much
   lower overhead than HTTP since it eliminates the HTTP headers.
2) The hash equivalence server can either bind to a TCP port, or a Unix
   domain socket. Unix domain sockets are more efficient for local
   communication, and so are preferred if the user enables hash
   equivalence only for the local build. The arguments to the
   'bitbake-hashserve' command have been updated accordingly.
3) The value to which BB_HASHSERVE should be set to enable a local hash
   equivalence server is changed to "auto" instead of "localhost:0". The
   latter didn't make sense when the local server was using a Unix
   domain socket.
4) Clients are expected to keep a persistent connection to the server
   instead of creating a new connection each time a request is made for
   optimal performance.
5) Most of the client logic has been moved to the hashserve module in
   bitbake. This makes it easier to share the client code.
6) A new bitbake command has been added called 'bitbake-hashclient'.
   This command can be used to query a hash equivalence server, including
   fetching the statistics and running a performance stress test.
7) The table indexes in the SQLite database have been updated to
   optimize hash lookups. This change is backward compatible, as the
   database will delete the old indexes first if they exist.
8) The server has been reworked to use python async to maximize
   performance with persistently connected clients. This requires Python
   3.5 or later.

(Bitbake rev: 2124eec3a5830afe8e07ffb6f2a0df6a417ac973)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-09-18 17:52:01 +01:00
Richard Purdie
a3c53bff11 bitbake: tests/runqueue: Fix tests
There were paths being accidentally included in some of the hashserv tests. Remove
that and update the hashes so the tests work independently of paths.

(Bitbake rev: 6ddb9f09cb60c2354fa6a67cce412c4dc1e7dc2d)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-15 08:43:22 +01:00
Richard Purdie
977a293f2f bitbake: runqueue: Fix event timing race
The event from the task notifiing of hash equivalency should only be processed
when the task completes. This can otherwise result in a race where a dependent
task may run before the original task completes causing various failures.

To make this work reliably, the code had to be restructured quite a bit.

(Bitbake rev: 1bf5be46f92f125193638cf41ff207d68f592259)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-14 17:28:23 +01:00
Richard Purdie
abda938d66 bitbake: tests/runqueue: Add further hash equivalence tests
Add some extra hash equivalence runqueue tests based on recent scenarios
that caused problems during testing.

(Bitbake rev: 373b085ead992a725b2230ededd992b4c61a1a05)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-14 17:28:23 +01:00
Richard Purdie
fd79638046 bitbake: tests/runqueue: Add hashserv+runqueue test
Add a test which tests the runqueue adaptations for hash equivalency.

(Bitbake rev: 477321d0780df177c1582db119c2bb6795912fc6)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-06 11:21:32 +01:00
Richard Purdie
9881c532c8 bitbake: runqueue: Fix non setscene tasks targets being lost
If you specify both setscene and non-setscene tasks on the commandline, the
non-setscene tasks could be missed, e.g. "bitbake X:do_patch X:do_populate_sysroot"
and do_patch would fail to run.

Fix the problem in runqueue and add a testcase.

(Bitbake rev: 75292fdec5d9c0b5b3c554c4b7474a63656f7e12)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-18 12:16:19 +01:00
Richard Purdie
1069c36417 bitbake: runqueue: Optimise multiconfig with overlapping setscene
Currently if a multiconfig build contains different configurations which
have overlapping sstate artefacts, it will build them multiple times.
This is clearly suboptimal and not what users want/expect.

This adds code to detect this and stall all but one of the setscne tasks
so that once its built, it can be found by the other tasks.

We take care to iterate the multiconfigs in order so try and avoid
dependency loops. We also match on PN+taskname+taskhash since this is
what we know sstate in OE-Core would use. There are some tasks even within
a multiconfig which match hashes (mostly do_populate_lic tasks) but those
have a much higher chance of circular dependency so aren't work attempting
to optimise.

If a deadlock does occur the build will be slower but there is code to
unbreak such a deadlock so it hopefully doens't break anything.

Comments are injected into the test tasks so they have different task
hashes and a new test for this optimisation is added.

(Bitbake rev: a75c5fd6d4ec56836de0be2fe679c81297a080ad)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-16 13:53:17 +01:00
Richard Purdie
7484fb49a4 bitbake: tests: Add initial scenario based test for runqueue
We need some tests for runqueue, its been something which has been hard to test
for a long time. Add some dummy metadata to allow this, mirroring the OE
structure in spirit.

(Bitbake rev: 37564d7440c5d7aa05ec537f3b79026b1c83bb68)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15 10:28:12 +01:00