TESTS: UNMAP/WRITESAME10/16 Check LBPRZ before we read the unmapped blocks and verify they are blank.

This commit is contained in:
Ronnie Sahlberg
2013-05-15 17:10:20 -07:00
parent bdce246bc0
commit 8c22f8d986
6 changed files with 94 additions and 44 deletions

View File

@@ -1,4 +1,3 @@
/*
Copyright (C) 2013 Ronnie Sahlberg <ronniesahlberg@gmail.com>

View File

@@ -54,14 +54,23 @@ test_writesame10_unmap(void)
0, 1, 0, 0, NULL);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Read %d blocks and verify they are now zero", i);
ret = read10(iscsic, tgt_lun, 0,
i * block_size, block_size,
0, 0, 0, 0, 0, buf);
for (j = 0; j < block_size * i; j++) {
if (buf[j] != 0) {
CU_ASSERT_EQUAL(buf[j], 0);
if (rc16->lbprz) {
logging(LOG_VERBOSE, "LBPRZ is set. Read the unmapped "
"blocks back and verify they are all zero");
logging(LOG_VERBOSE, "Read %d blocks and verify they "
"are now zero", i);
ret = read10(iscsic, tgt_lun, 0,
i * block_size, block_size,
0, 0, 0, 0, 0, buf);
for (j = 0; j < block_size * i; j++) {
if (buf[j] != 0) {
CU_ASSERT_EQUAL(buf[j], 0);
}
}
} else {
logging(LOG_VERBOSE, "LBPRZ is clear. Skip the read "
"and verify zero test");
}
free(buf);
}
@@ -84,14 +93,23 @@ test_writesame10_unmap(void)
0, 1, 0, 0, buf);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Read %d blocks and verify they are now zero", i);
ret = read10(iscsic, tgt_lun, num_blocks - i,
i * block_size, block_size,
0, 0, 0, 0, 0, buf);
for (j = 0; j < block_size * i; j++) {
if (buf[j] != 0) {
CU_ASSERT_EQUAL(buf[j], 0);
if (rc16->lbprz) {
logging(LOG_VERBOSE, "LBPRZ is set. Read the unmapped "
"blocks back and verify they are all zero");
logging(LOG_VERBOSE, "Read %d blocks and verify they "
"are now zero", i);
ret = read10(iscsic, tgt_lun, num_blocks - i,
i * block_size, block_size,
0, 0, 0, 0, 0, buf);
for (j = 0; j < block_size * i; j++) {
if (buf[j] != 0) {
CU_ASSERT_EQUAL(buf[j], 0);
}
}
} else {
logging(LOG_VERBOSE, "LBPRZ is clear. Skip the read "
"and verify zero test");
}
free(buf);
}

View File

@@ -1,4 +1,3 @@
/*
Copyright (C) 2013 Ronnie Sahlberg <ronniesahlberg@gmail.com>

View File

@@ -54,14 +54,23 @@ test_writesame10_unmap_until_end(void)
0, 1, 0, 0, NULL);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Read %d blocks and verify they are now zero", i);
ret = read10(iscsic, tgt_lun, num_blocks - i,
i * block_size, block_size,
0, 0, 0, 0, 0, buf);
for (j = 0; j < block_size * i; j++) {
if (buf[j] != 0) {
CU_ASSERT_EQUAL(buf[j], 0);
if (rc16->lbprz) {
logging(LOG_VERBOSE, "LBPRZ is set. Read the unmapped "
"blocks back and verify they are all zero");
logging(LOG_VERBOSE, "Read %d blocks and verify they "
"are now zero", i);
ret = read10(iscsic, tgt_lun, num_blocks - i,
i * block_size, block_size,
0, 0, 0, 0, 0, buf);
for (j = 0; j < block_size * i; j++) {
if (buf[j] != 0) {
CU_ASSERT_EQUAL(buf[j], 0);
}
}
} else {
logging(LOG_VERBOSE, "LBPRZ is clear. Skip the read "
"and verify zero test");
}
free(buf);
}

View File

@@ -59,14 +59,22 @@ test_writesame16_unmap(void)
}
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Read %d blocks and verify they are now zero", i);
ret = read16(iscsic, tgt_lun, 0,
i * block_size, block_size,
0, 0, 0, 0, 0, buf);
for (j = 0; j < block_size * i; j++) {
if (buf[j] != 0) {
CU_ASSERT_EQUAL(buf[j], 0);
if (rc16->lbprz) {
logging(LOG_VERBOSE, "LBPRZ is set. Read the unmapped "
"blocks back and verify they are all zero");
logging(LOG_VERBOSE, "Read %d blocks and verify they "
"are now zero", i);
ret = read16(iscsic, tgt_lun, 0,
i * block_size, block_size,
0, 0, 0, 0, 0, buf);
for (j = 0; j < block_size * i; j++) {
if (buf[j] != 0) {
CU_ASSERT_EQUAL(buf[j], 0);
}
}
} else {
logging(LOG_VERBOSE, "LBPRZ is clear. Skip the read "
"and verify zero test");
}
}
@@ -86,14 +94,22 @@ test_writesame16_unmap(void)
0, 1, 0, 0, buf);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Read %d blocks and verify they are now zero", i);
ret = read16(iscsic, tgt_lun, num_blocks - i,
i * block_size, block_size,
0, 0, 0, 0, 0, buf);
for (j = 0; j < block_size * i; j++) {
if (buf[j] != 0) {
CU_ASSERT_EQUAL(buf[j], 0);
if (rc16->lbprz) {
logging(LOG_VERBOSE, "LBPRZ is set. Read the unmapped "
"blocks back and verify they are all zero");
logging(LOG_VERBOSE, "Read %d blocks and verify they "
"are now zero", i);
ret = read16(iscsic, tgt_lun, num_blocks - i,
i * block_size, block_size,
0, 0, 0, 0, 0, buf);
for (j = 0; j < block_size * i; j++) {
if (buf[j] != 0) {
CU_ASSERT_EQUAL(buf[j], 0);
}
}
} else {
logging(LOG_VERBOSE, "LBPRZ is clear. Skip the read "
"and verify zero test");
}
}

View File

@@ -58,14 +58,23 @@ test_writesame16_unmap_until_end(void)
}
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Read %d blocks and verify they are now zero", i);
ret = read16(iscsic, tgt_lun, num_blocks - i,
i * block_size, block_size,
0, 0, 0, 0, 0, buf);
for (j = 0; j < block_size * i; j++) {
if (buf[j] != 0) {
CU_ASSERT_EQUAL(buf[j], 0);
if (rc16->lbprz) {
logging(LOG_VERBOSE, "LBPRZ is set. Read the unmapped "
"blocks back and verify they are all zero");
logging(LOG_VERBOSE, "Read %d blocks and verify they "
"are now zero", i);
ret = read16(iscsic, tgt_lun, num_blocks - i,
i * block_size, block_size,
0, 0, 0, 0, 0, buf);
for (j = 0; j < block_size * i; j++) {
if (buf[j] != 0) {
CU_ASSERT_EQUAL(buf[j], 0);
}
}
} else {
logging(LOG_VERBOSE, "LBPRZ is clear. Skip the read "
"and verify zero test");
}
}
}