Re: kselftest.h API usage - question about return

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

 



Hi Tim,

On 06/13/2017 05:56 PM, Bird, Timothy wrote:
> Hi all,
> 
> I'm looking at the existing kselftest API in kselftest.h.
> 
> The existing (pre-TAP conversion) API basically consists of
> some inline functions for handling and reporting different counters,
> and some inline functions for exiting with different return codes.
> 
> My question is about the use of the exit functions with 
> return throughout the kselftest code.
> 
> exit() does not return, but I see lots of instances of code like this:
> return ksft_exit_pass();
> 
> Shouldn't this just be a call to ksft_exit_pass()?  ksft_exit_pass
> (and other other ksft_exit_ routines) will never return, so this
> is calling convention is a bit misleading.

Correct. When I added this API a couple of years ago, the intended usage
was for tests to call increment functions for pass/fail/xfail/xpass counts
as needed and the call ksft_exit_pass() at the end.

> 
> I'm happy to submit a patch to change these call sites, if one
> is desired.
> 
> Just by way of info, there are 119 calls to ksft_exit_*, and 57 of
> them use the calls in conjunction with 'return'.

You are right that there is no need for this return there. All of the
ones that do return do that from their main() routines. In some cases,
these are after waitpid with parent and child cases.

I will take a look at these and make changes as needed. Some of these
commits are mine when I made changes early on when I updated some of
these tests to the API. It could just be that when I made these changes
I might be intending to keep it open for just a return code.

thanks,
-- Shuah
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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