summaryrefslogtreecommitdiff
path: root/tests/format
Commit message (Collapse)AuthorAgeFilesLines
* tests/format/variables.py: Added some new testsTristan van Berkom2020-07-0910-16/+97
| | | | | | | | | | | | * Test scenarios where a junction needs to resolve variables in order to configure a subproject, but where some other variables may be derived from the same subproject. In this scenario we allow partial resolution of variables for junction elements. * Enhanced the undefined variables and circular reference tests to also check for the expected provenances.
* tests/format/junctions.py: Adding tests for internal junctionsTristan van Berkom2020-06-2482-0/+356
|
* tests/format/junctions.py: Adding tests for duplicate junctionsTristan van Berkom2020-06-24180-7/+761
|
* tests/format/junctions.py: Adding tests for the overrides featureTristan van Berkom2020-06-2399-6/+565
| | | | | | | | | | | | | * Test various scenarios of overriding junctions, including deep paths as junctions to override, and as junctions to use to override. * Test conflicting junction configurations, ensuring that we report both provenances of where the junctions were declared. * Test circular references in element paths while declaring overrides, for instance when trying to override a subproject using a deeper definition of the same subproject.
* tests/format/junctions.py: Major refactorTristan van Berkom2020-06-1995-454/+305
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit refactors the junctions test to use more parameterization and to remove copy_subproject(), using statically committed data as much as possible. This is because copy_subproject() causes data to be shared among tests in such a way that when such data get's modified, it easily causes unintended side effects on adjacent test cases, better to keep this data separate. Overview of changes: * Remove copy_subproject() * Split up test data into case specific directories, sometimes reusing a directory among various related tests * Use @pytest.mark.parameterize() as much as possible for better coverage and more clearly expressed test cases * Adds update_project() to modify a project.conf inline, as is done in some other tests like tests/plugins/loading.py * Removes tests related to junction name coalescing, this feature will be removed later in this branch and other tests related to junction overrides will replace these. * Removes some redundant tests * Removes a comment about how junction name coalescing can cause errors when trying to open a junction but the project.conf is missing. We continue to test missing project.conf files in a variety of scenarios, but the comment will be rendered irrelevant with the removal of junction name coalescing. * Change the git related tests to use tar instead, this serves the same purpose, but tar will remain a core plugin in BuildStream 2.
* _includes.py: Propagate provenance through Loader.get_loader()Tristan van Berkom2020-06-101-2/+2
| | | | | | | | | | | Instead of raising a customized error message which adds little value to the provenance, just pass the provenance along. This is important so that the Loader is aware of the provenance of loaded junctions, so that it can more precisely report errors about conflicting junctions when includes cause conflicts. This commit also adjusts tests/format/includes.py
* tests/format/include.py: Test including of files using full pathsTristan van Berkom2020-06-0811-0/+54
|
* tests/format/link.py: Testing full path link targetsTristan van Berkom2020-06-085-1/+23
| | | | | | | | * Test that we succeed to load links with full path targets * Test that we get correct provenance information in errors when linking to non-existing elements in existing subprojects, using full paths.
* tests/format/junctions.py: Test loading dependencies and targets with full pathsTristan van Berkom2020-06-085-0/+66
|
* Optimize variable flatteningValentin David2020-06-032-0/+14
| | | | | | | | | | | | | | | | | Verifying for variables (all used variables defined and no cycle) is much faster than flattening them. It also uses much less memory. Only `bst show -f "%{vars}"` requires to flatten all variables. For other cases we can improve performance by only checking rather than flattening. Also flattening very nested variables could lead to very long lists of empty strings. The memory usage for flattening could be a lot bigger than the resulting value. Force flattening and caching every variable definitions can improve intermediate memory consumption and only consume memory of the size of the result. Finally, an optimization allowed inifinite cycles leading to segmentation fault. This was solved by simplifying the code.
* junctions: Remove all traces of the `target` optionTristan van Berkom2020-06-0113-106/+0
| | | | | | | | | | | | | | | This removes: * The `target` feature from the junction plugin * Special case code in the loader for the `target` feature * The `target` related cases in tests/format/junctions.py This also adjusts the `target` related documentation in the `junction` element to suggest using a `link` element for the purpose of using a subproject junction configuration to access a common sub-subproject.
* tests/format/link.py: Adding tests for the link elementTristan van Berkom2020-06-0160-0/+407
|
* element.py: Always expand public data's variablesBenjamin Schubert2020-05-294-0/+46
| | | | | | | | | | | | | | | | | This fixes a bug introduced by d7d18c1a2e454c507afd9e1d3f1358639dd43871, where public data integration commands and others would never get their data expanded and would thus fail to run. The previous however revelead a previous bug, where variables values in public data of elements would not be part of the cache key of an element or it's reverse dependencies, and thus, on variable change, rebuilds would not happen when they would have been needed. This ensures that all the public data is always resolved and part of the element's cache key. This however will bring a rebuild of an element whenever its integration commands variables change, which is simpler to handle than to try to push that responsibility on reverse dependencies, since public data can contain plugin-defined values.
* node.pyx: Deep clone ScalarNode toobschubert/ensure-composite-works-with-variablesBenjamin Schubert2020-05-195-0/+38
| | | | | This ensures that when resolving variables, we do not overwrite the values for a different element in the case we were using composition.
* _frontend/profile: Use non-greedy search to substitute variablesChandan Singh2020-05-181-0/+20
| | | | | | | | Use non-greedy search to ensure that we stop at the next closing brace. Otherwise, for a string like `%{variable} {variable}`, the second variable will also get substituted. Fixes #1307.
* tests/plugins/loading.py: Migrate tests for found/not found pluginsTristan Van Berkom2020-05-0311-65/+0
| | | | This new test replaces the test in tests/format/project.py.
* _pluginfactory/pluginfactory.py: Add provenance to missing plugin errorsTristan Van Berkom2020-05-031-1/+1
| | | | | | | | | So far we were only reporting "No Source plugin registered for kind 'foo'", without specifying what bst file with line and column information, this commit fixes it. Additionally, this patch stores the provenance on the MetaSource to allow this to happen for sources.
* plugin.py/pluginfactory.py: Implementing BST_MIN_VERSIONTristan Van Berkom2020-04-294-0/+12
| | | | | | | | | | | | | | The BST_MIN_VERSION guards assert that the BuildStream core which loaded the plugin is compatible with the plugin itself. This commit adds BST_MIN_VERSION to the base plugin.py with documentation informing Plugin authors how to set the minimum version, and also adds the assertions at plugin loading time in pluginfactory.py. This commit also: * Adds the BST_MIN_VERSION specification to all current core plugins * Adds the BST_MIN_VERSION specification to plugins used in test cases
* Plugin loading refactor, removing all versioningTristan Van Berkom2020-04-295-9/+9
| | | | | | | | | | | | | | | | Plugin format versioning was decided to be removed for local plugins and any plugins for which we do not load an explicitly provided plugin. For pip, this will be handled with a standard distutils/setuptools approach, allowing users to specify pip style version boundaries in the plugin origins. This patch refactors plugin loading so that all related code goes into the private _pluginfactory module, a new small PluginOrigin type was added to better manipulate loaded origins. Test cases have been removed and will be readded in a following commit, adjusted to new expectations.
* Replace format-version with min-versionTristan Van Berkom2020-04-25109-6/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * "min-version" is specified as a <major>.<minor> point version and uses the installed BuildStream version instead of having a separate versioning number for the format. * The presence of "format-version" is now used to indicate that we might be loading a BuildStream 1 project. * For now, where parsing the version at startup is concerned, and also where `bst init` is concerned, we artificially bump the detected BuildStream version to 2.0 if we detect a version < 2.0, these exceptions can be removed once 2.0 is tagged and released. Summary of changes: _project.py: Now parse "min-version" and detect "format-version" to warn about loading a BuildStream 1 project _versions.py: Remove obsolete BST_FORMAT_VERSION numbers from here data/projectconfig.yaml: Remove old "format-version" from defaults utils.py: Added new private _parse_version() helper function, and another _get_bst_api_version() to get an adjusted API version. frontend/app.py, frontend/cli.py: Updated `bst init` implementation testing (buildstream.testing): Updated testing utilities to generate and use projects with min-version instead of format-version. tests and examples: Updated to use min-version across the board.
* tests/format/variables.py: Increase timeout for test_cyclic_variablesjuerg/test-timeoutsJürg Billeter2020-04-241-1/+1
| | | | CI runners sometimes need more time under load.
* Process options in includes files with the options of their junctionvalentindavid/include-options-from-junctionValentin David2020-04-1515-0/+130
| | | | | | | | | Unfortunately the options from main project cannot always be processed in the include processing since project configuration might load option declarations from a separate file. For that reason the result of `Include.process` should still be passed through the option processor. But all options files included from junctioned are already evaluated.
* _project.py: resolve options before running the final assertionsabderrahim/optionsAbderrahim Kitouni2020-04-052-0/+37
| | | | | | otherwise, having an optional list append in theh configuration wouldn't work This also avoids special casing for element and source overrides
* tests/format/junctions.py: Drop Python 3.5 compatibilityJürg Billeter2020-04-021-6/+3
|
* exceptions: Expose ErrorDomain, ErrorLoadReasonThomas Coldrick2020-01-2316-16/+16
| | | | | | | Plugin tests are already accessing this API, but using imports from private modules. For motivation for this to be exposed publicly, note that ErrorDomain is an argument for most things in runcli.py, and LoadErrorReason may be another.
* source.py: Remove 'get_consistency' completelyBenjamin Schubert2020-01-162-8/+2
| | | | | This is not needed now that we have 'is_resolved' and 'is_cached'. We can therefore drop all calling places and implementations of it.
* Tests: Remove bst-plugins-experimental dependencyThomas Coldrick2020-01-1313-98/+2
| | | | This stops the tests from being interlinked for BuildStream itself.
* _frontend/widget.py: show_pipeline() Don't show buildable for junctionTom Pollard2020-01-091-0/+9
| | | | | Instead output "junction" in magenta for info. Also include test in format/junctions.py
* _platform/platform.py: Add alias for IBM AIX 7 powerpcChandan Singh2019-12-231-2/+2
| | | | | | | | | | | * `uname -m` is unusable in case of IBM AIX 7 as it reports the serial number of the machine. As a workaround, special case it and use the reported processor identifier. * tests/format/optionos.py: Don't use AIX for unsupported architecture `AIX` is special-cased in BuildStream, so use a different system for testing unsupported architectures.
* Reformat code using BlackChandan Singh2019-11-1422-1276/+993
| | | | | | | As discussed over the mailing list, reformat code using Black. This is a one-off change to reformat all our codebase. Moving forward, we shouldn't expect such blanket reformats. Rather, we expect each change to already comply with the Black formatting style.
* _context.py: Improve reporting of incorrect user configbschubert/better-reporting-on-userconfigBenjamin Schubert2019-11-051-0/+25
| | | | | | This fixes a case where, in project overrides, if a user specified a scalar/sequence instead of a mapping for a given project, the user would receive an ugly stacktrace instead of an invalid format.
* loader.py: Avoid loading deps of junction metaelementsTristan Maat2019-10-101-1/+1
| | | | | | | | | | | | | By avoiding this, loading metaelements of junctions becomes cheap even for junctions with erroneous dependencies, and we can ignore their task reporting. Task reporting for junction metaelement loading is confusing, since the junction element itself will never be part of the pipeline, so we'd rather not have this show up as an actual loaded element. Elements loaded from the junction are loaded separately, therefore this does not affect their progress display.
* Use distutils plugin from bst-plugins-experimentalJavier Jardón2019-09-122-0/+2
|
* tests/format/dependencies.py: Test errors when explicitly setting strict to Truetristan/strict-rebuildTristan Van Berkom2019-08-312-0/+17
|
* tests/format/dependencies.py: Testing for error of invalid strict runtime depsTristan Van Berkom2019-08-312-0/+16
|
* tests: Include testing provenance through options and includesDaniel Silverstone2019-08-165-3/+25
| | | | Signed-off-by: Daniel Silverstone <daniel.silverstone@codethink.co.uk>
* invalid_keys.py: Test compositied nodes are reported back usefullydanielsilverstone-ct/fix-node-provenanceJames Ennis2019-08-153-0/+28
| | | | | | | | | | | Test that we get the correct provenance from a node which has been compositied. This tests asserts that if we forget to include one of the local plugin's essential keys, we fail and see the appropriate error message. Tests issue described in #1059.
* Move qmake plugin to bst-plugins-experimentalcoldtom/move-qmakeThomas Coldrick2019-08-142-0/+2
|
* Move modulebuild plugin to bst-plugins-experimentalThomas Coldrick2019-08-142-0/+2
| | | | Continuing moving plugins over to bst-plugins-experimental.
* Move makemaker plugin to bst-plugins-experimentalThomas Coldrick2019-08-122-0/+2
| | | | Continuing moving plugins to bst-plugins-experimental.
* tests: Add test for DUPLICATE_DEPENDENCY verificationDaniel Silverstone2019-08-089-0/+94
| | | | Signed-off-by: Daniel Silverstone <daniel.silverstone@codethink.co.uk>
* Move cmake plugin to bst-plugins-experimentalcoldtom/move-cmakeThomas Coldrick2019-08-082-0/+11
| | | | | | | | | | | | It was agreed on the mailing list to move all plugins to a single repository, before moving them into domain-specific repositories. As a result it seems reasonable to move everything to the bst-plugins-experimental repo as this stepping stone, rather than creating a whole new repo. This commit starts the process of moving things over by moving only the cmake plugin to bst-plugins-experimental, and altering the tests to reflect the new location.
* _variables: Fix reporting of missing variableBenjamin Schubert2019-07-172-2/+7
| | | | | | | When the missing variable was not defined, we would get an exception as a string doesn't contain provenance information. - Add a test to prevent regression
* node: Add 'get_str_list' on 'MappingNode'Benjamin Schubert2019-07-173-11/+11
| | | | | | `mapping.get_sequence(...).as_str_list()` is a very common pattern seen both in plugins and the core. Adding a helper to reduce the number of operations will make usage smoother
* tests/format/include_composition.py: Use dummy_context()Jürg Billeter2019-07-161-79/+84
|
* _yaml: Decomission 'dump()'. 'roundtrip_dump' is an equivalent function nowBenjamin Schubert2019-07-151-2/+2
| | | | | Remove completely '_yaml.dump()' and replace all notions and call by 'roundtrip_dump'
* tests: Change all calls to _yaml.dump to _yaml.rountrip_dumpBenjamin Schubert2019-07-155-60/+51
| | | | | Now that both are equivalent, we can skip the sanitization part before the yaml call.
* _yaml: Introduce 'get_sequence()' and 'sequence_at()'/'mapping_at()'Benjamin Schubert2019-07-154-17/+17
| | | | | | | | | - Adding 'get_sequence' on MappingNode to access sequences in a mapping - Adding 'sequence_at' on SequenceNode to access sequences in a sequence - Adding 'mapping_at' on SequenceNode to access mappings in a sequence Using "*_at" in sequences allows us to quickly understand if we are dealing with a sequence or a mapping.
* _yaml: Add 'as_bool()' and 'is_none()' to ScalarNodeBenjamin Schubert2019-07-151-3/+3
| | | | | | | | | | | - 'as_bool()' casts a ScalarNode into a boolean, understanding both 'True' and 'False' as truthy-falsy values, as per node_get(type=bool) behavior - 'is_none()' allwos checking whether the scalar node contains a 'None' value. Since 'None' cannot be used when working with booleans, we need to have a way of checking for 'None' when we actually need the information of whether the value is unset. - Adapt all call places to use the new API
* _yaml: Add 'as_str()' on ScalarNode and 'get_scalar()' on MappingNodeBenjamin Schubert2019-07-1513-37/+37
| | | | | | | | | | - 'get_scalar()' allows retrieving a scalar node from a mapping. - 'as_str()' casts a ScalarNode into a string (thus removing the node information). Both together, those replace 'node_get(mapping, key, type=str)' but also allow retrieving the 'Node' itself, which will allow in the future lazier provenance computation.