test: Updated mii_test to work with latest api changes

Mostly for benching/leak check purpose

Signed-off-by: Michel Pollet <buserror@gmail.com>
This commit is contained in:
Michel Pollet 2023-10-28 06:30:25 +01:00
parent 3ee2a36d38
commit 8ed001203d

View File

@ -26,18 +26,27 @@ _mii_mish_bp(
int argc, int argc,
const char * argv[]); const char * argv[]);
int main() int main(
int argc,
const char * argv[])
{ {
mii_t *mii = &g_mii; mii_t *mii = &g_mii;
mii_init(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); mii_prepare(mii, MII_INIT_DEFAULT);
// int count = 100000; int count = 500000;
mish_prepare(0); mish_prepare(0);
mish_set_command_parameter(MII_MISH_KIND, &g_mii);
// add a breakpoint // add a breakpoint
const char *av[] = {"bp", "+d5fdr", NULL}; const char *av[] = {"bp", "+d5fdr", NULL};
_mii_mish_bp(NULL, 2, av); _mii_mish_bp(mii, 2, av);
do { do {
if (mii->state != MII_STOPPED) if (mii->state != MII_STOPPED)
mii_run(mii); mii_run(mii);
@ -56,6 +65,7 @@ int main()
// } // }
usleep(1000); usleep(1000);
} }
} while (1); } while (mii->state != MII_TERMINATE && count--);
mii_dispose(mii);
return 0; return 0;
} }