static int bio_test_device(bdev_t* device) { ssize_t num_errors = erase_test(device); if (num_errors < 0) { printf("error %ld performing erase test\n", num_errors); return -1; } printf("discovered %ld error(s) while testing erase.\n", num_errors); if (num_errors) { // No point in continuing the tests if we couldn't erase the device. printf("not continuing to test writes.\n"); return -1; } num_errors = write_test(device); printf("Discovered %ld error(s) while testing write.\n", num_errors); if (num_errors) { return -1; } printf ("Testing sub-erase...\n"); bool success = sub_erase_test(device, SUB_ERASE_TEST_SAMPLES); if (!success) { printf("Discovered errors while testing sub-erase.\n"); return -1; } else { printf("No errors while testing sub-erase.\n"); } return 0; }
static int bio_test_device(bdev_t *device) { ssize_t num_errors = erase_test(device); if (num_errors < 0) { printf("error %ld performing erase test\n", num_errors); return -1; } printf("discovered %ld error(s) while testing erase.\n", num_errors); if (num_errors) { // No point in continuing the tests if we couldn't erase the device. printf("not continuing to test writes.\n"); return -1; } num_errors = write_test(device); printf("Discovered %ld error(s) while testing write.\n", num_errors); if (num_errors) { return -1; } printf ("Testing sub-erase...\n"); bool success = sub_erase_test(device, SUB_ERASE_TEST_SAMPLES); if (!success) { printf("Discovered errors while testing sub-erase.\n"); return -1; } else { printf("No errors while testing sub-erase.\n"); } printf("Testing memory mapped mode...\n"); status_t test_result = memory_mapped_test(device); if (test_result != NO_ERROR) { printf("Memory mapped test returned error %d\n", test_result); } else { printf("Memory mapped mode tests returned successfully\n"); } return 0; }