aboutsummaryrefslogtreecommitdiff
path: root/unittests
AgeCommit message (Collapse)AuthorFilesLines
2023-04-20intro: add more details to generated json filesCharles Brunet1-8/+34
This will help with the writing of tools to generate VisualStudio project and solution files, and possibly for other IDEs as well. - Used compilers a about `host`, `build` and `target` machines arere listed in `intro-compilers.json` - Informations lister in `intro-machines.json` - `intro-dependencies.json` now includes internal dependencies, and relations between dependencies. - `intro-targets.json` now includes dependencies, `vs_module_defs`, `win_subsystem`, and linker parameters.
2023-04-14minstall: Fix install_subdir() excludes with path separators on WinDaniele Nicolodi1-5/+6
The paths in meson.build use / as path separator, however, the paths constructed during the directory structure walk use native path separators, thus the path never compare equal to the excluded ones. Normalize the exclusion paths before the comparison.
2023-04-11fix various spelling issuesJosh Soref5-6/+6
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-11Change "can not" to "cannot" throughout projectHiPhish1-1/+1
The word "cannot" expresses inability to do something whereas "can not" expresses the ability to refrain from doing something.
2023-03-30msetup: Allow (re)configure of not empty builddirXavier Claessens2-0/+36
Also prevent from using a parent directory as builddir by mistake. Co-authored-by: Volker Weißmann <volker.weissmann@gmx.de> Co-authored-by: Charles Brunet <charles.brunet@optelgroup.com>
2023-03-30msetup: use more consistent exceptions on exitXavier Claessens1-3/+5
- MesonException for errors is clearer than SystemExit('error message') and provides meson-formatted "ERROR: ..." - `raise SystemExit` with no parameter isn't obvious that it intends to exit successfully While clarifying the latter, it was observed to cause test_preprocessor_checks_CPPFLAGS() failure to be ignored. That test checks get_define() on both c and cpp compilers, which means we need to define either CPPFLAGS or both CFLAGS+CXXFLAGS.
2023-03-30coredata: Fix changing prefix optionXavier Claessens1-4/+4
This is a regression from #11537.
2023-03-28Condense test directories for rc1.Jussi Pakkanen4-23/+23
2023-03-28Add support for meson.options as a replacement for meson_options.txtDylan Baker1-1/+3
We will still try to load `meson_options.txt` if `meson.options` doesn't exist. Because there are some advantages to using `meson.options` even with older versions of meson (such as better text editor handling) we will not warn about the existence of a `meson.options` file if a `meson_options.txt` file or symlink also exists. The name `meson.options` was picked instead of alternative proposals, such as `meson_options.build` for a couple of reasons: 1. meson.options is shorter 2. While the syntax is the same, only the `option()` function may be called in meson.options, while, it may not be called in meson.build 3. While the two files share a syntax and elementary types (strings, arrays, etc), they have different purposes: `meson.build` declares build targets, `meson.options` declares options. This is similar to the difference between C's `.c` and `.h` extensions. As an implementation detail `Interpreter.option_file` has been removed, as it is used exactly once, in the `project()` call to read the options, and we can just calculate it there and not store it. Fixes: #11176
2023-03-28unittests: Pass the exact backend nameXavier Claessens2-3/+5
CI runs with vs2019 and we were passing --backend=vs. This fix reconfigure tests because we can't reconfigure with --backend=vs when initial configuration determined the backend is actually vs2019.
2023-03-28Make backend option read-onlyXavier Claessens1-1/+26
2023-03-20backends: add a new "none" backendEli Schwartz2-0/+18
It can only be used for projects that don't have any rules at all, i.e. they are purely using Meson to: - configure files - run (script?) tests - install files that exist by the end of the setup stage This can be useful e.g. for Meson itself, a pure python project.
2023-03-16Stop using replace_if_different() for coredata pickle fileDaan De Meyer1-5/+32
This was added in f774609 to only change the access time of the coredata file if the coredata struct actually changed. However, this doesn't work as pickle serializations aren't guaranteed to be stable. Instead, let's manually check if options have changed values and skip the save if they haven't changed. We also extend the associated unit test to cover all the option types and to ensure that configure does get executed if one of the options changes value.
2023-03-16prevent lib prefix warning from pkg-configCharles Brunet1-1/+1
2023-03-04msubprojects: fix potential error when resetting a git checkoutBenoit Pierre1-0/+11
Untracked files need to be stashed too, or resetting may fail when trying to (re-)apply a patch that adds one of those untracked files.
2023-03-04typed_kwargs: Extend since_values and deprecated_values for typesXavier Claessens1-2/+40
2023-03-01interpreter: Add testcase..endtestcase clause supportXavier Claessens1-0/+6
This is currently only enabled when running unit tests to facilitate writing failing unit tests. Fixes: #11394
2023-03-01unittests: add test for source dir stripping from rpathsStefan Hajnoczi1-0/+42
This test checks that rpaths are stripped correctly when their prefix matches the source directory. This test fails without the previous commit: 1/4 visitation FAIL 0.01s exit status 127 >>> MALLOC_PERTURB_=150 meson/tmpy7c0joy5/patron ――――――――――――――――――――――――――――――――――――― βœ€ ――――――――――――――――――――――――――――――――――――― stderr: meson/tmpy7c0joy5/patron: error while loading shared libraries: libalexandria.so: cannot open shared object file: No such file or directory Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
2023-02-27mintro: Add exclude_{files, dirs} to install_subdir install_planDaniele Nicolodi1-1/+11
These are necessary for projects outside Meson itself that want to extend the 'meson install' functionality as meson-python does to assemble Python package wheels from Meson projects. Fixes #11426.
2023-02-24test cases: use best practices method to find the python3 programEli Schwartz1-2/+4
We do not need the python module's find_installation() for this, as this does various things to set up building and installing python modules (pure python and C-API). This functionality is already tested in the python tests. Elsewhere, when we just need an interpreter capable of running python scripts in order to guarantee a useful scripting language for custom commands, it suffices to use find_program(), which does not run an introspection script or do module imports, and is thus faster and a bit cleaner. Either way, both methods are guaranteed to find the python3 interpreter, deferring to mesonlib.python_command for that guarantee. test "71 summary" can sometimes return the python command with the ".exe" part all uppercased for mysterious Windows reasons. Smooth this over with ExternalProgram.
2023-02-20interpreter/mesonmain: Add build_options methodL. E. Segovia1-0/+27
This method allows meson.build to introspect on the changed options. It works by merely exposing the same set of data that is logged by MesonApp._generate. Fixes #10898
2023-02-14allow install script to run in dry-run modeCharles Brunet1-0/+14
2023-02-10cython: add unittest to verify that depfiles workEli Schwartz1-0/+21
2023-02-08internaltests: 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-01remove /utf-8 option when /validate-charset- is presentCharles Brunet1-0/+22
2023-01-20coredata: use a frozenset instead of a dict where values are always NoneDylan Baker1-3/+3
2023-01-18devenv: Allow dumping into file and select a formatXavier Claessens1-0/+27
It is often more useful to generate shell script than dumping to stdout. It is also important to be able to select the shell format. Formats currently implemented: - sh: Basic VAR=prepend_value:$VAR - export: Same as 'sh', but also export VAR - vscode: Same as 'sh', but without substitutions because they don't seems to work. To be used in launch.json's envFile.
2023-01-15BUG: 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.