[v2] test/cycles: restore original delay function

Message ID 20200727102151.192516-1-ruifeng.wang@arm.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series [v2] test/cycles: restore original delay function |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/iol-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS

Commit Message

Ruifeng Wang July 27, 2020, 10:21 a.m. UTC
  test_delay_us_sleep registers sleep based delay for testing.
This changes the default delay function of testing environment.
It is not expected.

Restore default delay function after the test to fix the issue.

Fixes: a51639cc720a ("eal: add nanosleep based delay function")
Cc: stable@dpdk.org

Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
---
v2:
Dropped other patches in the series that are not needed.

 app/test/test_cycles.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
  

Comments

David Marchand July 27, 2020, 12:21 p.m. UTC | #1
On Mon, Jul 27, 2020 at 12:22 PM Ruifeng Wang <ruifeng.wang@arm.com> wrote:
>
> test_delay_us_sleep registers sleep based delay for testing.
> This changes the default delay function of testing environment.
> It is not expected.
>
> Restore default delay function after the test to fix the issue.
>
> Fixes: a51639cc720a ("eal: add nanosleep based delay function")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Reviewed-by: Gavin Hu <gavin.hu@arm.com>
> ---
> v2:
> Dropped other patches in the series that are not needed.
>
>  app/test/test_cycles.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/app/test/test_cycles.c b/app/test/test_cycles.c
> index c78e6a5b1..015a9290f 100644
> --- a/app/test/test_cycles.c
> +++ b/app/test/test_cycles.c
> @@ -79,8 +79,14 @@ REGISTER_TEST_COMMAND(cycles_autotest, test_cycles);
>  static int
>  test_delay_us_sleep(void)
>  {
> +       int rv = 0;

No initialisation needed, I removed it while applying.


> +
>         rte_delay_us_callback_register(rte_delay_us_sleep);
> -       return check_wait_one_second();
> +       rv = check_wait_one_second();
> +       /* restore original delay function */
> +       rte_delay_us_callback_register(rte_delay_us_block);
> +
> +       return rv;
>  }
>
>  REGISTER_TEST_COMMAND(delay_us_sleep_autotest, test_delay_us_sleep);

Reviewed-by: David Marchand <david.marchand@redhat.com>


Applied, thanks.
  

Patch

diff --git a/app/test/test_cycles.c b/app/test/test_cycles.c
index c78e6a5b1..015a9290f 100644
--- a/app/test/test_cycles.c
+++ b/app/test/test_cycles.c
@@ -79,8 +79,14 @@  REGISTER_TEST_COMMAND(cycles_autotest, test_cycles);
 static int
 test_delay_us_sleep(void)
 {
+	int rv = 0;
+
 	rte_delay_us_callback_register(rte_delay_us_sleep);
-	return check_wait_one_second();
+	rv = check_wait_one_second();
+	/* restore original delay function */
+	rte_delay_us_callback_register(rte_delay_us_block);
+
+	return rv;
 }
 
 REGISTER_TEST_COMMAND(delay_us_sleep_autotest, test_delay_us_sleep);