aboutsummaryrefslogtreecommitdiff
path: root/test cases
AgeCommit message (Collapse)AuthorFilesLines
2023-05-05Fix `ERROR: no toolchain found` when run from unittestsRalf Gommers1-1/+1
[skip actions]
2023-05-05Use release buildtype in Cython tests, and skip unless ninja backendRalf Gommers5-21/+33
This matches the tests for Python extensions. Also include some other cleanups to these `meson.build` files: Adding `python_dep` is no longer needed, this is automatic now. Use a single line for `import('python').find_installation()`, because the result of `import('python')` by itself is not used for anything.
2023-05-02tests: add a python test for bytecode compilationEli Schwartz10-3/+58
Some tweaks are added to the test case so that it supports python2 as well.
2023-05-02python module: add an automatic byte-compilation stepEli Schwartz3-3/+4
For all source `*.py` files installed via either py.install_sources() or an `install_dir: py.get_install_dir()`, produce `*.pyc` files at install time. Controllable via a module option.
2023-05-01Rust: C static library cannot link_whole Rust static libraryXavier Claessens2-3/+13
2023-05-01Fix niche cases when linking static libsXavier Claessens5-0/+59
Case 1: - Prog links to static lib A - A link_whole to static lib B - B link to static lib C - Prog dependencies should be A and C but not B which is already included in A. Case 2: - Same as case 1, but with A being installed. - To be useful, A must also include all objects from C that is not installed. - Prog only need to link on A.
2023-04-27Don't use dyndep scanner when preprocessingVolker Weißmann2-0/+11
Fixes #11504
2023-04-27Specify c++ 11 flag as code uses c++ 11 featuresPeter Hull1-1/+2
2023-04-26Add env kwarg to gnome.generate_gir().Volker Weißmann7-11/+18
Fixes #384
2023-04-24ci: Don't search for llvm modules with LLVM 16.0.xNirbheek Chauhan1-16/+40
See: https://github.com/mesonbuild/meson/issues/11642
2023-04-24dependencies: allow to fallback on CMake to find the SDL2 libraryMatthieu Bouron2-2/+3
On Windows, the SDL2 library is generally provided with only CMake config files. This commit allows meson to fallback on CMake as a last resort to find the SDL2 library.
2023-04-23fix python.version() not working in some casesCharles Brunet1-0/+3
import('python').find_installation('python').version() causes exception because of a missing initialization, when `find_installation()` receives a name or a path.
2023-04-21rust: Add new `rust_dependency_map` target configurationSebastian Dröge2-2/+2
This allows changing the crate name with which a library ends up being available inside the Rust code, similar to cargo's dependency renaming feature or `extern crate foo as bar` inside Rust code.
2023-04-21rust: add support for b_ndebugDylan Baker2-1/+13
Rust has a `debug_assert!()` macro, which is designed to be toggled on the command line. It is on by default in debug builds, and off by default in release builds, in cargo. This matches what meson's b_ndebug option does in `if-release` mode.
2023-04-18pkgconfig module: fix traceback on invalid missing descriptionEli Schwartz1-0/+9
If the optional first "mainlib" argument is there, then we infer several values. Otherwise, some of those values fall back to a generic default, and two of them -- name and description -- fall back to being mandatory. In commit e84f293f672a372d2434d0ce4fa39d3f902b6ce8, we removed validation for description as part of refactoring that never actually validated anything.
2023-04-14minstall: Fix install_subdir() excludes with path separators on WinDaniele Nicolodi5-0/+10
The paths in meson.build use / as path separator, however, the paths constructed during the directory structure walk use native path separators, thus the path never compare equal to the excluded ones. Normalize the exclusion paths before the comparison.
2023-04-14rust: Don't pass dependency compile arguments to the compilerSebastian Dröge1-2/+6
Rust doesn't have a concept of dependency compile arguments, i.e. something like headers. Dependencies are linked in and all required metadata is provided by the linker flags.
2023-04-11fix various spelling issuesJosh Soref55-60/+60
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-11Change "can not" to "cannot" throughout projectHiPhish9-9/+9
The word "cannot" expresses inability to do something whereas "can not" expresses the ability to refrain from doing something.
2023-04-04propagate the most accurate node to error messagesEli Schwartz47-47/+47
During evaluation of codeblocks, we start off with an iteration of nodes, and then while evaluating them we may update the global self.current_node context. When catching and formatting errors, we didn't take into account that the node might be updated from the original top-level iteration. Switch to formatting errors using self.current_node instead, to ensure we can point at the likely most-accurate actual cause of an error. Also update the current node in a few more places, so that function calls always see the function call as the current node, even if the most recently parsed node was an argument to the function call. Fixes #11643
2023-04-03tests/94 threads: fix build error with clang 16Christoph Reiter1-1/+1
It fails with "incompatible-function-pointer-types" otherwise
2023-03-30tests: add test to ensure that build dir is preferred to src dirBarnabás Pőcze4-1/+7
Extend the "common/include order" test to ensure that the build directory is preferred over the source directory. For example, when using `configure_file()`, the resulting file should be preferred over a file with the same name in the source directory.
2023-03-28test cases: make various things werror-safeEli Schwartz5-4/+11
Allows getting closer to `./run_project_tests.py -- -Dwerror=true`. - when argc and argv are not *both* used, there's a standard, compliant mechanism to mark the variable as unused - generated code should not build as -Werror - more thoroughly comment out some commented code
2023-03-28test that python modules nominally compile without warningsEli Schwartz1-1/+1
Because we poke around with the dependency, so we might introduce some, and have at least once.
2023-03-28Condense test directories for rc1.Jussi Pakkanen89-0/+0
2023-03-28Fix validation regexes to handle rc version numbers.Jussi Pakkanen2-2/+2
2023-03-28backends: fix bug where meson_exe crashed if constructed with found programsEli Schwartz2-1/+1
Because we base the pickled data name on the name property of the command being run... and for built targets, `exe.name` is always just the name. However, for an ExternalProgram this is just whatever string we searched for, so, NOT just the basename. This became a bigger issue once we started using generator() with the actual program in commit 6aeec808367f05463394e30a8d40834e97c7afc0, rather than first casting it to a string, because the VS backend *always* uses the meson_exe approach for various reasons related to VS being VS. Outside of that, it's difficult to actually get an ExternalProgram object passed to meson_exe -- CustomTarget lowers it to a string, capture is handled via argparse instead of pickling, etc. Fixes #11593
2023-03-28Add support for meson.options as a replacement for meson_options.txtDylan Baker6-0/+14
We will still try to load `meson_options.txt` if `meson.options` doesn't exist. Because there are some advantages to using `meson.options` even with older versions of meson (such as better text editor handling) we will not warn about the existence of a `meson.options` file if a `meson_options.txt` file or symlink also exists. The name `meson.options` was picked instead of alternative proposals, such as `meson_options.build` for a couple of reasons: 1. meson.options is shorter 2. While the syntax is the same, only the `option()` function may be called in meson.options, while, it may not be called in meson.build 3. While the two files share a syntax and elementary types (strings, arrays, etc), they have different purposes: `meson.build` declares build targets, `meson.options` declares options. This is similar to the difference between C's `.c` and `.h` extensions. As an implementation detail `Interpreter.option_file` has been removed, as it is used exactly once, in the `project()` call to read the options, and we can just calculate it there and not store it. Fixes: #11176
2023-03-27custom_target: libfoo.so.1 is linkableXavier Claessens1-1/+8
2023-03-26tests: fix critical existence failure of doxygen testEli Schwartz3-4/+4
It was totally subproject-unsafe, and setting a super bad example. This is bad, because doxygen is annoying to get right and we occasionally tell people to go use our example test case. There is a fun nuance here, that makes doxygen unpredictably work on some versions, and fail on others. Specifically, values must be quoted in doxygen 1.8, but not in doxygen 1.9, or they break -- but only if the output directory contains spaces. This was "fixed" in commit https://github.com/doxygen/doxygen/commit/ef91bacb7a69bbf7bccb4a864698cc003aabac66 which actually caused it to act like an unquoted OUTPUT_DIRECTORY is not provided at all, and then fixed for real in commit https://github.com/doxygen/doxygen/commit/eb3d1eb5ad85c94d6f2c32934fce2b8630331d6c For portability, it is necessary to quote this just to be on the safe side. Fixes #11579
2023-03-20backends: add a new "none" backendEli Schwartz2-0/+7
It can only be used for projects that don't have any rules at all, i.e. they are purely using Meson to: - configure files - run (script?) tests - install files that exist by the end of the setup stage This can be useful e.g. for Meson itself, a pure python project.
2023-03-16Stop using replace_if_different() for coredata pickle fileDaan De Meyer1-5/+6
This was added in f774609 to only change the access time of the coredata file if the coredata struct actually changed. However, this doesn't work as pickle serializations aren't guaranteed to be stable. Instead, let's manually check if options have changed values and skip the save if they haven't changed. We also extend the associated unit test to cover all the option types and to ensure that configure does get executed if one of the options changes value.
2023-03-11Make generator exe more resilient.Jussi Pakkanen1-2/+10
2023-03-09tests: allow a long test to have more time to complete before timing outEli Schwartz1-2/+2
This test is intended to test really long output, so it prints 100k lines of stdout/stderr. It completes in two seconds on my machine, but the default 30-second timeout is apparently too much for CI, because on Windows we often get flaky tests due to this. e.g. we'll get within 200 lines of the end. Bump the CI time by x2. We know this isn't particularly surprising behavior, and allowing it to request another 30 seconds won't hang the CI. But it will save us from some spurious failures and restarted jobs.
2023-03-09re-deduplicate feature warnings printed at the end of setupEli Schwartz1-1/+1
In commit eaf365cb3ef4f1c2ba66e07237d86a44089aff4f we explicitly sorted them for neatness, with the rationale that we were restoring intentional behavior and we only need a set for stylistic purposes. This actually wasn't true, because we never sorted them to begin with (we did sort the version numbers), but sorting them is fine. The bigger issue is that we actually used a set to avoid printing the same feature type multiple times. Now we do print them multiple times -- because each registered feature includes the unique node. Fix this by using both sorted and a set. Fix tests that should in retrospect have flagged this as an issue, but were added later on in the same series to check something else entirely, happen to cover this too, and were presumably copied directly from stdout as-is...
2023-03-04typed_kwargs: Extend since_values and deprecated_values for typesXavier Claessens2-2/+2
2023-03-01interpreter: report FeatureNew for kwargs to project()Eli Schwartz2-1/+9
We need to know the project minimum version before evaluating the rest of the function. There's three basic approaches: - try to set it inside KwargInfo - just run a minimal version of func_project for this, then load everything after - drop down to the AST and set it before anything else In order to handle FeatureNew emitted by a FunctionNode evaluated before project() due to being inlined, such as `version: run_command()`, only option 3 suffices, the rest all happen way too late. Since we have just added AST handling support for erroring out, we can do that to set the version as well.
2023-03-01handle meson_version after parsing but before invalid project() kwargsEli Schwartz3-1/+11
If we add new kwargs to a function invoked on the first line, we also need to validate the meson_version before erroring out due to unknown kwargs. Even if the AST was successfully built. Amusingly, we also get to improve the error message a bit. By passing the AST node instead of an interpreter node, we get not just line numbers, but also column offsets of the issueful meson_version. That broke the stdout of another failing test; adapt it.
2023-03-01handle meson_version even when the build file fails to parseEli Schwartz2-0/+12
If the meson.build file is sufficiently "broken", even attempting to lex and parse it will totally fail, and we error out without getting the opportunity to evalaute the project() function. This can fairly easily happen if we add new grammar to the syntax, which old versions of meson cannot understand. Setting a minimum meson_version doesn't help, because people with a too-old version of meson get parser errors instead of advice about upgrading meson. Examples of this include adding dict support to meson. There are two general approaches to solving this issue, one of which projects are empowered to do: - refactor the project to place too-new syntax in a subdir() loaded build file, so the root file can be interpreted - teach meson to catch errors in building the initial AST, and just load enough of the AST to check for meson_version advice This implements the latter, allowing to future-proof the build grammar.
2023-03-01interpreter: Add testcase..endtestcase clause supportXavier Claessens2-0/+46
This is currently only enabled when running unit tests to facilitate writing failing unit tests. Fixes: #11394
2023-02-27mintro: Add exclude_{files, dirs} to install_subdir install_planDaniele Nicolodi4-0/+9
These are necessary for projects outside Meson itself that want to extend the 'meson install' functionality as meson-python does to assemble Python package wheels from Meson projects. Fixes #11426.
2023-02-24test cases: use best practices method to find the python3 programEli Schwartz12-13/+14
We do not need the python module's find_installation() for this, as this does various things to set up building and installing python modules (pure python and C-API). This functionality is already tested in the python tests. Elsewhere, when we just need an interpreter capable of running python scripts in order to guarantee a useful scripting language for custom commands, it suffices to use find_program(), which does not run an introspection script or do module imports, and is thus faster and a bit cleaner. Either way, both methods are guaranteed to find the python3 interpreter, deferring to mesonlib.python_command for that guarantee. test "71 summary" can sometimes return the python command with the ".exe" part all uppercased for mysterious Windows reasons. Smooth this over with ExternalProgram.
2023-02-22Implement rustc controlled whole-archive linkingDylan Baker13-13/+62
Rustc as of version 1.61.0 has support for controlling when whole-archive linking takes place, previous to this it tried to make a good guess about what you wanted, which worked most of the time. This is now implemented. Additionally, rustc makes some assumptions about library names (specifically static names), that meson does not keep. This can be fixed with rustc 1.67, where a new +verbatim modifier has been added. We can then force rustc to use the name we give it. Before that, we can sneak through `/WHOELARCHIVE:` in cases of dynamic linking (into a dll or exe), but we can't force the archiver to do what we want (rustc considers the archiver to be an implementation detail). The only solution I can come up with is to copy the library to the format that rustc expects. I've run into some issues with that as well, so we warn in that case. The decisions to leave static into static broken on MSVC for 1.61–1.66 was made because: 1) The work around is non-trivial, and we would have to support that workaround for a long time 2) The number of users of Rust in Meson is small 3) The number of users of Rust in Meson on Windows, with MSVC is tiny 4) Using rustup to update rustc on windows is trivial, and solves the problem completely Fixes: #10723 Fixes: #11247 Co-authored-by: Nirbheek Chauhan <nirbheek@centricular.com>
2023-02-20interpreter/mesonmain: Add build_options methodL. E. Segovia2-0/+7
This method allows meson.build to introspect on the changed options. It works by merely exposing the same set of data that is logged by MesonApp._generate. Fixes #10898
2023-02-20nasm: Link with windows CRT libs when nasm is used as linker languageXavier Claessens4-0/+31
2023-02-15interpreter: add FeatureOption.enable_if and .disable_ifDylan Baker1-0/+10
This adds two new methods, that are conceptually related in the same way that `enable_auto_if` and `disable_auto_if` are. They are different however, in that they will always replace an `auto` value with an `enabled` or `disabled` value, or error if the feature is in the opposite state (calling `feature(disabled).enable_if(true)`, for example). This matters when the feature will be passed to dependency(required : …)`, which has different behavior when passed an enabled feature than an auto one. The `disable_if` method will be controversial, I'm sure, since it can be expressed via `feature.require()` (`feature.require(not condition) == feature.disable_if(condition)`). I have two defences of this: 1) `feature.require` is difficult to reason about, I would expect require to be equivalent to `feature.enable_if(condition)`, not to `feature.disable_if(not condition)`. 2) mixing `enable_if` and `disable_if` in the same call chain is much clearer than mixing `require` and `enable_if`: ```meson get_option('feat') \ .enable_if(foo) \ .disable_if(bar) \ .enable_if(opt) ``` vs ```meson get_option('feat') \ .enable_if(foo) \ .require(not bar) \ .enable_if(opt) ``` In the first chain it's immediately obvious what is happening, in the second, not so much, especially if you're not familiar with what `require` means.
2023-02-15interpreter: add a feature.enable_auto_ifDylan Baker1-0/+6
It's always been strange to me we don't have an opposite method of the `disable_auto_if` method, but I've been pressed to find a case where we _need_ one, because `disable_auto_if` can't be logically contorted to work. I finally found the case where they're not equivalent: when you don't want to convert to a boolean: ```meson f = get_option('feat').disable_auto_if(not foo) g = get_option('feat').enable_auto_if(foo) dep1 = dependency('foo', required : f) dep2 = dependency('foo', required : g) ```
2023-02-15preprocess: Add dependencies kwargXavier Claessens2-2/+4
2023-02-15preprocess: Allow custom_tgt, custom_idx and generated_listXavier Claessens2-2/+11
It was documented to be supported but only File and str were actually working.
2023-02-14allow install script to run in dry-run modeCharles Brunet2-5/+15