Commit Graph

1035 Commits

Author SHA1 Message Date
Jussi Pakkanen 1d06d4ca1a Set unittest backend with an argument rather than an envvar. 2021-05-08 21:35:08 +03:00
Nellie Zhang 802f66f442 Clarify incorrect configuration format message
Print the path and line where the problem occurred to make it more clear
what the error message means.
2021-05-03 13:06:05 -07:00
Jussi Pakkanen b2687e86c8 Do not accidentally format files when only checking if they are formatted. 2021-05-01 23:34:14 +03:00
Jussi Pakkanen e75e3976fa Condense test directory names. 2021-04-26 23:39:15 +01:00
Tristan Partin cc54284885
Fix issue where multiple dist files were not being produced for comma separated formats value 2021-04-26 17:13:13 +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
Tristan Partin bb12587e0b Add subprojects purge wrap-git coverage 2021-04-26 12:06:12 -04: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
Tristan Partin b6d277c140 Add 'subprojects purge' command
This will help facilitate cache busting in certain situations, and
replaces hand-rolled solutions of writing a length command to remove
various files/folders within the subprojects directory.
2021-04-26 16:42:29 +03:00
Xavier Claessens 3c64ecaf86 pkgconfig: Add support for CustomTarget objects in generator
Fixes: #8618.
2021-04-19 17:57:34 +03:00
Xavier Claessens d9b9eecd54 msetup: Restore .gitignore after wipe 2021-04-17 22:54:03 -04:00
Dylan Baker fdde948ca1 environment: don't load project options from a native file in a cross build 2021-04-06 16:09:13 -07:00
Jussi Pakkanen 7ec9e81e6f
Merge pull request #8606 from dcbaker/submit/fix-for-build-env-variables
Fix _FOR_BUILD env variables
2021-04-03 20:42:21 +03:00
Xavier Claessens 558a7bc6ff interpreter: Move to its own folder and split it 2021-04-01 14:26:33 -04:00
Dylan Baker d569d0bb3c tests: Add a test for the _FOR_BUILD env vars 2021-04-01 09:54:43 -07:00
Dylan Baker 848cacc38c unittests: extend machine file override tests for CFLAGS (and friends)
They behave slightly differently than other env vars, so have a test for
them as well.
2021-04-01 09:22:11 -07:00
Dylan Baker 2cd0723c42 Split environment variable and command line cflags
They are supposed to have different behavior. The environment variables
apply to both the compiler and linker when the compiler acts as a
linker, but the command line ones do not.

Fixes #8345
2021-03-30 18:52:17 +03:00
Jussi Pakkanen e80ff985fb Do not add custom target dir automatically when implicit false. 2021-03-29 18:57:34 +03:00
Xavier Claessens 47633330da pkgconfig: Allow setting prefix in dataonly pc file
Some variables are reserved because meson set them automatically. But we
are not setting them for dataonly pc files, so there is no reason to
reserve them.

Fixes: #8583.
2021-03-26 23:41:03 +02:00
Jussi Pakkanen 54767ab482
Merge pull request #8568 from dcbaker/submit/qt-dependency-factory
QT: use a proper dependency factory
2021-03-24 22:52:15 +02:00
Dylan Baker c211fea513 Refactor Qt Dependency into proper split classes with factories
Currently the Qt Dependencies still use the old "combined" method for
dependencies with multiple ways to be found. This is problematic as it
means that `get_variable()` and friends don't work, as the dependency
can't implement any of those methods. The correct solution is to make
use of multiple Dependency instances, and a factory to tie them
together. This does that.

To handle QMake, I've leveraged the existing config-tool mechanism,
which allows us to save a good deal of code, and use well tested code
instead of rolling more of our own code.

The one thing this doesn't do, but we probably should, is expose the
macOS ExtraFrameworks directly, instead of forcing them to be found
through QMake. That is a problem for another series, and someone who
cares more about macOS than I do.
2021-03-23 15:28:08 -07: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 b33e7bca73 mlog: Add a space after 'subproject|' 2021-03-22 21:29:14 -04:00
Dylan Baker 40e3577a65 split program related classes and functions out of dependencies
Dependencies is already a large and complicated package without adding
programs to the list. This also allows us to untangle a bit of spaghetti
that we have.
2021-03-19 08:47:10 -04:00
Eli Schwartz f7b0238ed6
add test case for installed targets uninstalling a single directory 2021-03-18 21:50:38 -04:00
Xavier Claessens 3990754bf5 Allow add_dist_script() in subprojects
Fixes: #8440.
2021-03-18 08:41:21 -04:00
Xavier Claessens 0638e38bfc clangformat: Add clang-format-check target 2021-03-16 21:01:54 -04:00
Xavier Claessens f558689277 clangformat: Add include and ignore files 2021-03-16 21:01:54 -04:00
Jussi Pakkanen ecd8c7e4af Update VS module version check. 2021-03-16 21:06:51 +02:00
Jussi Pakkanen 3ac3e125e4 Delete leftover files from some tests. 2021-03-16 16:37:02 +02:00
Paolo Bonzini 5cd7f5f8c5 msetup: do not print bogus "Option ... is:" messages
get_non_matching_default_options is checking a string from
project_default_options against a validated value from
coredata.options.

Passing the string to validate_value ensures that the comparison
is sound; otherwise, "false" might be compared against False
and a bogus difference is printed.
2021-03-16 09:35:48 -04:00
Xavier Claessens 598e968993 Add `meson devenv` command and meson.add_devenv() 2021-03-16 09:00:50 -04:00
Jussi Pakkanen be86199221 Fix run_targets running scripts from different subdirs. 2021-03-14 13:17:19 +02:00
Tristan Partin 8801381563 Fix duplicate pkg_config_path entries
Previously builds would *potentially* get sammed with messaging at
configure time that duplicate entries in an array would be an error in
the future, and the cause was because the same entries were getting
added over and over to pkg_config_path.p
2021-03-12 12:32:41 -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
Eli Schwartz 76df995ba6
raw string literals are next to godliness
Invalid escape sequences are deprecated and will be removed from a
future version of python. Use r"" to define them so they remain
readable.
2021-03-04 17:09:00 -05:00
Paolo Bonzini be0a05e777 mintro: include the correct target filenames for flat layout
Fixes: #8408
2021-03-04 17:36:41 +01:00
Paolo Bonzini 0c663d056a mtest: create separate runners for multiple repeats
Reusing the runners for multiple repeats of the test run gets in the
way of the progress report, which stores runners in an OrderedSet.
Instead, create a separate SingleTestRunner object for each repeat.

While at it, fix the "duplicate suite" assertion as it can fire
with TAP tests and --repeat=N.

Fixes: #8405
2021-03-02 00:57:57 +02: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 cef5cab23c Support multiple args in error()
Seems it got forgotten when that was added to warnings() and message().

Fixes: #8414.
2021-02-25 22:58:45 +02: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 b03039ec9d allow build.b_* options
These continue to be ignored as they always have, but no longer raise an
error.

Fixes: #8354
2021-02-18 10:57:20 -08:00
Jussi Pakkanen add502c648 Disable failing Cygwin GIR test. 2021-02-18 02:14:07 +02:00
Xavier Claessens a5b33db558 ci: Fix failure in unit tests with vs backend 2021-02-17 22:59:54 +02:00
Paolo Bonzini 92134bac8d unittests: expect mtest logs to be utf-8 2021-02-17 21:14:05 +02:00
Dylan Baker 6c1467db27 compilers: Only insert -flto-jobs in clang's link arguments
Clang has a hand `-Wunused-command-line-argument` switch, which when
turned to an error, gets very grump about `-flto-jobs=0` being set in
the compiler arguments (although `-flto=` belongs there). We'll refactor
a bit to put that only in the link arguments.

GCC doesn't have this probably because, a) it doesn't have an equivalent
warning, and b) it uses `-flto=<$numthreads.

Fixes: #8347
2021-02-17 18:06:52 +02:00
Xavier Claessens b6804bf49c Substitute @CURRENT_SOURCE_DIR@ in run_target() and custom_target()
run_target() does some variable substitutions since 0.57.0. This is a
new behavior, and undocumented, caused by sharing more code with
custom_target(). More consistency is better, so document it now.

custom_target() was doing variable substitution in the past, because it
shared some code with generator(), but that was undocumented. Some
refactoring in 0.57.0 caused it to not replace @CURRENT_SOURCE_DIR@,
@SOURCE_DIR@, and @BUILD_DIR@ anymore. This patch adds back
@CURRENT_SOURCE_DIR@ and document it. It does not add back @SOURCE_DIR@
because it is duplicate with @SOURCE_ROOT@ that has a better name. Also
do not add back @BUILD_DIR@ which is duplicate of @PRIVATE_DIR@, and
not @BUILD_ROOT@ surprisingly, adding to the confusion.
2021-02-17 14:48:04 +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
Olexa Bilaniuk 3410465178 Small patch to unittests to initialize CUDA compiler correctly.
Suggested by Dylan Baker.
2021-02-16 17:01:24 -05:00
Paolo Bonzini 3506d8daf2 mtest: TestSetup can have [] as an exe_wrapper
Fix "meson test --wrapper foo --setup bar", it should work just fine
if the setup does not define a wrapper.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-02-09 18:51:05 +01:00
Jussi Pakkanen d2c39e83ba Condense test directory names in preparation for rc1. 2021-02-09 00:30:20 +02:00
Jussi Pakkanen 71784e1002 Fix exe wrapper detection for run targets. 2021-02-08 23:19:41 +02:00
Luca Weiss 398df56298 Add Qt6 module 2021-02-07 22:43:00 +02:00
Peter Hutterer 3f8585676b Make installing non-existing subdirs a supported feature
install_subdir() with a non-existing subdir creates the directory in the
target directory. This seems like an implementation detail but is quite useful
to create new directories for e.g. configuration or plugins in the installed
locations.

git bisect says this started with 8fe8161014.
Let's add a test for it and document it to make this behavior official.

Limitation: it can only create at the install_dir location, trying to create
nested subdirectories does not work and indeed creates the wrong directory
structure. That is a bug that should be fixed separately:

        install_subdir('blah',
                        install_dir: get_option('prefix'))
        install_subdir('sub/foobar',
                        install_dir: get_option('prefix'))
        install_subdir('foo/baz',
                        install_dir: get_option('prefix'))

        $ tree ../_inst
        ../_inst
        ├── baz
        ├── blah
        └── foobar

Fixes #2904
2021-02-07 12:38:31 +00:00
Jussi Pakkanen 034b81a09f
Merge pull request #8288 from bonzini/test-setup-exclude-suites
introduce add_test_setup(exclude suites: ...) keyword argument
2021-02-07 12:03:10 +00:00
Jussi Pakkanen 8b82ffa9e4
Merge pull request #8305 from xclaesse/run-target-env
run_target: Add env kwarg
2021-02-07 11:46:41 +00:00
Dylan Baker 2650977c38 interpreterbase: Add support for optional arguments to typed_pos_args
This allows representing functions like assert(), which take optional
positional arguments, which are not variadic. More importnatly you can
represent a function like (* means optional, but possitional):
```txt
func(str, *int, *str)
```

typed_pos_args will check that all of your types are correct, and if not
provide None, which allow simplifying a number of implementation details
2021-02-06 13:11:25 -05:00
Dylan Baker 978eeddab8 interpreterbase: Add support for variadic arguments to typed_pos_args
This allows functions like `files()` to be decorated.
2021-02-06 13:11:25 -05:00
Dylan Baker 0ead2e10db interpreterbase: Add a helper method for typing positional arguments
We don't do a very good job of type checking in the interpreter,
sometimes we leave it to the mid layers of backends to do that (layering
violations) and sometimes we just don't check them at all. When we do
check them it's a ton of boilerplate and complicates the code. This
should help quite a bit.
2021-02-06 13:11:25 -05:00
Eli Schwartz ccd0cd3163 run_unittests: fix misc lint errors due to whitespace or unused imports/args 2021-02-05 16:33:23 -08:00
Eli Schwartz 67e99bb4ed run_unittests: fix undefined variable in error message
In commit fe973d9fc4, some uses of p got
rewritten to compiler.language, but not all. We'd still raise an error
message, but for the wrong thing. o_O
2021-02-05 16:33:23 -08:00
Eli Schwartz c3d516421f run_unittests: remove double definition of the same test case
In commit 591e6e94b9 we somehow ended up
with an identical extra copy.
2021-02-05 16:33:23 -08:00
Dylan Baker d7cbde4118 unittests: fix error message string 2021-02-05 16:31:33 -08:00
Xavier Claessens 522392e755 run_target: Add env kwarg
Re-implement it in backend using the same code path as for
custom_target(). This for example handle setting PATH on Windows when
command is an executable.
2021-02-05 17:53:09 -05:00
Xavier Claessens 95c0790711 minstall: Add --dry-run option
Closes: #1281
2021-02-04 16:24:38 +00:00
Dylan Baker 6f532b72c8 Add support for LLVM's thinLTO
This uses a separate option, b_lto_mode. It works in conjunction with
b_lto_threads.

Fixes #7493
2021-02-02 12:42:48 -08:00
Dylan Baker bffc94b08f compilers: Add support for using multiple threads with lto
Both Clang and GCC support using multiple threads for preforming link
time optimizaions, and they can now be configured using the
`-Db_lto_threads` option.

Fixes #7820
2021-02-02 12:42:48 -08: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
Jussi Pakkanen f0fbb31ccf
Merge pull request #8200 from bonzini/mtest-asyncio-logs
mtest: improvements to logging
2021-01-30 09:52:43 +00:00
Jussi Pakkanen 3f0a0c1582 Can read project version from a file. 2021-01-29 16:42:59 +00:00
Xavier Claessens baa9eeebe4 dist: Allow packaging subproject in same git repo as main project 2021-01-26 21:32:03 -05:00
Paolo Bonzini 52a2f46af1 unittests: use utf-8 encoding for child processes
Ensure that unit tests will be able to parse UTF-8 output of "meson test".
2021-01-22 12:18:59 +01:00
Paolo Bonzini adb1b2f3f6 interpreter: accept external programs and dependencies for summary 2021-01-21 08:54:35 -05:00
Fini Jastrow 5dd1aac5c9 unittests: Remove double install for case 10
[why]
In test case 10 the project is installed twice. This has been introduced
with commit
  55abe16 unit tests: Test that relative install_rpath works correctly
where the cxx tests where added by copy and paste.

[how]
First test all build rpaths, then after install all install rpaths.

[note]
The aforementioned commit is a bit strange in that it adds a tests with
a relative rpath with cxx files but not with c files.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2021-01-20 19:01:47 +00: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
Jussi Pakkanen 8133a7b9a4 Keep buildtype the same even if user changes debug and/or optimization. 2021-01-19 20:25:55 +00:00
Jussi Pakkanen c64d407076 Fix cases where text leaks to stdout in unit tests. 2021-01-18 19:55:42 +00:00
Xavier Claessens 5db77fd103 coredata: Add missing nopromote wrap_mode choice 2021-01-14 18:29:28 +00:00
Antonin Décimo 39ede12aa5 Fix misspells
Signed-off-by: Antonin Décimo <antonin.decimo@gmail.com>
2021-01-13 12:53:10 -05:00
Eli Schwartz adfcf77109
summary: align left, not align middle
aligning along the left is, I think, what most projects want to do.
Aligning along the middle looks subjectively ugly, and objectively
prevents me from further indenting an element, e.g.

  Build information:
    prefix                : /usr
    sysconfdir            : /etc
        conf file         : /etc/myprogram.conf
2021-01-12 19:19:00 -05:00
Luke Elliott 9efcdba0d5 Allow '//' as project function id due to git bash path conversion.
See https://stackoverflow.com/questions/54258996/git-bash-string-parameter-with-at-start-is-being-expanded-to-a-file-path
2021-01-12 17:42:57 +00:00
Dylan Baker f3fcbba1f8 boost: default machine file properties to env var values
This both moves the env reading to configuration time, which is useful,
and also simplifies the implementation of the boost dependency. The
simplification comes from being able to delete basically duplicated code
since the values will be in the Properties if they exist at all.
2021-01-11 11:15:07 -08:00
Dylan Baker e7a5c75285 Move BinaryTable environment lookups to Environment
This means that all the env lookups are done once, at initial configure
time. This has all of the expected advantages.
2021-01-11 11:15:07 -08:00
Dylan Baker 38c7a7590c pull env to program mappings out of BinaryType class
These really aren't pivotal to that class, and they're used outside of
it. In a follow up patch they're not going to be used inside it at all.
2021-01-11 11:15:07 -08:00
Dylan Baker 4580433b82 rename cflags_mapping to CFLAGS_MAPPING
This is PEP8 convention for a const variable. Also, make the type
Mapping, which doesn't have mutation methods. This means mypy will warn
us if someone tries to change this.
2021-01-11 11:15:06 -08:00
Dylan Baker 9f343212e0 unittests: Clang on windows can use either ld or link.exe
it generally uses the ld style linkers with msys2 and link.exe style
linkers otherwise, but anything's possible.
2021-01-11 11:15:06 -08:00
Jussi Pakkanen a8c138ebc1
Merge pull request #8029 from bonzini/mtest-asyncio-next
mtest: asynchronous TAP parsing, improved progress report
2021-01-10 21:44:34 +00:00
Eli Schwartz c18a9715b8
Hotdoc: use template for Commands.md instead of generating the entire file (#8154)
* doc: fix hotdoc misuse for dynamically generated content

hotdoc has a native include feature for including files inline. Use this
to generate one file for each dynamically generated code block, and
include that file in Commands.md; see:
https://hotdoc.github.io/syntax-extensions.html#smart-file-inclusion-syntax

This permits us to move back to using the in-tree version of the hotdoc
*.md sources, thus fixing the incorrect inclusion of "builddir/" in the
"Edit on github" links which resulted from using copies as the source.

Fixes #8061

* doc: call the dummy file a "stamp" as it is a better known term
2021-01-10 14:48:34 +02:00
Paolo Bonzini e50861e62f mtest/TAPParser: use typing.NamedTuple
It is cleaner than collections.namedtuple.  It also catches that "count()" is
a method on tuple, so rename the field to num_tests.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-07 19:20:11 +01:00
Paolo Bonzini 304abaf9ee mtest: remove argument to the TAPParser constructor
Pass the StringIO object to the parse method instead, because
there will be no T.Iterator[str] to use in the asynchronous
case.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-06 08:44:22 +01:00
Dylan Baker e81acbd606 Use a single coredata dictionary for options
This patches takes the options work to it's logical conclusion: A single
flat dictionary of OptionKey: UserOptions. This allows us to simplify a
large number of cases, as we don't need to check if an option is in this
dict or that one (or any of 5 or 6, actually).
2021-01-04 12:20:58 -08:00
Dylan Baker 71db6b04a3 use OptionKey for builtin and base options
I would have prefered to do these seperatately, but they are combined in
some cases, so it was much easier to convert them together.

this eliminates the builtins_per_machine dict, as it's duplicated with
the OptionKey's machine parameter.
2021-01-04 12:20:40 -08:00
Dylan Baker f9b19e73a5 move OptionKey to mesonlib
There's starting to be a lot of things including coredata that coredata
needs to itself include. putting it in mesonlib makes more sense
2021-01-04 12:20:40 -08:00
Dylan Baker fe973d9fc4 use OptionKey for compiler_options 2021-01-04 12:20:39 -08:00
Dylan Baker e2ef6930ff use OptionKey for coredata.user_options 2021-01-04 12:15:41 -08:00
Dylan Baker b25a423a64 use the OptionKey type for command line and machine files 2021-01-04 12:15:41 -08:00
Dylan Baker fa9c1a7a72 run_unittests: Add fatal-warnings to test_command_line
Otherwise bugs like "option c_args is unknown" can slip through. that's
bad.
2021-01-04 12:15:41 -08:00