From 8ed001203de72975159327803090eec199427073 Mon Sep 17 00:00:00 2001 From: Michel Pollet Date: Sat, 28 Oct 2023 06:30:25 +0100 Subject: [PATCH] test: Updated mii_test to work with latest api changes Mostly for benching/leak check purpose Signed-off-by: Michel Pollet --- test/mii_test.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/test/mii_test.c b/test/mii_test.c index 9c1193d..f2b0576 100644 --- a/test/mii_test.c +++ b/test/mii_test.c @@ -26,18 +26,27 @@ _mii_mish_bp( int argc, const char * argv[]); -int main() +int main( + int argc, + const char * argv[]) { mii_t *mii = &g_mii; mii_init(mii); + int idx = 1; + uint32_t flags = MII_INIT_DEFAULT; + int r = mii_argv_parse(&g_mii, argc, argv, &idx, &flags); + if (r == 0) { + printf("mii: Invalid argument %s, skipped\n", argv[idx]); + } else if (r == -1) + exit(1); mii_prepare(mii, MII_INIT_DEFAULT); -// int count = 100000; + int count = 500000; mish_prepare(0); - + mish_set_command_parameter(MII_MISH_KIND, &g_mii); // add a breakpoint const char *av[] = {"bp", "+d5fdr", NULL}; - _mii_mish_bp(NULL, 2, av); + _mii_mish_bp(mii, 2, av); do { if (mii->state != MII_STOPPED) mii_run(mii); @@ -56,6 +65,7 @@ int main() // } usleep(1000); } - } while (1); + } while (mii->state != MII_TERMINATE && count--); + mii_dispose(mii); return 0; }