Re: [PATCH net-next 7/7] testing: net-drv: add a driver test for stats reporting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jakub Kicinski <kuba@xxxxxxxxxx> writes:

> On Tue, 2 Apr 2024 10:31:11 -0700 Jakub Kicinski wrote:
>> Yes, I was wondering about that. It must be doable, IIRC 
>> the multi-threading API "injects" args from a tuple.
>> I was thinking something along the lines of:
>> 
>>     with NetDrvEnv(__file__) as cfg:
>>         ksft_run([check_pause, check_fec, pkt_byte_sum],
>>                  args=(cfg, ))
>
> seems to work, is this good?
>
> diff --git a/tools/testing/selftests/net/lib/py/ksft.py b/tools/testing/selftests/net/lib/py/ksft.py
> index 7c296fe5e438..c7210525981c 100644
> --- a/tools/testing/selftests/net/lib/py/ksft.py
> +++ b/tools/testing/selftests/net/lib/py/ksft.py
> @@ -60,7 +60,7 @@ KSFT_RESULT = None
>      print(res)
>  
>  
> -def ksft_run(cases):
> +def ksft_run(cases, args=()):
>      totals = {"pass": 0, "fail": 0, "skip": 0, "xfail": 0}
>  
>      print("KTAP version 1")
> @@ -72,7 +72,7 @@ KSFT_RESULT = None
>          KSFT_RESULT = True
>          cnt += 1
>          try:
> -            case()
> +            case(*args)
>          except KsftSkipEx as e:
>              ktap_result(True, cnt, case, comment="SKIP " + str(e))
>              totals['skip'] += 1

Yep, looks good.




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux