aboutsummaryrefslogtreecommitdiff
path: root/test cases/common
AgeCommit message (Collapse)AuthorFilesLines
2022-05-03interpreter: new function add_project_dependencies()Paolo Bonzini4-0/+43
This function can be used to add fundamental dependencies such as glib to all build products in one fell swoop. This can be useful whenever, due to a project's coding conventions, it is not really possible to compile any source file without including the dependency. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-05-01Add support for multiline f-stringsPeter Lesslie2-1/+49
+ Extend the parser to recognize the multiline f-strings, which the documentation already implies will work. The syntax is like: ``` x = 'hello' y = 'world' msg = f'''This is a multiline string. Sending a message: '@x@ @y@' ''' ``` which produces: ``` This is a multiline string. Sending a message: 'hello world' ``` + Added some f-string tests cases to "62 string arithmetic" to exercise the new behavior.
2022-05-01Convert if...error checks to assert() in string arithmetic testsPeter Lesslie1-11/+3
2022-05-01Merge pull request #10039 from eli-schwartz/wayland-protocols-subproject-filesJussi Pakkanen5-0/+48
dependencies: allow get_variable to expose files from subprojects
2022-04-21Allow deprecating an option for a new oneXavier Claessens2-0/+13
2022-04-20vcs_tag: handle non-str / non-file argumentsKirill Isakov1-1/+15
This makes vcs_tag behave like other commands so it accepts not only string and file arguments, but also exe, custom_tgt, and external_program.
2022-04-20vcs_tag: document the already supported file argKirill Isakov2-0/+8
2022-04-13dependencies: allow get_variable to expose files from subprojectsEli Schwartz5-0/+48
There are somewhat common, reasonable and legitimate use cases for a dependency to provide data files installed to /usr which are used as command inputs. When getting a dependency from a subproject, however, the attempt to directly construct an input file from a subproject results in a sandbox violation. This means not all dependencies can be wrapped as a subproject. One example is wayland-protocols XML files which get scanned and used to produce C source files. Teach Meson to recognize when a string path is the result of fetching a dep.get_variable(), and special case this to be exempt from subproject violations. A requirement of this is that the file must be installed by install_data() or install_subdir() because otherwise it is not actually representative of what a pkg-config dependency would provide.
2022-03-22interpreter: Make compiler options per-subprojectXavier Claessens5-6/+32
2022-03-22tests/common/44: Prepend to PKG_CONFIG_PATh instead of replacing itDylan Baker2-4/+10
Which is required to make this test work when PKG_CONFIG_PATH is required to get a working system, such as on nixos
2022-03-14sourceset: reinstate extra_depsPaolo Bonzini1-2/+2
Dependencies in the "if_true" keyword argument do not prevent the sources from being used; in other words, they work just like dependencies with "disabler: false". However, this was broken in commit ab0ffc6a2 ("modules/sourceset: Fix remaining typing issues", 2022-02-23) which changed logic instead of just fixing typing issues. This was likely an attempt to avoid using "dependencies.Dependency" after the "dependencies" field was declared, but it also broke QEMU. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-03-12fix regression in vcs_tag when the VCS program is not installedEli Schwartz1-0/+6
We are supposed to fallback on the fallback when running the vcstagger, but instead we errored out during configure. Fixes regression in commit b402817fb6f0392812bfa272bdbc05c9c30139fa. Before this, we used shutil.which || relative paths, and in the latter case if it could not be found we still wrote out that path but it failed to run in vcstagger. Now, we use find_program under the hood, so it needs to be run in non-fatal mode, and if it is not found, we simply keep the original command string. It's a VCS command, so if we magically end up finding it at runtime because it was installed after running configure, that is *fine*.
2022-03-09Move dataonly pkgconfig file to datadir/pkgconfigTristan Partin1-2/+2
dataonly files are architecture independent (lib vs lib64 for example). Fixes #9902
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