Commit Graph

1035 Commits

Author SHA1 Message Date
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
3410465178 Small patch to unittests to initialize CUDA compiler correctly.
Suggested by Dylan Baker.
2021-02-16 17:01:24 -05:00
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
d2c39e83ba Condense test directory names in preparation for rc1. 2021-02-09 00:30:20 +02:00
71784e1002 Fix exe wrapper detection for run targets. 2021-02-08 23:19:41 +02:00
398df56298 Add Qt6 module 2021-02-07 22:43:00 +02:00
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
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
8b82ffa9e4 Merge pull request #8305 from xclaesse/run-target-env
run_target: Add env kwarg
2021-02-07 11:46:41 +00:00
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
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
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
ccd0cd3163 run_unittests: fix misc lint errors due to whitespace or unused imports/args 2021-02-05 16:33:23 -08:00
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
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
d7cbde4118 unittests: fix error message string 2021-02-05 16:31:33 -08:00
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
95c0790711 minstall: Add --dry-run option
Closes: #1281
2021-02-04 16:24:38 +00:00
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
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
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
f0fbb31ccf Merge pull request #8200 from bonzini/mtest-asyncio-logs
mtest: improvements to logging
2021-01-30 09:52:43 +00:00
3f0a0c1582 Can read project version from a file. 2021-01-29 16:42:59 +00:00
baa9eeebe4 dist: Allow packaging subproject in same git repo as main project 2021-01-26 21:32:03 -05:00
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
adb1b2f3f6 interpreter: accept external programs and dependencies for summary 2021-01-21 08:54:35 -05:00
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
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
8133a7b9a4 Keep buildtype the same even if user changes debug and/or optimization. 2021-01-19 20:25:55 +00:00
c64d407076 Fix cases where text leaks to stdout in unit tests. 2021-01-18 19:55:42 +00:00
5db77fd103 coredata: Add missing nopromote wrap_mode choice 2021-01-14 18:29:28 +00:00
39ede12aa5 Fix misspells
Signed-off-by: Antonin Décimo <antonin.decimo@gmail.com>
2021-01-13 12:53:10 -05:00
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
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
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
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
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
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
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
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
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
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
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
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
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
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
fe973d9fc4 use OptionKey for compiler_options 2021-01-04 12:20:39 -08:00
e2ef6930ff use OptionKey for coredata.user_options 2021-01-04 12:15:41 -08:00
b25a423a64 use the OptionKey type for command line and machine files 2021-01-04 12:15:41 -08:00
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