test/cycles: restore default delay callback
authorRuifeng Wang <ruifeng.wang@arm.com>
Mon, 27 Jul 2020 10:21:50 +0000 (18:21 +0800)
committerDavid Marchand <david.marchand@redhat.com>
Mon, 27 Jul 2020 14:42:19 +0000 (16:42 +0200)
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>
app/test/test_cycles.c

index c78e6a5..97d42f3 100644 (file)
@@ -79,8 +79,14 @@ REGISTER_TEST_COMMAND(cycles_autotest, test_cycles);
 static int
 test_delay_us_sleep(void)
 {
+       int rv;
+
        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);