1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2014 Intel Corporation
10 #include <rte_debug.h>
11 #include <rte_common.h>
21 /* use fork() to test rte_panic() */
31 rte_panic("Test Debug\n");
33 printf("Fork Failed\n");
38 printf("Child process terminated normally!\n");
41 printf("Child process terminated as expected - Test passed!\n");
46 /* use fork() to test rte_exit() */
48 test_exit_val(int exit_val)
56 rte_exit(exit_val, __func__);
58 printf("Fork Failed\n");
62 printf("Child process status: %d\n", status);
63 #ifndef RTE_EAL_ALWAYS_PANIC_ON_ERROR
64 if(!WIFEXITED(status) || WEXITSTATUS(status) != (uint8_t)exit_val){
65 printf("Child process terminated with incorrect status (expected = %d)!\n",
76 int test_vals[] = { 0, 1, 2, 255, -1 };
78 for (i = 0; i < sizeof(test_vals) / sizeof(test_vals[0]); i++){
79 if (test_exit_val(test_vals[i]) < 0)
82 printf("%s Passed\n", __func__);
87 dummy_app_usage(const char *progname)
89 RTE_SET_USED(progname);
95 if (rte_set_application_usage_hook(dummy_app_usage) != NULL) {
96 printf("Non-NULL value returned for initial usage hook\n");
99 if (rte_set_application_usage_hook(NULL) != dummy_app_usage) {
100 printf("Incorrect value returned for application usage hook\n");
110 rte_dump_registers();
111 if (test_panic() < 0)
115 if (test_usage() < 0)
120 REGISTER_TEST_COMMAND(debug_autotest, test_debug);