Skip to content

Commit

Permalink
testing/mm: add maxsize parameter
Browse files Browse the repository at this point in the history
Signed-off-by: hujun5 <[email protected]>
  • Loading branch information
hujun260 committed Jul 26, 2023
1 parent 7afa9b5 commit 9dc907b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions testing/mm/mm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,9 @@ static int mm_stress_test(int argc, FAR char *argv[])
int prio = 0;
int size;
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')
{
Expand All @@ -329,6 +330,10 @@ static int mm_stress_test(int argc, FAR char *argv[])
{
prio = atoi(optarg);
}
else if (i == 's')
{
maxsize = atoi(optarg);
}
else
{
printf("Unrecognized option: '%c'\n", i);
Expand All @@ -347,7 +352,7 @@ static int mm_stress_test(int argc, FAR char *argv[])

while (1)
{
size = random() % 1024 + 1;
size = random() % maxsize + 1;
tmp = malloc(size);
assert(tmp);

Expand Down

0 comments on commit 9dc907b

Please sign in to comment.