aboutsummaryrefslogtreecommitdiff
path: root/test cases/common
AgeCommit message (Collapse)AuthorFilesLines
2022-03-06find_program: add a version() method to match the one for dependenciesEli Schwartz1-0/+3
It is often useful to check the found version of a program without checking whether you can successfully find `find_program('foo', required: false, version: '>=XXX')`
2022-02-17test cases: rename shared library('c') avoid libc collisionEli Schwartz5-5/+10
In a bunch of cases we create a series of sample libraries named "a", "b", "c" etc. This breaks on musl. Originally reported with muon via commit https://git.sr.ht/~lattis/muon/commit/ca5c37171423e9884047a85349e1b236d7449510 and also breaks the testsuite when packaging meson for alpine linux. libc.so is an existing library which is linked in by default for all the obvious reasons. You can get away with this on glibc, because that includes a soversion of "6", but it loads the wrong library on musl.
2022-02-15pkgconfig module: allow custom variables to reference builtin directoriesEli Schwartz2-1/+30
Automatically generate additional variables and write them into the generated pkg-config file. This means projects no longer need to manually define the ones they use, which is annoying for dataonly usages (it used to forbid setting the base library-relevant "reserved" ones, and now allows it only for dataonly. But it's bloat to manualy list them anyway). It also fixes a regression in commit 248e6cf4736ef9ec636228da66c28f9be03aa74f which caused libdir to not be set, and to be unsettable, if the pkg-config file has no libraries but uses the ${libdir} expansion in a custom variable. This could be considered likely a case for dataonly, but it's not guaranteed.
2022-02-01unittests: check that "verbose: true" works on testsPaolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-02-01Fix dep.get_variable() with empty string default_valueXavier Claessens2-0/+10
2022-01-26compilers/c_function_attributes: add retainArsen Arsenović1-0/+6
retain is a relatively young attribute which has proven itself useful for working with --gc-sections -z start-stop-gc.
2022-01-18interpreterobjects: use typed_* for configuration_data.set*Dylan Baker2-10/+1
This removes the ability to use ConfigurationData as a dict, but restricting the inputs to `str | int | bool`. This may be a little too soon for this, and we may want to wait on that part, it's only bee 8 months since we started warning about this.
2022-01-15Fix system include arguments for clang-clGatgat3-0/+20
2022-01-07Fix typo.Itoh Shimon1-1/+1
2022-01-02Condense test directory numbers for rc1.Jussi Pakkanen10-0/+0
2021-12-22unit tests: Don't check quoting with multiple libsNirbheek Chauhan1-0/+1
pkgconf has a bug on MSYS2 due to which prefixes with spaces are not handled correctly if the library has a Requires: on another library and both have prefixes with spaces in them. See: https://github.com/pkgconf/pkgconf/issues/238 So move the unit test to libanswer.pc instead of libfoo.pc till that is fixed.
2021-12-22Set RPATH for all non-system libs with absolute pathsNirbheek Chauhan4-3/+22
If a pkg-config dependency has multiple libraries in it, which is the most common case when it has a Requires: directive, or when it has multiple -l args in Libs: (rare), then we don't add -Wl,-rpath directives to it when linking. The existing test wasn't catching it because it was linking to a pkgconfig file with a single library in it. Update the test to demonstrate this. This function was originally added for shared libraries in the source directory, which explains the name: https://github.com/mesonbuild/meson/pull/2397 However, since now it is also used for linking to *all* non-system shared libraries that we link to with absolute paths: https://github.com/mesonbuild/meson/pull/3092 But that PR is incomplete / wrong, because only adding RPATHs for dependencies that specify a single library, which is simply inconsistent. Things will work for some dependencies and not work for others, with no logical reason for it. We should add RPATHs for *all* libraries. There are no special length limits for RPATHs that I can find. For ELF, DT_RPATH or DT_RUNPATH are used, which are just stored in a string table (DT_STRTAB). The maximum length is only a problem when editing pre-existing tags. For Mach-O, each RPATH is stored in a separate LC_RPATH entry so there are no length issues there either. Fixes https://github.com/mesonbuild/meson/issues/9543 Fixes https://github.com/mesonbuild/meson/issues/4372
2021-12-22pkgconfig: Fix linking to a custom targetXavier Claessens2-0/+17
When generating pkgconfig file for a library that links to an uninstalled static library built by custom_target() Meson was crashing when trying to access some attributes that does not exist on that class. Also fix is_internal() implementation, it only really make sense on a CustomTargetIndex or if CustomTarget has only a single output.
2021-12-06interpreter: allow extract_objects to receive generated sourcesPaolo Bonzini2-0/+18
Fixes: #8333
2021-12-06allow passing a CustomTargetIndex as argument to a testPaolo Bonzini1-1/+1
Fixes: #7585 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-12-06pass all outputs of a custom_target as arguments to a testPaolo Bonzini2-3/+6
Meson was passing only the first output and warning about it. To do this easily, refactor construct_target_rel_path to return a list. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-12-01add install_symlink functionPablo Correa Gómez3-0/+17
Allows installing symlinks directly from meson, which can become useful in multiple scenarios. Current main use is to help moving forward #9557
2021-11-20guard a complicated mlog.warning inside a Feature checkEli Schwartz1-1/+1
This is only relevant on certain versions of meson, so do not print it when meson_version is too low. The message itself is not precisely a deprecation warning, since ostensibly it may be an unlikely coding mistake. It is probably an attempt to implement `copy: true`, but it might not be, hence "warning" instead of "deprecation". So although we could switch this to a FeatureDeprecated, that is not being done at this time.
2021-11-15dependencies/zlib: Add system zlib method for androidDudemanguy1-2/+2
The same method that the BSDs use should also work for android. Also update the tests and docs where appropriate.
2021-11-04fix regression that broke string.format with list objectsEli Schwartz1-0/+1
String formatting should validly assume that printing a list means printing the list itself. Instead, something like this broke: 'one is: @0@ and two is: @1@'.format(['foo', 'bar'], ['baz']) which would evaluate as: 'one is: foo and two is: bar' or: 'the value of array option foobar is: @0@'.format(get_option('foobar')) which should evaluate with '-Dfoobar=[]' as 'the value of array option foobar is: []' But instead produced: meson.build:7:0: ERROR: Format placeholder @0@ out of range. Fixes #9530
2021-10-31Fix cygwin test failure due to shortpath usageNirbheek Chauhan1-0/+5
Two tests are failing on Cygwin because the argument is passed as a long-path and the Path is ending up as a short-path: AllPlatformTests.test_run_target_files_path Traceback (most recent call last): File "/cygdrive/d/a/meson/meson/test cases/common/51 run target/check-env.py", line 22, in <module> assert build_root == env_build_root AssertionError SubprojectsCommandTests.test_purge > self.assertEqual(deleting(out), sorted([ str(self.subprojects_dir / 'redirect.wrap'), str(self.subprojects_dir / 'sub_file'), str(self.subprojects_dir / 'sub_git'), ])) E AssertionError: Lists differ: ['/cygdrive/c/Users/runneradmin/AppData/Local/Temp/tmpeaa2a49[205 chars]git'] != ['/cygdrive/c/Users/RUNNER~1/AppData/Local/Temp/tmpeaa2a49z/s[196 chars]git'] [...] ['/cygdrive/c/Users/runneradmin/AppData/Local/Temp/tmpeaa2a49z/src/subprojects/redirect.wrap', ^^^^^^^^^^^ ['/cygdrive/c/Users/RUNNER~1/AppData/Local/Temp/tmpeaa2a49z/src/subprojects/redirect.wrap', ^^^^^^^^ The fix is to not use the tempdir for all tests, but only for tests that check the mode.
2021-10-30Added warning if run_command is called without the check kwargVolker Weißmann12-32/+32
2021-10-26interpreter: Revert old path joining behavior (fixes #9450)Daniel Mensinger1-0/+3
2021-10-12interpreter: Fix missing holder entry (fixes #9389)Daniel Mensinger1-0/+11
2021-10-10Fix typos discovered by codespellChristian Clauss4-4/+4
2021-10-10Revert "interpreter: Add FeatureNew check"Eli Schwartz2-8/+1
This reverts commit c0efa7ab22f8900f6fa1dadf0d306ec375569c8d. This was a nice idea, or a beautiful hack depending on your perspective. Unfortunately, it turns out to be a lot harder than we originally thought. By operating on bare nodes, we end up triggering a FeatureNew on anything that isn't a string literal, rather than anything that isn't a string. Since no one else has come up with a better idea for implementing a FeatureNew, let's just revert it. Better to not have a warning, than have it trigger way too often.
2021-10-09optinterpreter: Add deprecated kwargXavier Claessens3-0/+59
It can be either: - boolean: the option is completely deprecated. - list: some choices are deprecated. - dict: some choices are deprecated and replaced by another. Fixes: #7444
2021-10-08add install_emptydir functionEli Schwartz2-0/+11
This replaces the absolute hack of using ``` install_subdir('nonexisting', install_dir: 'share') ``` which requires you to make sure you don't accidentally or deliberately have a completely different directory with the same name in your source tree that is full of files you don't want installed. It also avoids splitting the name in two and listing them in the wrong order. You can also set the install mode of each directory component by listing them one at a time in order, and in fact create nested structures at all. Fixes #1604 Properly fixes #2904
2021-10-04backend/vs: Generate dependencies for CustomTargetIndex for a CustomTarget.Andres Freund6-0/+76
Test & fix.
2021-10-04backend/vs: process link dependencies.Andres Freund2-10/+0
Partially-Fixes: #1799
2021-10-04various python neatness cleanupsEli Schwartz1-2/+2
All changes were created by running "pyupgrade --py3-only" and committing the results. Although this has been performed in the past, newer versions of pyupgrade can automatically catch more opportunities, notably list comprehensions can use generators instead, in the following cases: - unpacking into function arguments as function(*generator) - unpacking into assignments of the form x, y = generator - as the argument to some builtin functions such as min/max/sorted Also catch a few creeping cases of new code added using older styles.
2021-09-30dependency: Allow searching for multiple namesXavier Claessens2-0/+13
2021-09-25interpreter: Add FeatureNew checkDaniel Mensinger2-1/+8
2021-09-25Remove helpers.check_stringlist()Daniel Mensinger1-0/+3
2021-09-25interpreter: Introduce StringHolderDaniel Mensinger1-0/+1
Another commit in my quest to rid InterpreterBase from all higher level object processing logic. Additionally, there is a a logic change here, since `str.join` now uses varargs and can now accept more than one argument (and supports list flattening).
2021-09-20dependencyfallbacks: Use default_options for implicit fallbacksXavier Claessens3-1/+4
This removes the warning when using default_options without fallback kwarg completely because a subproject does not know if the main project has an implicit fallback or not, so it could set default_options even if not fallback is available at all. Fixes: #9278
2021-08-31interpreter: Make comparisons of different types a hard errorDaniel Mensinger1-11/+0
2021-08-31pylint: turn on superflous-parensDylan Baker5-5/+5
We have a lot of these. Some of them are harmless, if unidiomatic, such as `if (condition)`, others are potentially dangerous `assert(...)`, as `assert(condtion)` works as expected, but `assert(condition, message)` will result in an assertion that never triggers, as what you're actually asserting is `bool(tuple[2])`, which will always be true.
2021-08-30decorators: Make unknown kwarg fatalXavier Claessens1-1/+0
2021-08-27interpreter: fix IndexError when specifying dependency 'include_type'Rihards Skuja1-0/+3
Exception is thrown when dependency name is empty and when its 'include_type' differs from the default one. Regression from b6d754a40c.
2021-08-23interpreter: Fix dependency(..., static: true) fallbackXavier Claessens2-0/+35
It should build the fallback subprject with default_library=static and override the dependency for both static=True and static kwarg not given. Fixes: #8050.
2021-08-21Path special casing for the Xcode backend.Jussi Pakkanen1-1/+1
2021-08-16Add unset_variable()Tristan Partin1-0/+15
This should be useful for helping to control variable scope within Meson. CMake has something similar for controlling scope.
2021-08-15editorconfig: add setting to trim trailing whitespaceEli Schwartz30-30/+7
and clean up all outstanding issues Skip 'test cases/common/141 special characters/meson.build' since it intentionally uses trailing newlines.
2021-08-09interpreter: Fix list contains for Holders (fixes #9020 #9047)Daniel Mensinger4-0/+24
2021-08-04Escape path in exclude filter passed to gcovrAlois Wohlschlager2-0/+7
Gcovr interprets exclude filters, as passed to the -e option, as regexes. Since we want to exclude a raw path, the argument must be escaped.
2021-07-27build: learn to take CustomTargetIndex as custom_target commandMarc-André Lureau1-0/+6
Fix ERROR: Argument <CustomTargetIndex:...>[0]> in "command" is invalid. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-07-23Add support for gcovr --sonarqube reportWeston Schmidt1-0/+1
Sonarcloud.io only can read the sonarqube based report that gcovr can produce. This change enables support for this output in meson and ninja. Signed-off-by: Weston Schmidt <Weston_Schmidt@alumni.purdue.edu>
2021-07-15Condense test directory names for next release.Jussi Pakkanen9-0/+0
2021-07-10fix: Fix recursive _unholder permissive kwarg (fixes #8977)Daniel Mensinger1-0/+2