Tests: add helpers for read*

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This commit is contained in:
Ronnie Sahlberg
2016-02-21 11:07:54 -08:00
parent 0a814db48f
commit c48283fe75
59 changed files with 377 additions and 603 deletions
+3 -8
View File
@@ -34,8 +34,7 @@ check_wacereq(void)
struct scsi_task *task_ret = NULL;
logging(LOG_VERBOSE, "Read one block from LBA 0");
read10(sd, &task_ret, 0, block_size, block_size,
0, 0, 0, 0, 0, NULL,
READ10(sd, &task_ret, 0, block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_PTR_NOT_NULL_FATAL(task_ret);
CU_ASSERT_NOT_EQUAL(task_ret->status, SCSI_STATUS_CANCELLED);
@@ -104,14 +103,10 @@ check_wacereq(void)
static void
check_lun_is_wiped(unsigned char *buf, uint64_t lba)
{
int ret;
unsigned char *rbuf = alloca(256 * block_size);
ret = read16(sd, NULL, lba, 256 * block_size,
block_size, 0, 0, 0, 0, 0, rbuf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
READ16(sd, NULL, lba, 256 * block_size, block_size, 0, 0, 0, 0, 0, rbuf,
EXPECT_STATUS_GOOD);
if (!memcmp(buf, rbuf, 256 * block_size)) {
logging(LOG_NORMAL, "[FAILED] Blocks were not wiped");
CU_FAIL("[FAILED] Blocks were not wiped");