Tests: Add helpers for WRITESAME

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This commit is contained in:
Ronnie Sahlberg
2016-02-21 08:57:26 -08:00
parent 4d1e3aecd0
commit 0b5b724f17
15 changed files with 169 additions and 276 deletions

View File

@@ -30,7 +30,6 @@
void
test_writesame16_unmap_until_end(void)
{
int ret;
unsigned int i;
CHECK_FOR_DATALOSS;
@@ -56,15 +55,9 @@ test_writesame16_unmap_until_end(void)
logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME16", i);
memset(scratch, 0, block_size);
ret = writesame16(sd, num_blocks - i,
block_size, 0, 0, 1, 0, 0, scratch,
EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] WRITESAME16 is not implemented.");
CU_PASS("[SKIPPED] Target does not support WRITESAME16. Skipping test");
return;
}
CU_ASSERT_EQUAL(ret, 0);
WRITESAME16(sd, num_blocks - i,
block_size, 0, 0, 1, 0, 0, scratch,
EXPECT_STATUS_GOOD);
if (rc16->lbprz) {
logging(LOG_VERBOSE, "LBPRZ is set. Read the unmapped "
@@ -72,10 +65,10 @@ test_writesame16_unmap_until_end(void)
logging(LOG_VERBOSE, "Read %d blocks and verify they "
"are now zero", i);
ret = read16(sd, NULL, num_blocks - i,
i * block_size, block_size,
0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD);
read16(sd, NULL, num_blocks - i,
i * block_size, block_size,
0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD);
CU_ASSERT(all_zeroes(scratch, i * block_size));
} else {
logging(LOG_VERBOSE, "LBPRZ is clear. Skip the read "