Re: [PATCH v3] Add selftests run filtering

Simon Marchi
2017-09-16T12:08:52Z

On 2017-09-07 17:11, Simon Marchi wrote:
> On 2017-09-07 17:09, Simon Marchi wrote:
>> New in v3:
>>
>> I realized I had forgotten help, news and doc, this patch adds those.
>>
>> Actual commit log:
>>
>> With the growing number of selftests, I think it would be useful to be
>> able to run only a subset of the tests. This patch associates a name
>> to
>> each registered selftest. It then allows doing something like:
>>
>> (gdb) maintenance selftest aarch64
>> Running self-tests.
>> Running selftest aarch64-analyze-prologue.
>> Running selftest aarch64-process-record.
>> Ran 2 unit tests, 0 failed
>>
>> or with gdbserver:
>>
>> ./gdbserver --selftest=aarch64
>>
>> In both cases, only the tests that contain "aarch64" in their name are
>> ran. To help validate that the tests you want to run were actually
>> ran,
>> it also prints a message with the test name before running each test.
>>
>> Right now, all the arch-dependent tests are registered as a single
>> test
>> of the selftests. To be able to filter those too, I made them
>> "first-class citizen" selftests. The selftest type is an interface,
>> with different implementations for "simple selftests" and "arch
>> selftests". The run_tests function simply iterates on that an invokes
>> operator() on each test.
>>
>> I changed the tests data structure from a vector to a map, because
>>
>> - it allows iterating in a stable (alphabetical) order
>> - it allows to easily verify if a test with a given name has been
>> registered, to avoid duplicates
>>
>> There's also a new command "maintenance info selftests" that lists the
>> registered selftests.
>
> Arg, the subject should have said v3.

I pushed this patch, but I am still open to making changes if you have
further comments.

Simon