Tests: helper for READCAPACITY16

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This commit is contained in:
Ronnie Sahlberg
2016-02-21 11:11:23 -08:00
parent c48283fe75
commit 935c2cba22
3 changed files with 19 additions and 21 deletions

View File

@@ -265,6 +265,20 @@ do { \
CU_ASSERT_EQUAL(_r, 0); \
} while (0);
#define READCAPACITY16(...) \
do { \
int _r; \
_r = readcapacity16(__VA_ARGS__); \
if (_r == -2) { \
logging(LOG_NORMAL, "[SKIPPED] READCAPACITY16 " \
"is not implemented."); \
CU_PASS("[SKIPPED] Target does not support " \
"READCAPACITY16. Skipping test"); \
return; \
} \
CU_ASSERT_EQUAL(_r, 0); \
} while (0);
#define RECEIVE_COPY_RESULTS(...) \
do { \
int _r; \

View File

@@ -29,20 +29,13 @@
void
test_readcapacity16_alloclen(void)
{
int i, ret;
int i;
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test that READCAPACITY16 with alloc_len 0-15 is not an error");
for (i = 0; i < 16; i++) {
ret = readcapacity16(sd, NULL, i,
EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] READCAPACITY16 is not implemented on this target and it does not claim SBC-3 support.");
CU_PASS("READCAPACITY16 is not implemented and no SBC-3 support claimed.");
return;
}
CU_ASSERT_EQUAL(ret, 0);
READCAPACITY16(sd, NULL, i,
EXPECT_STATUS_GOOD);
}
}

View File

@@ -29,18 +29,9 @@
void
test_readcapacity16_simple(void)
{
int ret;
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test that READCAPACITY16 works");
ret = readcapacity16(sd, NULL, 16,
EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] READCAPACITY16 is not implemented on this target and it does not claim support.");
CU_PASS("READCAPACITY16 is not implemented and no SBC-3 support claimed.");
return;
}
CU_ASSERT_EQUAL(ret, 0);
READCAPACITY16(sd, NULL, 16,
EXPECT_STATUS_GOOD);
}