summaryrefslogtreecommitdiff
path: root/test cases/unit
AgeCommit message (Collapse)Author
2025-11-23Condense directory names for rc1.Jussi Pakkanen
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-29coredata: move cmd_line.txt and command line handling to a new modulePaolo Bonzini
cmd_line.txt is not related to serialized data, in fact it's a fallback for when serialized data cannot be used and is also related to setting up argparse for command line parsing. Since there is no code in common with the rest of coredata, move it to a new module. Fixes: #15081 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-10-20Fix typos in authorship informationVlad-Stefan Harbuz
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-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-17rewriter: accept UnknownValue for name_prefix/name_suffixPaolo Bonzini
Fixes another problem with running "meson configure" on Mesa. Related: #14840 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-08-11Condense test directory names.Jussi Pakkanen
2025-08-10rewriter: Accept UnknownValue() in more placesVolker Weißmann
Fixes #14840
2025-08-01Condense test directory names for 1.9.Jussi Pakkanen
2025-07-14environment: really remove assertionPaolo Bonzini
Fixes: #14789 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
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-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-09AstInterpreter: Fix dead-code-crashVolker Weißmann
Without this commit, the rewriter and the static introspection tool crash if `meson.build` contains something like ```meson if false foo = not_defined endif ``` or ```meson if false message(not_defined) endif ``` While it could be argued, that you should not write stuff like this, this used to raise a `MesonBugException`, which we have to fix. Fixes #14667
2025-05-29Add AstInterpreter.dataflow_dagVolker Weißmann
Make the AstInterpreter create a directed acyclic graph (called `dataflow_dag`) that stores the how the data flowes from one node in the AST to another. Add `AstInterpreter.node_to_runtime_value` which uses `dataflow_dag` to find what value a variable at runtime will have. We don't use dataflow_dag or node_to_runtime_value anywhere yet, but it will prove useful in future commits.
2025-04-24interpreter: do not use pathlib for DependencyVariableString creationPaolo Bonzini
Path.is_dir() can raise a PermissionError if a parent does not have the executable permission set; plus the "in p.parents" tests are very expensive. Do not use Path at all. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
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-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-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>
2025-02-13Make all Meson level options overridable per subproject.Jussi Pakkanen
2025-01-27unit tests: Test ObjC and ObjC++ as well as C and C++Dylan Baker
This tests ObjC and ObjC++ both with and without C enabled. I did this because I ran into issues where ObjC only worked when C was enabled, and then a later bug where C was disabled, due to the fact that C and ObjC both use `c_std` and not `objc_std`.
2025-01-20linkers: fix rpath padding calculation for non-asciiEli Schwartz
rpaths are calculated in bytes, and that's also how depfixer processes them. We need to ensure that the ascii padding we use (bytes == unicode) is the correct offset for the install rpath - build rpath (both specified in unicode which then gets converted to bytes). In the event of a unicode install_rpath, we can get into a situation where the install rpath is longer than the padding, since we assumed that the install_rpath was shorter than it actually is -- because we counted the length in characters instead of the length in bytes. This then broke installation for people who e.g. install into a prefix inside their home directory, when their home directory contains multibyte unicode characters. Bug: https://gitlab.gnome.org/GNOME/gnome-builder/-/issues/2280
2025-01-09Condensed directory names for release.Jussi Pakkanen
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-12-16Handle top level options set in subprojects. Closes #13847.Jussi Pakkanen
2024-10-20Condense test directories.Jussi Pakkanen
2024-10-11test: avoid need for explict CMake minimumscivision
This mitigates maintenance burden as CMake minimum version isn't relevant for these tests. CMake >= 3.31 warns if CMake minimum version is less than 3.10. ref: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/9875
2024-09-19Fix typosspaette
2024-08-15unittests: fix git dist test on Windows with Python < 3.8Dylan Baker
pathlib.Path objects are not supported in subprocess calls on Windows before Python 3.8, so we must convert to a string.
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-23Use dl instead of zlib for checking an external dependencyTristan Partin
Fedora has switched to zlib-ng, which has a version of `1.3.0.zlib-ng`, causing AllPlatformTests.test_summary to fail. dl is much less likely to change format.
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-02Merge pull request #12804 from joukewitteveen/dist-rewriterJussi Pakkanen
Support `meson dist` when getting project versions from VCS
2024-03-01Fix base and compiler options not reconfigurable.Charles Brunet
Fixes #12920.
2024-02-12Add MESONREWRITE to `meson dist` scriptsJouke Witteveen
Fixes #688
2024-01-17tests: Also test implicit rpaths from dependenciesJonathon Anderson
Meson will implicit rpaths when *.so/*.dll/etc. files are injected onto the link line from pkg-config and (now) cmake dependencies. Extend the "prebuilt shared" tests to test that these are added.
2023-11-12Renumber test dirs for rc3.Jussi Pakkanen
2023-10-27Condense test directories for RC1.Jussi Pakkanen
2023-10-05build: use suffix when getting target id for exesDudemanguy
When checking target names, meson explictly forbids having multiple targets with the same name. This is good, but it is strict and it is impossible to have targets with the same basename and differing suffixes (e.g. foo and foo.bin) in the same directory. Allow this for executables by including the suffix (if it exists) in the interal target id. So foo would be foo@exe and foo.bin would be foo.bin@exe.
2023-09-28unittest: Fix clang-tidy-fixLei YU
The unittest case for `clang-tidy-fix` checks if the whole project is in git or not, and skips if not. Fix this by creating a temporary git repo, copy the test files and run the tests, following how `clang-format` does. It also reverts some help code introduced in the previous test. Tested: Verify the test case passes. Signed-off-by: Lei YU <yulei.sh@bytedance.com>
2023-09-18Remove get_configtool_variable()Xavier Claessens
This also makes it more consistent with get_pkgconfig_variable() which always return empty value instead of failing when the variable does not exist. Linking that to self.required makes no sense and was never documented any way.
2023-09-18Remove get_pkgconfig_variable()Xavier Claessens
Make sure that pkgconfig_define is a pair of strings and not a list with more than 2 strings.
2023-09-12Merge pull request #12152 from bruchar1/ast-preserve-allJussi Pakkanen
Preserve whitespaces and comments in AST
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-11parser: allow whitespaces and comments in cont_eolCharles Brunet
FIXME: another approach would be to consider cont_eol as comment (i.e. add backslash and whitespaces to the comment regex). In both cases it works until we want to parse comments separately. TODO?: handle eol_cont inside a string (to split long string without breaking lines). Probably a bad idea and better to simply join a multiline string.
2023-09-11raw printerCharles Brunet
this printer preserves all whitespaces and comments in original meson.build file. It will be useful for rewrite and potential auto-formatter