aboutsummaryrefslogtreecommitdiff
path: root/unittests
AgeCommit message (Collapse)AuthorFilesLines
2023-02-19cython: add unittest to verify that depfiles workEli Schwartz1-0/+21
2023-02-19internaltests: Fix tests for /utf-8 removalDylan Baker1-5/+6
Now that we don't insert /utf-8 into the always args for MSVC < 19.00 we need to use a version > 19.00 for testing. This also means that /Zc:__cplusplus will be added to the always args.
2023-02-19remove /utf-8 option when /validate-charset- is presentCharles Brunet1-0/+22
2023-02-19BUG: Fix generated sources not being included as dependencies in cython ↵Thomas Li1-0/+26
transpilation
2022-12-14depfixer: silence fix_jar() and make it do somethingBenjamin Gilbert2-0/+35
fix_jar() tries to remove an existing Class-Path entry from the jar manifest by postprocessing the manifest and passing it to `jar -um`. However, `jar -um` can only add/replace manifest entries, not remove them, and it also complains loudly when replacing an entry: Dec 13, 2022 7:11:19 PM java.util.jar.Attributes read WARNING: Duplicate name in Manifest: Manifest-Version. Ensure that the manifest does not have duplicate entries, and that blank lines separate individual sections in both your manifest and in the META-INF/MANIFEST.MF entry in the jar file. Thus fix_jar() produces one such warning for each entry in the manifest and accomplishes nothing else. Use jar -uM instead. This completely removes the manifest from the jar and allows adding it back as a normal zip member, fixing fix_jar() and avoiding the warnings. Fixes: https://github.com/mesonbuild/meson/issues/10491 Fixes: c70a051e93 ("java: remove manifest classpath from installed jar")
2022-12-07wrap: Don't use --branch with shallow clones against HEADL. E. Segovia1-2/+16
Fixes #10931
2022-12-05mtest: warn on invalid TAP outputEli Schwartz1-0/+4
In commit a7e458effadbc884eacf34528df3a57b60e43fe3 we stopped erroring out on invalid TAP stream contents, with the rationale that "prove" has become more lenient. A close reading of the TAP spec indicates why, though: > A TAP parser is required to not consider an unknown line as an error but > may optionally choose to capture said line and hand it to the test > harness, which may have custom behavior attached. This is to allow for > forward compatability. Test::Harness silently ignores incorrect lines, > but will become more stringent in the future. TAP::Harness reports TAP > syntax errors at the end of a test run. The goal of treating unknown lines as an error in the TAP parser is not because unknown lines are fine and dandy. The goal is to allow implementing future versions of TAP, and handling it via existing parsers. Since Meson has both a parser and a harness, let's do exactly that -- pass these lines as a distinctive status to the test harness, then have the test harness complain.
2022-12-04refactor pkg-config dependency to allow statically finding the programEli Schwartz1-1/+1
The pkg-config dependency class has some interesting logic for finding a good pkg-config that will be used for dependency lookups. We sometimes need to use it, though, outside of the class. Make that possible.
2022-11-27Add warning_level=everythingDavid Robillard1-0/+6
Adds a new maximum warning level that is roughly equivalent to "all warnings". This adds a way to use `/Wall` with MSVC (without the previous broken warning), `-Weverything` with clang, and almost all general warnings in GCC with strictness roughly equivalent to clang's `-Weverything`. The GCC case must be implemented by meson since GCC doesn't provide a similar option. To avoid maintenance headaches for meson, this warning level is defined objectively: all warnings are included except those that require specific values or are specific to particular language revisions. This warning level is mainly intended for new code, and it is expected (nearly guaranteed) that projects will need to add some suppressions to build cleanly with it. More commonly, it's just a handy way to occasionally take a look at what warnings are present with some compiler, in case anything interesting shows up you might want to enable in general. Since the warnings enabled at this level are inherently unstable with respect to compiler versions, it is intended for use by developers and not to be set as the default.
2022-11-22unittests: add and use get_meson_log_raw functionMarvin Scholz3-10/+13
This is like get_meson_log but returns the whole contents not split into individual lines.
2022-11-22unittests: add and use _open_meson_log functionMarvin Scholz1-12/+17
Factors out opening the meson log into its own function so that it can be used in the places where with was done before. Additionally instead of checking if the file exists before opening it, try to open it and handle the exception when it is not found.
2022-11-21Handle freezing tests. Fixes #10752.Jussi Pakkanen1-0/+8
2022-11-17tests: fix potential failure to verify pkg-config generationEli Schwartz1-1/+1
We use a dummy project with a vague name and try to find flags for it based on the installable pkg-config files. This sort of works, generally, because it attempts to match `-lct` which doesn't exist because the test case isn't installed, and that link argument is passed directly through. Except, sometimes that library does exist. It is provided by the "freetds" project, which may be a dependency other tools. In that case, Meson finds a library, and the `dependency()` resolves to `/usr/lib/libct.so` and the test fails. Fortunately, we do have an API to say that we really want to get back the same flags pkg-config returned. Use this.
2022-11-16Fix test_rust_clippy for rust 1.65Xeonacid1-1/+2
clippy changed output message fix #11004
2022-11-02backends: Try guessing install tag for all installed filesXavier Claessens1-0/+5
It was only trying to guess install tag, and log missing tags, for files installed by install_data(). Do it also for all other files, especially custom_taget() that commonly installs generated headers.
2022-11-01minstall: make do_strip run with -Sx for macOS targetsL. E. Segovia1-6/+22
This commit also adds some extra symbol noise to lib.c, in order to aid detection of the debug information with nm. Fixes #10943
2022-10-25Compilers: Keep ccache and exelist separatedXavier Claessens1-4/+4
Only combine them in the Compiler base class, this will make easier to run compiler without ccache.
2022-10-25Skip wrapdb test if there is no connectivity.Jussi Pakkanen1-0/+9
2022-10-25Condense test directory numbers.Jussi Pakkanen3-21/+21
2022-10-24Accept disablers in summary valuesElliott Sales de Andrade1-2/+3
They are commonly used as a replacement for a `dependency`, and not accepting them in `summary` breaks the last example in [1] when used as a value. [1] https://mesonbuild.com/Disabler.html#disabling-parts-of-the-build
2022-10-10Document and test new WrapDB auto fallbackXavier Claessens1-0/+19
2022-09-28Move classes used by scripts to their own moduleXavier Claessens2-3/+31
Those classes are used by wrapper scripts and we should not have to import the rest of mesonlib, build.py, and all their dependencies for that. This renames mesonlib/ directory to utils/ and add a mesonlib.py module that imports everything from utils/ to not have to change `import mesonlib` everywhere. It allows to import utils.core without importing the rest of mesonlib.
2022-09-22modules/gnome: make_native_glib_version an instance varDylan Baker1-5/+2
This removes the need for the use of the global statement. I've also updated the test that overrides this to use mock.patch instead of hand monkey patching.
2022-09-19compilers: don't export every compiler as a top-level propertyEli Schwartz3-10/+16
This is wasteful and generally unneeded, since code can just use the compiler they detected instead of manually poking at the internals of this subpackage. It also avoids importing an absolute ton of code the instant one runs `from . import compilers`
2022-09-19compilers: don't use instance checks to determine propertiesEli Schwartz1-4/+3
In various situations we want to figure out what type of compiler we have, because we want to know stuff like "is it the pgi one", or "does it use msvc style". The compiler object has this property already, via an API specifically designed to communicate this info, but instead we performed isinstance checks on a compiler class. This is confusing and indirect, and has the side effect of requiring more imports everywhere. We should do away with it.
2022-09-18Warn if wrap file changesDaniel Carson1-1/+17
Save off the hash of the wrap file when first configuring a subproject. When reconfiguring a subproject, check the hash of the wrap file against the stored hash. If they don't match then warn the user.
2022-09-13Use os.path.realpath for default include paths testing in -isystem.Yang Bo1-0/+12
This ensures correct removal of default include paths in -isystem options when symbolic links are involved. A test for this is also added.
2022-09-06Fix install_subdirs not showing up in intro-install_plan.jsonThomas Li1-0/+6
2022-09-04mtest: Run ninja build.ninja before loading testsAndres Freund1-0/+20
When the build definition has changed since the last ninja invocation meson test operated on an outdated list of tests and their dependencies. That could lead to some tests not being run / not all dependencies being built. This was particularly confusing because the user would see the output of reconfiguration and rebuilding, and the next mtest invocation would have the updated configuration. One issue with this is that that we will now output more useless ninja output when nothing needs to be done (the "Entering directory" part is not repeated, as we happen to be in the build directory already). It likely is worth removing that output, perhaps by testing if anything needs to be done with ninja -n, but that seems better addressed separately. Fixes: #9852
2022-08-23install modes should not apply sticky bit to filesEli Schwartz1-5/+5
This is generally a bad idea, e.g. it causes OSError on freebsd. It also gets ignored by solaris and thus causes unittest failures. The proper solution is to simply reject any attempt to set this, and log a warning. The install_emptydir function does apply the mode as well, and since it is a directory it actually does something. This is the only place where we don't reset the mode. Although install_subdir also installs directories, and in theory it could set the mode as well, that would be a new feature. Also it doesn't provide much granularity and has mixed semantics with files. Better to let people use install_emptydir + install_subdir. Fixes #5902
2022-08-22introspection: untangle install_plan implemetation, fix a bunch of wrong onesEli Schwartz1-17/+17
Generally plumb through the values of get_option() passed to install_dir, and use this to establish the install plan name. Fixes several odd cases, such as: - {datadir} being prepended to "share" or "include" - dissociating custom install directories and writing them out as {prefix}/share/foo or {prefix}/lib/python3.10/site-packages This is the second half of #9478 Fixes #10601
2022-08-18unittests: Add additional tests for KwargInfo::since valuesDylan Baker1-0/+16
The first test is checking the added support for keys as either `dict` or `list`. The second checks that a default value which would otherwise trigger a value_since check doesn't, and that passing the default value explicitly does.
2022-08-17interpreter: move handling of module stability to interpreterDylan Baker1-1/+1
Thanks to `ModuleInfo`, all modules are just named `foo.py` instead of `unstable_foo.py`, which simplifies the import method a bit. This also allows for accurate FeatureNew/FeatureDeprecated use, as we know when the module was added and if/when it was stabilized.
2022-08-17allplatformstests: use subTests with test_warning_locationDylan Baker1-9/+11
2022-08-16deprecate running "meson builddir" without setup subcommandEli Schwartz1-2/+2
This is ambiguous, if the build directory has the same name as a subcommand then we end up running the subcommand. It also means we have a hard time adding *new* subcommands, because if it is a popular name of a build directory then suddenly scripts that try to set up a build directory end up running a subcommand instead. The fact that we support this at all is a legacy design. Back in the day, the "meson" program was for setting up a build directory and all other tools were their own entry points, e.g. `mesontest` or `mesonconf`. Then in commit fa278f351fe3d6924b4d1961f77b5b4a36e133f8 we migrated to the subcommand mechanism. So, for backwards compatibility, we made those tools print a warning and then invoke `meson <tool>`. We also made the `meson` tool default to setup. However, we only warned for the other tools whose entry points were eventually deleted. We never warned for setup itself, we just continued to silently default to setup if no tool was provided. `meson setup` has worked since 0.42, which is 5 years old this week. It's available essentially everywhere. No one needs to use the old backwards-compatible invocation method, but it continues to drag down our ability to innovate. Let's finally do what we should have done a long time ago, and sunset it.
2022-08-07mtest: unify parsed and non-parsed output handlingHemmo Nieminen1-0/+62
Use the same routines to handle output both when parsing the output and when not. Also fixes broken stderr handling for parsed tests.
2022-07-31Only reconfigure if configure options actually changedDaan De Meyer1-0/+10
Currently, if we run "meson configure -Doption=value", meson will do a reconfigure when running "ninja build" afterwards, even if the new value is the same one that was already configured previously. To avoid this unnecessary reconfigure, let's use replace_if_different() instead of unconditionally replacing the conf file in coredata's save() function.
2022-07-21ar linker: detect the "osx ld" case (where generating thin archives won't ↵Justin Blanchard1-1/+1
work) based on host OS, not build OS.
2022-07-11tests: skip template test for windows shared fortranEli Schwartz1-0/+6
This is only supported with gfortran, see "test cases/fortran/6 dynamic" for more details. Skip it explicitly here too.
2022-07-07Fix test case numbers.Jussi Pakkanen3-19/+19
2022-06-14Fix crash when a reconfigure adds a new subprojectXavier Claessens1-0/+11
When a subproject is disabled on the initial configuration we should not add it into self.coredata.initialized_subprojects because that will prevent calling self.coredata.init_builtins() on a reconfigure if the subproject gets enabled. Fixes: #10225.
2022-06-13unittests: do more accurate check for ninja "nothing to do"Eli Schwartz1-2/+2
We only want to scan stdout for these strings, and particularly, if we allow `-d explain` to be mingled into stdout, then buffering issues across OSes can lead to inaccurate results.
2022-06-13unittests: allow test commands to suppress returning stderrEli Schwartz1-5/+11
Add better logging of commands by printing stdout and stderr separately, if relevant. Also while we are at it, print the actual command being run.
2022-06-09intro-install_plan: fix destinations for build_targets with custom install_dirEli Schwartz1-0/+8
There are a couple issues that combine to make the current handling a bit confusing. - we call it "install_dir_name" but it is only ever the class default - CustomTarget always has it set to None, and then we check if it is None then create a different variable with a safe fallback. The if is useless -- it cannot fail, but if it did we'd get an undefined variable error when we tried to use `dir_name` Remove the special handling for CustomTarget. Instead, just always accept None as a possible value of outdir_name when constructing install data, and, if it is None, fall back to {prefix}/outdir regardless of what type it used to be.
2022-06-01Fix sandbox violation when using subproject as a symlinkVili Väinölä1-0/+13
Fix "Tried to grab file outside current (sub)project" error when subproject exists within a source tree but it is used through a symlink. Using subprojects as symlinks is very useful feature when migrating an existing codebase to meson that all sources do not need to be immediately moved to subprojects folder.
2022-05-24mtest: ignore invalid inputPaolo Bonzini1-1/+0
TAP version 14 introduced subtests, that are supposedly backward compatible because "TAP13 specifies that non-TAP output should be ignored". Meson reported TAP syntax errors based on behavior of "prove" at the time, but it seems that now "prove" has become a lot more lenient; it even accepts the following completely bogus input just fine: --- ok 1 ok 2 x 1..1 --- So do the same and make Meson's parser accept invalid TAP input silently. Fixes: #10032
2022-05-19Reword message in warningZbigniew Jędrzejewski-Szmek3-16/+16
"targetting" is verb-derived adjective, which sort-of-works here, but makes the whole sentence awkward, because there's no verb. Let's just use present simple.
2022-05-10Require CMake 3.14 for all tests that use the cmake moduleSimon McVittie1-2/+0
Older versions are not supported by the cmake module since 0.62. This avoids having to hard-code the linux-bionic-gcc CI job as being unable to run these tests, which leaves other older environments like Debian 10 still trying to run them (and failing). Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-06unittests: Skip prelinking test with gcc 8 or olderSimon McVittie1-4/+2
This was already skipped when running on the Ubuntu 18.04 version of gcc, but it also fails with gcc 8.3.0 on Debian 10. Instead of hard-coding specific versions to look for, do a version comparison. Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-04-30pkgconfig: Use EnvironmentVariables to build PKG_CONFIG_* envXavier Claessens1-2/+5
The new get_env() method that returns an EnvironmentVariables object will be needed in next commit that will pass it to CustomTarget. This has the side effect to use the proper os specific path separator instead of hardcoding `:`. It is the obvious right thing to do here, but has caused issues in the past. Hopefully issues have been fixed in the meantime. If not, better deal with fallouts than keep doing the wrong thing forever.