This is an automated email from the ASF dual-hosted git repository.

ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new f618031  util/cbmem: Fix hosted test
f618031 is described below

commit f6180319b509bdd9763e17a20df98a2a1137413b
Author: Christopher Collins <[email protected]>
AuthorDate: Wed Mar 13 09:27:43 2019 -0700

    util/cbmem: Fix hosted test
    
    The hosted cbmem test tries to allocate a 64kB buffer in BSS.   This is
    due to a blind copy and paste from the cbmem self test.
    
    This commit reduces this buffer to 2kB.
---
 util/cbmem/hosttest/include/cbmem_test/cbmem_test.h | 5 +++--
 util/cbmem/hosttest/src/cbmem_test.c                | 2 +-
 util/cbmem/selftest/include/cbmem_test/cbmem_test.h | 5 +++--
 util/cbmem/selftest/src/cbmem_test.c                | 2 +-
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/util/cbmem/hosttest/include/cbmem_test/cbmem_test.h 
b/util/cbmem/hosttest/include/cbmem_test/cbmem_test.h
index 01a3559..c7d15b4 100644
--- a/util/cbmem/hosttest/include/cbmem_test/cbmem_test.h
+++ b/util/cbmem/hosttest/include/cbmem_test/cbmem_test.h
@@ -28,8 +28,9 @@
 #include "testutil/testutil.h"
 #include "cbmem/cbmem.h"
 
-#define CBMEM1_BUF_SIZE (64 * 1024)
-#define CBMEM1_ENTRY_SIZE 1024
+#define CBMEM1_ENTRY_COUNT  32
+#define CBMEM1_ENTRY_SIZE   64
+#define CBMEM1_BUF_SIZE     (CBMEM1_ENTRY_COUNT * CBMEM1_ENTRY_SIZE)
 
 extern struct cbmem cbmem1;
 extern uint8_t cbmem1_buf[CBMEM1_BUF_SIZE];
diff --git a/util/cbmem/hosttest/src/cbmem_test.c 
b/util/cbmem/hosttest/src/cbmem_test.c
index 08c0c66..cf8f2ff 100644
--- a/util/cbmem/hosttest/src/cbmem_test.c
+++ b/util/cbmem/hosttest/src/cbmem_test.c
@@ -54,7 +54,7 @@ setup_cbmem1(void *arg)
      * entries, so there should be a total of 63 entries.
      * Ensure no data corruption.
      */
-    for (i = 0; i < 65; i++) {
+    for (i = 0; i < CBMEM1_ENTRY_COUNT + 1; i++) {
         cbmem1_entry[0] = i;
         rc = cbmem_append(&cbmem1, cbmem1_entry, sizeof(cbmem1_entry));
         TEST_ASSERT_FATAL(rc == 0, "Could not append entry %d, rc = %d", i, 
rc);
diff --git a/util/cbmem/selftest/include/cbmem_test/cbmem_test.h 
b/util/cbmem/selftest/include/cbmem_test/cbmem_test.h
index 01a3559..8b2c972 100644
--- a/util/cbmem/selftest/include/cbmem_test/cbmem_test.h
+++ b/util/cbmem/selftest/include/cbmem_test/cbmem_test.h
@@ -28,8 +28,9 @@
 #include "testutil/testutil.h"
 #include "cbmem/cbmem.h"
 
-#define CBMEM1_BUF_SIZE (64 * 1024)
-#define CBMEM1_ENTRY_SIZE 1024
+#define CBMEM1_ENTRY_COUNT  64
+#define CBMEM1_ENTRY_SIZE   1024
+#define CBMEM1_BUF_SIZE     (CBMEM1_ENTRY_COUNT * CBMEM1_ENTRY_SIZE)
 
 extern struct cbmem cbmem1;
 extern uint8_t cbmem1_buf[CBMEM1_BUF_SIZE];
diff --git a/util/cbmem/selftest/src/cbmem_test.c 
b/util/cbmem/selftest/src/cbmem_test.c
index afbf796..d4574c7 100644
--- a/util/cbmem/selftest/src/cbmem_test.c
+++ b/util/cbmem/selftest/src/cbmem_test.c
@@ -54,7 +54,7 @@ setup_cbmem1(void *arg)
      * entries, so there should be a total of 63 entries.
      * Ensure no data corruption.
      */
-    for (i = 0; i < 65; i++) {
+    for (i = 0; i < CBMEM1_ENTRY_COUNT + 1; i++) {
         cbmem1_entry[0] = i;
         rc = cbmem_append(&cbmem1, cbmem1_entry, sizeof(cbmem1_entry));
         TEST_ASSERT_FATAL(rc == 0, "Could not append entry %d, rc = %d", i, 
rc);

Reply via email to