#include "omtTest.h"
#include "omalloc.h"
Go to the source code of this file.
|
void | omtTestDebug (omMemCell cell) |
|
void | TestAddrContentEqual (void *s1, void *s2, size_t size) |
|
void | TestAddrContent (void *addr, unsigned long value, size_t size) |
|
void | InitCellAddrContent (omMemCell cell) |
|
void | omCheckCells (int n, int level, omMemCell_t *cells) |
|
int | MyRandSpec () |
|
void | TestAlloc (omMemCell cell, unsigned long spec) |
|
void | TestRealloc (omMemCell cell, unsigned long spec) |
|
void | TestDup (omMemCell cell, unsigned long spec) |
|
void | TestFree (omMemCell cell) |
|
omBin | omtGetStickyBin (omBin bin) |
|
void | omtMergeStickyBins (omMemCell cell, int n) |
|
void | my_exit () |
|
int | main (int argc, char *argv[]) |
|
◆ OM_CHECK
◆ InitCellAddrContent()
Definition at line 130 of file omtTest.c.
131{
134}
#define omMemsetW(P1, W, L)
◆ main()
Definition at line 336 of file omtTest.c.
337{
339 unsigned long spec,
j;
340 int n = 1;
347
349
354
358
361
365 while (1)
366 {
368 {
370 printf(
"\nCells: %d KeptAddr:%d AlwaysKeptAddr:%d\n",
n_cells,
373#else
374 0, 0
376 );
377
378 printf(
"Checking Memory and all cells ");
386#if CHECK_LEVEL > 0 && TRACK_LEVEL > 0
388 {
391 {
393 }
394 }
395#endif
398 {
401 }
406 if (
om_Info.CurrentRegionsAlloc > 0)
407 {
410 }
413 n--;
415 {
417 }
418 else
419 {
421 }
422 }
427 {
429 {
436 }
437 }
439 {
441 {
447 }
448 }
450 {
452 {
458 }
459 }
460 else
461 {
467 {
470 }
471 }
474
476 {
480 }
481#if 0
483 {
485 {
487 }
488 }
489#endif
490 }
491 return 0;
492}
void * om_AlwaysKeptAddrs
#define omInitGetBackTrace()
#define omListLength(ptr)
void TestAlloc(omMemCell cell, unsigned long spec)
omMemCell_t cells[MAX_CELLS]
void TestFree(omMemCell cell)
void omtMergeStickyBins(omMemCell cell, int n)
void TestRealloc(omMemCell cell, unsigned long spec)
void omtTestDebug(omMemCell cell)
void omCheckCells(int n, int level, omMemCell_t *cells)
void TestDup(omMemCell cell, unsigned long spec)
#define myprintf(format, args...)
#define omPrintUsedAddrs(F, max)
#define omPrintBinStats(F)
#define omInitRet_2_Info(argv0)
◆ my_exit()
Definition at line 318 of file omtTest.c.
319{
320 printf(
"\nomtTest Summary: ");
322 {
327 }
328 else
329 {
332 }
333}
◆ MyRandSpec()
Definition at line 166 of file omtTest.c.
167{
168 unsigned long spec =
random() + 1;
170 {
174 }
178 return spec;
179}
#define SET_SIZE(spec, size)
◆ omCheckCells()
Definition at line 136 of file omtTest.c.
137{
138#if END_CHECK_LEVEL > 0
141
145 {
148 {
151 }
152 if ((
i % 10000) == 0)
153 {
156 }
157 }
159#endif
160}
omError_t omTestMemory(int check_level)
◆ omtGetStickyBin()
Definition at line 275 of file omtTest.c.
276{
281}
#define omFindInGList(ptr, next, what, value)
#define omGetStickyBinOfBin(B)
◆ omtMergeStickyBins()
Definition at line 283 of file omtTest.c.
284{
287
289 {
291 {
294
297 }
298 }
299
302 {
304 {
309 }
310 else
311 {
312 bin = bin->next;
313 }
314 }
315}
#define __omFreeBinAddr(addr)
#define omRemoveFromGList(ptr, next, addr)
#define omIsOnGList(ptr, next, addr)
omBinPage_t om_ZeroPage[]
#define omMergeStickyBinIntoBin(A, B)
◆ omtTestDebug()
Definition at line 36 of file omtTest.c.
37{
40
43 {
46 else
48 }
49 else
50 {
53 else
55 }
57
59 {
61 "addr:%p is unaligned",
cell->addr);
62 return;
63 }
64
66 {
68 "addr:%p is not strict unaligned",
cell->addr);
69 return;
70 }
71
74 {
77 return;
78 }
79
81 {
84 return;
85 }
86
88}
#define omDebugAddrAlignedBin
#define omDebugAddrAlignedSize
#define omDebugAddrSize(addr, size)
#define omDebugAddrBin(addr, bin)
size_t omSizeOfAddr(const void *addr)
omError_t omReportError(omError_t error, omError_t report_error, OM_FLR_DECL, const char *fmt,...)
void TestAddrContent(void *addr, unsigned long value, size_t size)
◆ TestAddrContent()
Definition at line 106 of file omtTest.c.
107{
110
112 {
114 "addr %p unaligned", addr);
115 return;
116 }
117
118 for (
i=0;
i<sizeW;
i++)
119 {
120 if (((
unsigned long*)addr)[
i] != value)
121 {
123 "word %d modified: is %u should be %u",
i, ((
unsigned long*)addr)[
i], value);
124 return;
125 }
126 }
127}
◆ TestAddrContentEqual()
Definition at line 90 of file omtTest.c.
91{
94
95 for (
i=0;
i<sizeW;
i++)
96 {
97 if (((
unsigned long*)
s1)[
i] != ((
unsigned long*)
s2)[
i])
98 {
100 "s1[%u]==%d != s2[%u]==%d",
i, ((
unsigned long*)
s1)[
i],
i, ((
unsigned long*)
s2)[
i]);
101 return;
102 }
103 }
104}
◆ TestAlloc()
Definition at line 182 of file omtTest.c.
183{
185 {
188 else
190
193 else
195 }
196 else
199 {
202 }
203}
void omtTestAlloc(omMemCell cell, unsigned long spec)
void omtTestAllocKeep(omMemCell cell, unsigned long spec)
void omtTestAllocDebug(omMemCell cell, unsigned long spec)
◆ TestDup()
Definition at line 228 of file omtTest.c.
229{
231 {
234 else
236
239 else
241 }
242 else
244
246 {
249 }
250}
void omtTestDup(omMemCell cell, unsigned long spec)
void omtTestDupDebug(omMemCell cell, unsigned long spec)
void omtTestDupKeep(omMemCell cell, unsigned long spec)
◆ TestFree()
Definition at line 252 of file omtTest.c.
253{
255 {
257 {
260 else
262 }
263 else
264 {
266 }
268 {
271 }
272 }
273}
#define DO_FREE_CHECK(spec)
void omtTestFreeDebug(omMemCell cell)
void omtTestFree(omMemCell cell)
void omtTestFreeKeep(omMemCell cell)
◆ TestRealloc()
Definition at line 205 of file omtTest.c.
206{
208 {
211 else
213
216 else
218 }
219 else
222 {
225 }
226}
void omtTestReallocDebug(omMemCell cell, unsigned long spec)
void omtTestReallocKeep(omMemCell cell, unsigned long spec)
void omtTestRealloc(omMemCell cell, unsigned long spec)
◆ cells
◆ errors
◆ missed_errors
◆ seed
◆ size_range
◆ size_range_number
◆ used_regions