summaryrefslogtreecommitdiff
path: root/unittests/allplatformstests.py
AgeCommit message (Collapse)Author
2025-12-17dependencies: Require 'native' be passed in kwargsDylan Baker
This simplifies a bunch of cases, and likely fixes some annoying bugs in cross compile situations where should have been passing this and weren't.
2025-12-01templates: fix remaining languages for source file discovery tooSam James
I missed this in 9104bb616766bd9a05f0b2f280359463d32e227d as we were only testing whitelisted languages for source file discovery. Tests now handle all of these by using the map we have in compilers, as we need to know the suffix to use for the invalid source files we inject. Note that for tests, we mix explicit --lang in some cases and not others, which we could probably do better with. For these 'must fail' tests, I've stuck with explicit `--lang` to make sure we're testing what we want, but the others are perhaps up for debate. Bug: https://github.com/mesonbuild/meson/issues/15286
2025-12-01templates: sort langs in testSam James
2025-12-01templates: fix --executableSam James
* In 1.7.1, the behaviour of --executable was to just ignore it. * After my recent 9104bb616766bd9a05f0b2f280359463d32e227d, the behaviour was that we'd require, for --executable xyz, xyz.c to exist or we'd fail to generate. Neither are good! Instead, create the sample source file w/ the project name, but call the executable whatever the user passed with `--executable`. Bug: https://github.com/mesonbuild/meson/issues/15286
2025-12-01templates: refactor tests to have a bit less nestingSam James
Use `itertools.product()` to reduce an indentation level or two, though we lose one again by changing to a function for fresh vs dirty. I plan on adding more to these tests and it makes it a bit more manageable. Best-viewed-with: --ignore-all-space
2025-11-23Condense directory names for rc1.Jussi Pakkanen
2025-11-23templates: respect parametersSam James
Respect collected sources for `meson init` as well as --executable. This regressed in 9f0ac314ba0c54cc18c2499845324efc14c1849e (part of https://github.com/mesonbuild/meson/pull/14086, it's easier to see how with the whole PR). Also, add subtests (distinguishing between empty directories and those with some file(s) within). We already had some of these but they weren't marked as such. Test `meson init` with a broken source file in the source directory as we should fail with that, not ignore the file. It's easier to test with a broken file than a working one as we can assert the build should fail, it'll pass with just the 1 example file we generate. Closes: https://github.com/mesonbuild/meson/issues/15286
2025-11-19compilers: Remove Environment parameter from ↵Dylan Baker
Compiler.symbols_have_underscore_prefix
2025-11-19compilers: Remove Environment parameter from Compiler.sanity_checkDylan Baker
2025-11-19tests: Fix regex in test_sliceMarkus Jörg
If the first line already conained a match, the former regex didn't catch it correctly, because it was looking for a newline character to detect the start of a line. The new regex is using the proper `^` to match the beginning of a line. For this to work as expected the `re.MULTILINE` flag has to be set.
2025-11-17mtest: add convenience key to testlog.json for "is a failure"Eli Schwartz
This info is also available from the "result" entry, but requires mapping result types to "would cause a failure, but isn't literally FAIL". It comes in handy for the meson testsuite, too.
2025-11-03backends: add CustomTargetIndexes to meson-{test,benchmark}-prereqPaolo Bonzini
If a CustomTargetIndex is passed as an argument to a test, running meson test (with no test glob) does not automatically build the custom_target before running the test, because CustomTargetIndex outputs are not added as prerequisites to the meson-test-prereq and meson-benchmark-prereq targets. Fixes: #14743 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
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-10-23mtest: Display test name in format expected by "meson test" argumentXavier Claessens
This makes easier to run a single test after running them all. For example the test "test_accsadubl" in the suite "default" of project "orc" used to be displayed "orc:default / test_accsadubl". To run that test specifically the command line is `meson test -C builddir orc:test_accsadubl --suite default`. To make this more consistent the test is now displayed as "default - orc:test_accsadubl".
2025-10-23mtest: Fix test selection implementationXavier Claessens
Omitting test()'s `suite` kwarg used to default to `test.suite==['']` because of how stringlistify() works. That had inconsistent behavior with `suite: []` which makes `test.suite==[]`. That changed when porting to typed_kwarg (#8855), which made the default `test.suite==[]`. Change `suite: []`, and missing kwarg, back to `test.suite==['']` which was the original intention. It has impact on `meson test --suite` selection, an empty `test.suite` list means that test is never going to be selected when `--suite` is used, even when we want all tests from a given subproject. It was also unclear what `--suite foo` means. Is `foo` a suite or a project name? It can now be either, it selects all tests from project `foo` as well as all tests from any project in suite `foo`.
2025-10-06options: replace get_value with get_value_forPaolo Bonzini
The two methods are identical. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-08-28python: add a python.build_config option (PEP 739)Filipe Laíns
Signed-off-by: Filipe Laíns <lains@riseup.net> Signed-off-by: Michał Górny <mgorny@quansight.com>
2025-08-18Revert "backends: Use POSIX paths for target paths"Jussi Pakkanen
This reverts commit 12563f74a9f3dda70dcd4778aa958de355d1fae7.
2025-08-11Revert "build: Throw an error instead of warning for sourceless targets"Eli Schwartz
This reverts commit 651aede977179c5fe382744e3dd91ca8e01d050c. This was most certainly not acceptable.
2025-08-11Condense test directory names.Jussi Pakkanen
2025-08-10build: Throw an error instead of warning for sourceless targetsFlorian "sp1rit"​
We might run into an assertion failure down the road, if we don't fail here. Specifically project('proj') executable('bin', 'header.h') will throw during the ninja generation.
2025-08-10rewriter: Accept UnknownValue() in more placesVolker Weißmann
Fixes #14840
2025-08-04build: fix introspection interpreter issue when project selects RustPaolo Bonzini
The introspection interpreter sometimes produces targets with no source files; BuildTarget will then pick a random compiler, according to the order in clink_langs. According to the comment in sort_clink, clink_langs are supposed to list languages from *lowest* to highest priority. However, process_compilers_late() process clink_langs in straight order and returns the first language; which is the one with lowest priority. This became visible with the addition of Rust to clink_langs, because Rust has limitation on the names of library targets, but the bug existed before. Fixes: e49f2f7283e1d9f18e2f5f54647c07287cd70339 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-08-01Condense test directory names for 1.9.Jussi Pakkanen
2025-07-22mintro: Record rpath_dirs_to_remove in install_planDaniele Nicolodi
This is required by meson-python to fix RPATH entries when building a wheel.
2025-07-14unittests: add test case for setting and retrieving build optionsPaolo Bonzini
Check that build options fall back to host options, and that they can be retrieved with get_option. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-07-13backends: Use POSIX paths for target pathsL. E. Segovia
This commit completes 5de09cbe8838e8febf1ca3aa83b53cf06972bff3, ensuring that only POSIX style paths are passed to the compiler line, and thus fixing UNIX-style tools that treat single backward slashes as Unicode escaped characters. Fixes #12191 Completes #12534 Completes #12564
2025-06-08add unittest for cmake preprocessingJan200101
it uses the existing 14 configure file test case to configure config 7 and 10 with cmake and meson and then compares the relevant output to see if they are equal
2025-06-05unittests: Handle missing compiler support in test_compiler_detectionDylan Baker
This wraps all of the compiler detections in this test case in try/except blocks. These blocks will return a skipTest for Python >= 3.11 (where subTest and skipTest interact correctly), and continue if they do not. For Meson CI runs they will fail the specific subtest, which is also an improvement as it can help pinpoint exactly which subtest failed. Fixes: #14579
2025-06-05unittests: add asserts to test_compiler_detectionDylan Baker
Add a few asserts for functions that could in theory return None, but if they do something has gone *really* wrong with the test.
2025-06-05unittests: use subtests to break up test_compiler_detectionDylan Baker
Which is a very large and complicated test function
2025-06-05Add ELD linkerKushal Pal
ELD is Qualcomm's open-source embedded linker. https://github.com/qualcomm/eld Signed-off-by: Kushal Pal <kushpal@qti.qualcomm.com>
2025-06-03utils: Replace BuildDirLock with generic DirectoryLockFlorian "sp1rit"​
DirectoryLock provides a generic locking implementation the replaces the previously used BuildDirLock.
2025-05-29rewriter: Rewrite how we add/remove source filesVolker Weißmann
Change the semantics of IntrospectionBuildTarget.source_nodes and IntrospectionBuildTarget.extra_files . The rewriter and the static introspection tool used to be very broken, now it is *less* broken, hence we add some tests in this commit. Fixes #11763
2025-05-14devenv: do not use os.execv on WindowsCharles Brunet
On Windows, os.execv spawn the process in background and returns 0. Therefore, it prevents devenv to return proper exit code from the called process. (see https://github.com/python/cpython/issues/63323 for reference.) The solution is to call subprocess.run instead, on Windows, at the price of keeping the meson python process alive while the devenv subprocess runs.
2025-05-01unittests: smoke test the backend optionsPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-04-29unittests: fix overly loose regex in tests for `--slice=` optionPatrick Steinhardt
The unit tests for the `meson test --slice=` option check that the option is working by extracting all tests that have been run from the command output. This is done with a rather loose regular expression "test-[0-9]*", which can easily match other parts of the output, as well. One user for example reported that the test broke because they were executing tests in a directory called "meson-test-1.8.0-build", and given that the "test-1" part of that directory matches the regular expression we have too many matches. Fix the issue by tightening the regex so that is way less likely to match anything from the host's build environment. Reported-by: Dominique Leuenberger <dleuenberger@suse.com> Signed-off-by: Patrick Steinhardt <ps@pks.im>
2025-04-18fix prefix computation in validate_original_argsPaolo Bonzini
validate_original_args only checks whether an option is prefixed with the name of a built-in option that was also set. It does not check whether the prefix is the full name of the option specified with -D. Adding an "=" at the end fixes the test. Fixes: #14487 Reported-by: Alyssa Ross <hi@alyssa.is> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-04-14Condense directory names for 1.8 rc1.Jussi Pakkanen
2025-04-03backend/ninja: Fortran targets need to -I transitive deps private dirsDylan Baker
Otherwise they won't be able to find their module outputs. This requires a new method to look at dependencies, as the existing ones wont find static libraries that were linked statically into previous targets (this links with A which link_whole's B). We still need to have B in that case because we need it's BMI outputs.
2025-04-03tests: our fortran order deps are wrong if a new module is introducedDylan Baker
Because we don't set the appropriate dependencies
2025-04-03tests: demonstrate that our scanner cannot handle cross target modulesDylan Baker
2025-04-02rust: new target rustdocPaolo Bonzini
Another rust tool, another rough copy of the code to run clippy. Apart from the slightly different command lines, the output is in a directory and test targets are skipped. Knowing the output directory can be useful, so print that on successful execution of rustdoc. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-03-14Add subTests to test_introspect_json_dumpCharles Brunet
2025-03-09compilers: convert `b_sanitize` to a free-form array optionPatrick Steinhardt
In the preceding commit we have started to perform compiler checks for the value of `b_sanitize`, which allows us to detect sanitizers that aren't supported by the compiler toolchain. But we haven't yet loosened the option itself to accept arbitrary values, so until now it's still only possible to pass sanitizer combinations known by Meson, which is quite restrictive. Lift that restriction by adapting the `b_sanitize` option to become a free-form array. Like this, users can pass whatever combination of comma-separated sanitizers to Meson, which will then figure out whether that combination is supported via the compiler checks. This lifts a couple of restrictions and makes the supporting infrastructure way more future proof. A couple of notes regarding backwards compatibility: - All previous values of `b_sanitize` will remain valid as the syntax for free-form array values and valid combo choices is the same. We also treat 'none' specially so that we know to convert it into an empty array. - Even though the option has been converted into a free-form array, callers of `get_option('b_sanitize')` continue to get a string as value. We may eventually want to introduce a kwarg to alter this behaviour, but for now it is expected to be good enough for most use cases. Fixes #8283 Fixes #7761 Fixes #5154 Fixes #1582 Co-authored-by: Dylan Baker <dylan@pnwbakers.com> Signed-off-by: Patrick Steinhardt <ps@pks.im>
2025-03-09Add cache to coredata.get_external_link_argsCharles Brunet
2025-03-05unittests: use subtests for test_Builtin_options_documentedDylan Baker
2025-02-27test: fix hang when running tests that need parsing with `--interactive`Patrick Steinhardt
When running tests with `--interactive` we don't redirect stdin, stdout or stderr and instead pass them on to the user's console. This redirect causes us to hang in case the test in question needs parsing, like it is the case for TAP output, because we cannot read the process's stdout. Fix this hang by not parsing output when running in interactive mode. Signed-off-by: Patrick Steinhardt <ps@pks.im>
2025-02-27mtest: add option to slice testsPatrick Steinhardt
Executing tests can take a very long time. As an example, the Git test suite on Windows takes around 4 hours to execute. The Git project has been working around the issue by splitting up CI jobs into multiple slices: one job creates the build artifacts, and then we spawn N test jobs with those artifacts, where each test job executes 1/Nth of the tests. This can be scripted rather easily by using `meson test --list`, selecting every Nth line, but there may be other projects that have a similar need. Wire up a new option "--slice i/n" to `meson test` that does implements this logic. Signed-off-by: Patrick Steinhardt <ps@pks.im>