aboutsummaryrefslogtreecommitdiff
path: root/unittests
AgeCommit message (Collapse)AuthorFilesLines
2022-03-09install: Add --strip optionXavier Claessens1-0/+20
2022-03-09Replace freezing regex with plain text operations.Jussi Pakkanen1-2/+14
The regex in question causes Python's regex parser to freeze indefinitely in certain Python versions. That might be due to a bug or because the re does infinite backtracking and it just happened to work on earlier implementations.
2022-03-07Fix default install tag for shared lib symlinksXavier Claessens1-0/+21
Versioned shared libraries should have .so file in devel, .so.1 and .so.1.2.3 in runtime. Fixes: #9811
2022-02-17tests: allow setting MESON_CI_JOBNAME=thirdpartyEli Schwartz1-1/+1
This is treated by the test harness as though unset, i.e. we do normal skipping and don't assume we are running in Meson's own project CI. However, it has one distinction which is that it isn't an error to set $CI without setting $MESON_CI_JOBNAME, if it is in fact set but to the ignored value. This lets automated workflows such as Linux distro testing, particularly alpine linux, set $CI or have it set for them by default, without messing things up. Also it has the advantage of $CI actually enabling useful benefits! We will still assume that this thirdparty environment wants to force verbose logging (printing testlogs, running ninja/samu with -v) and colorize the console.
2022-02-14unittests: fine-tune the check for whether we are in CIEli Schwartz1-1/+1
The $CI environment variable may be generally set by Github or Gitlab actions, and is not a reliable indicator of whether we are running "CI". It could also, for an absolutely random example that didn't *just happen*, be Alpine Linux's attempt to enable the Meson testsuite in their packaging, which... uses Gitlab CI. In this case, we do want to perform normal skipping on not-found requirements. Instead of checking for $CI, check for $MESON_CI_JOBNAME as we already use that in all of our own CI jobs for various reasons. This makes it easier for linux distros to package Meson without accumulating hacks like "run the testsuite using `env -u CI`".
2022-02-09meson: Allow directory options outside of prefixJan Tojnar1-7/+7
This bring us in line with Autotools and CMake and it is useful for platforms like Nix, which install projects into multiple independent prefixes. As a consequence, `get_option` might return absolute paths for some directory options, if a directory outside of prefix is passed. This is technically a backwards incompatible change but its effect should be minimal, thanks to widespread use of `join_paths`/`/` operator and pkg-config generator module. It should only cause an issue when a path were constructed by concatenating the value of directory path option. Also remove a comment about commonpath since we do not use that since <https://github.com/mesonbuild/meson/commit/00f5dadd5b7d71c30bd7393d165a87f554eb92e5>. Fixes: https://github.com/mesonbuild/meson/issues/2561
2022-02-03cmake: ci: Skip tests on Ubuntu Bionic where CMake is stuck on 3.10Daniel Mensinger1-0/+2
2022-02-01unittests: check that "verbose: true" works on testsPaolo Bonzini1-0/+7
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-01-30unittests: Fix warning about distutils deprecationNirbheek Chauhan1-2/+5
unittests/rewritetests.py:19: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives from distutils.dir_util import copy_tree
2022-01-30ninja backend: Fix usage of same constants file for native and crossNirbheek Chauhan4-25/+32
For example: ``` meson builddir \ --native-file vs2019-paths.txt \ --native-file vs2019-win-x64.txt \ --cross-file vs2019-paths.txt \ --cross-file vs2019-win-arm64.txt ``` This was causing the error: > ERROR: Multiple producers for Ninja target "/path/to/vs2019-paths.txt". Please rename your targets. Fix it by using a set() when generating the list of regen files, and add a test for it too.
2022-01-18interpreterobjects: use typed_* for configuration_data.set*Dylan Baker1-1/+0
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-18dependencies: don't pass kwargs from get_pkgconfig_variableDylan Baker1-6/+6
This is a layering violation, we're relying on the way the interpreter handles keyword arguments. Instead, pass them as free variables, destructuring in the interpreter
2022-01-16Add a test for the --vsenv meson setup optionNirbheek Chauhan3-4/+44
The tests and the unittests both unconditionally call setup_vsenv() because all tests are run using the backend commands directly: ninja, msbuild, etc. There's no way to undo this vs env setup, so the only way to test that --vsenv works is by: 1. Removing all paths in PATH that provide ninja 2. Changing setup_vsenv(force=True) to forcibly set-up a new vsenv when MESON_FORCE_VSENV_FOR_UNITTEST is set 3. Mock-patching build_command, test_command, install_command to use `meson` instead of `ninja` 4. Asserting that 'Activating VS' is in the output for all commands 5. Ensure that compilation works because ninja is picked up from the vs env. I manually checked that this test actually does fail when the previous commit is reverted.
2022-01-10manually clean up some python 3.6 era codeEli Schwartz1-5/+0
2022-01-10port from embedded data to importlib.resourcesEli Schwartz1-36/+0
2022-01-10condense linesEli Schwartz1-2/+1
2022-01-10pyupgrade --py37-plusEli Schwartz3-4/+4
2022-01-02Condense test directory numbers for rc1.Jussi Pakkanen3-8/+8
2021-12-22unit tests: Don't check quoting with multiple libsNirbheek Chauhan1-2/+2
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 Chauhan1-1/+1
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-15rewriter: create {add,rm}_extra_files commandsCeleste Wouters1-53/+102
Add ability to mutate a target's `extra_files` list through the rewriter. The logic is copied from sources add/rm, but changes the `extra_files` kwarg instead of the sources positional argument. Has additional logic to handle creating the `extra_files` list if it doesn't exist.
2021-12-06add message option to since_values and deprecated_valuesDylan Baker1-1/+9
This allows these two arguments to take a tuple of (version, message), where the message will be passed to Feature*'s message parameter
2021-12-06unittests/internal: use more subTestDylan Baker1-13/+11
2021-12-06Add deprecated_message and since_message to KwargInfoDylan Baker1-6/+6
For passing an extra message to Feature* This allows providing a more detailed message.
2021-12-06unittests/internal: use mock and subTestDylan Baker1-7/+9
This just makes things a little cleaner, and allows more accurate error reporting.
2021-12-06interpreterbase/decorators: Fix types of deprecated_values and since_valuesDylan Baker1-0/+5
Which shouldn't be Dict[str, str], they should be Dict[_T, str], as nay value that can be passed to types is valid here.
2021-11-28make sure files arguments to compiler.compiles and friends, performs rebuildEli Schwartz1-0/+7
If the compiler check is updated as a string in meson.build, we force rebuild, which is a good thing since the outcome of that check changes the configuration context and can enable or disable parts of the build. If the compiler check came from a files() object then we didn't add a regen rule on those files. Fixes #1656
2021-11-27Merge pull request #9599 from dcbaker/submit/typed_kwargs-message-improvementsJussi Pakkanen1-4/+4
Improve error messages for typed_kwarg type mismatches in containers
2021-11-25tests: add a test for OptionKey.from_stringDylan Baker1-0/+19
2021-11-24shared_module: Add soname when used as a link targetNirbheek Chauhan2-2/+22
Emit a detailed deprecation warning that explains what to do instead. Also add a unittest. ``` DEPRECATION: target prog links against shared module mymod, which is incorrect. This will be an error in the future, so please use shared_library() for mymod instead. If shared_module() was used for mymod because it has references to undefined symbols, use shared_libary() with `override_options: ['b_lundef=false']` instead. ``` Fixes https://github.com/mesonbuild/meson/issues/9492
2021-11-24unit tests: Extend prebuilt test to test intermediateDylan Baker1-0/+23
This provides coverage for the bug: https://github.com/mesonbuild/meson/issues/9542
2021-11-24unittests: use UnitTest.addCleanup a bitDylan Baker1-11/+14
2021-11-23interpreter: extract_objects provides a valid sourcePaolo Bonzini1-0/+6
This ensures that there is no warnings when running meson on test cases/common/22 object extraction. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-11-22unittests: cover cases here two of the same wrong type are providedDylan Baker1-1/+1
We don't want to get something like "expected array[str], but got array[int | int]", we really want `arrayp[int]`.
2021-11-22typed_kwargs: use | for type unions, not ,Dylan Baker1-2/+2
Python uses this syntax now, as does typescript and other languages
2021-11-22typed_kwargs: provide better error messages for wrong container typesDylan Baker1-3/+3
Currently, if you pass a `[]string`, but the argument expects `[]number`, then you get a message like `expected list[str] but got list`. That isn't helpful. With this patch arrays and dictionaries will both print messages with the types provided.
2021-11-20Feature kwargs decorator: automatically report the nodes which trigger an issueEli Schwartz1-2/+2
2021-11-18tests: replace python2 framework with metalDylan Baker1-3/+3
The bundled python is deprecated, metal is unlikely to be deprecated any time soon, so let's use that.
2021-11-02python.dependency(): Do not stop when first candidate is not foundXavier Claessens1-0/+4
It has to lookup the dependency with required=False otherwise it raises an exception when the first candidate (pkg-config) failed.
2021-10-31Fix cygwin test failure due to shortpath usageNirbheek Chauhan2-8/+21
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-27Fix add_install_script() ignoring install_tagXavier Claessens1-10/+12
Fixes: #9454
2021-10-27test_clang_format: Do not assume meson source is in gitXavier Claessens1-0/+8
Fixes: #9437
2021-10-26unittests: use better assert methodsEli Schwartz3-25/+25
assertTrue and assertFalse are recommended against, if you can get a more specific assertion. And sometimes it is considerably shorter, for example we have a custom assertPathExists which we can take advantage of.
2021-10-26do not save unused variableEli Schwartz1-1/+1
Constructing a PackageDefinition is enough to assert that it raises an error.
2021-10-26remove unused variableEli Schwartz1-1/+1
It never made sense here to save self.init() which returns a string containing a log or stdout or something, and which was never actually used. Also we then overwrote the variable with a pathname...
2021-10-26remove dead code that is immediately overriddenEli Schwartz1-4/+0
In commit d932cd9fb48e8fecb167641c3d6bee8a68831c6e, we migrated to meson's own static linker definition, and the old code that hardcoded two of the possible exelists should have been removed in the process.
2021-10-26do not save variable when all we want is the side effect of popping itEli Schwartz1-1/+1
It's redefined on every loop iteration, and as the comment says, we just want to make sure the next loop skips a value.
2021-10-14optinterpreter: Fix builtin option names not being reserved anymoreXavier Claessens1-0/+34
2021-10-14introspect: include choices for array optionsPaolo Bonzini1-2/+5
There was even a test covering this, but it did not fail due to a typo.
2021-10-10Fix typos discovered by codespellChristian Clauss2-2/+2