diff mbox series

[v6,1/2] lib/tst_timer_test: move test setup function before PR_GET_TIMERSLACK

Message ID 1574044495-2813-1-git-send-email-xuyang2018.jy@cn.fujitsu.com
State Accepted
Headers show
Series [v6,1/2] lib/tst_timer_test: move test setup function before PR_GET_TIMERSLACK | expand

Commit Message

Yang Xu Nov. 18, 2019, 2:34 a.m. UTC
Move test setup function before PR_GET_TIMERSLACK in timer setup function so
that the library includes the newly set timerslack in the calculation.

Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
---
 lib/tst_timer_test.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Yang Xu Nov. 20, 2019, 6:54 a.m. UTC | #1
Hi Cyril

  I think this patch can be merged if it is ok.

Thanks
Yang Xu

> Move test setup function before PR_GET_TIMERSLACK in timer setup function so
> that the library includes the newly set timerslack in the calculation.
>
> Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
> ---
>   lib/tst_timer_test.c | 8 +++-----
>   1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/lib/tst_timer_test.c b/lib/tst_timer_test.c
> index f6459e5c0..13e9deff2 100644
> --- a/lib/tst_timer_test.c
> +++ b/lib/tst_timer_test.c
> @@ -340,6 +340,9 @@ static void timer_setup(void)
>   	struct timespec t;
>   	int ret;
>   
> +	if (setup)
> +		setup();
> +
>   	tst_clock_getres(CLOCK_MONOTONIC, &t);
>   
>   	tst_res(TINFO, "CLOCK_MONOTONIC resolution %lins", (long)t.tv_nsec);
> @@ -360,16 +363,11 @@ static void timer_setup(void)
>   	tst_res(TINFO, "PR_GET_TIMERSLACK not defined, using %uus",
>   		timerslack);
>   #endif /* PR_GET_TIMERSLACK */
> -
>   	parse_timer_opts();
>   
>   	samples = SAFE_MALLOC(sizeof(long long) * MAX(MAX_SAMPLES, sample_cnt));
> -
>   	if (set_latency() < 0)
>   		tst_res(TINFO, "Failed to set zero latency constraint: %m");
> -
> -	if (setup)
> -		setup();
>   }
>   
>   static void timer_cleanup(void)
Yang Xu Nov. 25, 2019, 10:18 a.m. UTC | #2
Hi

ping.

> Hi Cyril
>   I think this patch can be merged if it is ok.
> Thanks
> Yang Xu
>> Move test setup function before PR_GET_TIMERSLACK in timer setup function so
>> that the library includes the newly set timerslack in the calculation.
>>
>> Signed-off-by: Yang Xu<xuyang2018.jy@cn.fujitsu.com>
>> Reviewed-by: Cyril Hrubis<chrubis@suse.cz>
>> ---
>>   lib/tst_timer_test.c | 8 +++-----
>>   1 file changed, 3 insertions(+), 5 deletions(-)
>>
>> diff --git a/lib/tst_timer_test.c b/lib/tst_timer_test.c
>> index f6459e5c0..13e9deff2 100644
>> --- a/lib/tst_timer_test.c
>> +++ b/lib/tst_timer_test.c
>> @@ -340,6 +340,9 @@ static void timer_setup(void)
>>   	struct timespec t;
>>   	int ret;
>>   
>> +	if (setup)
>> +		setup();
>> +
>>   	tst_clock_getres(CLOCK_MONOTONIC, &t);
>>   
>>   	tst_res(TINFO, "CLOCK_MONOTONIC resolution %lins", (long)t.tv_nsec);
>> @@ -360,16 +363,11 @@ static void timer_setup(void)
>>   	tst_res(TINFO, "PR_GET_TIMERSLACK not defined, using %uus",
>>   		timerslack);
>>   #endif /* PR_GET_TIMERSLACK */
>> -
>>   	parse_timer_opts();
>>   
>>   	samples = SAFE_MALLOC(sizeof(long long) * MAX(MAX_SAMPLES, sample_cnt));
>> -
>>   	if (set_latency() < 0)
>>   		tst_res(TINFO, "Failed to set zero latency constraint: %m");
>> -
>> -	if (setup)
>> -		setup();
>>   }
>>   
>>   static void timer_cleanup(void)
>
diff mbox series

Patch

diff --git a/lib/tst_timer_test.c b/lib/tst_timer_test.c
index f6459e5c0..13e9deff2 100644
--- a/lib/tst_timer_test.c
+++ b/lib/tst_timer_test.c
@@ -340,6 +340,9 @@  static void timer_setup(void)
 	struct timespec t;
 	int ret;
 
+	if (setup)
+		setup();
+
 	tst_clock_getres(CLOCK_MONOTONIC, &t);
 
 	tst_res(TINFO, "CLOCK_MONOTONIC resolution %lins", (long)t.tv_nsec);
@@ -360,16 +363,11 @@  static void timer_setup(void)
 	tst_res(TINFO, "PR_GET_TIMERSLACK not defined, using %uus",
 		timerslack);
 #endif /* PR_GET_TIMERSLACK */
-
 	parse_timer_opts();
 
 	samples = SAFE_MALLOC(sizeof(long long) * MAX(MAX_SAMPLES, sample_cnt));
-
 	if (set_latency() < 0)
 		tst_res(TINFO, "Failed to set zero latency constraint: %m");
-
-	if (setup)
-		setup();
 }
 
 static void timer_cleanup(void)