Skip to content

Commit 9dc907b

Browse files
committed
testing/mm: add maxsize parameter
Signed-off-by: hujun5 <[email protected]>
1 parent 7afa9b5 commit 9dc907b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

testing/mm/mm_main.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,9 @@ static int mm_stress_test(int argc, FAR char *argv[])
318318
int prio = 0;
319319
int size;
320320
int i;
321+
int maxsize = 1024;
321322

322-
while ((i = getopt(argc, argv, "d:p:")) != ERROR)
323+
while ((i = getopt(argc, argv, "d:p:s:")) != ERROR)
323324
{
324325
if (i == 'd')
325326
{
@@ -329,6 +330,10 @@ static int mm_stress_test(int argc, FAR char *argv[])
329330
{
330331
prio = atoi(optarg);
331332
}
333+
else if (i == 's')
334+
{
335+
maxsize = atoi(optarg);
336+
}
332337
else
333338
{
334339
printf("Unrecognized option: '%c'\n", i);
@@ -347,7 +352,7 @@ static int mm_stress_test(int argc, FAR char *argv[])
347352

348353
while (1)
349354
{
350-
size = random() % 1024 + 1;
355+
size = random() % maxsize + 1;
351356
tmp = malloc(size);
352357
assert(tmp);
353358

0 commit comments

Comments
 (0)