summaryrefslogtreecommitdiff
path: root/unittests/platformagnostictests.py
AgeCommit message (Collapse)Author
2025-11-23Condense directory names for rc1.Jussi Pakkanen
2025-10-17options: Fix long/short option mixture detectionTobias Stoeckmann
Take the key/value separator `=` into account when comparing long and short option names to avoid invalid matches.
2025-10-04utils: merge per-platform utils into `platform.py`Dylan Baker
This allows us to simplify running mypy, as we can just mypy the entire utils module regardless of the platform we're using. As an added bonus, this means we open one less module.
2025-08-11Condense test directory names.Jussi Pakkanen
2025-08-01Condense test directory names for 1.9.Jussi Pakkanen
2025-06-23vala: Also add --target-glib if glib is built as subprojectFlorian "sp1rit"​
Previously, meson would only check if glib was part of target.external_dependencies and add --target-glib appropriately. This however had the downside of meson not adding --target-glib if glib was included as a subproject, potentially breaking otherwise builds. Instead of checking external_dependencies, check target.added_deps for an occurrence of 'glib-2.0' and then pick the appropriate codepath (either from the external dependency based on version_reqs or for the internal dependency based on the actual version, potentially downgraded to the latest release version) Related-to: #14694
2025-06-18options: reuse set_option_maybe_rootPaolo Bonzini
There is common logic hiding between project() and "meson configure": the complication that the comment mentions for the "default_options" case actually applies to "meson configure", to machine files, to command line options and to project options. Reuse the same function in all four cases. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-18options: print option name before "as_root()" in errorsPaolo Bonzini
Starting with Meson 1.8.0, "meson configure" prints some options as ":foo" instead of "foo". Print the option as it was passed by the user. While at it, make errors more consistent and/or correct (e.g. "Unknown option" instead of "Unknown options"). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-15unittests: add minimal coverage of --buildtype=customPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-15add test case for setting options from reconfigurePaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-04-14Condense directory names for 1.8 rc1.Jussi Pakkanen
2025-03-10options: merge set_value and set_optionDylan Baker
Which are basically the same, except for handling of deprecated options, and various bugs that only existed in one implementation or the other.
2025-03-06unittests: Use more subtestsDylan Baker
2025-03-04msetup: remove bad warning about unused optionsDylan Baker
This is just a bad warning, while it *could* give the user useful information, it often doesn't since it can get values to warn about from: - environment variables - the command line - machine files - `project(default_options : ...)` - `subproject(default_options : ...)` - `dependency(default_options : ...)` The problem of course is that user may have no control over these values. 3 of them are hardcoded into the meson.build files, so the user can't do anything about them. And there are legitimate reasons to have unused values in those, like setting defaults for a language only used on specific platforms. Environment variables may be set by the distro (NixOS sets them for any enabled language, so just having a D compiler causes `DFLAGS` to be set, for example). They likely don't want to special case "only set the environment variables if the project is going to use them". For machine files it limits the utility of the files, since the user needs to be sure that they don't include any options that wont be used. Finally, the command line could be altered by wrapper scripts, or simply programmed to insert options that *may* be used but aren't required. like setting `objc_args` regardless of whether ObjectivC bindings are generated. However, passing completely unknown builtin options should be an error, as it was before the optionrefactor
2025-02-22Permit all unknown b_ options.Jussi Pakkanen
Closes #14254.
2025-02-13Make all Meson level options overridable per subproject.Jussi Pakkanen
2025-01-09Condensed directory names for release.Jussi Pakkanen
2025-01-07fix trailing whitespace issuesEli Schwartz
2025-01-07mtest: fix rebuilding all before running testsEli Schwartz
Inconsistency in the original implementation of commit 79e2c52a15e896e46ff3cfa3ec16fbf3f132ee01. If an explicit list of targets is passed on the CLI, then that is passed to rebuild_deps. If not, we pass every loaded test to rebuild_deps instead. This means we cannot distinguish between "trying to run all tests" and "trying to run specific tests". We then load all the deps for all tests, and try to build them all as explicit arguments to the underlying ninja. There are two situations where this falls flat: - given underspecified deps - given all (selected?) tests legitimately happen to have no dependencies In both cases, we calculate that there are no deps to rebuild, we run ninja without any targets, and this invokes the default "all" rule and maybe builds a few thousand targets that this specific test run does not need. Additionally, in large projects which define many tests with many dependencies, we could end up overflowing ARG_MAX when processing *all* tests. Instead, pass no tests to rebuild_deps. We then specially handle this by directly running the relevant ninja target for "all test deps", which is overall more elegant than specifying many many dependencies by name. Given a subset of tests to guarantee the freshness of, we instead skip running ninja at all if there are indeed no test dependencies.
2024-10-20Condense test directories.Jussi Pakkanen
2024-09-06mformat: detect invalid configCharles Brunet
- detect unknown config keys in format config - add test for detection of invalid config values - detect invalid .editorconfig values Fixes #13569
2024-08-20format: fix indentation of commentsCharles Brunet
Fixes #13508 - Fix indentation of comments in arrays - Fix indentation of comments in dicts - Fix indentation of comments in if clauses - Fix indentation of comments in foreach clauses
2024-08-01mformat: fix formatting of empty build fileCharles Brunet
Running meson format multiple times on an empty file was adding a new line each time, which is bad for pre-commit checks...
2024-07-11Move project option detection into OptionStore.Jussi Pakkanen
2024-06-04Extract native file parser to machinefile source file.Jussi Pakkanen
2024-05-23Refactor option classes to their own file.Jussi Pakkanen
2024-04-08meson format commandCharles Brunet
2024-03-18mconf: Reload the options files if they have changedDylan Baker
This fixes issues where a new option is added, an option is removed, the constraints of an option are changed, an option file is added where one didn't previously exist, an option file is deleted, or it is renamed between meson_options.txt and meson.options There is one case that is known to not work, but it's probably a less common case, which is setting options for an unconfigured subproject. We could probably make that work in some cases, but I don't think it makes sense to download a wrap during meson configure.
2024-03-18tests: Add tests for configure on changed optionsDylan Baker
This demonstrates a limitation of Meson that can happen in the following situation: `meson setup builddir` <update to meson.options> (such as git pull) `meson configure -Dnew_option=value builddir` <Error> Since Meson is unaware of the updates to the meson.options file. The purposes of these tests is to fix this behavior.
2024-03-15Improve error messages for invalid option valuesCharles Brunet
By adding the option name to UserOption object, it is now possible to display the name of the affected option when the given option value is not valid. Fixes #12635
2024-03-10fix reconfigure subproject base optionsCharles Brunet
2024-03-10Fix detection of unknown base options in subprojCharles Brunet
cc4cfbcad92945a1629c80664e1eb755c68905dd added detection for unknown base options, but it was not working for subproject base options. This should fix it.
2024-03-01Fix unknown base options not detected in commandline argumentsCharles Brunet
2024-03-01Fix base and compiler options not reconfigurable.Charles Brunet
Fixes #12920.
2023-12-13Use SPDX-License-Identifier consistentlyDylan Baker
This replaces all of the Apache blurbs at the start of each file with an `# SPDX-License-Identifier: Apache-2.0` string. It also fixes existing uses to be consistent in capitalization, and to be placed above any copyright notices. This removes nearly 3000 lines of boilerplate from the project (only python files), which no developer cares to look at. SPDX is in common use, particularly in the Linux kernel, and is the recommended format for Meson's own `project(license: )` field
2023-11-12Renumber test dirs for rc3.Jussi Pakkanen
2023-11-04Fine-tune the error message when trying to build outside the project rootEli Schwartz
We try to backtrack through the filesystem to find the correct directory to build in, and suggest this as a possible diagnostic. However, our current heuristic relies on parsing the raw file with string matching to see if it starts with `project(`, and this may or may not actually work. Instead, do a bit of recursion and parse each candidate with mparser, then check if the first node of *that* file is a project() function. This makes us resilient to a common case: where the root meson.build is entirely valid, but, the first line is a comment containing e.g. SPDX license headers and a simple string comparison simply does not cut it. Fixes the bad error message from #12441, which was supposed to provide more guidance but did not.
2023-10-27Condense test directories for RC1.Jussi Pakkanen
2023-09-12fix bug with openssl when cmake is missingCharles Brunet
Fixes #12098 DependencyFactory was returning a lambda, but it has no log_tried() function
2023-09-05wrap: Use MESON_PACKAGE_CACHE_DIR as default packagecache pathXavier Claessens
Allow packagecache to contain already extracted directory to match what some distro does with Cargo source packages in /usr/share/cargo/registry. Note that there is no need to lock the cache directory because we download into a temporary name and atomically rename afterward. It means we could be downloading the same file twice, but at least integrity is guaranteed. Fixes: #12211
2023-08-25msetup: Update options when builddir is already configuredXavier Claessens
`meson setup -Dfoo=bar builddir` command was returning success ignoring new option values. This now also update options. It is useful because it means `meson setup -Dfoo=bar builddir && ninja -C builddir` works regardless whether builddir already exists or not, and when done in a script, changing options in the script will automatically trigger a reconfigure if needed. This was already possible by always passing --reconfigure argument, but that triggers a reconfigure even when options did not change.
2023-07-13Silence some encoding warningsTristan Partin
By specifiying explicit encodings, we can silence warnings like: /__w/meson/meson/test cases/common/100 postconf with args/postconf.py:15: EncodingWarning: 'encoding' argument not specified with open(input_file) as f: in CI.
2023-07-05Renumber test dirs for rc2.Jussi Pakkanen
2023-06-26Revert "modules: move gnome targets into gnome module"Eli Schwartz
This reverts commit a2def550c586aeba4269588e79a1a308467f2582. This results in a 2k line file being unconditionally imported at startup, and transitively loading two more (for a total cost of 2759 lines of code), and it's not clear it was ever needed to begin with...
2023-06-26stop importing cmake when it isn't usedEli Schwartz
We don't need a CMakeInterpreter until and unless we actually attempt to use a cmake subproject via the cmake module. Minus 10 files and 3679 lines of code imported at startup.
2023-06-26dependencies: defer importing a custom dependency until it is usedEli Schwartz
This lessens the amount of code imported at Meson startup by mapping each dependency to a dictionary entry and using a programmable import to dynamically return it. Minus 16 files and 6399 lines of code imported at startup.
2023-06-26dependencies: delay often-unused importsEli Schwartz
We expose detect.py as the mesonbuild.dependencies entrypoint and import it upfront everywhere. But unless the `dependency()` function is actually invoked, we don't need *any* of the private implementations for this. Avoid doing so until, as part of actual dependency lookup, we attempt that specific dependency method. This avoids importing big modules if `method:` is specified, and in most cases hopefully pkg-config works and we can avoid importing the cmake implementation particularly. Actually avoiding most of these imports requires more refactoring. But even so, the garden path no longer needs to import the dub dependency impl.
2023-06-26add profiling startup import check and testcase to count itEli Schwartz
2023-06-25tests: move script loaded modules test to platform-agnosticEli Schwartz
We have the same platform startup logic here for all platforms and I do not believe it's important to test this on the slow CI machines.
2023-03-30msetup: Allow (re)configure of not empty builddirXavier Claessens
Also prevent from using a parent directory as builddir by mistake. Co-authored-by: Volker Weißmann <volker.weissmann@gmx.de> Co-authored-by: Charles Brunet <charles.brunet@optelgroup.com>