Commit Graph

10263 Commits

Author SHA1 Message Date
Daniel Mensinger 8f1d9bb7b0 cmake: add PATH logic to preliminary dep check (fixes #8133) 2021-01-10 21:48:23 +00: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
Nirbheek Chauhan 832bcac0a7 ci: Run github workflows on stable branches too 2021-01-09 14:06:21 +05:30
Nirbheek Chauhan 540deb538b ci: Fix pip installation in Cygwin on Azure
Python3 in Cygwin is now Python 3.8
2021-01-09 10:32:57 +05:30
Paolo Bonzini f13dde1f08 mtest: print TAP subtest count
The parentheses look ugly in the progress report.  To keep it aligned
with the test outcomes, remove them from the outcomes as well.
2021-01-07 19:20:40 +01:00
Paolo Bonzini b05aee5c94 mtest: print time that the test has been running
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-07 19:20:40 +01:00
Paolo Bonzini 4371756182 mtest: align decimal point of test durations 2021-01-07 19:20:40 +01:00
Paolo Bonzini 72e96a470a mtest: create runners in advance
Compute all options in advance so that we can compute the maximum
timeout.
2021-01-07 19:20:40 +01:00
Paolo Bonzini d470a915da mtest: move timeout message to ConsoleLogger
This adds a point where to call the progress report flush() method.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-07 19:20:40 +01:00
Paolo Bonzini d1ee242e0d mtest: store timeout in TestRun
This will be useful when printing the progress report.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-07 19:20:40 +01:00
Paolo Bonzini 4b8364b1e2 mtest: add more formatting options to TestHarness.format
Allow leaving extra space in the left column, as well as customizing parts of
the printed line.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-07 19:20:40 +01:00
Paolo Bonzini f97521a1ff mtest: align correctly tests with wide Unicode characters
This correctly formats tests with CJK names or, well, emoji.  It is not perfect
(for example it does not correctly format emoji that are variations of 1-wide
characters), but it is as good as most terminal emulators.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-07 19:20:40 +01:00
Paolo Bonzini fa4fb3e350 mtest: make test output parsing asynchronous
Instead of slurping in the entire stream, build the TestResult along
the way.  This allows reporting the results of TAP and Rust subtests as
they come in, either as part of the progress report or (in the future)
as individual lines of the output.
2021-01-07 19:20:40 +01:00
Paolo Bonzini f1938349c7 mtest: move Rust parsing inside TestRun
Make the code look like the TAP parser.  This simplifies the introduction of
asynchronous parsing.
2021-01-07 19:20:40 +01:00
Paolo Bonzini 755412b526 mtest: read test stdout/stderr via asyncio pipes
Instead of creating temporary files, get the StreamReaders from
_run_subprocess's returned object. Through asyncio magic, their
contents will be read as it becomes ready and then returned when
the StreamReader.read future is awaited.

Because of this change, the stdout and stderr can be easily
preserved when TestSubprocess returns an additional_error.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-07 19:20:40 +01:00
Paolo Bonzini 0ccc70ae1b mtest: do not wait inside _run_subprocess
We would like SingleTestRunner to run code before waiting on the process,
for example starting tasks to read stdout and stderr.

Return a new object that is able to complete _run_subprocess's task.
In the next patch, SingleTestRunner will also use the object to get hold
of the stdout and stderr StreamReaders.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-07 19:20:40 +01:00
Paolo Bonzini 63e26ba05f mtest: handle should_fail in common code
This is common to all protocols, place the code in a single
place.
2021-01-07 19:20:40 +01:00
Paolo Bonzini d2da7565fd mtest: reorder arguments to "complete"
Put them in the same order as complete_*.
2021-01-07 19:20:40 +01:00
Paolo Bonzini c48713e58c mtest: improve JUnit XML generation for TAP testsuites
Include the names from the TAP output and the SKIP/TODO explanations
if present.  Omit the classname attribute, it is optional.

In order to enable this, TestRun.results becomes a list of TAPParser.Test
objects.  If in the future there are other kinds of subtest results a
new class can be introduced, but for now it is enough.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-07 19:20:38 +01:00
Paolo Bonzini 35d3baaa2f mtest: improvements to JUnit XML generation
Omit the classname attribute, as it is optional, and add the duration.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-07 19:20:12 +01:00
Paolo Bonzini 723c4c9fef mtest: extract TAP parsing out of TestRun.make_tap
For now this is just a refactoring that simplifies the next patch.  However,
it will also come in handy when we will make the parsing asynchronous, because
it will make it possible to access subtest results while the test runs.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-07 19:20:12 +01: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
Paolo Bonzini ee5e7977e3 mtest: allow parsing TAP line by line
This is the first step towards asynchronous parsing of the TAP output.
We will need to call the same code from both a "for" loop (for unit
tests) and an "async for" loop (for mtest itself).  Because the same
function cannot be both a generator and an asynchronous generator, we
need to build both on a common core.  This commit therefore introduces
a parse_line function that "parse" can call in a loop.  All the local
variables of TAPParser.parse move into "self".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-06 08:43:26 +01:00
Jussi Pakkanen c9d9dacdbc
Merge pull request #7860 from dcbaker/wip/2020-10/rust-module
Add a rust module
2021-01-06 00:05:48 +00:00
Dylan Baker 827fa95de1 update codeowners with the rust module 2021-01-05 15:10:50 -08:00
Dylan Baker 3d80a88bd3 modules: Add an unstable-rust module
Like other language specific modules this module is module for holding
rust specific helpers. This commit adds a test() function, which
simplifies using rust's internal unittest mechanism.

Rust tests are generally placed in the same code files as they are
testing, in contrast to languages like C/C++ and python which generally
place the tests in separate translation units. For meson this is
somewhat problematic from a repetition point of view, as the only
changes are generally adding --test, and possibly some dependencies.

The rustmod.test() method provides a mechanism to remove the repatition:
it takes a rust target, copies it, and then addes the `--test` option,
then creates a Test() target with the `rust` protocol. You can pass
additional dependencies via the `dependencies` keyword. This all makes
for a nice, DRY, test definition.
2021-01-05 15:10:50 -08:00
Jussi Pakkanen f9dd75f213 Fix last mention of Python 3.5. [skip ci] 2021-01-05 11:48:58 -08:00
Dylan Baker b2c2549b93 interpreter: split code that creates a Test instance
For modules to make use of, as they're not allowed to modify the Build
instance directly.
2021-01-05 10:23:57 -08:00
Dylan Baker 8d19beccb2 interpreter: allow modules to create tests 2021-01-05 10:23:57 -08:00
Dylan Baker d89ec98b47 mtest: Add support for rust unit tests
Rust has it's own built in unit test format, which is invoked by
compiling a rust executable with the `--test` flag to rustc. The tests
are then run by simply invoking that binary. They output a custom test
format, which this patch adds parsing support for. This means that we
can report each subtest in the junit we generate correctly, which should
be helpful for orchestration systems like gitlab and jenkins which can
parse junit XML.
2021-01-05 10:23:41 -08:00
Dylan Baker 07ff9c61fe mtest: Handle subtest results as a dict
for non tap tests we want to associate names with the tests, to that end
store them as a dict. For TAP tests, we'll store the "name" as an
integer string that coresponds to the order that the tests were run in.
2021-01-05 10:17:27 -08:00
Luke Elliott 1c60fdd847 fix: llvm toolset is "ClangCL" in VS2019. 2021-01-04 23:44:26 +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 d47a5c81a9
Merge pull request #8080 from dcbaker/submit/option-key-type
Use an object for option keys
2021-01-04 23:42:50 +00:00
Dylan Baker f14bf8b2ed mintro: fix mypy warning
The output of list_targets is a pretty horrific jumble of things. We
really need a TypeDict to make this not so terrible we can't deal with
it, so for now just use Any.
2021-01-04 12:20:59 -08:00
Dylan Baker a539fda0cf fix LGTM warnings 2021-01-04 12:20:59 -08: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
Daniel Mensinger 6b515c4321 cmake: fix missing languages from CMake (fixes #8132) 2021-01-04 20:16:30 +00:00
Dylan Baker bdca05e2e6 Add choices to OptionProxy
they're probably not strictly needed, but it makes mypy happy.
2021-01-04 12:15:41 -08:00
Dylan Baker 615686fd6d use new optionkey.is_* methods 2021-01-04 12:15:41 -08:00
Dylan Baker 30ec7612c8 coredata: Add a type to the OptionKey
This is useful for figuring out what kind of option this is. My hope is
that in the longterm this is less useful, but we'll still want it for
the configuration summary printing.
2021-01-04 12:15:41 -08:00
Dylan Baker 7142c92285 use OptionKey for backend_options 2021-01-04 12:15:41 -08:00
Dylan Baker e2ef6930ff use OptionKey for coredata.user_options 2021-01-04 12:15:41 -08:00
Dylan Baker b37f0cce2c movve insert_build_prefix to mconf
that's the only place it's used anyway.
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