X-Git-Url: https://gerrit.fd.io/r/gitweb?p=deb_dpdk.git;a=blobdiff_plain;f=app%2Ftest%2Ftest.h;h=467b9c07232f5e356a661e3d34505036ba60fec2;hp=81828bee7720a8dfd5f5c001eed674ff1d491910;hb=5d4e5dcd8a186778b3d78e27c81550d07a288fd2;hpb=a41e6ff15809d40e0f9bbc9576bf8f7f80fbec1d diff --git a/app/test/test.h b/app/test/test.h index 81828bee..467b9c07 100644 --- a/app/test/test.h +++ b/app/test/test.h @@ -250,11 +250,16 @@ struct test_command { void add_test_command(struct test_command *t); -#define REGISTER_TEST_COMMAND(t) \ -static void __attribute__((used)) testfn_##t(void);\ -void __attribute__((constructor, used)) testfn_##t(void)\ -{\ - add_test_command(&t);\ -} +/* Register a test function with its command string */ +#define REGISTER_TEST_COMMAND(cmd, func) \ + static struct test_command test_struct_##cmd = { \ + .command = RTE_STR(cmd), \ + .callback = func, \ + }; \ + static void __attribute__((constructor, used)) \ + test_register_##cmd(void) \ + { \ + add_test_command(&test_struct_##cmd); \ + } #endif