On 8/29/23 17:24, David Gow wrote:
On Wed, 30 Aug 2023 at 06:46, Guenter Roeck linux@roeck-us.net wrote:
Hi,
On Tue, Jul 25, 2023 at 09:25:15PM +0000, Rae Moar wrote:
Add filtering of test attributes. Users can filter tests using the module_param called "filter".
Filters are imputed in the format: <attribute_name><operation><value>
Example: kunit.filter="speed>slow"
Operations include: >, <, >=, <=, !=, and =. These operations will act the same for attributes of the same type but may not between types.
Note multiple filters can be inputted by separating them with a comma. Example: kunit.filter="speed=slow, module!=example"
Since both suites and test cases can have attributes, there may be conflicts. The process of filtering follows these rules:
- Filtering always operates at a per-test level.
- If a test has an attribute set, then the test's value is filtered on.
- Otherwise, the value falls back to the suite's value.
- If neither are set, the attribute has a global "default" value, which is used.
Filtered tests will not be run or show in output. The tests can instead be skipped using the configurable option "kunit.filter_action=skip".
Note the default settings for running tests remains unfiltered.
Finally, add "filter" methods for the speed and module attributes to parse and compare attribute values.
Note this filtering functionality will be added to kunit.py in the next patch.
Reviewed-by: David Gow davidgow@google.com Signed-off-by: Rae Moar rmoar@google.com
This patch causes all my s390 boot tests to crash.
Thanks: I can reproduce this here.
Looks like this is an issue with string constants in the tests not being writable. (I'd've thought my testing with KASAN would pick up on this, but I guess string literals are in a writable segment on x86_64?)
Regardless, using char[] for the filters seems to work here. I've sent out a patch to do so: https://lore.kernel.org/linux-kselftest/20230830002116.3768675-1-davidgow@go...
That fixes the issue with the stacktrack below, but if you bisected it to this patch, maybe there's another issue. The tests weren't introduced until 76066f93f1df ("kunit: add tests for filtering attributes"). I don't get any crashes with this patch applied, though, so let me know if something's still broken.
Your patch works just fine. Maybe bisect acted up ? I don't recall seeing this happen, but who knows.
Thanks a lot for the quick fix!
Guenter