Tests: add getlbastatus helper

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This commit is contained in:
Ronnie Sahlberg
2016-02-21 11:53:29 -08:00
parent 23a9278e23
commit 05fb882e19
5 changed files with 50 additions and 83 deletions

View File

@@ -29,31 +29,18 @@
void
test_get_lba_status_simple(void)
{
int i, ret;
int i;
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test GET_LBA_STATUS of 1-256 blocks at the start of the LUN");
logging(LOG_VERBOSE, "Test GETLBASTATUS of 1-256 blocks at the start of the LUN");
for (i = 1; i <= 256; i++) {
ret = get_lba_status(sd, NULL, i, 24,
EXPECT_STATUS_GOOD);
if (ret == -2) {
CU_PASS("[SKIPPED] Target does not support GET_LBA_STATUS. Skipping test");
return;
}
if (ret != 0) {
CU_FAIL("[FAILED] GET_LBA_STATUS command failed");
return;
}
GETLBASTATUS(sd, NULL, i, 24,
EXPECT_STATUS_GOOD);
}
logging(LOG_VERBOSE, "Test GET_LBA_STATUS of 1-256 blocks at the end of the LUN");
logging(LOG_VERBOSE, "Test GETLBASTATUS of 1-256 blocks at the end of the LUN");
for (i = 1; i <= 256; i++) {
ret = get_lba_status(sd, NULL, num_blocks - i, 24,
EXPECT_STATUS_GOOD);
if (ret != 0) {
CU_FAIL("[FAILED] GET_LBA_STATUS command failed");
return;
}
GETLBASTATUS(sd, NULL, num_blocks - i, 24,
EXPECT_STATUS_GOOD);
}
}