a test for CmiMemoryUsage()
authorGengbin Zheng <gzheng@newskillz.(none)>
Wed, 17 Feb 2010 02:30:28 +0000 (20:30 -0600)
committerGengbin Zheng <gzheng@newskillz.(none)>
Wed, 17 Feb 2010 02:30:28 +0000 (20:30 -0600)
tests/util/check.C

index 2da5ebb2dbfd81f360e1c6b948abb336ee8fee70..8d0257a8932c4dbaab26806605a3d4d4c74dec56 100644 (file)
@@ -48,6 +48,16 @@ void check_test(int argc, char** argv) {
     CmiPrintf("Error: sizeof(CmiFloat8) is %d!\n",sizeof(float8));
     exit(1);
   }
+
+  CmiUInt8 mem_before = CmiMemoryUsage();
+  void *buf = CmiAlloc(1024);
+  CmiUInt8 mem_after = CmiMemoryUsage();
+  CmiFree(buf);
+  if (mem_after - mem_before < 1024) {
+    CmiPrintf("Error: CmiMemoryUsage() does not work!\n");
+    exit(1);
+  }
+
   CmiPrintf("All tests passed\n");
   CmiPrintf("Info: converse header: %d envelope: %d\n", CmiReservedHeaderSize, sizeof(envelope));
 }