aboutsummaryrefslogtreecommitdiff
path: root/unittests
AgeCommit message (Collapse)AuthorFilesLines
2022-04-03Document and test env vars a bit betterJohn Ericson1-4/+2
2022-03-31Merge pull request #9989 from ePirat/epirat-fix-uscore-prefix-detectionJussi Pakkanen1-1/+27
Fix underscore detection
2022-03-31unittests: move get_convincing_fake_env_and_cc to run_tests.pyMarvin Scholz1-14/+3
2022-03-31unittests: add underscore prefix testsMarvin Scholz1-0/+37
Tests the two new detection methods for the underscore prefix against what is detected in the binary. Contrary to the in-the-wild failures, we can trust the binary here as we do not get any additional flags that influence the binary contents in this test environment.
2022-03-30unittests: correctly use test asserts instead of regular onesMarvin Scholz1-2/+2
2022-03-30Add new debug() functionMarvin Scholz1-0/+13
Adds a new debug() function that can be used in the meson.build to log messages to the meson-log.txt that will not be printed to stdout when configuring the project.
2022-03-29Condense test directory names.Jussi Pakkanen6-91/+91
2022-03-24Make compilers list per subprojectXavier Claessens1-4/+8
Previously subprojects inherited languages already added by main project, or any previous subproject. This change to have a list of compilers per interpreters, which means that if a subproject does not add 'c' language it won't be able to compile .c files any more, even if main project added the 'c' language. This delays processing list of compilers until the interpreter adds the BuildTarget into its list of targets. That way the interpreter can add missing languages instead of duplicating that logic into BuildTarget for the cython case.
2022-03-22unittests: Fix rpath tests no nixosDylan Baker1-0/+3
Which insert a bunch of rpath entries we strip, but then don't check if they're empty and fail anyway.
2022-03-22tests/linuxlike: prepend rather than override PKG_CONFIG_PATHDylan Baker1-5/+17
If you rely on PKG_CONFIG_PATH to make anything work (like nixos) then these tests cannot pass without the system values appended to the override values.
2022-03-22tests/linuxlike: Honor PKG_CONFIG envvarDylan Baker1-14/+16
For some of us, we need to use this to get the right pkg-config. If the variable is unset, `'pkg-config'` is used.
2022-03-16unittests: convert python tests to project testsEli Schwartz1-39/+2
Perhaps when this test case was originally created, project tests could not use a matrix of options? This is certainly possible today, so don't write special unittest handling for this instead. This adds proper visibility into what gets run and what doesn't. Now we know which python executables got tested and which got skipped.
2022-03-13Merge pull request #9339 from dcbaker/submit/structured_sourcesJussi Pakkanen1-0/+1
Structured Sources
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-07build: plumb structured sources into BuildTargetsDylan Baker1-0/+1
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.