Re: [PATCH] selftests: rtc: Support harness test filtering and arguments
From: Alexandre Belloni
Date: Mon Sep 21 2026 - 15:35:04 EST
On 10/09/2026 03:48:21+0000, Wake Liu wrote:
> rtctest implements its own main() function with a rigid switch (argc)
> check that only accepts an optional single argument for the RTC device
> node path. This prevents kselftest_harness standard arguments from
> working properly:
>
> 1. Passing filter options like -t <name> or -T <name> triggers a usage
> error because argc is greater than 2.
> 2. Passing -l or -h causes rtctest to treat "-l" or "-h" as the device
> node path and fail with access() errors before ever reaching the
> harness argument checker.
>
> Parse command line arguments with getopt() to pass all kselftest harness
> options (such as -t, -T, -v, -V, -f, -F, -r, -d, -h, and -l) through to
> test_harness_run(), while preserving the ability to specify an optional
> RTC device node path as a non-option argument. Also ensure optind is
> reset before invoking test_harness_run() so the harness can inspect the
> options, and bypass device accessibility checks when help or test
> listing is requested.
>
> Signed-off-by: Wake Liu <wakel@xxxxxxxxxx>
Acked-by: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com