aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bb/tests/parse.py
AgeCommit message (Collapse)Author
2024-01-10ast: Fix EXPORT_FUNCTIONS bugRichard Purdie
If you have two classes, both of which set EXPORT_FUNCTIONS for the same funciton and a standard funciton definition for the function that is exported, the export function can sometimes overwrite the standard one. The issue is that the internal flag the code uses isn't ovweritten if the variable is giving a new value. Fix the issue by using a comment in the code that is injected so that we know if it is ours or not. Also add some testing for EXPORT_FUNCTIONS, not perfect but a start. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-06-27bitbake: tests: Use assertLogs to test logging outputPeter Hoyes
By default, pytest captures all stdout and exposes it using its built-in fixtures (capsys, caplog etc), so stdout does not support getvalue(). To support running tests using both unittest and pytest, use assertLogs to capture logging and assert on the log output instead. Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-04-13bitbake: ConfHandler: Allow variable flag name with a single characterKai Kang
Update regex pattern to allow variable flag name with a single character. Regression tests have also been updated in `bb.parse` and `bin/bitbake-selftest -k ParseTest` has been successfully executed. Eliminate a trailing space as well. Signed-off-by: Kai Kang <kai.kang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-03-23ConfHandler: Allow the '@' character in variable flag namesJames R T
This patch enables the usage of the '@' character in variable flag names. One use case of variable flags is to assign the network namespaces of some systemd services/targets to configure other parts of the build process of some system. The filenames of systemd services/targets might contain the '@' character if they are template unit files that can take in a single parameter/argument and be instanced multiple times, as indicated by systemd's official manual page. The '@' character is disallowed as the first character in a variable flag name. Imposing more restrictions on the first character is a compromise to make parsing easier and to allow for more options in the future to extend the syntax. This patch is successfully verified by creating a custom BitBake recipe that sets and unsets the value of a variable flag with the '@' character in its name and ensuring that no ParseError is being thrown. Regression tests have also been added to `bb.parse`. `bin/bitbake-selftest` has also been successfully executed and all tests passed. Signed-off-by: James Raphael Tiovalen <jamestiotio@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2022-08-12BBHandler/cooker: Implement recipe and global classesRichard Purdie
We have some confusion for users since some classes are meant to work in the configuration space (or "globally") and some are meant to be selected by recipes individually. The cleanest way I could find to clarify this is to create "classes-global" and "classes-recipe" directories which contain the approproate classes and have bitbake switch scope between them at the appropriate point during parsing. The existing "classes" directory is always searched as a fallback. Once a class is moved to a specific directory, it will no longer be found in the incorrect context. A good example from OE is that INHERIT += "testimage" will no longer work but IMAGE_CLASSES += "testimage" will, which makes the global scope cleaner by only including it where it is useful and intended to be used (images). Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-07-04ConfHandler/BBHandler: Improve comment error messages and add testsRichard Purdie
Currently if you trigger one of the comment errors, the newline characters are stripped and the line numbers are incorrect. In one case it prints the empty line which is also unhelpful. Rework the code around these errors so the line numbers are correct and the lines in question are more clearly displayed complete with newlines so the user can more clearly see the error. I also added a couple of simplistic test cases to ensure that errors are raised by the two known comment format errors. [YOCTO #11904] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-04-21tests/parse: Fix one test overwriting anotherRichard Purdie
Fix an issue where two tests have the same name with one overwriting the other. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-08-06fetch/tests/toaster: Override conversion fixupsRichard Purdie
Fix some references that missed during the overrides syntax migration or were incorrect. Thanks to Quentin Schulz <foss@0leil.net> for the patch. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-08-02doc/lib: Add fixes for issues missed by the automated conversionRichard Purdie
The examples and tests use non-standard override names, convert these to the new syntax by hand. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-08-02doc/lib: Update to use new override syntax containing colonsRichard Purdie
This runs the overrides conversion script in OE-Core over the bitbake code base including the docs. A handful of things were excluded in toaster and for the Changelog file. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-07-21build: Allow deltask to take multiple tasknamesRichard Purdie
deltask currently supports only one task to delete but it would be useful if it could support a variable which gets expanded to allow flexibility in the metadata. This is simple to support in bitbake and is how other directives such as inherit operate so adjust the parser/code to handle that. It means that syntax like: EXTRA_NOPACKAGE_DELTASKS = "" deltask ${EXTRA_NOPACKAGE_DELTASKS} is now allowed. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-04bitbake: Strip old editor directives from file headersRichard Purdie
There are much better ways to handle this and most editors shouldn't need this in modern times, drop the noise from the files. Its not consitently applied anyway. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-04bitbake: Drop duplicate license boilerplace textRichard Purdie
With the introduction of SPDX-License-Identifier headers, we don't need a ton of header boilerplate in every file. Simplify the files and rely on the top level for the full licence text. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-04bitbake: Add initial pass of SPDX license headers to source codeRichard Purdie
This adds the SPDX-License-Identifier license headers to the majority of our source files to make it clearer exactly which license files are under. The bulk of the files are under GPL v2.0 with one found to be under V2.0 or later, some under MIT and some have dual license. There are some files which are potentially harder to classify where we've imported upstream code and those can be handled specifically in later commits. The COPYING file is replaced with LICENSE.X files which contain the full license texts. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-01build: Disable warning about dependent tasks for nowRichard Purdie
This breaks with rm_work so disable the warning until we find a better solution (and change the test accordingly too). Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-01build: Ensure warning for invalid task dependencies is usefulRichard Purdie
WARNING: elfutils: dependent task do_rm_work does not exist is much less useful than WARNING: elfutils: dependent task do_rm_work for do_deploy does not exist Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-04-30tests/parse.py: Add testcase for addtask and deltaskRobert Yang
Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-09-25lib/bb/tests/parse.py: Test case was changing chdirMark Hatle
The test case was changing the current directory, but was never restoring it to the original location. This causes occasional failures in later test cases. Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-02ConfHandler: Require whitespace between export and variable nameOla x Nilsson
Signed-off-by: Ola x Nilsson <olani@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-30bitbake: remove True option to getVarFlag callsJoshua Lock
getVarFlag() now defaults to expanding by default, thus remove the True option from getVarFlag() calls with a regex search and replace. Search made with the following regex: getVarFlag ?\(( ?[^,()]*, ?[^,()]*), True\) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-30bitbake: remove True option to getVar callsJoshua Lock
getVar() now defaults to expanding by default, thus remove the True option from getVar() calls with a regex search and replace. Search made with the following regex: getVar ?\(( ?[^,()]*), True\) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-08-17ast/ConfHandler: Add a syntax to clear variableJérémy Rosen
unset VAR will clear variable VAR unset VAR[flag] will clear flag "flag" from var VAR Signed-off-by: Jérémy Rosen <jeremy.rosen@openwide.fr> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-01bitbake: Convert to python 3Richard Purdie
Various misc changes to convert bitbake to python3 which don't warrant separation into separate commits. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-22tests/parse: Add BBCLASSEXTEND multiple data store corruption reproducerRichard Purdie
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>
2015-07-12tests/data: Add new data testsRichard Purdie
Add a variety of tests which were found to be useful when working on the data store recently. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-16tests/parse: Add file missing from previous commitRichard Purdie
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>