[LTP] [PATCH 1/1] hugeshmctl01: Fix reset stat_time when looping with -i n

Xiao Yang yangx.jy@cn.fujitsu.com
Fri Mar 6 04:29:50 CET 2020


On 2020/3/6 9:53, Yang Xu wrote:
>>     static void test_hugeshmctl(unsigned int i)
>>   {
>> +    stat_time = FIRST;
>> +
> My description may confuse you.  stat_time should not be reseted every
> time, it only needs to be reseted when next loop. This value will be +1
>   when call stat_cleanup.
> struct tcase {
>          int cmd;
>          void (*func_test) (void);
>          void (*func_setup) (void);
> } tcases[] = {
>          {IPC_STAT, func_stat, stat_setup},   //stat_time = FIRST
>          {IPC_STAT, func_stat, stat_setup},   //stat_time = SECOND
>
> As you do, the first and second case are same. it should be added into
> the "if == 0".
>
> ps: I personally think old case is more cleaner. Let's hear from others.
>
Hi Petr, Xu

For xu's comment, we can assign 'i' to stat_time and remove 
"stat_time++;" directly:
----------------------------------------
  static void test_hugeshmctl(unsigned int i)
  {
+       stat_time = i;
+
...
-       stat_time++;
----------------------------------------

Thanks,
Xiao Yang





More information about the ltp mailing list