aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
AgeCommit message (Collapse)AuthorFilesLines
2021-01-07mtest: do not wait inside _run_subprocessPaolo Bonzini1-66/+81
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-07mtest: handle should_fail in common codePaolo Bonzini1-10/+4
This is common to all protocols, place the code in a single place.
2021-01-07mtest: reorder arguments to "complete"Paolo Bonzini1-6/+6
Put them in the same order as complete_*.
2021-01-07mtest: improve JUnit XML generation for TAP testsuitesPaolo Bonzini1-46/+52
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-07mtest: improvements to JUnit XML generationPaolo Bonzini1-6/+8
Omit the classname attribute, as it is optional, and add the duration. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-07mtest: extract TAP parsing out of TestRun.make_tapPaolo Bonzini1-44/+53
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-07mtest/TAPParser: use typing.NamedTuplePaolo Bonzini1-14/+29
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-06mtest: remove argument to the TAPParser constructorPaolo Bonzini1-6/+3
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-06mtest: allow parsing TAP line by linePaolo Bonzini1-63/+68
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-05modules: Add an unstable-rust moduleDylan Baker1-0/+137
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-05interpreter: split code that creates a Test instanceDylan Baker1-5/+8
For modules to make use of, as they're not allowed to modify the Build instance directly.
2021-01-05interpreter: allow modules to create testsDylan Baker1-0/+2
2021-01-05mtest: Add support for rust unit testsDylan Baker3-2/+46
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-05mtest: Handle subtest results as a dictDylan Baker1-17/+17
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-04fix: llvm toolset is "ClangCL" in VS2019.Luke Elliott1-1/+1
2021-01-04Merge pull request #8080 from dcbaker/submit/option-key-typeJussi Pakkanen52-990/+1228
Use an object for option keys
2021-01-04mintro: fix mypy warningDylan Baker1-4/+4
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-04fix LGTM warningsDylan Baker5-9/+8
2021-01-04Use a single coredata dictionary for optionsDylan Baker31-313/+277
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-04use OptionKey for builtin and base optionsDylan Baker31-396/+406
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-04move OptionKey to mesonlibDylan Baker17-235/+237
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-04use OptionKey for compiler_optionsDylan Baker24-292/+359
2021-01-04cmake: fix missing languages from CMake (fixes #8132)Daniel Mensinger1-8/+29
2021-01-04Add choices to OptionProxyDylan Baker4-25/+26
they're probably not strictly needed, but it makes mypy happy.
2021-01-04use new optionkey.is_* methodsDylan Baker3-3/+3
2021-01-04coredata: Add a type to the OptionKeyDylan Baker1-18/+43
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-04use OptionKey for backend_optionsDylan Baker6-21/+20
2021-01-04use OptionKey for coredata.user_optionsDylan Baker6-18/+34
2021-01-04movve insert_build_prefix to mconfDylan Baker2-9/+8
that's the only place it's used anyway.
2021-01-04use the OptionKey type for command line and machine filesDylan Baker5-123/+110
2021-01-04coredata: Add OptionKey typeDylan Baker1-0/+169
This is a complex key that can store multiple bits of data in a single place. It can be generated from a command line formatted string, and it's str method returns it to that form. It's intentionally immutable, use the evolve() method to create variations of an existing key.
2020-12-30Handle uppercase dependency names in wraps.Jussi Pakkanen1-2/+5
2020-12-29cmake: fix -framework dependencies (fixes #8045)Daniel Mensinger1-0/+14
2020-12-29Only do module scanning if C++ version is latest.Jussi Pakkanen1-0/+2
2020-12-29Implement support of dlang -makedeps switch (#8119)Remi Thebault2-3/+32
* Implement support of dlang -makedeps switch Fix #8118 * resolve code review comments
2020-12-28Fix network path output in ninja backend on WindowsSamuel Longchamps1-0/+7
2020-12-28Incorrect source-build directory error when using network paths on WindowsSamuel Longchamps1-2/+5
2020-12-28Merge pull request #8001 from bonzini/mtest-asyncioJussi Pakkanen2-179/+368
mtest: refactor logging and add progress report
2020-12-28Fix missed imports in #7902wereii1-0/+3
2020-12-27mtest: flush progress report before warningPaolo Bonzini1-4/+14
2020-12-27mtest: flush stdout after printing test resultsPaolo Bonzini1-1/+1
Flush after each output line, even if printing to a file, so that each result is immediately visible down a pipeline. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-12-27mtest: add progress reportPaolo Bonzini2-1/+116
Add a progress report in the style of "yum". Every second the report prints a different test among the ones that are running. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-12-27mtest: merge print_stats and process_test_resultPaolo Bonzini1-7/+5
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-12-27mtest: convert console output to TestLoggerPaolo Bonzini1-26/+26
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-12-27mtest: convert logfile to TestLoggerPaolo Bonzini1-35/+33
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-12-27mtest: convert jsonlogfile to TestLoggerPaolo Bonzini1-20/+27
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-12-27mtest: introduce TestLoggerPaolo Bonzini1-10/+28
The TestLogger class lets us move the code for all those log files out of TestHarness. The interface is based on JunitBuilder, which is converted already in this commit. Over the next commits, we will also convert JSON, text and console output. The main difference with JunitBuilder is that the completion method is asynchronous. This can be useful if the logger needs to clean up after itself and wait for asyncio tasks. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-12-27mtest: do not use __del__Paolo Bonzini1-8/+8
Use try/finally instead of destructors to ensure that log files are closed. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-12-27mtest: remove collected_logsPaolo Bonzini1-25/+33
Just reuse the collected_failures collection now that it contains TestRun objects. Move the code to generate the short form of the log to TestRun. Note that the first line of the error log is not included in get_log()'s return value, so the magic "first four lines are passed unscathed" is changed to three lines only. The resulting output is like this: --- command --- <command line> --- Listing only the last 100 lines from a long log. --- --- stdout --- ... Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-12-27mtest: use backslash replace when printing error logsPaolo Bonzini1-1/+1
If there's an UnicodeEncodeError while printing the error logs, TestHarness tries an encode/decode pair to get rid of anything that is not a 7-bit ASCII character; this however results in "?" characters that are not very clear. To make it easier to understand what is going on, use backslashreplace instead. While at it, fix the decode to use a matching encoding. This will only matter in the rare case of sys.stdout.encoding not being an ASCII superset, but that should not matter. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>