pkarashchenko commented on code in PR #1406:
URL: 
https://github.com/apache/incubator-nuttx-apps/pull/1406#discussion_r1019876731


##########
testing/mm/mm_main.c:
##########
@@ -310,6 +310,60 @@ static void do_frees(FAR void **mem, FAR const int *size,
     }
 }
 
+static int mm_stress_test(int argc, FAR char *argv[])
+{
+  FAR unsigned char *tmp;
+  int delay = 1;
+  int prio = 0;
+  int size;
+  int i;
+
+  while ((i = getopt(argc, argv, "d:p:")) != ERROR)
+    {
+      if (i == 'd')
+        {
+          delay = atoi(optarg);
+        }
+      else if (i == 'p')
+        {
+          prio = atoi(optarg);
+        }
+      else
+        {
+          printf("Unrecognized option: '%c'\n", i);
+          return -EINVAL;
+        }
+    }
+
+  if (prio != 0)
+    {
+      struct sched_param param;
+
+      sched_getparam(0, &param);
+      param.sched_priority = prio;
+      sched_setparam(0, &param);
+    }
+
+  while (1)
+    {
+      size = random() % 1024 + 1;
+      tmp = malloc(size);
+      assert(tmp);
+
+      memset(tmp, 0xfe, size);
+      usleep(delay);
+
+      for (i = 0; i < size; i++)

Review Comment:
   Why not memcmp and assert the result?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to