Commit Graph

1035 Commits

Author SHA1 Message Date
5db0d86b5c run_unittests: make another test inprocess safe 2021-01-04 12:15:41 -08:00
0574134bf8 run_unittests: Make test_command_line safe witn inprocess
This is pretty important to be able to debug the test, as it's huge and
really should be a test split into subtests.
2021-01-04 12:15:41 -08:00
9f1ba40252 Merge pull request #8013 from mesonbuild/cppmodules
C++ module support
2020-12-14 15:00:04 +00:00
b8052f9e50 Support native tests in crossbuild 2020-12-13 16:32:52 +02:00
3df064484a Add unit test. 2020-12-13 14:03:22 +02:00
b65168c558 unit tests: correctly skip c++20 checks if the compiler doesn't support
them

I can't find a supported version for AppleClang, and you need relatively
recent versions of GCC and Clang for -std=c++20 to work.
2020-12-11 17:46:11 +05:30
c21b04ba08 Add prelinking support for static libraries. 2020-12-03 22:58:07 +02:00
b53505a9dc Merge pull request #7982 from dcbaker/submit/unittest-fixups
Unittest fixups
2020-11-24 00:02:22 +02:00
f6672c7a19 use real pathlib module
We added the _pathlib module to work around defeciencies in python 3.5's
implementation, since we now rely on 3.6 lets drop this
2020-11-20 15:08:40 -08:00
cef406b3a5 run_unittests: delete test for external syntax highlighting
It's a bit odd we have a test for an external project that's not even in
the meson organization. Regardless, the json file was recently replaced
by a cson file. There is an  coffee-script-notation parser in pypi,
but I couldn't get it to work. Just delete the test
2020-11-20 10:24:00 -08:00
460cb9af08 unittests: ignore nix rpaths
As a necessity nix adds a bunch of rpaths to files, this is unavoidable
do to the way nix package management works. Meson doesn't expect this
however, and fails all rpath tests. To correct this we just ignore any
rpath entries that start with `/nix`.
2020-11-18 14:44:07 -08:00
3e89c30bae unittests: Simplify and make test_templates more reliable
env.detect_<lang>_compiler only checks that there is a binary called
whatever that returns a version. There are several cases where the found
binary doesn't work:
 1) gcc for ojbc[pp], when support isn't compiled in.
 2) the compiler is broken (rust in appveyor somtimes)
Because of that we need to call compiler.sanity_check() as well, and if
we get an EnvironmentException from that skip the language

Also, instead of having a long line of try: ... except: pass, roll all
of the checking up into a loop using getattr(), which is less code and
makes adding a new language easier
2020-11-16 10:19:15 -08:00
85550e8fce run_unittests: correctly handle users setting init.defaultBranch 2020-11-16 10:19:15 -08:00
6431a0f89d run_unittests: Don't assume things are in /usr/bin
This is generally a safe assumption, except for some of the more exotic
OSes/distros like nixos, where env is the only thing in /usr/bin
2020-11-16 09:47:54 -08:00
fc9b0cbb7f stabilize sets that are converted to lists
The order of elements in sets cannot be relied upon, because the hash
values are randomized by Python.  Whenever sets are converted to lists
we need to keep their order stable, or random changes in the command line
cause ninja to rebuild a lot of files unnecessarily.  To stabilize them,
use either sort or OrderedSet.  Sorting is not always applicable, but it
can be faster because it's done in C and it can produce slightly nicer
output.
2020-11-15 14:21:31 +01:00
6ce3812762 environment: Fix detection of rust compilers, more 2020-11-13 09:00:35 -08:00
5c74cccbb9 run_unittests: use textwrap.dedent
So that editors that can fold code (vim, vscode, etc) can correctly fold
functions, instead of getting confused by code that doesn't follow the
current indention. Also, it makes the code easier to read.
2020-11-13 09:00:35 -08:00
41a79a0757 Merge pull request #7965 from dcbaker/wip/2020-11/macos-github-actions
Migrate osx CI from travis to github actions
2020-11-12 20:36:27 +02:00
d2aac3d809 dependencies: Put pkgconfig options before operands
This fixes building with meson when the POSIX behavior of getopt is used, such as when GNU libc is used with POSIXLY_CORRECT=1 defined
2020-11-12 20:27:40 +02:00
220da39c7c actions: Add unittests for macos 2020-11-11 07:42:40 -08:00
11ece5dbf3 unittests: Don't try to set alternative linkers for apple-clang 2020-11-10 14:24:35 -08:00
9d1e747d17 Condense test directory names again. 2020-11-03 21:05:20 +02:00
47d071a34f interpreter: store correct files for project regeneration
Right now sub-sub projects are not correctly registered, because we
don't have a way to pass up past the first level of subproject. This
patch changes that by making the build_Def_files as defined in the
Interpreter initializer accurate for translated dependencies, ie, cmake
dependencies won't define a dependency on a non-existent meson.build.
This means that it can always add the subi.build_def_files because they
are always accurate.
2020-11-01 19:26:31 +02:00
0f4f0acaff Remove a status message that leaks to stdout. 2020-10-19 00:04:38 +03:00
64f8479097 In text, betterer grammer usings. 2020-10-19 00:04:14 +03:00
ac6041e110 Add delays to test for timestamp issues on mac. 2020-10-19 00:03:37 +03:00
0c95d92404 pkgconfig: InternalDependency's ext_deps should be private by default
This fixes a regression introduced by
https://github.com/mesonbuild/meson/pull/7488.

InternalDependency's ext_deps previously where simply ignored, but that
PR has effect to add many more public Requires in generated pc files.
2020-10-17 15:53:46 +03:00
ed70c6df52 Subprojects should not inherit parent override
This was the behaviour in 0.55.0, so this test was assuming a behaviour
change. Revert it to the behaviour we had in 0.55.0.
2020-10-16 17:42:24 -04:00
7271b1e942 Machine file pkg_config_path overrides environment
This is consistent with c_args in machine file overriding CFLAGS from
env. This also spotted an issue where in a native build this resulted
in pkg_config_path being /bar instead of /foo:
`-Dpkg_config_path=/foo -Dbuild.pkg_config_path=/bar`

Fixes: #7573
2020-10-16 17:42:24 -04:00
bcf369ea3c Fix consistency in variables kwarg
Share common code to extract the `variables` kwarg in
declare_dependency() and pkg.generate().
2020-10-16 18:09:56 +03:00
7c377e5a5d intro: Add extra_files key to intro output (fixes #7310) 2020-10-15 01:56:59 +03:00
3a01823786 wrap: Add 'redirect' type and use it when auto promote 2020-10-13 17:55:16 -04:00
6333ee88c1 Merge wraps from subprojects into wraps from main project
wraps from subprojects are now merged into the list of wraps from main
project, so they can be used to download dependencies of dependencies
instead of having to promote wraps manually. If multiple projects
provides the same wrap file, the first one to be configured wins.

This also fix usage of sub-subproject that don't have wrap files. We can
now configure B when its source tree is at
`subprojects/A/subprojects/B/`. This has the implication that we cannot
assume that subproject "foo" is at `self.subproject_dir / 'foo'` any
more.
2020-10-13 17:55:16 -04:00
7e58f33376 cmake: Add cross compilation support 2020-10-13 17:04:19 +02:00
dccff1f2bc msubprojects: Handle wrap-file to wrap-git case 2020-10-13 11:12:49 +00:00
94ac51fdda options: Handle updates to choices in options
Currently if you change the `choices` field in the meson_options.txt
file, no update will be done until `meson setup --wipe` is called. Now
if the choices change then the options will be properly merged.

If the currently select value is still valid it is guaranteed to be
kept, if it is now invalid the new default value will be used and a
warning will be printed.

Fixes #7386
2020-10-05 23:10:35 +03:00
c4fa876925 Never run clang-format / clang-tidy against directories
`pathlib.Path.glob()` also returns directories that match source
filenames (i.e. a directory named `test.h/`), but `clang-format` and
`clang-tidy` fail when handed a directory. We manually skip calling
`clang-format` and `clang-tidy` on those directories.
2020-10-05 23:07:20 +03:00
4b1c1d83c8 machinefiles: Allow keys to be stored case insensitive
This is required to make the various keys in the [user options] section
work the same as they do in the meson_options.txt file, where we don't
have any rules about case sensitivity.

There is some risk here. Someone may be relying on this lower by default
behavior, and this could break their machine files.

Fixes #7731
2020-10-05 08:59:45 -04:00
1dfaccfd91 pathlib: Fix resolve() by overriding it in Python 3.5 2020-10-04 10:45:48 +02:00
135f5d5838 compilers: make get_optimization_args abstract 2020-10-01 15:06:10 -07:00
bb3fe3c451 compilers/mixins/clike: fix mypy issues 2020-09-24 12:14:13 -07:00
79d1ecd5bc compilers/compilers: Fully type annotate 2020-09-24 12:14:13 -07:00
17f07a53d0 msubprojects: Fix unit tests on Windows 2020-09-18 03:01:15 +00:00
da72e6284e msubprojects: Revert back to rev-parse instead of --show-current
It is undocumented in manpage, but --show-current is new in git 2.22
which is too recent for distros we want to support like Ubuntu 18.04.
2020-09-18 03:01:15 +00:00
e0cd54a322 msubprojects: Stop trying to guess subproject type
It was done to include them in `meson subprojects foreach` without
--types argument, but it's better to special case missing --types and
include wraps that have type=None too. It was a bad idea because that
was messing them in `meson subprojects update`, now they are ignored by
that command.
2020-09-18 03:01:15 +00:00
c203e2f92b msubprojects: Add basic unit tests 2020-09-18 03:01:15 +00:00
e9fea0fecf unittests: mock os.environ before mucking with it 2020-09-17 11:26:50 +00:00
80ec7ec681 tests: Make monkey patching smarter
There are two problems here. The first is that we're doing manual monkey
patching which is fragile and verbose, when unittest.mock is designed
specifically to solve this exact problem. The second is that we're
monkey patching os.environ at two different levels with the same
information. So let's only do it once.
2020-09-17 11:26:50 +00:00
3526b36a77 linkers: fully type annotate and fix mypy issues
This makes GnuDynamicLinker not suitable for instantiation, so the tests
need to be changed to use the BFD class.
2020-09-16 20:28:56 -07:00
67c0ec1640 InternalDependency: Add as_link_whole() method 2020-09-14 20:32:22 -04:00