summaryrefslogtreecommitdiff
path: root/test cases/common
AgeCommit message (Collapse)Author
2025-12-17interpreter|build: Use typed_kwargs for build_target(dependencies)Dylan Baker
What is basically impossible is to handle `SubprojectHolder`, because it's not a true holder but an interpreter object. Well, impossible without changing SubprojectHolder into a true holder, because it's avoiding the circular import becomes extremely convoluted otherwise, and refactoring is difficult because the held object is itself an Interpreter. It's a rather complex problem to solve gracefully. I've punted to avoid the complexity, it does mean that the error message is somewhat less exact. I don't think this is actually a huge problem because we've really guided people away from using `subproject()` and to instead use dependency fallbacks, which don't have this problem to begin with. This removes validation from the build layer, and puts it in interpreter. For code sharing reasons this means that `internal_dependency` also gets more fine grained error messages. The test case for this has been modified to use the `testcase expect_error` construct, and thus has been moved to the common tests directory. It's also been extended to cover both the library case, which gives coverage for the `extra_types` in `KwargInfo`
2025-11-28interpreter: Add a slice() method to arraysJouke Witteveen
This can come in handy for instance when a custom target creates both headers and sources. Slicing the output of a `to_list()` call provides convenient access to just the headers or just the sources.
2025-11-23Require GCC 15.3 or newer for import std tests.Jussi Pakkanen
2025-11-23Add import std support to MSVC.Jussi Pakkanen
2025-11-23Add basic import std support for GCC.Jussi Pakkanen
2025-11-23Add test case for import std (uses #include for now).Jussi Pakkanen
2025-11-18Add support for the `counted_by` attributeTristan Partin
This is a new attribute released in GCC 15 and clang 18. It isn't supported in C++ compilers at the moment.
2025-11-14add test cases for meson.version.version_compare()Eli Schwartz
Extracted from https://github.com/mesonbuild/meson/pull/15230 Co-authored-by: Charlie Hutcheson <chaz.hutcheson@gmail.com>
2025-11-05ExternalProgram: add cmd_array to complete the offferingStéphane Cerveau
In case of python and especially in the case of pyInstaller where the python command is meson.exe runpython, it should not be full path to be used but cmd_array. Fixing #13834
2025-11-04Add build target keyword parameter 'build_subdir' [v8]Keith Packard
Place the build products in a directory of the specified name somewhere within the build directory. This allows use of the target that includes a specific directory name: #include <subdir/configure.h> This also allows creating targets with the same basename by using different subdirectory names. v2: Move build_subdir to Target class. Error if path separator in build_dir v3: Rename to 'build_subdir' to make it clear that the name is appended to a meson-specific build directory, and does not provide the user with a way to define the overall meson build hierarchy. Allow build_subdir to include path separators. Support 'build_subdir' for configure_file. build_subdir must not exist in the source directory and must not contain '..' Add documentation and tests v4: Rebase and prepare for version 1.9.1 Add failing test case when build_subdir is present in the project. Add release note snippet v5: Clarify wording on restrictions on the value of build_subdir. Use the same wording in each place this restriction is described. v6: Move path validation to shared function, validate_build_subdir, instead of duplicating the tests in two places. v7: Update version numbers to 1.10.0 Add TypedDict updates. Remove spurious build_subdir instance variable v8: Oops, missed one version number update. Signed-off-by: Keith Packard <keithp@keithp.com>
2025-10-31Always check if found libraries are linkableSam James
We don't always check if a library is actually linkable because of concerns that a library may not be standalone, so linking against it may still have unresolved references. We can workaround that by building a shared library as a test rather than an executable, and in fact we already do that in a bunch of cases since bb5f2ca3da821d7a8e865cd55a8d5d638e0aab22. This comes up in particular with Fedora and dependency('atomic') because on x86_64, they provide a libatomic.so linker script (so our file existence check passes), but trying to use it later on will fail if the backing package isn't installed. _get_file_from_list has not been deleted because the Ninja backend's guess_library_absolute_path uses it. We might be able to change it to also use a link test but I've left that alone. Test notes: * The _test_all_naming unittest has been tweaked because we were using a blank file rather than an actual shared library, which (as expected), now fails. * I've also added a test for dependency('atomic') providing a result that can actually be linked against. I've not made it check generally whether dependency('atomic') finds something when we expect to (at least for now) as it'll involve some CI whack-a-mole. Bug: https://bugzilla.redhat.com/show_bug.cgi?id=2352531 Bug: https://github.com/mesonbuild/meson/issues/14946 Closes: https://github.com/mesonbuild/meson/issues/10936
2025-10-20interpreter: Fix extract_object subproject validationXavier Claessens
Fixes: #12519
2025-10-15revert local_program()Eli Schwartz
This reverts https://github.com/mesonbuild/meson/pull/15107 Explicit objections regarding the design were raised and not answered, so it shouldn't have been merged. It needs to be discussed and revisited.
2025-10-15Add interpreter kwarg to local_program()Xavier Claessens
2025-10-15Add local_program() functionXavier Claessens
2025-10-14pkgconfig: Improve handling of empty string depsEyal Itkin
Fix the original bug fix for #13950 to only warn about empty required strings, instead of failing the entire build. This will simplify the workflow for users that build the string from a possibly empty list, and save them the need for the added if-check. Signed-off-by: Eyal Itkin <eyal.itkin@gmail.com>
2025-10-11Avoid running overriden program to get its versionXavier Claessens
The parent `__init__` was setting cached_version back to None. This fixes a regression caused by https://github.com/mesonbuild/meson/pull/8885.
2025-09-15Revert "test cases: do not pass global option on command line"Paolo Bonzini
This reverts commit 9b1eb8b8ed434d1c2fdca0d8ac46b79c9b91bb0f. It is not needed anymore since the pre-1.8 semantics were the good ones. Only leave in place the new and clearer testcase names.
2025-09-15Revert "tests: skip test common/223 in the -Ddefault_library=... jobs"Paolo Bonzini
This reverts commit 5ab871be5287aa5cce1e8dfdfb7c4a6b07b4f2f7. It is not needed anymore since the pre-1.8 semantics were the good ones.
2025-09-09msetup: not-found subprojects do not have known optionsPaolo Bonzini
If a subproject had its SubprojectHolder created, but was disabled, its options were not parsed; therefore the subproject should not be checked for unknown options. Fixes: #14969 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-08-29tests: add dict.values() testsMarvin Scholz
2025-08-29tests: add tests for the dict.keys() methodMarvin Scholz
2025-08-26test cases/common/32 has header: disable undef with libcxxHaelwenn (lanodan) Monnier
Can be tested with adding -stdlib=libc++ to C++ flags. In file included from /usr/include/c++/v1/stdio.h:93: In file included from /usr/include/c++/v1/__config:14: In file included from /usr/include/c++/v1/__configuration/abi.h:15: /usr/include/c++/v1/__configuration/platform.h:35:7: error: function-like macro '__has_include' is not defined 35 | # if __has_include(<features.h>) | ^ /usr/include/c++/v1/__configuration/platform.h:48:5: error: function-like macro '__has_include' is not defined 48 | #if __has_include(<picolibc.h>) | ^ 1 warning and 2 errors generated. '
2025-08-25coredata: check for per-subproject compiler and linker argumentsPaolo Bonzini
The compiler and linker argument options are special and are only added when the compiler is first discovered. Thus any project-specific values in a child project will remain sitting in pending_options after initialize_from_subproject_call; coredata needs to inform the option store that they now exist. Fixes: #14939 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-08-25coredata: check for per-subproject compiler optionsPaolo Bonzini
If the parent project has not enabled a language, the child project's project-specific compiler option values are sitting in pending_options after initialize_from_subproject_call, and the option store has to be informed that they now exist. Fixes: #14939 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
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-01wrap: wraps from subprojects can replace directories found with no wrapXavier Claessens
If main project finds a directory subprojects/foo with no corresponding foo.wrap, it creates a dummy PackageDefinition for it. If we later find a subproject that has foo.wrap, replace the dummy wrap with it. This happens for example when wrap-redirect have been deleted. It also happens for subprojects downloaded from some Cargo.lock which does not create a wrap-redirect. Avoid loading the same location twice, which can happen when preparing cargo subprojects.
2025-08-01modules/pkgconfig: Resolve dependencies in case of an internal dependencyCorentin Noël
When giving a dependency object as requires, allow to use the dependency from a subproject (that is an InternalDepdency).
2025-07-29c: add more exceptions to -Wno-*Henrik Lehtonen
Commit eca1ac18dc1978b15b500c9f1710c05cb1ccc0ec (#14252) added support for properly detecting the -Wno-vla-larger-than flag: a value must be specified for its positive form (-Wvla-larger-than=N), or GCC will exit with the error "missing argument to ‘-Walloc-size-larger-than=’". There is a handful of other -Wno-* flags whose positive form act in the same manner, but are not covered here: * -Wno-alloc-size-larger-than (GCC >=7.1.0) * -Wno-alloca-larger-than (GCC >=7.1.0) * -Wno-frame-larger-than (GCC >=4.4.0) * -Wno-stack-usage (GCC >=4.7.0) Add logic to treat these in the same way. Signed-off-by: Henrik Lehtonen <eigengrau@vm86.se>
2025-07-24Add suffix function to the fs moduleJouke Witteveen
2025-07-24Work around os.path.isabs bug in fs moduleJouke Witteveen
2025-07-24Restructure fs module in terms of os.pathJouke Witteveen
2025-07-19interpreter: Add a flatten() method to arraysDylan Baker
This allows users to do two things, flatten potentially nested arrays themselves, and, to safely convert types that may be an array to not an array. ```meson x = [meson.get_external_property('may_be_array)].flatten() ``` ```meson x = ['a', ['b', 'c']] assert(x.flatten() == ['a', 'b', 'c']) ```
2025-06-18tests: skip test common/223 in the -Ddefault_library=... jobsPaolo Bonzini
It is impossible to detect the source of default_library=both from within the test, so add yet another knob... :( Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-18test cases: do not pass global option on command linePaolo Bonzini
The test covers overriding an option from the dependency() function. If the same option is passed on the command line, it overrides the dependency()'s default_options as well. Tweak the description of the unittests that uses the same sources. The tests pass, but I am not sure they should. For example in the second test the default_library=both setting in the machine file should have the same effect as the -D option (machine files have lower priority than command line, but higher priority than anything in meson.build files). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-18options: print option name before "as_root()" in errorsPaolo Bonzini
Starting with Meson 1.8.0, "meson configure" prints some options as ":foo" instead of "foo". Print the option as it was passed by the user. While at it, make errors more consistent and/or correct (e.g. "Unknown option" instead of "Unknown options"). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-17Add project to check that test target's args and depends are in pathLuca Bacci
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-08replace regex implementation for cmake with a parserJan200101
cmake does preprocessing in a linear pass through the entire file this allows recursive variable lookups which cannot be supported by a basic regex implementation.
2025-05-15add test case for setting options from reconfigurePaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-06test cases: add testcase for setting options from superprojectPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-06test cases: cover passing default_options together with static: truePaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-06Add license keyword to pkgconfig generateCharles Brunet
Fixes #14270.
2025-04-24add testcase for propagating options to subprojectsPaolo Bonzini
2025-04-14Condense directory names for 1.8 rc1.Jussi Pakkanen
2025-04-09tests: add test for deprecated options with project-option syntaxPaolo Bonzini
Cover ":foo" syntax in default_options as well. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-04-09tests: enhance deprecated options testMarvin Scholz
This actually tests the handling of deprecated options when passed to meson instead of just as default_options. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-04-02add testcase for subproject options in machine filePaolo Bonzini