test-tool: Give up if READ CAPACITY reports that the block size is zero

Since the test tool can't proceed in a meaningful way if the block size
is zero, give up if the SCSI target reports that the block size is zero.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
This commit is contained in:
Bart Van Assche
2019-12-22 09:27:32 -08:00
parent e1978f991a
commit 69c4783d2d

View File

@@ -1301,6 +1301,10 @@ main(int argc, char *argv[])
block_size = rc10->block_size;
num_blocks = rc10->lba + 1;
scsi_free_scsi_task(task);
if (block_size == 0) {
printf("block_size is zero - giving up.\n");
goto err_sds_free;
}
rc16_task = NULL;
readcapacity16(sd, &rc16_task, 96, EXPECT_STATUS_GOOD);
@@ -1318,6 +1322,10 @@ main(int argc, char *argv[])
block_size = rc16->block_length;
num_blocks = rc16->returned_lba + 1;
lbppb = 1 << rc16->lbppbe;
if (block_size == 0) {
printf("block_size is zero - giving up.\n");
goto err_sds_free;
}
}
/* create a really big buffer we can use in the tests */