aboutsummaryrefslogtreecommitdiff
path: root/test cases
AgeCommit message (Collapse)AuthorFilesLines
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
2023-02-13add a CI runner testing that Meson runs correctly under PyPy3Eli Schwartz2-2/+2
Silence a couple of framework tests that need to be skipped since we don't install their dependencies for pypy3.
2023-02-10cython: add unittest to verify that depfiles workEli Schwartz3-0/+8
2023-02-08CI: skip gpgme-config test on ArchEli Schwartz1-1/+1
gpgme has decided that config-tool is bad, which makes sense. They've also decided that they will only install theirs, if gpg-error also installs one, which is a bit... confusing. Anyway, it's impossible to know whether it should or should not exist, so just accept that this test is ready to be skipped on distros that currently no longer have this ancient config-tool script. Victory is within reach!
2023-02-07test cases/vala: Fix clang error during int to pointer coercionNirbheek Chauhan2-3/+3
``` clang [...] -c valaprog.p/GLib.Thread.c ../test cases/vala/5 target glib/GLib.Thread.vala:17:17: error: incompatible integer to pointer conversion passing 'gint' (aka 'int') to parameter of type 'gpointer' (aka 'void *') [-Wint-conversion] g_thread_exit (get_ret_code ()); ^~~~~~~~~~~~~~~ /usr/include/glib-2.0/glib/gthread.h:158:66: note: passing argument to parameter 'retval' here void g_thread_exit (gpointer retval); ^ 1 error generated. ```
2023-02-01add cc.has_function_attribute('vector_size')Dudemanguy1-0/+1
2023-01-31log running commands a bit better by doing proper shell quotingEli Schwartz1-1/+1
2023-01-28tests/llvm: require cmake 3.11Konstantin1-1/+4
This is a weird but working way to skip this test from running on bionic (where it should not run).
2023-01-28cmake: allow dynamic linking with LLVMKonstantin3-45/+85
llvm-config is unsuitable for standard cross-compile, because we need to build llvm especially for it, which is not done is almost any distros, so, for example, standard bootstrap chroot will be unsuitable. This patch is trying to acheive feature parity between config-tool searching of LLVM and CMake-based one, which is arch-agnostic. Signed-off-by: Konstantin <ria.freelander@gmail.com>
2023-01-25tests: avoid unexpected failure when cmake is not installedEli Schwartz1-1/+2
This test case checks stdout and demands a `dependency()` lookup fail. The resulting error message can be different depending on whether cmake is installed, or not. For cmake-specific tests we would simply skip the test if cmake is not installed, but here we can just fine-tune the pattern matching we use to determine if the test failed "correctly". Fixes #11320
2023-01-20Deprecate passing strings to non-string optionsDylan Baker4-2/+16
Currently Meson allow the following (Muon does not): ```meson option('foo', type : 'boolean', value : 'true') option('bar', type : 'integer', value : '42') ``` This is possibly a holdover from very old code, but it's a bad idea and we should stop doing it. This deprecation is the first stop on that journey.
2023-01-20use typed_kwargs for the various option subparsersDylan Baker1-1/+1
We make use of allow_unknown=True here, which allows us to only look at the common arguments in the main option parser, and then look at the specific options in the dispatched parsers. This allows us to do more specific checking on a per overload basis.
2023-01-18devenv: Allow dumping into file and select a formatXavier Claessens2-0/+6
It is often more useful to generate shell script than dumping to stdout. It is also important to be able to select the shell format. Formats currently implemented: - sh: Basic VAR=prepend_value:$VAR - export: Same as 'sh', but also export VAR - vscode: Same as 'sh', but without substitutions because they don't seems to work. To be used in launch.json's envFile.
2023-01-18 Fix nasm when target has threads as added dependencyGijs Peskens1-0/+12
2023-01-15BUG: Fix generated sources not being included as dependencies in cython ↵Thomas Li3-0/+23
transpilation
2023-01-10backends: Stop passing generator exes to ExecutableSerialisation as stringsDylan Baker7-0/+81
The code below this already handles being passed an Executable or ExternalProgram, and it does it correctly, since it handles host binaries that need an exe_wrapper correctly, while the code in the generator paths doesn't. The xcode backend is, like always, problematic, it doesn't handle things the same way as the ninja and vscode backends, and generates a shell script instead of using meson as a wrapper when needed (it seems likely that just forcing the meson path for xcode would be better). I don't have a working mac to develop a fix for, so I've left a todo comment there. Fixes: #11264