The test passed even when the secondary failed every pdump call.
process_dup() returns the raw status from wait(), which is positive
on failure, but the caller folded it in with ret |= and test_pdump()
only treats a negative value as an error.

The client secondary also never called rte_pdump_init(), so it had no
IPC handler for the requests the primary sends it.

Check the launched process for any non-zero status, and initialize
pdump in the client so the enable and disable paths are actually
exercised in the secondary.

Fixes: 086eb64db39e ("test/pdump: add unit test for pdump library")
Cc: [email protected]

Signed-off-by: Stephen Hemminger <[email protected]>
---
 app/test/test_pdump.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/app/test/test_pdump.c b/app/test/test_pdump.c
index f1c9bd9d7e..9d7e5d94fc 100644
--- a/app/test/test_pdump.c
+++ b/app/test/test_pdump.c
@@ -56,6 +56,12 @@ run_pdump_client_tests(void)
        struct rte_eth_dev *eth_dev = NULL;
        char poolname[] = "mbuf_pool_client";
 
+       ret = rte_pdump_init();
+       if (ret < 0) {
+               printf("rte_pdump_init failed\n");
+               return -1;
+       }
+
        ret = test_get_mempool(&mp, poolname);
        if (ret < 0)
                return -1;
@@ -119,6 +125,11 @@ run_pdump_client_tests(void)
        if (mp != NULL)
                test_mp_free(mp);
 
+       if (rte_pdump_uninit() < 0) {
+               printf("rte_pdump_uninit failed\n");
+               return -1;
+       }
+
        return ret;
 }
 
@@ -192,7 +203,9 @@ run_pdump_server_tests(void)
        snprintf(core_str, sizeof(core_str), "%u", rte_get_main_lcore());
 
        ret = test_pdump_init();
-       ret |= launch_p(argv1);
+       /* process_dup() returns the raw wait() status, not a negative errno */
+       if (launch_p(argv1) != 0)
+               ret = -1;
        ret |= test_pdump_uninit();
        return ret;
 }
-- 
2.53.0

Reply via email to