testing/mm: add maxsize parameter

Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
hujun5 2023-06-21 15:34:50 +08:00 committed by Xiang Xiao
parent 7afa9b51ea
commit 7daeca62b0

View File

@ -318,8 +318,9 @@ static int mm_stress_test(int argc, FAR char *argv[])
int prio = 0; int prio = 0;
int size; int size;
int i; int i;
int maxsize = 1024;
while ((i = getopt(argc, argv, "d:p:")) != ERROR) while ((i = getopt(argc, argv, "d:p:s:")) != ERROR)
{ {
if (i == 'd') if (i == 'd')
{ {
@ -329,6 +330,10 @@ static int mm_stress_test(int argc, FAR char *argv[])
{ {
prio = atoi(optarg); prio = atoi(optarg);
} }
else if (i == 's')
{
maxsize = atoi(optarg);
}
else else
{ {
printf("Unrecognized option: '%c'\n", i); printf("Unrecognized option: '%c'\n", i);
@ -347,7 +352,7 @@ static int mm_stress_test(int argc, FAR char *argv[])
while (1) while (1)
{ {
size = random() % 1024 + 1; size = random() % maxsize + 1;
tmp = malloc(size); tmp = malloc(size);
assert(tmp); assert(tmp);