summaryrefslogtreecommitdiff
path: root/run_tests.py
AgeCommit message (Collapse)Author
2025-10-29environment: move tool detection functions to a new modulePaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-10-29environment: move detection functions to envconfig.pyPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-09-19pkgconfig: Fix class cached to be keyed on extra_pathsMichał Górny
Add `extra_paths` to cache keys for `PkgConfigInterface` and `PkgConfigCLI` instances, to avoid incorrectly reusing an instance with a different `extra_paths` value, see: https://github.com/mesonbuild/meson/pull/14657#discussion_r2320623799 Signed-off-by: Michał Górny <mgorny@quansight.com>
2025-08-10unittests: remove FakeCompilerOptionsPaolo Bonzini
It does not seem to be needed anymore, and the incomplete mock does not have for example the "yielding" attribute that is used by OptionStore.get_value_object_and_value_for. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-07-17Remove language (AKA compiler) type from OptionKey.Jussi Pakkanen
2024-07-16run_tests: add annotations to get_fake_envDylan Baker
2024-07-11Fix Type hintsZhipeng Xue
2024-07-11Move OptionKey in the option source file.Jussi Pakkanen
2024-06-14Replace direct indexing with named methods.Jussi Pakkanen
2024-06-14Rename option variable to optstore to make it unique.Jussi Pakkanen
2024-05-23Refactor option classes to their own file.Jussi Pakkanen
2024-04-14Fix builds with Ninja 12 and remove a 5 year old workaround.Jussi Pakkanen
2024-04-10Do not use verbose mode in unittests.Jussi Pakkanen
2024-02-23coredata: use a Protocol for shared options between setup configure and distDylan Baker
These are all passed around interchangably inside Meson, so use a shared protocol for them.
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-09-18pkgconfig: Cache the implementation instanceXavier Claessens
2023-08-17tests: consolidate MESON_SKIP_TEST reporting and use it in unittestsEli Schwartz
Previously, we only reported the skip reason when running project tests.
2023-08-03PkgConfigDependency: Move CLI handling into its own abstractionXavier Claessens
This makes the code cleaner and will allow to have other implementations in the future.
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-03-28unittests: Pass the exact backend nameXavier Claessens
CI runs with vs2019 and we were passing --backend=vs. This fix reconfigure tests because we can't reconfigure with --backend=vs when initial configuration determined the backend is actually vs2019.
2023-03-20project tests: add log of the setup command being runEli Schwartz
Followup to commit 2acb6ee79e24db047800da30f5f4ac52cb9c012d.
2023-03-20tests: fix regression that broke mtest_inprocessEli Schwartz
In commit faf79f4539841cbf89fe8d53cf35aa91fd8273c9 we broke this utility function by referencing a non-existent variable. Fortunately, the only time we ever used said function was once, and that in a test case where we tested that it raised a MesonException before the undefined variable error could occur.
2023-02-13CI: log individual steps in run_testsEli Schwartz
2022-11-03python 3.11: suppress an incorrect EncodingWarningEli Schwartz
python 3.11 adds a warning that in 3.15, UTF-8 mode will be default. This is fantastic news, we'd love that. Less fantastic: this warning is silly, we *want* these checks to be affected. Plus, the recommended alternative API would (in addition to warning people when UTF-8 mode removed the problem) also require using a minimum python version of 3.11 (in which the warning was added) or add verbose if/else soup. The simple, and obvious, approach is to add a warnings filter to hide it.
2022-09-19compilers: directly import from subpackagesEli Schwartz
It turns out we don't generally need to proxy every compiler ever through the top-level package. The number of times we directly poke at one is negligible and direct imports are pretty clean.
2022-03-31unittests: move get_convincing_fake_env_and_cc to run_tests.pyMarvin Scholz
2022-03-01use a more sane check instead of run_custom_lintEli Schwartz
Unfortunately, checking for strings without context is exceedingly prone to false positives, while missing anything that indirectly opens a file. Python 3.10 has a feature to warn about this though -- and it uses a runtime check which runs at the same time that the code fails to open files in the broken Windows locale. Set this up automatically when running the testsuite. Sadly, Python's builtin feature to change the warning level, e.g. by setting EncodingWarning to error at startup, is utterly broken if you want to limit it to only certain modules. This is tracked in order to be more efficiently ignored at https://bugs.python.org/issue34624 and https://github.com/python/cpython/pull/9358 It is also very trigger happy and passing stuff around via environment variable either messes with the testsuite, or with thirdparty programs which are implemented in python *such as lots of gnome*, or perhaps both. Instead, add runtime code to meson itself, to add a hidden "feature". In the application source code, running the 'warnings' module, you can actually get the expected behavior that $PYTHONWARNINGS doesn't have. So check for a magic testsuite variable every time meson starts up, and if it does, then go ahead and initialize a warnings filter that makes EncodingWarning fatal, but *only* when triggered via Meson and not arbitrary subprocess scripts.
2022-02-17unittests: make ninja detection faster and more robustEli Schwartz
Instead of blindly assuming when $CI is set that `ninja` is always correct and always new enough, check for it the same way we do when $CI is not set. Instead of special casing when $CI is set and skipping ninja detection in subprocess tests (by assuming it is always `ninja`), skip detection in subprocess tests all the time, by passing this information around across processes after the first time it is looked up. This means that local (non-CI) tests are faster too! Fixes running unittests in alpine linux using samu. Although ninja is a symlink to samu, the exact output string on no-op builds is different, which we already handle, but what we don't handle is the fact that samu prints a third case when you invoke it as `ninja`. If $CI is exported, then the unittests ignored $NINJA entirely. Fixes running unittests when $CI is set, `samu` exists and `ninja` does not exist. This is not currently the case anywhere, but may be in the future; why not fix it now?
2022-01-16Add a test for the --vsenv meson setup optionNirbheek Chauhan
The tests and the unittests both unconditionally call setup_vsenv() because all tests are run using the backend commands directly: ninja, msbuild, etc. There's no way to undo this vs env setup, so the only way to test that --vsenv works is by: 1. Removing all paths in PATH that provide ninja 2. Changing setup_vsenv(force=True) to forcibly set-up a new vsenv when MESON_FORCE_VSENV_FOR_UNITTEST is set 3. Mock-patching build_command, test_command, install_command to use `meson` instead of `ninja` 4. Asserting that 'Activating VS' is in the output for all commands 5. Ensure that compilation works because ninja is picked up from the vs env. I manually checked that this test actually does fail when the previous commit is reverted.
2021-10-10Add --vsenv command line option and active VS only when neededXavier Claessens
2021-06-29pathlib: Patch pathlib to work around some bugs (fixes #7295)Daniel Mensinger
2021-06-22coverage: Enable coverage reportsDaniel Mensinger
2021-06-18tests: clear mesonlib.project_meson_versions (which **really** needs a refactor)Daniel Mensinger
2021-06-18tests: Always enable the traceback in run_project_tests.pyDaniel Mensinger
2021-06-09typing: Fully annotate run_project_tests.pyDaniel Mensinger
2021-05-29Remove HFS workaround as everyone should use APFS by now.Jussi Pakkanen
2021-05-13Set up VS environment automatically when run.Jussi Pakkanen
2021-05-08Set unittest backend with an argument rather than an envvar.Jussi Pakkanen
2021-04-25Xcode: add objective C flags to plain C because Xcode requires it.Jussi Pakkanen
2021-03-04mass rewrite of string formatting to use f-strings everywhereEli Schwartz
performed by running "pyupgrade --py36-plus" and committing the results
2021-03-04various python neatness cleanupsEli Schwartz
All changes were created by running "pyupgrade --py3-only --keep-percent-format" and committing the results. I have not touched string formatting for now. - use set literals - simplify .format() parameter naming - remove __future__ - remove default "r" mode for open() - use OSError rather than compatibility aliases - remove stray parentheses in function(generator) scopes
2021-02-23add a script to run a single testDylan Baker
As a Meson developer it's often frustrating to have a single functional test with a regression. These tests can be awkward to reproduce, especially when they make use of a test.json file. This script provides a simmple interface to call functional tests 1 at a time, regardless of whether they use a test.json or not. If they do use a test.json, and have a matrix, then the `--subtest` option can be used to select spcific combinations, for example: ```sh ./run_single_test.py "test cases/frameworks/15 llvm" --subtest 1 ``` will run only the second (zero indexed of course) subtest from the llvm test cases. This is not a super elegent script, but this is super useful.
2021-02-23run_*_tests: Add some type annotationsDylan Baker
2021-01-21mlog: add __str__ method to AnsiDecoratorPaolo Bonzini
Automatically colorize the text when printing the AnsiDecorator, based on the result of mlog.colorize_console(). This is how AnsiDecorator is used most of the time anyway.
2021-01-04Use a single coredata dictionary for optionsDylan Baker
This patches takes the options work to it's logical conclusion: A single flat dictionary of OptionKey: UserOptions. This allows us to simplify a large number of cases, as we don't need to check if an option is in this dict or that one (or any of 5 or 6, actually).
2021-01-04move OptionKey to mesonlibDylan Baker
There's starting to be a lot of things including coredata that coredata needs to itself include. putting it in mesonlib makes more sense
2021-01-04use OptionKey for compiler_optionsDylan Baker
2020-11-20use real pathlib moduleDylan Baker
We added the _pathlib module to work around defeciencies in python 3.5's implementation, since we now rely on 3.6 lets drop this
2020-10-04pathlib: Fix resolve() by overriding it in Python 3.5Daniel Mensinger
2020-09-24compilers/mixins/clike: fix mypy issuesDylan Baker