[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5423404B.2050400@osg.samsung.com>
Date: Wed, 24 Sep 2014 16:06:03 -0600
From: Shuah Khan <shuahkh@....samsung.com>
To: Davidlohr Bueso <dave@...olabs.net>
CC: akpm@...ux-foundation.org, gregkh@...uxfoundation.org,
colin.king@...onical.com, ebiederm@...ssion.com,
serge.hallyn@...ntu.com, thierry@...ux.vnet.ibm.com,
luto@...capital.net, linux-api@...r.kernel.org,
linux-kernel@...r.kernel.org, Shuah Khan <shuahkh@....samsung.com>
Subject: Re: [PATCH v2 1/7] selftests: add kselftest framework for uniform
test reporting
On 09/24/2014 02:09 AM, Davidlohr Bueso wrote:
>> +/* counters */
>> +static int ksft_pass;
>> +static int ksft_fail;
>> +static int ksft_xfail;
>> +static int ksft_xpass;
>> +static int ksft_xskip;
>
> unsigned int?
Yes unsigned int is a better choice.
>
>> +static inline void ksft_inc_pass_cnt(void) { ksft_pass++; }
>> +static inline void ksft_inc_fail_cnt(void) { ksft_fail++; }
>> +static inline void ksft_inc_xfail_cnt(void) { ksft_xfail++; }
>> +static inline void ksft_inc_xpass_cnt(void) { ksft_xpass++; }
>> +static inline void ksft_inc_xskip_cnt(void) { ksft_xskip++; }
>
> It would probably make sense to have the counters in a structures,
> something like: struct ksft_counter { ... } ksft_cnt;
>
> Then just pass it around the proposed functions as arguments. That also
> minimizes a bit the global variables and would allow you to easily
> change it in the future.
How does the following look?
struct ksft_count
{
unsigned int ksft_pass;
unsigned int ksft_fail;
unsigned int ksft_xfail;
unsigned int ksft_xpass;
unsigned int ksft_xskip;
};
static ksft_count ksft_cnt;
static inline void ksft_inc_pass_cnt(void) { ksft_cnt.ksft_pass++; }
static inline void ksft_inc_fail_cnt(void) { ksft_cnt.ksft_fail++; }
static inline void ksft_inc_xfail_cnt(void) { ksft_cnt.ksft_xfail++; }
static inline void ksft_inc_xpass_cnt(void) { ksft_cnt.ksft_xpass++; }
static inline void ksft_inc_xskip_cnt(void) { ksft_cnt.ksft_xskip++; }
With this approach, tests don't have to define their own counter
variable and pass it in. I am looking to abstract the framework
as much as possible.
thanks,
-- Shuah
--
Shuah Khan
Sr. Linux Kernel Developer
Samsung Research America (Silicon Valley)
shuahkh@....samsung.com | (970) 217-8978
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists