TESTS: Add VERIFY16 tests
This commit is contained in:
@@ -197,6 +197,13 @@ bin_iscsi_test_cu_SOURCES = test-tool/iscsi-test-cu.c \
|
||||
test-tool/test_read16_rdprotect.c \
|
||||
test-tool/test_read16_flags.c \
|
||||
test-tool/test_readcapacity10_simple.c \
|
||||
test-tool/test_verify16_simple.c \
|
||||
test-tool/test_verify16_beyond_eol.c \
|
||||
test-tool/test_verify16_0blocks.c \
|
||||
test-tool/test_verify16_vrprotect.c \
|
||||
test-tool/test_verify16_flags.c \
|
||||
test-tool/test_verify16_mismatch.c \
|
||||
test-tool/test_verify16_mismatch_no_cmp.c \
|
||||
test-tool/test_write10_simple.c \
|
||||
test-tool/test_write10_beyond_eol.c \
|
||||
test-tool/test_write10_0blocks.c \
|
||||
|
||||
@@ -76,7 +76,7 @@ int T0270_verify16_simple(const char *initiator, const char *url)
|
||||
/* verify the first 1 - 256 blocks at the start of the LUN */
|
||||
printf("Verify first 1-256 blocks.\n");
|
||||
for (i = 1; i <= 256; i++) {
|
||||
ret = verify16(iscsi, lun, buf, i * block_size, 0, 0, 1, 1, block_size);
|
||||
ret = verify16(iscsi, lun, 0, i * block_size, block_size, 0, 1, 1, buf);
|
||||
if (ret != 0) {
|
||||
goto finished;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ int T0271_verify16_mismatch(const char *initiator, const char *url)
|
||||
/* flip a random byte in the data */
|
||||
buf[offset] ^= 'X';
|
||||
|
||||
ret = verify16_miscompare(iscsi, lun, buf, i * block_size, 0, 0, 1, 1, block_size);
|
||||
ret = verify16_miscompare(iscsi, lun, 0, i * block_size, block_size, 0, 1, 1, buf);
|
||||
if (ret != 0) {
|
||||
goto finished;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ int T0272_verify16_mismatch_no_cmp(const char *initiator, const char *url)
|
||||
/* flip a random byte in the data */
|
||||
buf[offset] ^= 'X';
|
||||
|
||||
ret = verify16(iscsi, lun, buf, i * block_size, 0, 0, 1, 0, block_size);
|
||||
ret = verify16(iscsi, lun, 0, i * block_size, block_size, 0, 1, 0, buf);
|
||||
if (ret != 0) {
|
||||
goto finished;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ int T0273_verify16_beyondeol(const char *initiator, const char *url)
|
||||
/* verify 2 - 256 blocks beyond the end of the device */
|
||||
printf("Verifying 2-256 blocks beyond end-of-device.\n");
|
||||
for (i = 2; i <= 256; i++) {
|
||||
ret = verify16_lbaoutofrange(iscsi, lun, buf, i * block_size, num_blocks, 0, 1, 1, block_size);
|
||||
ret = verify16_lbaoutofrange(iscsi, lun, num_blocks, i * block_size, block_size, 0, 1, 1, buf);
|
||||
if (ret != 0) {
|
||||
goto finished;
|
||||
}
|
||||
@@ -59,7 +59,7 @@ int T0273_verify16_beyondeol(const char *initiator, const char *url)
|
||||
/* verify 1 - 256 blocks at LBA 2^63 */
|
||||
printf("Verifying 1-256 blocks at LBA 2^63.\n");
|
||||
for (i = 1; i <= 256; i++) {
|
||||
ret = verify16_lbaoutofrange(iscsi, lun, buf, i * block_size, 0x8000000000000000, 0, 1, 1, block_size);
|
||||
ret = verify16_lbaoutofrange(iscsi, lun, 0x8000000000000000, i * block_size, block_size, 0, 1, 1, buf);
|
||||
if (ret != 0) {
|
||||
goto finished;
|
||||
}
|
||||
@@ -68,7 +68,7 @@ int T0273_verify16_beyondeol(const char *initiator, const char *url)
|
||||
/* verify 1 - 256 blocks at LBA -1 */
|
||||
printf("Verifying 1-256 blocks at LBA -1.\n");
|
||||
for (i = 1; i <= 256; i++) {
|
||||
ret = verify16_lbaoutofrange(iscsi, lun, buf, i * block_size, 0xffffffffffffffff, 0, 1, 1, block_size);
|
||||
ret = verify16_lbaoutofrange(iscsi, lun, 0xffffffffffffffff, i * block_size, block_size, 0, 1, 1, buf);
|
||||
if (ret != 0) {
|
||||
goto finished;
|
||||
}
|
||||
|
||||
@@ -321,7 +321,7 @@ int T0370_nomedia(const char *initiator, const char *url)
|
||||
}
|
||||
|
||||
printf("Test VERIFY16.\n");
|
||||
ret = verify16_nomedium(iscsi, lun, buf, block_size, 0, 0, 0, 1, block_size);
|
||||
ret = verify16_nomedium(iscsi, lun, 0, block_size, block_size, 0, 0, 1, buf);
|
||||
if (ret != 0) {
|
||||
goto finished;
|
||||
}
|
||||
|
||||
@@ -1720,148 +1720,180 @@ verify12_lbaoutofrange(struct iscsi_context *iscsi, int lun, unsigned char *data
|
||||
}
|
||||
|
||||
int
|
||||
verify16(struct iscsi_context *iscsi, int lun, unsigned char *data, uint32_t datalen, uint64_t lba, int vprotect, int dpo, int bytchk, int blocksize)
|
||||
verify16(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int vprotect, int dpo, int bytchk, unsigned char *data)
|
||||
{
|
||||
struct scsi_task *task;
|
||||
|
||||
printf("Send VERIFY16 LBA:%" PRIu64 " blocks:%d vprotect:%d dpo:%d bytchk:%d ... ", lba, datalen / blocksize, vprotect, dpo, bytchk);
|
||||
logging(LOG_VERBOSE, "Send VERIFY16 LBA:%" PRIu64 " blocks:%d vprotect:%d dpo:%d bytchk:%d", lba, datalen / blocksize, vprotect, dpo, bytchk);
|
||||
task = iscsi_verify16_sync(iscsi, lun, data, datalen, lba, vprotect, dpo, bytchk, blocksize);
|
||||
if (task == NULL) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send VERIFY16 command: %s\n", iscsi_get_error(iscsi));
|
||||
logging(LOG_NORMAL, "[FAILED] Failed to send VERIFY16 command: %s",
|
||||
iscsi_get_error(iscsi));
|
||||
return -1;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_CHECK_CONDITION
|
||||
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
|
||||
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
|
||||
printf("[SKIPPED]\n");
|
||||
printf("VERIFY16 is not implemented on target\n");
|
||||
logging(LOG_NORMAL, "[SKIPPED] VERIFY16 is not implemented on target");
|
||||
scsi_free_scsi_task(task);
|
||||
return -2;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("VERIFY16 command: failed with sense. %s\n", iscsi_get_error(iscsi));
|
||||
logging(LOG_NORMAL, "[FAILED] VERIFY16 command: failed with sense. %s", iscsi_get_error(iscsi));
|
||||
scsi_free_scsi_task(task);
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("[OK]\n");
|
||||
scsi_free_scsi_task(task);
|
||||
logging(LOG_VERBOSE, "[OK] VERIFY16 returned SUCCESS.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
verify16_nomedium(struct iscsi_context *iscsi, int lun, unsigned char *data, uint32_t datalen, uint64_t lba, int vprotect, int dpo, int bytchk, int blocksize)
|
||||
verify16_nomedium(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int vprotect, int dpo, int bytchk, unsigned char *data)
|
||||
{
|
||||
struct scsi_task *task;
|
||||
|
||||
printf("Send VERIFY16 LBA:%" PRIu64 " blocks:%d vprotect:%d dpo:%d bytchk:%d (expecting NOT_READY/MEDIUM_NOT_PRESENT) ... ", lba, datalen / blocksize, vprotect, dpo, bytchk);
|
||||
logging(LOG_VERBOSE, "Send VERIFY16 LBA:%" PRIu64 " blocks:%d vprotect:%d dpo:%d bytchk:%d (expecting NOT_READY/MEDIUM_NOT_PRESENT)", lba, datalen / blocksize, vprotect, dpo, bytchk);
|
||||
task = iscsi_verify16_sync(iscsi, lun, data, datalen, lba, vprotect, dpo, bytchk, blocksize);
|
||||
if (task == NULL) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send VERIFY16 command: %s\n", iscsi_get_error(iscsi));
|
||||
logging(LOG_NORMAL, "[FAILED] Failed to send VERIFY16 command: %s",
|
||||
iscsi_get_error(iscsi));
|
||||
return -1;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_CHECK_CONDITION
|
||||
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
|
||||
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
|
||||
printf("[SKIPPED]\n");
|
||||
printf("VERIFY16 is not implemented on target\n");
|
||||
logging(LOG_NORMAL, "[SKIPPED] VERIFY16 is not implemented on target");
|
||||
scsi_free_scsi_task(task);
|
||||
return -2;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_GOOD) {
|
||||
logging(LOG_NORMAL, "[FAILED] VERIFY16 successful but should have failed with NOT_READY/MEDIUM_NOT_PRESENT*");
|
||||
scsi_free_scsi_task(task);
|
||||
return -1;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_CHECK_CONDITION
|
||||
|| task->sense.key != SCSI_SENSE_NOT_READY
|
||||
|| (task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT
|
||||
&& task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT_TRAY_OPEN
|
||||
&& task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT_TRAY_CLOSED)) {
|
||||
printf("[FAILED]\n");
|
||||
printf("VERIFY16 after eject failed with the wrong sense code. Should fail with NOT_READY/MEDIUM_NOT_PRESENT*\n");
|
||||
logging(LOG_NORMAL, "[FAILED] VERIFY16 after eject failed with the wrong sense code. Should fail with NOT_READY/MEDIUM_NOT_PRESENT* but failed with %s", iscsi_get_error(iscsi));
|
||||
scsi_free_scsi_task(task);
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("[OK]\n");
|
||||
scsi_free_scsi_task(task);
|
||||
logging(LOG_VERBOSE, "[OK] VERIFY16 returned NOT_READY/MEDIUM_NOT_PRESENT.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
verify16_miscompare(struct iscsi_context *iscsi, int lun, unsigned char *data, uint32_t datalen, uint64_t lba, int vprotect, int dpo, int bytchk, int blocksize)
|
||||
verify16_miscompare(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int vprotect, int dpo, int bytchk, unsigned char *data)
|
||||
{
|
||||
struct scsi_task *task;
|
||||
|
||||
printf("Send VERIFY16 LBA:%" PRIu64 " blocks:%d vprotect:%d dpo:%d bytchk:%d (expecting MISCOMPARE) ... ", lba, datalen / blocksize, vprotect, dpo, bytchk);
|
||||
logging(LOG_VERBOSE, "Send VERIFY16 LBA:%" PRIu64 " blocks:%d vprotect:%d dpo:%d bytchk:%d (expecting MISCOMPARE)", lba, datalen / blocksize, vprotect, dpo, bytchk);
|
||||
task = iscsi_verify16_sync(iscsi, lun, data, datalen, lba, vprotect, dpo, bytchk, blocksize);
|
||||
if (task == NULL) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send VERIFY16 command: %s\n", iscsi_get_error(iscsi));
|
||||
logging(LOG_NORMAL, "[FAILED] Failed to send VERIFY16 command: %s",
|
||||
iscsi_get_error(iscsi));
|
||||
return -1;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_CHECK_CONDITION
|
||||
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
|
||||
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
|
||||
printf("[SKIPPED]\n");
|
||||
printf("VERIFY16 is not implemented on target\n");
|
||||
logging(LOG_NORMAL, "[SKIPPED] VERIFY16 is not implemented on target");
|
||||
scsi_free_scsi_task(task);
|
||||
return -2;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("VERIFY16 command successful but should have failed with MISCOMPARE\n");
|
||||
logging(LOG_NORMAL, "[FAILED] VERIFY16 successful but should have failed with MISCOMPARE");
|
||||
scsi_free_scsi_task(task);
|
||||
return -1;
|
||||
}
|
||||
if (task->sense.key != SCSI_SENSE_MISCOMPARE) {
|
||||
printf("[FAILED]\n");
|
||||
printf("VERIFY16 command returned wrong sense key. MISCOMPARE MISCOMPARE 0x%x expected but got key 0x%x. Sense:%s\n", SCSI_SENSE_MISCOMPARE, task->sense.key, iscsi_get_error(iscsi));
|
||||
logging(LOG_NORMAL, "[FAILED] VERIFY16 command returned wrong sense key. MISCOMPARE MISCOMPARE 0x%x expected but got key 0x%x. Sense:%s", SCSI_SENSE_MISCOMPARE, task->sense.key, iscsi_get_error(iscsi));
|
||||
scsi_free_scsi_task(task);
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("[OK]\n");
|
||||
scsi_free_scsi_task(task);
|
||||
logging(LOG_VERBOSE, "[OK] VERIFY16 returned MISCOMPARE.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
verify16_lbaoutofrange(struct iscsi_context *iscsi, int lun, unsigned char *data, uint32_t datalen, uint64_t lba, int vprotect, int dpo, int bytchk, int blocksize)
|
||||
verify16_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int vprotect, int dpo, int bytchk, unsigned char *data)
|
||||
{
|
||||
struct scsi_task *task;
|
||||
|
||||
printf("Send VERIFY16 LBA:%" PRIu64 " blocks:%d vprotect:%d dpo:%d bytchk:%d (expecting LBA_OUT_OF_RANGE) ... ", lba, datalen / blocksize, vprotect, dpo, bytchk);
|
||||
logging(LOG_VERBOSE, "Send VERIFY16 LBA:%" PRIu64 " blocks:%d vprotect:%d dpo:%d bytchk:%d (expecting LBA_OUT_OF_RANGE)", lba, datalen / blocksize, vprotect, dpo, bytchk);
|
||||
task = iscsi_verify16_sync(iscsi, lun, data, datalen, lba, vprotect, dpo, bytchk, blocksize);
|
||||
if (task == NULL) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send VERIFY16 command: %s\n", iscsi_get_error(iscsi));
|
||||
logging(LOG_NORMAL, "[FAILED] Failed to send VERIFY16 command: %s",
|
||||
iscsi_get_error(iscsi));
|
||||
return -1;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_CHECK_CONDITION
|
||||
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
|
||||
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
|
||||
printf("[SKIPPED]\n");
|
||||
printf("VERIFY16 is not implemented on target\n");
|
||||
logging(LOG_NORMAL, "[SKIPPED] VERIFY16 is not implemented on target");
|
||||
scsi_free_scsi_task(task);
|
||||
return -2;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("VERIFY16 command successful but should have failed with LBA_OUT_OF_RANGE\n");
|
||||
logging(LOG_NORMAL, "[FAILED] VERIFY16 successful but should have failed with LBA_OUT_OF_RANGE");
|
||||
scsi_free_scsi_task(task);
|
||||
return -1;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_CHECK_CONDITION
|
||||
|| task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST
|
||||
|| task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) {
|
||||
printf("[FAILED]\n");
|
||||
printf("VERIFY16 should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi));
|
||||
logging(LOG_NORMAL, "[FAILED] VERIFY16 should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s", iscsi_get_error(iscsi));
|
||||
scsi_free_scsi_task(task);
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("[OK]\n");
|
||||
scsi_free_scsi_task(task);
|
||||
logging(LOG_VERBOSE, "[OK] VERIFY16 returned LBA_OUT_OF_RANGE.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
verify16_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int vprotect, int dpo, int bytchk, unsigned char *data)
|
||||
{
|
||||
struct scsi_task *task;
|
||||
|
||||
logging(LOG_VERBOSE, "Send VERIFY16 LBA:%" PRIu64 " blocks:%d vprotect:%d dpo:%d bytchk:%d (expecting INVALID_FIELD_IN_CDB)", lba, datalen / blocksize, vprotect, dpo, bytchk);
|
||||
task = iscsi_verify16_sync(iscsi, lun, data, datalen, lba, vprotect, dpo, bytchk, blocksize);
|
||||
if (task == NULL) {
|
||||
logging(LOG_NORMAL, "[FAILED] Failed to send VERIFY16 command: %s",
|
||||
iscsi_get_error(iscsi));
|
||||
return -1;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_CHECK_CONDITION
|
||||
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
|
||||
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] VERIFY16 is not implemented on target");
|
||||
scsi_free_scsi_task(task);
|
||||
return -2;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_GOOD) {
|
||||
logging(LOG_NORMAL, "[FAILED] VERIFY16 successful but should have failed with LBA_OUT_OF_RANGE");
|
||||
scsi_free_scsi_task(task);
|
||||
return -1;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_CHECK_CONDITION
|
||||
|| task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST
|
||||
|| task->sense.ascq != SCSI_SENSE_ASCQ_INVALID_FIELD_IN_CDB) {
|
||||
logging(LOG_NORMAL, "[FAILED] VERIFY16 should have failed with ILLEGAL_REQUEST/INVALID_FIELD_IN_CDB. Sense:%s", iscsi_get_error(iscsi));
|
||||
scsi_free_scsi_task(task);
|
||||
return -1;
|
||||
}
|
||||
|
||||
scsi_free_scsi_task(task);
|
||||
logging(LOG_VERBOSE, "[OK] VERIFY16 returned INVALID_FIELD_IN_CDB.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -139,10 +139,11 @@ int verify12(struct iscsi_context *iscsi, int lun, unsigned char *data, uint32_t
|
||||
int verify12_nomedium(struct iscsi_context *iscsi, int lun, unsigned char *data, uint32_t datalen, uint32_t lba, int vprotect, int dpo, int bytchk, int blocksize);
|
||||
int verify12_miscompare(struct iscsi_context *iscsi, int lun, unsigned char *data, uint32_t datalen, uint32_t lba, int vprotect, int dpo, int bytchk, int blocksize);
|
||||
int verify12_lbaoutofrange(struct iscsi_context *iscsi, int lun, unsigned char *data, uint32_t datalen, uint32_t lba, int vprotect, int dpo, int bytchk, int blocksize);
|
||||
int verify16(struct iscsi_context *iscsi, int lun, unsigned char *data, uint32_t datalen, uint64_t lba, int vprotect, int dpo, int bytchk, int blocksize);
|
||||
int verify16_nomedium(struct iscsi_context *iscsi, int lun, unsigned char *data, uint32_t datalen, uint64_t lba, int vprotect, int dpo, int bytchk, int blocksize);
|
||||
int verify16_miscompare(struct iscsi_context *iscsi, int lun, unsigned char *data, uint32_t datalen, uint64_t lba, int vprotect, int dpo, int bytchk, int blocksize);
|
||||
int verify16_lbaoutofrange(struct iscsi_context *iscsi, int lun, unsigned char *data, uint32_t datalen, uint64_t lba, int vprotect, int dpo, int bytchk, int blocksize);
|
||||
int verify16(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int vprotect, int dpo, int bytchk, unsigned char *data);
|
||||
int verify16_nomedium(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int vprotect, int dpo, int bytchk, unsigned char *data);
|
||||
int verify16_miscompare(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int vprotect, int dpo, int bytchk, unsigned char *data);
|
||||
int verify16_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int vprotect, int dpo, int bytchk, unsigned char *data);
|
||||
int verify16_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int vprotect, int dpo, int bytchk, unsigned char *data);
|
||||
int write10(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
|
||||
int write10_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
|
||||
int write10_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
|
||||
|
||||
@@ -102,12 +102,14 @@ static CU_TestInfo tests_readcapacity10[] = {
|
||||
CU_TEST_INFO_NULL
|
||||
};
|
||||
|
||||
static CU_TestInfo tests_write12[] = {
|
||||
{ (char *)"testWrite12Simple", test_write12_simple },
|
||||
{ (char *)"testWrite12BeyondEol", test_write12_beyond_eol },
|
||||
{ (char *)"testWrite12ZeroBlocks", test_write12_0blocks },
|
||||
{ (char *)"testWrite12WriteProtect", test_write12_wrprotect },
|
||||
{ (char *)"testWrite12Flags", test_write12_flags },
|
||||
static CU_TestInfo tests_verify16[] = {
|
||||
{ (char *)"testVerify16Simple", test_verify16_simple },
|
||||
{ (char *)"testVerify16BeyondEol", test_verify16_beyond_eol },
|
||||
{ (char *)"testVerify16ZeroBlocks", test_verify16_0blocks },
|
||||
{ (char *)"testVerify16VerifyProtect", test_verify16_vrprotect },
|
||||
{ (char *)"testVerify16Flags", test_verify16_flags },
|
||||
{ (char *)"testVerify16mismatch", test_verify16_mismatch },
|
||||
{ (char *)"testVerify16mismatch_no_cmp", test_verify16_mismatch_no_cmp },
|
||||
CU_TEST_INFO_NULL
|
||||
};
|
||||
|
||||
@@ -120,6 +122,15 @@ static CU_TestInfo tests_write10[] = {
|
||||
CU_TEST_INFO_NULL
|
||||
};
|
||||
|
||||
static CU_TestInfo tests_write12[] = {
|
||||
{ (char *)"testWrite12Simple", test_write12_simple },
|
||||
{ (char *)"testWrite12BeyondEol", test_write12_beyond_eol },
|
||||
{ (char *)"testWrite12ZeroBlocks", test_write12_0blocks },
|
||||
{ (char *)"testWrite12WriteProtect", test_write12_wrprotect },
|
||||
{ (char *)"testWrite12Flags", test_write12_flags },
|
||||
CU_TEST_INFO_NULL
|
||||
};
|
||||
|
||||
static CU_TestInfo tests_write16[] = {
|
||||
{ (char *)"testWrite16Simple", test_write16_simple },
|
||||
{ (char *)"testWrite16BeyondEol", test_write16_beyond_eol },
|
||||
@@ -142,6 +153,8 @@ static CU_SuiteInfo suites[] = {
|
||||
tests_read16 },
|
||||
{ (char *)"TestReadCapacity10", test_setup, test_teardown,
|
||||
tests_readcapacity10 },
|
||||
{ (char *)"TestVerify16", test_setup, test_teardown,
|
||||
tests_verify16 },
|
||||
{ (char *)"TestWrite10", test_setup, test_teardown,
|
||||
tests_write10 },
|
||||
{ (char *)"TestWrite12", test_setup, test_teardown,
|
||||
|
||||
@@ -64,6 +64,14 @@ void test_read16_flags(void);
|
||||
|
||||
void test_readcapacity10_simple(void);
|
||||
|
||||
void test_verify16_simple(void);
|
||||
void test_verify16_beyond_eol(void);
|
||||
void test_verify16_0blocks(void);
|
||||
void test_verify16_vrprotect(void);
|
||||
void test_verify16_flags(void);
|
||||
void test_verify16_mismatch(void);
|
||||
void test_verify16_mismatch_no_cmp(void);
|
||||
|
||||
void test_write10_simple(void);
|
||||
void test_write10_beyond_eol(void);
|
||||
void test_write10_0blocks(void);
|
||||
|
||||
57
test-tool/test_verify16_0blocks.c
Normal file
57
test-tool/test_verify16_0blocks.c
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
Copyright (C) 2013 Ronnie Sahlberg <ronniesahlberg@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <CUnit/CUnit.h>
|
||||
|
||||
#include "iscsi.h"
|
||||
#include "scsi-lowlevel.h"
|
||||
#include "iscsi-test-cu.h"
|
||||
|
||||
void
|
||||
test_verify16_0blocks(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
logging(LOG_VERBOSE, "");
|
||||
logging(LOG_VERBOSE, "Test VERIFY16 0-blocks at LBA==0");
|
||||
ret = verify16(iscsic, tgt_lun, 0, 0, block_size,
|
||||
0, 0, 1, NULL);
|
||||
if (ret == -2) {
|
||||
CU_PASS("[SKIPPED] Target does not support VERIFY16. Skipping test");
|
||||
return;
|
||||
}
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
logging(LOG_VERBOSE, "Test VERIFY16 0-blocks one block past end-of-LUN");
|
||||
ret = verify16_lbaoutofrange(iscsic, tgt_lun, num_blocks + 1, 0,
|
||||
block_size, 0, 0, 1, NULL);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
|
||||
logging(LOG_VERBOSE, "Test VERIFY16 0-blocks at LBA==2^63");
|
||||
ret = verify16_lbaoutofrange(iscsic, tgt_lun, 0x8000000000000000, 0,
|
||||
block_size, 0, 0, 1, NULL);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
|
||||
logging(LOG_VERBOSE, "Test VERIFY16 0-blocks at LBA==-1");
|
||||
ret = verify16_lbaoutofrange(iscsic, tgt_lun, -1, 0, block_size,
|
||||
0, 0, 1, NULL);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
78
test-tool/test_verify16_beyond_eol.c
Normal file
78
test-tool/test_verify16_beyond_eol.c
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
Copyright (C) 2013 Ronnie Sahlberg <ronneisahlberg@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <CUnit/CUnit.h>
|
||||
|
||||
#include "iscsi.h"
|
||||
#include "scsi-lowlevel.h"
|
||||
#include "iscsi-test-cu.h"
|
||||
|
||||
|
||||
void
|
||||
test_verify16_beyond_eol(void)
|
||||
{
|
||||
int i, ret;
|
||||
|
||||
logging(LOG_VERBOSE, "");
|
||||
logging(LOG_VERBOSE, "Test VERIFY16 1-256 blocks one block beyond the end");
|
||||
for (i = 1; i <= 256; i++) {
|
||||
unsigned char *buf = malloc(block_size * i);
|
||||
|
||||
ret = verify16_lbaoutofrange(iscsic, tgt_lun, num_blocks + 2 - i,
|
||||
i * block_size, block_size,
|
||||
0, 0, 1, buf);
|
||||
free(buf);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
|
||||
logging(LOG_VERBOSE, "Test VERIFY16 1-256 blocks at LBA==2^63");
|
||||
for (i = 1; i <= 256; i++) {
|
||||
unsigned char *buf = malloc(block_size * i);
|
||||
|
||||
ret = verify16_lbaoutofrange(iscsic, tgt_lun, 0x8000000000000000,
|
||||
i * block_size, block_size,
|
||||
0, 0, 1, buf);
|
||||
free(buf);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
|
||||
logging(LOG_VERBOSE, "Test VERIFY16 1-256 blocks at LBA==-1");
|
||||
for (i = 1; i <= 256; i++) {
|
||||
unsigned char *buf = malloc(block_size * i);
|
||||
|
||||
ret = verify16_lbaoutofrange(iscsic, tgt_lun, -1, i * block_size,
|
||||
block_size, 0, 0, 1, buf);
|
||||
free(buf);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
|
||||
logging(LOG_VERBOSE, "Test VERIFY16 2-256 blocks all but one block beyond the end");
|
||||
for (i = 2; i <= 256; i++) {
|
||||
unsigned char *buf = malloc(block_size * i);
|
||||
|
||||
ret = verify16_lbaoutofrange(iscsic, tgt_lun, num_blocks,
|
||||
i * block_size, block_size,
|
||||
0, 0, 1, buf);
|
||||
free(buf);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
}
|
||||
59
test-tool/test_verify16_flags.c
Normal file
59
test-tool/test_verify16_flags.c
Normal file
@@ -0,0 +1,59 @@
|
||||
|
||||
/*
|
||||
Copyright (C) 2013 Ronnie Sahlberg <ronniesahlberg@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <CUnit/CUnit.h>
|
||||
|
||||
#include "iscsi.h"
|
||||
#include "scsi-lowlevel.h"
|
||||
#include "iscsi-support.h"
|
||||
#include "iscsi-test-cu.h"
|
||||
|
||||
|
||||
void
|
||||
test_verify16_flags(void)
|
||||
{
|
||||
int ret;
|
||||
unsigned char *buf = malloc(block_size);
|
||||
|
||||
logging(LOG_VERBOSE, "");
|
||||
logging(LOG_VERBOSE, "Test VERIFY16 flags");
|
||||
|
||||
ret = read16(iscsic, tgt_lun, 0, block_size,
|
||||
block_size, 0, 0, 0, 0, 0, buf);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
|
||||
logging(LOG_VERBOSE, "Test VERIFY16 with DPO==1");
|
||||
ret = verify16(iscsic, tgt_lun, 0, block_size,
|
||||
block_size, 0, 1, 0, buf);
|
||||
if (ret == -2) {
|
||||
CU_PASS("[SKIPPED] Target does not support VERIFY16. Skipping test");
|
||||
free(buf);
|
||||
return;
|
||||
}
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
|
||||
logging(LOG_VERBOSE, "Test VERIFY16 with BYTCHK==1");
|
||||
ret = verify16(iscsic, tgt_lun, 0, block_size,
|
||||
block_size, 0, 0, 1, buf);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
free(buf);
|
||||
}
|
||||
76
test-tool/test_verify16_mismatch.c
Normal file
76
test-tool/test_verify16_mismatch.c
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
Copyright (C) 2013 Ronnie Sahlberg <ronniesahlberg@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <CUnit/CUnit.h>
|
||||
|
||||
#include "iscsi.h"
|
||||
#include "scsi-lowlevel.h"
|
||||
#include "iscsi-support.h"
|
||||
#include "iscsi-test-cu.h"
|
||||
|
||||
|
||||
void
|
||||
test_verify16_mismatch(void)
|
||||
{
|
||||
int i, ret;
|
||||
|
||||
logging(LOG_VERBOSE, "");
|
||||
logging(LOG_VERBOSE, "Test VERIFY16 for blocks 1-255");
|
||||
for (i = 1; i <= 256; i++) {
|
||||
unsigned char *buf = malloc(block_size * i);
|
||||
int offset = random() % (i * block_size);
|
||||
|
||||
ret = read16(iscsic, tgt_lun, 0, i * block_size,
|
||||
block_size, 0, 0, 0, 0, 0, buf);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
/* flip a random byte in the data */
|
||||
buf[offset] ^= 'X';
|
||||
logging(LOG_VERBOSE, "Flip some bits in the data");
|
||||
|
||||
ret = verify16_miscompare(iscsic, tgt_lun, 0, i * block_size,
|
||||
block_size, 0, 0, 1, buf);
|
||||
if (ret == -2) {
|
||||
CU_PASS("[SKIPPED] Target does not support VERIFY16. Skipping test");
|
||||
free(buf);
|
||||
return;
|
||||
}
|
||||
free(buf);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
logging(LOG_VERBOSE, "Test VERIFY16 of 1-256 blocks at the end of the LUN");
|
||||
for (i = 1; i <= 256; i++) {
|
||||
unsigned char *buf = malloc(block_size * i);
|
||||
int offset = random() % (i * block_size);
|
||||
|
||||
ret = read16(iscsic, tgt_lun, num_blocks +1 - i,
|
||||
i * block_size, block_size, 0, 0, 0, 0, 0, buf);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
/* flip a random byte in the data */
|
||||
buf[offset] ^= 'X';
|
||||
logging(LOG_VERBOSE, "Flip some bits in the data");
|
||||
|
||||
ret = verify16_miscompare(iscsic, tgt_lun, num_blocks +1 - i,
|
||||
i * block_size, block_size, 0, 0, 1, buf);
|
||||
free(buf);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
}
|
||||
77
test-tool/test_verify16_mismatch_no_cmp.c
Normal file
77
test-tool/test_verify16_mismatch_no_cmp.c
Normal file
@@ -0,0 +1,77 @@
|
||||
|
||||
/*
|
||||
Copyright (C) 2013 Ronnie Sahlberg <ronniesahlberg@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <CUnit/CUnit.h>
|
||||
|
||||
#include "iscsi.h"
|
||||
#include "scsi-lowlevel.h"
|
||||
#include "iscsi-support.h"
|
||||
#include "iscsi-test-cu.h"
|
||||
|
||||
|
||||
void
|
||||
test_verify16_mismatch_no_cmp(void)
|
||||
{
|
||||
int i, ret;
|
||||
|
||||
logging(LOG_VERBOSE, "");
|
||||
logging(LOG_VERBOSE, "Test VERIFY16 without BYTCHK for blocks 1-255");
|
||||
for (i = 1; i <= 256; i++) {
|
||||
unsigned char *buf = malloc(block_size * i);
|
||||
int offset = random() % (i * block_size);
|
||||
|
||||
ret = read16(iscsic, tgt_lun, 0, i * block_size,
|
||||
block_size, 0, 0, 0, 0, 0, buf);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
/* flip a random byte in the data */
|
||||
buf[offset] ^= 'X';
|
||||
logging(LOG_VERBOSE, "Flip some bits in the data");
|
||||
|
||||
ret = verify16(iscsic, tgt_lun, 0, i * block_size,
|
||||
block_size, 0, 0, 0, buf);
|
||||
if (ret == -2) {
|
||||
CU_PASS("[SKIPPED] Target does not support VERIFY16. Skipping test");
|
||||
free(buf);
|
||||
return;
|
||||
}
|
||||
free(buf);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
logging(LOG_VERBOSE, "Test VERIFY16 without BYTCHK of 1-256 blocks at the end of the LUN");
|
||||
for (i = 1; i <= 256; i++) {
|
||||
unsigned char *buf = malloc(block_size * i);
|
||||
int offset = random() % (i * block_size);
|
||||
|
||||
ret = read16(iscsic, tgt_lun, num_blocks +1 - i,
|
||||
i * block_size, block_size, 0, 0, 0, 0, 0, buf);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
/* flip a random byte in the data */
|
||||
buf[offset] ^= 'X';
|
||||
logging(LOG_VERBOSE, "Flip some bits in the data");
|
||||
|
||||
ret = verify16(iscsic, tgt_lun, num_blocks +1 - i,
|
||||
i * block_size, block_size, 0, 0, 0, buf);
|
||||
free(buf);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
}
|
||||
66
test-tool/test_verify16_simple.c
Normal file
66
test-tool/test_verify16_simple.c
Normal file
@@ -0,0 +1,66 @@
|
||||
|
||||
/*
|
||||
Copyright (C) 2013 Ronnie Sahlberg <ronniesahlberg@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <CUnit/CUnit.h>
|
||||
|
||||
#include "iscsi.h"
|
||||
#include "scsi-lowlevel.h"
|
||||
#include "iscsi-support.h"
|
||||
#include "iscsi-test-cu.h"
|
||||
|
||||
|
||||
void
|
||||
test_verify16_simple(void)
|
||||
{
|
||||
int i, ret;
|
||||
|
||||
logging(LOG_VERBOSE, "");
|
||||
logging(LOG_VERBOSE, "Test VERIFY16 of 1-256 blocks at the end of the LUN");
|
||||
for (i = 1; i <= 256; i++) {
|
||||
unsigned char *buf = malloc(block_size * i);
|
||||
ret = read16(iscsic, tgt_lun, 0, i * block_size,
|
||||
block_size, 0, 0, 0, 0, 0, buf);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
ret = verify16(iscsic, tgt_lun, 0, i * block_size,
|
||||
block_size, 0, 0, 1, buf);
|
||||
if (ret == -2) {
|
||||
CU_PASS("[SKIPPED] Target does not support VERIFY16. Skipping test");
|
||||
free(buf);
|
||||
return;
|
||||
}
|
||||
free(buf);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
logging(LOG_VERBOSE, "Test VERIFY16 of 1-256 blocks at the end of the LUN");
|
||||
for (i = 1; i <= 256; i++) {
|
||||
unsigned char *buf = malloc(block_size * i);
|
||||
|
||||
ret = read16(iscsic, tgt_lun, num_blocks +1 - i,
|
||||
i * block_size, block_size, 0, 0, 0, 0, 0, buf);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
ret = verify16(iscsic, tgt_lun, num_blocks +1 - i,
|
||||
i * block_size, block_size, 0, 0, 1, buf);
|
||||
free(buf);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
}
|
||||
53
test-tool/test_verify16_vrprotect.c
Normal file
53
test-tool/test_verify16_vrprotect.c
Normal file
@@ -0,0 +1,53 @@
|
||||
|
||||
/*
|
||||
Copyright (C) 2013 Ronnie Sahlberg <ronniesahlberg@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <CUnit/CUnit.h>
|
||||
|
||||
#include "iscsi.h"
|
||||
#include "scsi-lowlevel.h"
|
||||
#include "iscsi-support.h"
|
||||
#include "iscsi-test-cu.h"
|
||||
|
||||
|
||||
void
|
||||
test_verify16_vrprotect(void)
|
||||
{
|
||||
int i, ret;
|
||||
|
||||
logging(LOG_VERBOSE, "");
|
||||
logging(LOG_VERBOSE, "Test VERIFY16 with non-zero VRPROTECT");
|
||||
|
||||
for (i = 1; i < 8; i++) {
|
||||
unsigned char *buf = malloc(block_size);
|
||||
|
||||
ret = read16(iscsic, tgt_lun, 0, block_size,
|
||||
block_size, 0, 0, 0, 0, 0, buf);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
ret = verify16_invalidfieldincdb(iscsic, tgt_lun, 0, block_size,
|
||||
block_size, i, 0, 1, buf);
|
||||
free(buf);
|
||||
if (ret == -2) {
|
||||
CU_PASS("[SKIPPED] Target does not support VERIFY16. Skipping test");
|
||||
return;
|
||||
}
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user