Commit Graph

249 Commits

Author SHA1 Message Date
Jussi Pakkanen e75e3976fa Condense test directory names. 2021-04-26 23:39:15 +01:00
Jason Francis 39c751b94c introspection: export all sources for custom targets
Also adds some test cases for source files in target_sources.
2021-04-26 17:08:26 +01:00
Dylan Baker d4e867809b store the list of initializes subprojects in the coredata structure
We need to konw on rconfigure which options have already bee set not
just for the super project, but also for the subproject. However, using
first_invocation is not sufficient, as a reconfigure could add a new
subpproject that wasn't present before, and we need to initialize that
project's builtins.
2021-04-26 17:05:44 +01:00
Xavier Claessens 3af39a463b Interpreter: Fallback when required is false but forcefallback is true 2021-04-26 17:04:57 +01:00
Jussi Pakkanen e80ff985fb Do not add custom target dir automatically when implicit false. 2021-03-29 18:57:34 +03:00
Xavier Claessens 1be13710ad
environment(): Allow stacking append() and prepend() (#8547)
* environment(): Allow stacking append() and prepend()

* Update docs/markdown/Reference-manual.md

Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>

Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
2021-03-23 17:48:17 +02:00
Xavier Claessens 3990754bf5 Allow add_dist_script() in subprojects
Fixes: #8440.
2021-03-18 08:41:21 -04:00
Xavier Claessens f558689277 clangformat: Add include and ignore files 2021-03-16 21:01:54 -04:00
Xavier Claessens 598e968993 Add `meson devenv` command and meson.add_devenv() 2021-03-16 09:00:50 -04:00
Eli Schwartz ed252b87e0
use python2-compatible syntax because needed on macOS
Apparently this unittest runs on macOS using the system python2.
2021-03-04 17:49:36 -05:00
Eli Schwartz 6a0fabc647
mass rewrite of string formatting to use f-strings everywhere
performed by running "pyupgrade --py36-plus" and committing the results
2021-03-04 17:16:11 -05:00
Eli Schwartz 4340bf34fa
various python neatness cleanups
All changes were created by running

"pyupgrade --py3-only --keep-percent-format"

and committing the results. I have not touched string formatting for
now.

- use set literals
- simplify .format() parameter naming
- remove __future__
- remove default "r" mode for open()
- use OSError rather than compatibility aliases
- remove stray parentheses in function(generator) scopes
2021-03-04 17:11:26 -05:00
Dylan Baker e079553959 interpreter: correctly track whether a subproject is initialized
The way the tracking is currently done it works if no new subprojects
are added to a configured build directory. For cases where we want to
add a new subproject, it fails because we don't initialize builtins for
that subproject. This corrects that by checking to see if the subproject
already exists, and if it doesn't initializes the bultins for it.

Fixes: #8421
2021-02-26 09:05:30 -08:00
Stephen Gregoratto ec5fe58e6d Allow printing UserOptions in the summary 2021-02-26 10:28:00 -05:00
Xavier Claessens 2fabd4c7dc minstall: Add --skip-subprojects option
By default all subprojects are installed. If --skip-subprojects is given
with no value only the main project is installed. If --skip-subprojects
is given with a value, it should be a coma separated list of subprojects
to skip and all others will be installed.

Fixes: #2550.
2021-02-22 23:03:55 +02:00
Dylan Baker 10d94a12b8 Environment: Fix passing envrionment variables CPPFLAGS and CFLAGS
Or other language flags that use CPPFLAGS (like CXXFLAGS). The problem
here is actually rather simple, `dict.setdefault()` doesn't work like I
thought it did, I thought it created a weak entry, but it actually is
equivalent to:
```python
if k not in dict:
    dict[k] = v
```
Instead we'll use an intermediate dictionary (a default dictionary
actually, since that makes things a little cleaner) and then add the
keys from that dict to self.options as applicable.

Test case written by Jussi, Fix by Dylan

Co-authored-by: Jussi Pakkanen
Fixes: #8361
Fixes: #8345
2021-02-17 14:46:15 +02:00
Jussi Pakkanen d2c39e83ba Condense test directory names in preparation for rc1. 2021-02-09 00:30:20 +02:00
Paolo Bonzini c7c2bc8db1 interpreter, mtest: introduce add_test_setup(exclude_suites: ...)
This new keyword argument makes it possible to run specific
test setups only on a subset of the tests.  For example, to
mark some tests as slow and avoid running them by default:

    add_test_setup('quick', exclude_suites: ['slow'], is_default: true)
    add_test_setup('slow')

It will then be possible to run the slow tests with either
`meson test --setup slow` or `meson test --suite slow`.
2021-02-02 11:23:33 +01:00
Paolo Bonzini adb1b2f3f6 interpreter: accept external programs and dependencies for summary 2021-01-21 08:54:35 -05:00
Fini Jastrow 49cde9653c ninjabackend: Correct RPATH order
[why]
If we build and test a library we need to make sure that we find the
currently build library object first, before an older system installed
one.
This can be broken if the library in question is installed in a custom
path, and another library we depend on also is installed there.

[how]
Just move the rpath to the current build artifacts to the front.

Solves #8030.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2021-01-20 19:00:25 +00:00
Michael Hirsch bad0e95cae unit:cpp17: make C++17 test stricter check
many compilers allowed "nodiscard" C++17 feature with pre-c++17 flags.
The C++17 filesystem typically actually does require -std=c++17.
This makes this unit test more representative of C++17 flag support.
2021-01-04 23:43:30 +00:00
Jussi Pakkanen 9f1ba40252
Merge pull request #8013 from mesonbuild/cppmodules
C++ module support
2020-12-14 15:00:04 +00:00
Oleg B b8052f9e50
Support native tests in crossbuild 2020-12-13 16:32:52 +02:00
Jussi Pakkanen 5bd1276d20 Create unit test for C++ modules and accept ixx as C++ source extension. 2020-12-11 19:21:02 +00:00
Jussi Pakkanen c21b04ba08 Add prelinking support for static libraries. 2020-12-03 22:58:07 +02:00
jpark37 a441b13b89 Use c99 instead of c11 for buildoptions test
Older verisons of MSVC do not support C11 properly.
2020-11-13 16:13:02 -08:00
Jussi Pakkanen 9d1e747d17 Condense test directory names again. 2020-11-03 21:05:20 +02:00
Dylan Baker 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
Daniel Mensinger 7c377e5a5d intro: Add extra_files key to intro output (fixes #7310) 2020-10-15 01:56:59 +03:00
Xavier Claessens 9295aedb8d Tests: py.dependency() now has required:true by default
It used to ignore the required argument and got fixed to be consistent
with dependency() function.
2020-10-07 19:08:17 +02:00
Dylan Baker 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
Bernd Busse 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
Xavier Claessens 67c0ec1640 InternalDependency: Add as_link_whole() method 2020-09-14 20:32:22 -04:00
Jussi Pakkanen 8d54b7bda3
Merge pull request #7428 from jon-turney/introspector-add-languages
Handle add_languages(native:) in introspector
2020-09-09 19:51:28 +03:00
Jon Turney 461c14b8b7
Add a test of add_languages(native:) introspection
If the meson.build doesn't use a native compiler, the native compiler
options (e.g. 'c_args') shouldn't be present in the output of 'meson
introspect --buildoptions'.
2020-09-09 15:06:02 +01:00
Paolo Bonzini 4ed5c3acbf IntrospectInterpreter: allow dictionaries with nonconstant keys
Something like {a: foo} currently stymies the IntrospectionInterpreter and
breaks introspection of the source directory.  The fix is just to walk the keys
and return a dummy dictionary.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-09-08 19:56:20 +02:00
Paolo Bonzini fa5c2363eb introspect: add test dependencies info to test/benchmark JSON
Add the ids of any target that needs to be rebuilt before running the
tests as computed by the backend, to the introspection data for tests and benchmarks.
This also includes anything that appears on the test's command line.

Without this information, IDEs must update the entire build before running
any test.  They can now instead selectively build the test executable
itself and anything that is needed to run it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-09-04 14:45:20 +02:00
Xavier Claessens 9365486104 Special case meson.version().version_compare() statement
when that statement gets evaluated, the interpreter remembers the
version target and if it was part of the evaluation of a `if` condition
then the target meson version is temporally overriden within that
if-block.

Fixes: #7590
2020-09-02 12:55:31 -04:00
Daniel Mensinger fdae213a49 tests: update .gitignore 2020-08-27 00:08:02 +00:00
Xavier Claessens 1c403e20e7 Interpreter: Fix c_stdlib usage
- Exceptions raised during subproject setup were ignored.
- Allow c_stdlib in native file, was already half supported.
- Eliminate usage of subproject variable name by overriding
  '<lang>_stdlib' dependency name.
2020-08-18 14:47:38 -04:00
Dylan Baker 4d2a17041f run dircondensor.py 2020-08-01 22:00:06 -07:00
Dylan Baker a6164ca5a8 Allow setting project options from cross or native files
This allows adding a `[project options]` section to a cross or native file
that contains the options defined for a project in it's meson_option.txt
file.
2020-07-30 19:34:37 -07:00
Xavier Claessens 7f1e9b7492 summary: Wrap lines when printing lists
When a list_sep is provided (e.g. ', ') all items are printed on the
same line, which gets ugly on very long lists (e.g. list of plugins
enabled).
2020-07-21 07:30:37 +00:00
Xavier Claessens 2a7f72885f wrap: Add 'provide' section 2020-07-01 09:51:44 -04:00
Xavier Claessens 4a371c97f4 wrap: Apply patch even in VCS cases 2020-06-30 19:42:43 +03:00
Alan Coopersmith f71c828d99 unittests: Fix test_identity_cross on Solaris
Since mesonbuild/environment.py doesn't recognize Studio compilers,
force use of gcc on Solaris for now.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-06-22 15:01:34 -07:00
Daniel Mensinger 210b57a136
ast: add unittest 2020-05-23 18:13:25 +02:00
Dylan Baker af787874a8 pass exe_wrapper to test scripts through the environment
This adds a new MESON_EXE_WRAPPER environment variable containing the
string form of the exe_wrapper, if there is an exe_wrapper defined.

Fixes #4427
2020-05-18 13:53:58 -07:00
Dylan Baker 0ec94ca062 backends: Consider arguments passed to a test when cross compiling
Otherwise a wrapper script which takes an executable as an argument will
mistakenly run when that executable is cross compiled. This does not
wrap said executable in an exe_wrapper, just skip it.

Fixes #5982
2020-05-18 13:53:58 -07:00
Dylan Baker cb6662b572 backends: ensure that test executables can be run when passed as arguments
If an executable is passed as an argument to a script in the build
directory that it resides in then it will not execute (on *nix) due to a
lack of ./. Ie, `foo` must be called as `./foo`. If it is called from a
different directory it will work. Ie `../foo` or `bar/foo`.

Fixes #5984
2020-05-18 13:53:58 -07:00