When the test binary calls itself recursively e.g. when testing
multi-process, print out a few extra details on what is being done and
returned to help with debugging in case of any issues. As part of this,
if rte_eal_init ever fails, explicitly print out the failure code.

Signed-off-by: Bruce Richardson <[email protected]>
---
 app/test/test.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/app/test/test.c b/app/test/test.c
index 8a4598baee..58ef52f312 100644
--- a/app/test/test.c
+++ b/app/test/test.c
@@ -92,8 +92,13 @@ do_recursive_call(void)
        if (recursive_call == NULL)
                return -1;
        for (i = 0; i < RTE_DIM(actions); i++) {
-               if (strcmp(actions[i].env_var, recursive_call) == 0)
-                       return (actions[i].action_fn)();
+               if (strcmp(actions[i].env_var, recursive_call) == 0) {
+                       printf("Calling recursive action for %s\n", 
recursive_call);
+                       int ret = actions[i].action_fn();
+                       printf("Returned from recursive action for %s with 
%d\n",
+                                       recursive_call, ret);
+                       return ret;
+               }
        }
        printf("ERROR - missing action to take for %s\n", recursive_call);
        return -1;
@@ -146,6 +151,7 @@ main(int argc, char **argv)
        } else
                ret = rte_eal_init(argc, argv);
        if (ret < 0) {
+               printf("Error with EAL initialization, ret = %d\n", ret);
                ret = -1;
                goto out;
        }
@@ -259,10 +265,14 @@ main(int argc, char **argv)
        ret = 0;
 
 out:
+       if (recursive_call != NULL)
+               printf("Cleaning up %s recursive instance\n", argv[0]);
 #ifdef RTE_LIB_TIMER
        rte_timer_subsystem_finalize();
 #endif
        rte_eal_cleanup();
+       if (recursive_call != NULL)
+               printf("%s recursive instance returning %d\n", argv[0], ret);
        return ret;
 }
 
-- 
2.51.0

Reply via email to