This is an attempt to lift common functionality needed by libc++ and libc++abi into LIT proper.
SuffixDispatchTest handles:
- Reading XFAIL, REQUIRES, UNSUPPORTED, tags from the source file.
- Calculating if a test is unsupported.
- Invoking the test_runner based on the tests suffix.
The tags have the following semantics:
- XFAIL: Tests that are known failures and should be fixed.
- UNSUPPORTED: Tests that are not relevant given a set of features.
- REQUIRES: Mirrors UNSUPPORTED
SuffixDispatchTest allows tests with different suffixes to be handled in different ways. In libc++ .pass.cpp tests must compile and execute successfully and .fail.cpp tests must fail to compile. We can provide two different handlers to SuffixDispatchTest as follows:
test_format = SuffixDispatchTest() test_format.add_suffix_test('.pass.cpp', PassTestHandler(...)) test_format.add_suffix_test('.fail.cpp', FailTestHandler(...))
Test handlers are expected to provide the following signature:
result,report = handler(test, lit_config)
Where:
- result is a instance of ResultCode
- report is a string representing the test that was run and the output.
- test is an instance of lit.Test
- lit_config is the global lit configuration object.
CompileAndExecuteTestRunner is a test runner for use with SuffixDispatchTest. It attempts to compile and run an executable.
I have patches to move libc++ and libc++abi over to the new format once this is accepted.
I much prefer
Trailing backslashes are gross.