MCPcopy Create free account
hub / github.com/F-Stack/f-stack / memtest_addressing

Function memtest_addressing

app/redis-6.2.6/src/memtest.c:93–121  ·  view source on GitHub ↗

Test that addressing is fine. Every location is populated with its own * address, and finally verified. This test is very fast but may detect * ASAP big issues with the memory subsystem. */

Source from the content-addressed store, hash-verified

91 * address, and finally verified. This test is very fast but may detect
92 * ASAP big issues with the memory subsystem. */
93int memtest_addressing(unsigned long *l, size_t bytes, int interactive) {
94 unsigned long words = bytes/sizeof(unsigned long);
95 unsigned long j, *p;
96
97 /* Fill */
98 p = l;
99 for (j = 0; j < words; j++) {
100 *p = (unsigned long)p;
101 p++;
102 if ((j & 0xffff) == 0 && interactive)
103 memtest_progress_step(j,words*2,'A');
104 }
105 /* Test */
106 p = l;
107 for (j = 0; j < words; j++) {
108 if (*p != (unsigned long)p) {
109 if (interactive) {
110 printf("\n*** MEMORY ADDRESSING ERROR: %p contains %lu\n",
111 (void*) p, *p);
112 exit(1);
113 }
114 return 1;
115 }
116 p++;
117 if ((j & 0xffff) == 0 && interactive)
118 memtest_progress_step(j+words,words*2,'A');
119 }
120 return 0;
121}
122
123/* Fill words stepping a single page at every write, so we continue to
124 * touch all the pages in the smallest amount of time reducing the

Callers 2

memtest_testFunction · 0.85
memtest_preserving_testFunction · 0.85

Calls 2

memtest_progress_stepFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected