Commit Graph

105 Commits

Author SHA1 Message Date
Paolo Bonzini 5e96730d7d introspect: include choices for array options
There was even a test covering this, but it did not fail due to a typo.
2021-10-14 09:04:25 -04:00
Christian Clauss a5020857f3 Fix typos discovered by codespell 2021-10-10 16:12:25 -04:00
Xavier Claessens 32b7cbd4a7 clangformat: Only format files tracked by git by default 2021-10-10 14:13:35 -04:00
Eli Schwartz 0a3a9fa0c3
ar linker: generate thin archives for uninstalled static libraries
Since they will never be used outside of the build directory, they do
not need to literally contain the .o files, and references will be
sufficient.

This covers a major use of object libraries, which is that the static
library would potentially take up a lot of space by including another
copy of every .o file.

Fixes #9292
Fixes #8057
Fixes #2129
2021-10-10 13:32:22 -04:00
Xavier Claessens 709d151eb9 typed_kwargs: Fix when ContainerTypeInfo is used in a tuple
info.types could be a tuple like (str, ContainerTypeInfo()). That means
we have to check types one by one and only print error if none of them
matched.

Also fix the case when default value is None for a container type, it
should leave the value to None to be able to distinguish between unset
and empty list.
2021-10-09 18:13:34 -04:00
Xavier Claessens 329d111709 python: Add platlibdir and purelibdir options 2021-10-08 17:47:35 -04:00
Paolo Bonzini 7639b70796 cmake: handle arguments in the [binaries] section of the machine file
Sometimes, the machine file can include compiler command line options,
in order to pick the correct multilib.  For example, Meson uses "$cc
--print-search-dirs" to find the library search path, where $cc is the
cc from the machine file.  Because the outputs of "gcc -m32
--print-search-dirs" and "gcc --print-search-dirs" are different, this
only works if you have

   [binaries]
   cc = ['gcc', '-m32']

in the machine file.  Right now, however, the cmake module assumes that
the compiler listed in the machine file is either a compiler, or a
"launcher" followed by the compiler.  Check if the second argument
starts with a slash (for Microsoft-like compilers) or a dash (for
everyone else), and if so presume that the CMAKE_*_COMPILER_LAUNCHER
need not be defined.
2021-10-08 20:09:43 +02:00
Eli Schwartz e8a85fa8a2
various python neatness cleanups
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-10-04 16:29:30 -04:00
Dylan Baker 73dd21036c rust: dependencies need to cause a rebuild/relink not just reorder
Otherwise changes to a dependency don't propogate
2021-10-01 12:21:31 -07:00
Xavier Claessens d2fa6d5080 Make custom_target() name argument optional 2021-09-30 12:26:19 -04:00
makise-homura 613c9e26c4 pkgconfig: pkg-configs version<0.29.1 escape variables incorrectly 2021-09-29 20:16:02 -07:00
Jussi Pakkanen fa47d8dab0
Merge pull request #9014 from bonzini/mixed-language-link
Use appropriate compiler for the source file for "links" tests with file argument
2021-09-28 17:32:44 +03:00
Eli Schwartz 5fa0fd3b47
fix test case instances where undefined message(true) occurred 2021-09-27 01:34:08 -04:00
Alan Coopersmith 7f0193e294 unittests: Make test_prelinking work on Solaris
Running 'cc --version' finds the Solaris Studio C compiler, not gcc,
and it doesn't support --version.
2021-09-25 18:12:14 -07:00
Dylan Baker 30202a2402 compilers/rust: Add support for clippy
Clippy is a compiler wrapper for rust that provides an extra layer of
linting. It's quite popular, but unfortunately doesn't provide the
output of the compiler that it's wrapping in it's output, so we don't
detect that clippy is rustc. This small patch adds a new compiler class
(that is the Rustc class with a different id) and the necessary logic to
detect that clippy is in fact rustc)

Fixes: #8767
2021-09-24 18:48:48 -07:00
Xavier Claessens ca866bcfc7 coredata: 0.59.1 -> 0.59.99 is a major version difference
Remove test_minor_version_does_not_reconfigure_wipe() because when run
during dev cycle that test reconfigure with .99 -> .100 which is
considered a major version change now. It is covered by a more efficient
internal test now anyway.

While at it, remove no-op `with Path(self.builddir):` statement, the
intention was clearly to set workdir.

Fixes: #9260
2021-09-21 18:09:12 +02:00
Xavier Claessens ea4b999473 Add platform agnostic tests
This adds a new category of tests that does not need to run on all
platforms during CI. For now only run them on Linux runners because they
are not the bottleneck.
2021-09-21 08:28:26 -04:00
Xavier Claessens e006e2ee99 Fix ignored install_tag kwarg in install_subdir()
Fixes: #9263
2021-09-16 07:53:18 -04:00
Andres Freund fddf88ba08 backends/vs: Do not emit dummy command for alias_command().
Alias commands did not work with the vs backend, due to trying to access
target.command[0] with an empty command. Fix this by just not emitting a
CustomBuild node for alias targets - the project references are enough to
trigger the necessary actions.

Fixes: #9247
2021-09-14 13:38:04 -04:00
Paolo Bonzini 0fcd696b1e unittests: test external dependency in summary
This requires a bit of extra code because the version might change, but
otherwise it fits in the existing AllPlatformTests.test_summary testcase

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-09-07 14:18:58 -04:00
Paolo Bonzini bb70277e96 add test case for mixed language link tests 2021-09-07 14:18:37 +02:00
Filipe Laíns af8b55d49b mintro: add installed_plan
Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-09-06 18:10:55 +02:00
Eli Schwartz 5166a47acb tests: when generating git repositories, make sure that pgpsign is off
I have a local configuration

tag.forcesignannotated=true
commit.gpgsign=true

This causes the tests to fail with e.g.

error: gpg failed to sign the data
fatal: failed to write commit object

Since this is a unittest, it is never wrong to tell git "just ignore
prior configuration, and disable all PGP signing".
2021-09-03 14:14:15 -04:00
Xavier Claessens 5e55a0bb2b interpreter: Add summary of all user defined options
It is a commonly needed information to help debugging build issues. We
already were printing options with non-default value at the end of the
configure but outside of the summary.

Keeping the list of user defined options in the interpreter will also in
the future be useful to use new default value on reconfigure.
2021-09-02 19:38:29 -04:00
Eli Schwartz 0b63dff3ba
run_target: do not yield broken names with subdirs
A run_target object created in a subdir/meson.build always has a ninja
rule name of "name", not "subdir/name".

Fixes #9175
2021-09-01 15:42:39 -04:00
Xavier Claessens ea02c1c48a msvc: Assume UTF8 source by default
Currently every project that uses UTF8 for its source files must add
'/utf-8' argument otherwise they don't work non-English locale MSVC.

Since meson.build itself is assumed to be UTF8 by default, seems better
to assume it for source files by default too.

For example:
- https://gitlab.freedesktop.org/gstreamer/gst-build/-/blob/master/meson.build#L62
- https://gitlab.gnome.org/GNOME/glib/-/blob/main/meson.build#L29
2021-09-01 19:26:36 +03:00
Dylan Baker bd691b847c interpreter: use python dunders instead of lock for unpicklability
This simplifies things for us, as we don't have to have threading
imported for no other reason, and we can remove the
`an_unpicklable_object` from the Interpreter and mesonlib, since there
was only one user of this.
2021-08-31 16:59:37 -07:00
Dylan Baker 042016a555 unittests: add a test to Interpreter is unpicklable
We want this, so let's test it.
2021-08-31 16:59:37 -07:00
Dylan Baker 4d7031437c pylint: turn on superflous-parens
We have a lot of these. Some of them are harmless, if unidiomatic, such
as `if (condition)`, others are potentially dangerous `assert(...)`, as
`assert(condtion)` works as expected, but `assert(condition, message)`
will result in an assertion that never triggers, as what you're actually
asserting is `bool(tuple[2])`, which will always be true.
2021-08-31 16:28:54 -04:00
Jussi Pakkanen 82ba2f1e05
Merge pull request #9193 from dcbaker/submit/aarch64-be
Handle aarch64_be as a cpu family
2021-08-31 20:29:29 +03:00
Xavier Claessens 88a1bed81b decorators: Make unknown kwarg fatal 2021-08-30 14:00:54 -04:00
Dylan Baker f073c3cfe1 environment: correctly handle cpu value aarch64_be
Fixes #9191
2021-08-30 10:41:12 -07:00
Dylan Baker 78f8a286d0 environment: add ppc -> ppc64 for aix to detect_cpu
This seems like an oversight, that we'd replace ppc with ppc64 on AIX
for the cpu_family, but not for the specific cpu.
2021-08-30 10:38:47 -07:00
Dylan Baker b8cdae7003 unittests: add tests for detect_cpu
Same thing, but for the more specific cases
2021-08-30 10:37:41 -07:00
Dylan Baker 84fff3521a unittests: Add a test case for detect_cpu_family
This should help prevent regressions.
2021-08-30 10:33:28 -07:00
Dylan Baker 11fbaf29d8 interpreter: fix cases of `KwargInfo(..., T, default=None)`
The correct way to mark these is `KwargInfo(..., (T, type(None)))`.
There's also a few cases of `(T, None)` which is invalid, as `None`
isn't a type
2021-08-27 14:54:29 -07:00
Dylan Baker aa895b383c interpreter: Add a helper for checking constrained inputs
This is quite valuable for enum-like inputs, where only a certain set
of values is allowed.
2021-08-27 14:49:23 -07:00
Xavier Claessens e646130ef1 interpreter: Fix dependency(..., static: true) fallback
It should build the fallback subprject with default_library=static and
override the dependency for both static=True and static kwarg not given.

Fixes: #8050.
2021-08-23 10:52:18 -04:00
Dylan Baker e0ab7290f0 unittests: Ensure that symlink is removed after tests complete
using `TestCase.addCleanup` is both neat and tidy, and also ensures that
the cleanup will be done, even if the test fails.
2021-08-20 21:22:55 +03:00
Xavier Claessens 8c5aa031b5 Add install tags
Fixes: #7007.
2021-08-17 15:19:18 -04:00
Dylan Baker b30dddd4e5 interpreter/compiler: Add type checking for the Compiler object
This adds a full set of `typed_pos_args` and `typed_kwarg` decorations,
as well as fixing all of the typing errors reported by mypy.
2021-08-16 16:21:51 -07:00
Dylan Baker 5fe03cf8d9 unittests/base: Allow init method to fail
This adds a new keyword argument to the init method, `allow_fail`. When
set to True (default is False) then a failure to configure is not an
error, and output is still returned. This can be useful for cases where
we expect initialization to fail, and want to check the output.
2021-08-16 16:21:51 -07:00
Dylan Baker 310d7d13f4 unittests/base: Move code out of the try block of a try/except statement
There are two problems with having this in the try/except block. The
first is that both of the if statements will raise, and the except
statement cathces `Exception`, so it catches these two cases, prints a
message that we either don't want or already printed, then re-raises.
2021-08-16 16:21:51 -07:00
Dylan Baker 7daed5faf8 unittests/baseplatform: don't double print on error 2021-08-16 16:21:51 -07:00
Eli Schwartz 59d4f771d2
editorconfig: add setting to trim trailing whitespace
and clean up all outstanding issues

Skip 'test cases/common/141 special characters/meson.build' since it
intentionally uses trailing newlines.
2021-08-15 09:36:18 -04:00
Eli Schwartz ead4ba7777
run_unittests: fix unused variable warnings
We don't actually want to do anything with the open()ed file, just
immediately close it.

The CalledProcessError doesn't have its return returncode checked
here, even though other code with the same type of context manager does.
2021-08-15 09:36:18 -04:00
Jussi Pakkanen a90d2925dd Revert "compilers/c++: Add MSVC option to make the __cplusplus define accurate"
This reverts commit 0b97d58548.
2021-08-15 13:18:35 +03:00
Dylan Baker 0b97d58548 compilers/c++: Add MSVC option to make the __cplusplus define accurate
Otherwise it always returns the value for c++98, starting with MSVC 2017
15.7 or later. Earlier versions are not affected by this mis-feature
2021-08-11 21:54:16 +03:00
Xavier Claessens 5462ea921f interpreter: Fix missing subsubproject summary when subproject fails
In the case main->subp->subsubp, if subsubp succeed to configure but
subp subsequentially fails, subsubp is still being built but its summary
was missing.
2021-08-09 14:11:42 -04:00
lilinzhe dd2e3bf446 pkg-config: support for `-l:libfoo.a`
fixs: #9000 Meson not correctly process with -l:xxx.a link arguments in pkgconfig .pc file.

see also:https://stackoverflow.com/questions/48532868/gcc-library-option-with-a-colon-llibevent-a

with unit test, unit test will be partially skiped if pkg-config version < 0.28 .
    see: https://gitlab.freedesktop.org/pkg-config/pkg-config/-/blob/master/NEWS
2021-08-09 19:32:48 +02:00
Xavier Claessens 943596abbb Fix --force-fallack-for with --wrap-mode=nofallback
Fixes: #9065
2021-08-07 11:20:57 +02:00
Alois Wohlschlager 40d5a38d1b Escape path in exclude filter passed to gcovr
Gcovr interprets exclude filters, as passed to the -e option, as
regexes. Since we want to exclude a raw path, the argument must be
escaped.
2021-08-04 20:31:35 +02:00
Xavier Claessens 9da99e7a59 destdir: Allow relative to build directory
Meson already works like that, except in do_copydir() that requires
absolute destdir. Better explicitly support that instead of leaving it
undefined and unconsistent.
2021-08-04 09:43:41 -04:00
Dylan Baker a450f8c6bc interenaltests: Add some version strings with ansi escapes in them
AS we've run into a few programs using ansi escapes in their version
outputs, we'd like to test them as well.
2021-07-30 10:19:28 -07:00
Xavier Claessens 7eb4c23156 Split run_unittests.py file 2021-07-26 15:19:13 -04:00