aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mtest.py
AgeCommit message (Collapse)AuthorFilesLines
2020-11-18Merge pull request #7836 from bonzini/mtest-asyncioJussi Pakkanen1-137/+212
[RFC] mtest: use asyncio instead of concurrency.futures
2020-11-18mtest: cleanup and fix print_statsPaolo Bonzini1-13/+8
Avoid calling self.collected_failures.append twice, and avoid inflated indentation by adding a "plain" decorator to mlog. Fixes: ba71fde18 ("mtest: collect failures regardless of colorized console", 2020-10-12)
2020-11-15mtest: switch to asyncio subprocessesPaolo Bonzini1-35/+19
No functional change except that the extra thread goes away.
2020-11-15mtest: use ProactorEventLoopPaolo Bonzini1-0/+4
This is needed to use asyncio with pipes and processes.
2020-11-15mtest: improve handling of SIGINT and SIGTERMPaolo Bonzini1-8/+36
Handle SIGINT and SIGTERM by respectively cancelling the longest running and all the running tests.
2020-11-15mtest: remove usage of executorsPaolo Bonzini1-50/+76
Rewrite the SingleTestRunner to use asyncio to manage subprocesses, while still using subprocess.Popen to run them. Concurrency is managed with an asyncio Semaphore; for simplicity (since this is a temporary state) we create a new thread for each test that is run instead of having a pool. This already provides the main advantage of asyncio, which is better control on cancellation; with the current code, KeyboardInterrupt was never handled by the thread executor so the code that tried to handle it in SingleTestRunner only worked for non-parallel tests. And because executor futures cannot be cancelled, there was no way for the user to kill a test that got stuck. Instead, without executors ^C exits "meson test" immediately. The next patch will improve things even further, allowing a single test to be interrupted with ^C.
2020-11-15mtest: add INTERRUPT to TestResultPaolo Bonzini1-21/+24
Distinguish a failure due to user interrupt from a presumable ERROR result due to the SIGTERM. The test should fail after CTRL+C even if the test traps SIGTERM and exits with a return code of 0.
2020-11-15mtest: always ignore ProcessLookupErrorPaolo Bonzini1-33/+26
ProcessLookupError can also happen from p.kill(). There is also nothing we can do in that case, so move the "try" for that exception to the entire kill_process function. The ValueError case seems like dead code, so get rid of it.
2020-11-15mtest: refactor _run_cmdPaolo Bonzini1-85/+101
A large part of _run_cmd is devoted to setting up and killing the test subprocess. Move that to a separate function to make the test runner logic easier to understand.
2020-11-15mtest: add back SIGINT handlingPaolo Bonzini1-6/+27
2020-11-15mtest: use asyncio for run loopPaolo Bonzini1-26/+39
Use asyncio futures for the run loop, while still handling I/O in a thread pool using run_on_executor. The handling of the test result is not duplicated anymore between run_tests and drain_futures. Instead, the test result is always processed and printed by run_test after single_test.run() completes and (in verbose mode) it cannot interleave with the test output. Therefore the special case for self.options.num_processes == 1 can be removed.
2020-11-15mtest: remove run_specialPaolo Bonzini1-13/+1
run_special and doit are the same except that run_special forgot to set self.is_run. There is no need for the duplication. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-11-15mtest: fix flake8 issuesPaolo Bonzini1-4/+3
2020-10-28Fix gtest invoking while workdir is set (#7904)Sergey Kartashev1-3/+3
* Fix gtest invoking while workdir is set * Fix gtest invoking when workdir is not set * Code style fix Co-authored-by: Sergey Kartashev <kartashev.sv@mipt.ru>
2020-10-13mtest: Allow filtering tests by subprojectNirbheek Chauhan1-3/+26
You could always specify a list of tests to run by passing the names as arguments to `meson test`. If there were multiple tests with that name (in the same project or different subprojects), all of them would be run. Now you can: 1. Run all tests with the specified name from a specific subproject: `meson test subprojname:testname` 1. Run all tests defined in a specific subproject: `meson test subprojectname:` Also forbid ':' in test names. We already forbid this elsewhere, so should not be a big deal.
2020-10-12mtest: collect failures regardless of colorized consoleCamilo Celis Guzman1-9/+11
2020-10-04pathlib: Fix resolve() by overriding it in Python 3.5Daniel Mensinger1-1/+1
2020-09-10mtest: Refactor test data checkingNirbheek Chauhan1-21/+12
2020-09-10mtest: Check version in the test data after loadingNirbheek Chauhan1-10/+27
Same as coredata.dat and build.dat loading. Also, do not assert if things change. Raise the appropriate exception. Fixes https://github.com/mesonbuild/meson/issues/7613
2020-09-08typing: more fixesDaniel Mensinger1-32/+35
2020-09-08typing: fully annotate mintro and mtestDaniel Mensinger1-13/+13
2020-09-04environment: use ExternalProgram to find ninjaPaolo Bonzini1-1/+1
This allows the NINJA environment variable to support all the Windows special cases, especially allowing an absolute path without extension. Based on a patch by Yonggang Luo. Fixes: #7659 Suggested-by: Nirbheek Chauhan <nirbheek@centricular.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-08-30Be stricter when detecting Windows/CygwinChristoph Reiter1-3/+2
This removes the check for "mingw" for platform.system(). The only case I know where "mingw" is return is if using a msys Python under a msys2 mingw environment. This combination is not really supported by meson and will result in weird errors, so remove the check. The second change is checking sys.platform for cygwin instead of platform.system(). The former is document to return "cygwin", while the latter is not and just returns uname(). While under Cygwin it uname() always starts with "cygwin" it's not hardcoded in MSYS2 and starts with the environment name. Using sys.platform is safer here. Fixes #7552
2020-08-13mtest: Actually call colorize_console()Nirbheek Chauhan1-1/+1
2020-08-08mtest: fix skipping with various prefixesMarc-André Lureau1-1/+1
According to the specification: https://testanything.org/tap-specification.html#skipping-tests The harness should report the text after # SKIP\S*\s+ as a reason for skipping. (it's not exactly like the TODO directive, the phrasing/presentation of the spec could be improved).
2020-08-05mtest: TestResult.SKIP is not a failure (#7525)Simon McVittie1-1/+1
* mtest: TestResult.SKIP is not a failure If some but not all tests in a run were skipped, then the overall result is given by whether there were any failures among the non-skipped tests. Resolves: https://github.com/mesonbuild/meson/issues/7515 Signed-off-by: Simon McVittie <smcv@debian.org> * Add test-cases for partially skipped TAP tests issue7515.txt is the output of one of the real TAP tests in gjs, which failed as a result of #7515. The version inline in meson.build is a minimal reproducer. Signed-off-by: Simon McVittie <smcv@debian.org>
2020-07-30mtest: report failures and overall summary *after* test(s) logsCamilo Celis Guzman1-2/+8
2020-05-18pass exe_wrapper to test scripts through the environmentDylan Baker1-15/+17
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-18backends: Consider arguments passed to a test when cross compilingDylan Baker1-3/+4
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-18mtest: don't use len() to test container emptinessDylan Baker1-5/+5
It's not idiomatic python and is significantly slower than not using the bool protocol.
2020-05-04Add native support for gtest testsDylan Baker1-7/+47
Gtest can output junit results with a command line switch. We can parse this to get more detailed results than the returncode, and put those in our own Junit output. We basically just throw away the top level 'testsuites' object, then fixup the names of the tests, and shove that into our junit.
2020-04-30Convert test protocol into an enumDylan Baker1-2/+3
This gives us better type safety, and will be important as we add more test methods
2020-04-30mtest: use argparse.type to simplify some codeDylan Baker1-2/+1
2020-04-30mtest: Replace if (bool) { return bool; } with return bool;Dylan Baker1-3/+1
2020-04-23mtest: Generate a JUnit xml result fileDylan Baker1-0/+113
JUnit is pretty ubiquitous, lots of services and results viewers understand it, in particular gitlab and jenkins know how to consume JUnit xml. This means projects using CI services can have their test results consumed automatically. Fixes: #6972
2020-04-23mtest: Store individual results for TAP testsDylan Baker1-21/+23
This will be used by the Junit writer
2020-04-22mtest: Use textrwap.dedent for large blockDylan Baker1-8/+9
This allows editors like vim to properly fold the code, and makes it generally easier to read.
2020-04-03mtest: Improve test output formatting.Hemmo Nieminen1-22/+29
Remove some weirdness from test output such as extra commas, missing spaces and way too precise time durations. Also improve the overall alignment of the output.
2020-03-19mtest: terminate a test via SIGTERM first then (if needed) via SIGKILLCamilo Celis Guzman1-7/+20
2020-03-03Cherry-picking - (rm python2 % add python3 .format) (#6725)Michael Brockus1-30/+28
2020-01-08types: import typing as T (fixes #6333)Daniel Mensinger1-42/+42
2019-11-07mesonbuild/mtest: plumb and report a test's start timeCamilo Celis Guzman1-11/+17
2019-11-07CI: add initial type annotation checkingMichael Hirsch, Ph.D1-3/+3
2019-11-06Fix typos found by codespellWolfgang Stöggl1-1/+1
- Typos were found by codespell v1.16.0
2019-10-04mtest: add gdb_path optionGerion Entrup1-1/+3
When using the '--gdb' argument of meson test the executed binary can now be specified with '--gdb-path'. Closing: #4373
2019-09-28mtest: Don't require an exe wrapper for if the cross file says we don't need oneDylan Baker1-1/+1
Fixes #5970
2019-09-23mtest: TAP: ignore empty linesMarc-André Lureau1-0/+3
According to http://testanything.org/tap-specification.html "Any output line that is not a version, a plan, a test line, a diagnostic or a bail out is considered an “unknown” line. A TAP parser is required to not consider an unknown line as an error but may optionally choose to capture said line and hand it to the test harness, which may have custom behavior attached [...] TAP::Harness reports TAP syntax errors at the end of a test run". (glib gtest can generate empty lines)
2019-09-05mesonlib.split_args/quote_arg/join_argsAleksey Gurtovoy1-4/+3
2019-08-24wine: Try to get the short paths when generating WINEPATHThibault Saunier1-10/+10
The size of WINEPATH is limited (1024 [until recently]), we can very easily reach that limit, and even the new one (2048) so try to keep path as small as possible by using the shortPath version of paths. Also assert that we do not reach the new hard limit. And avoid having duplicates in the list of path. [until recently]: https://bugs.winehq.org/show_bug.cgi?id=45810
2019-07-30DOC: meson test multiple --suite specifications [skip ci]Michael Hirsch, Ph.D1-2/+4
docs:wrap < 80 col