From 7daeca62b039719a8b76ad3f8d87d60b702fbda3 Mon Sep 17 00:00:00 2001 From: hujun5 Date: Wed, 21 Jun 2023 15:34:50 +0800 Subject: [PATCH] testing/mm: add maxsize parameter Signed-off-by: hujun5 --- testing/mm/mm_main.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/testing/mm/mm_main.c b/testing/mm/mm_main.c index 2ee80e027..0c6771adf 100644 --- a/testing/mm/mm_main.c +++ b/testing/mm/mm_main.c @@ -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') { @@ -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); @@ -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);