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

Function memtest_test

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

Test the specified memory. The number of bytes must be multiple of 4096. * If interactive is true the program exists with an error and prints * ASCII arts to show progresses. Instead when interactive is 0, it can * be used as an API call, and returns 1 if memory errors were found or * 0 if there were no errors detected. */

Source from the content-addressed store, hash-verified

235 * be used as an API call, and returns 1 if memory errors were found or
236 * 0 if there were no errors detected. */
237int memtest_test(unsigned long *m, size_t bytes, int passes, int interactive) {
238 int pass = 0;
239 int errors = 0;
240
241 while (pass != passes) {
242 pass++;
243
244 if (interactive) memtest_progress_start("Addressing test",pass);
245 errors += memtest_addressing(m,bytes,interactive);
246 if (interactive) memtest_progress_end();
247
248 if (interactive) memtest_progress_start("Random fill",pass);
249 memtest_fill_random(m,bytes,interactive);
250 if (interactive) memtest_progress_end();
251 errors += memtest_compare_times(m,bytes,pass,4,interactive);
252
253 if (interactive) memtest_progress_start("Solid fill",pass);
254 memtest_fill_value(m,bytes,0,(unsigned long)-1,'S',interactive);
255 if (interactive) memtest_progress_end();
256 errors += memtest_compare_times(m,bytes,pass,4,interactive);
257
258 if (interactive) memtest_progress_start("Checkerboard fill",pass);
259 memtest_fill_value(m,bytes,ULONG_ONEZERO,ULONG_ZEROONE,'C',interactive);
260 if (interactive) memtest_progress_end();
261 errors += memtest_compare_times(m,bytes,pass,4,interactive);
262 }
263 return errors;
264}
265
266/* A version of memtest_test() that tests memory in small pieces
267 * in order to restore the memory content at exit.

Callers 1

memtest_alloc_and_testFunction · 0.85

Calls 6

memtest_progress_startFunction · 0.85
memtest_addressingFunction · 0.85
memtest_progress_endFunction · 0.85
memtest_fill_randomFunction · 0.85
memtest_compare_timesFunction · 0.85
memtest_fill_valueFunction · 0.85

Tested by

no test coverage detected