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. */
| 235 | * be used as an API call, and returns 1 if memory errors were found or |
| 236 | * 0 if there were no errors detected. */ |
| 237 | int 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. |
no test coverage detected