Perform an interactive test allocating the specified number of megabytes. */
| 334 | |
| 335 | /* Perform an interactive test allocating the specified number of megabytes. */ |
| 336 | void memtest_alloc_and_test(size_t megabytes, int passes) { |
| 337 | size_t bytes = megabytes*1024*1024; |
| 338 | unsigned long *m = malloc(bytes); |
| 339 | |
| 340 | if (m == NULL) { |
| 341 | fprintf(stderr,"Unable to allocate %zu megabytes: %s", |
| 342 | megabytes, strerror(errno)); |
| 343 | exit(1); |
| 344 | } |
| 345 | memtest_test(m,bytes,passes,1); |
| 346 | free(m); |
| 347 | } |
| 348 | |
| 349 | void memtest(size_t megabytes, int passes) { |
| 350 | #if !defined(__HAIKU__) |
no test coverage detected