TESTS: Update the protection tests

This commit is contained in:
Ronnie Sahlberg
2013-05-12 08:06:08 -07:00
parent 67676d4756
commit ee689ee3fb
30 changed files with 160 additions and 151 deletions

View File

@@ -23,7 +23,7 @@
int T0160_readcapacity16_simple(const char *initiator, const char *url)
{
struct iscsi_context *iscsi;
struct scsi_readcapacity16 *rc16;
struct scsi_readcapacity16 *rc;
struct scsi_task *task;
int ret, lun;
@@ -59,8 +59,8 @@ int T0160_readcapacity16_simple(const char *initiator, const char *url)
scsi_free_scsi_task(task);
goto finished;
}
rc16 = scsi_datain_unmarshall(task);
if (rc16 == NULL) {
rc = scsi_datain_unmarshall(task);
if (rc == NULL) {
printf("[FAILED]\n");
printf("failed to unmarshall READCAPACITY16 data. %s\n", iscsi_get_error(iscsi));
ret = -1;

View File

@@ -42,7 +42,7 @@ int T0170_unmap_simple(const char *initiator, const char *url)
return -1;
}
if (lbpme == 0){
if (rc16 == NULL || rc16->lbpme == 0){
printf("Logical unit is fully provisioned. Skipping test\n");
ret = -2;
goto finished;

View File

@@ -44,7 +44,7 @@ int T0171_unmap_zero(const char *initiator, const char *url)
return -1;
}
if (lbpme == 0){
if (rc16 == NULL || rc16->lbpme == 0){
printf("Logical unit is fully provisioned. Skipping test\n");
ret = -2;
goto finished;

View File

@@ -49,7 +49,7 @@ int T0180_writesame10_unmap(const char *initiator, const char *url)
ret = 0;
if (lbpme == 0){
if (rc16 == NULL || rc16->lbpme == 0){
printf("Logical unit is fully provisioned. All commands should fail with check condition.\n");
}

View File

@@ -41,7 +41,7 @@ int T0181_writesame10_unmap_unaligned(const char *initiator, const char *url)
return -1;
}
if (lbpme == 0){
if (rc16 == NULL || rc16->lbpme == 0){
printf("Logical unit is fully provisioned. Skipping test\n");
ret = -2;
goto finished;

View File

@@ -49,7 +49,7 @@ int T0190_writesame16_unmap(const char *initiator, const char *url)
ret = 0;
if (lbpme == 0) {
if (rc16 == NULL || rc16->lbpme == 0){
printf("LBPME not set. Skip test for CPD page 0xB2 (logical block provisioning)\n");
goto finished;
}

View File

@@ -41,7 +41,7 @@ int T0191_writesame16_unmap_unaligned(const char *initiator, const char *url)
return -1;
}
if (lbpme == 0){
if (rc16 == NULL || rc16->lbpme == 0){
printf("Logical unit is fully provisioned. Skipping test\n");
ret = -2;
goto finished;

View File

@@ -42,7 +42,7 @@ int T0260_get_lba_status_simple(const char *initiator, const char *url)
return -1;
}
if (lbpme == 0){
if (rc16 == NULL || rc16->lbpme == 0){
printf("Logical unit is fully provisioned. Skipping test\n");
ret = -2;
goto finished;

View File

@@ -41,7 +41,7 @@ int T0264_get_lba_status_beyondeol(const char *initiator, const char *url)
return -1;
}
if (lbpme == 0){
if (rc16 == NULL || rc16->lbpme == 0){
printf("Logical unit is fully provisioned. Skipping test\n");
ret = -2;
goto finished;

View File

@@ -259,7 +259,7 @@ int T0300_readonly(const char *initiator, const char *url)
/* UNMAP one block at lba 0 */
printf("WRITESAME10 to UNMAP LUN 0 ... ");
if (lbpme == 0) {
if (rc16 == NULL || rc16->lbpme == 0){
printf("LUN is not thin-provisioned. [SKIPPED]\n");
goto finished;
}
@@ -295,10 +295,6 @@ int T0300_readonly(const char *initiator, const char *url)
/* UNMAP one block at lba 0 */
printf("WRITESAME16 to UNMAP LUN 0 ... ");
if (lbpme == 0) {
printf("LUN is not thin-provisioned. [SKIPPED]\n");
goto finished;
}
task = iscsi_writesame16_sync(iscsi, lun, 0,
data, block_size,
1,
@@ -331,10 +327,6 @@ int T0300_readonly(const char *initiator, const char *url)
/* UNMAP one block at lba 0 */
printf("UNMAP LUN 0 ... ");
if (lbpme == 0) {
printf("LUN is not thin-provisioned. [SKIPPED]\n");
goto finished;
}
list[0].lba = 0;
list[0].num = 1;
task = iscsi_unmap_sync(iscsi, lun, 0, 0, &list[0], 1);

View File

@@ -208,7 +208,7 @@ int T0390_mandatory_opcodes_sbc(const char *initiator, const char *url)
printf("Test UNMAP ... ");
if (lbpme == 0) {
if (rc16 == NULL || rc16->lbpme == 0){
printf("[LBPME == 0, SKIPPING TEST]\n");
} else {
task = iscsi_unmap_sync(iscsi, lun, 0, 0, NULL, 0);
@@ -246,7 +246,7 @@ int T0390_mandatory_opcodes_sbc(const char *initiator, const char *url)
printf("Test WRITE SAME16 ... ");
if (lbpme == 0) {
if (rc16 == NULL || rc16->lbpme == 0){
printf("[LBPME == 0, SKIPPING TEST]\n");
} else {
task = iscsi_writesame16_sync(iscsi, lun, 0,

View File

@@ -47,17 +47,16 @@ const char *initiatorname2 =
const char *tgt_url;
struct scsi_inquiry_standard *inq;
struct scsi_readcapacity16 *rc16;
size_t block_size;
uint64_t num_blocks;
int lbpme;
int lbppb;
int lbpme;
enum scsi_inquiry_peripheral_device_type device_type;
int data_loss;
int anc_sup;
int lbpws10;
int lbpws;
int anc_sup;
int readonly;
int sbc3_support;
int maximum_transfer_length;

View File

@@ -77,7 +77,7 @@ do { \
#define CHECK_FOR_THIN_PROVISIONING \
do { \
if (lbpme == 0) { \
if (rc16 == NULL || rc16->lbpme == 0) { \
logging(LOG_VERBOSE, "[SKIPPED] Logical unit is fully" \
" provisioned. Skipping test"); \
CU_PASS("[SKIPPED] Logical unit is fully provisioned." \
@@ -129,16 +129,15 @@ do { \
} while (0);
extern struct scsi_inquiry_standard *inq;
extern struct scsi_readcapacity16 *rc16;
extern size_t block_size;
extern uint64_t num_blocks;
extern int lbpme;
extern int lbppb;
extern int lbpme;
extern int data_loss;
extern int anc_sup;
extern int lbpws10;
extern int lbpws;
extern int anc_sup;
extern int readonly;
extern int sbc3_support;
extern int maximum_transfer_length;

View File

@@ -857,8 +857,8 @@ main(int argc, char *argv[])
CU_ErrorAction error_action = CUEA_IGNORE;
int res;
struct scsi_readcapacity10 *rc10;
struct scsi_readcapacity16 *rc16;
struct scsi_task *inq_task;
struct scsi_task *rc16_task;
int full_size;
int is_usb;
static struct option long_opts[] = {
@@ -992,29 +992,25 @@ main(int argc, char *argv[])
num_blocks = rc10->lba + 1;
scsi_free_scsi_task(task);
task = iscsi_readcapacity16_sync(iscsic, lun);
if (task == NULL) {
rc16_task = iscsi_readcapacity16_sync(iscsic, lun);
if (rc16_task == NULL) {
printf("Failed to send READCAPACITY16 command: %s\n",
iscsi_get_error(iscsic));
iscsi_destroy_context(iscsic);
return -1;
}
if (task->status == SCSI_STATUS_GOOD) {
rc16 = scsi_datain_unmarshall(task);
if (rc16_task->status == SCSI_STATUS_GOOD) {
rc16 = scsi_datain_unmarshall(rc16_task);
if (rc16 == NULL) {
printf("failed to unmarshall READCAPACITY16 data. %s\n",
iscsi_get_error(iscsic));
scsi_free_scsi_task(task);
scsi_free_scsi_task(rc16_task);
iscsi_destroy_context(iscsic);
return -1;
}
block_size = rc16->block_length;
num_blocks = rc16->returned_lba + 1;
lbpme = rc16->lbpme;
lbppb = 1 << rc16->lbppbe;
lbpme = rc16->lbpme;
scsi_free_scsi_task(task);
}
inq_task = iscsi_inquiry_sync(iscsic, lun, 0, 0, 64);
@@ -1049,7 +1045,7 @@ main(int argc, char *argv[])
}
/* if thin provisioned we also need to read the VPD page for it */
if (lbpme != 0) {
if (rc16 && rc16->lbpme != 0){
struct scsi_inquiry_logical_block_provisioning *inq_lbp;
task = iscsi_inquiry_sync(iscsic, lun, 1, SCSI_INQUIRY_PAGECODE_LOGICAL_BLOCK_PROVISIONING, 64);
@@ -1146,6 +1142,7 @@ main(int argc, char *argv[])
free(discard_const(tgt_url));
scsi_free_scsi_task(inq_task);
scsi_free_scsi_task(rc16_task);
return 0;
}

View File

@@ -315,8 +315,8 @@ int main(int argc, char *argv[])
struct iscsi_context *iscsi;
struct scsi_task *task;
struct scsi_task *inq_task;
struct scsi_task *rc16_task;
struct scsi_readcapacity10 *rc10;
struct scsi_readcapacity16 *rc16;
int full_size;
int c;
@@ -437,27 +437,23 @@ int main(int argc, char *argv[])
num_blocks = rc10->lba;
scsi_free_scsi_task(task);
task = iscsi_readcapacity16_sync(iscsi, lun);
if (task == NULL) {
rc16_task = iscsi_readcapacity16_sync(iscsi, lun);
if (rc16_task == NULL) {
printf("Failed to send READCAPACITY16 command: %s\n", iscsi_get_error(iscsi));
iscsi_destroy_context(iscsi);
return -1;
}
if (task->status == SCSI_STATUS_GOOD) {
rc16 = scsi_datain_unmarshall(task);
if (rc16_task->status == SCSI_STATUS_GOOD) {
rc16 = scsi_datain_unmarshall(rc16_task);
if (rc16 == NULL) {
printf("failed to unmarshall READCAPACITY16 data. %s\n", iscsi_get_error(iscsi));
scsi_free_scsi_task(task);
scsi_free_scsi_task(rc16_task);
iscsi_destroy_context(iscsi);
return -1;
}
block_size = rc16->block_length;
num_blocks = rc16->returned_lba;
lbpme = rc16->lbpme;
lbppb = 1 << rc16->lbppbe;
lbpme = rc16->lbpme;
scsi_free_scsi_task(task);
}
@@ -519,6 +515,7 @@ int main(int argc, char *argv[])
}
scsi_free_scsi_task(inq_task);
scsi_free_scsi_task(rc16_task);
iscsi_logout_sync(iscsi);
iscsi_destroy_context(iscsi);

View File

@@ -32,19 +32,17 @@ test_orwrite_wrprotect(void)
int i, ret;
unsigned char *buf = alloca(block_size);
CHECK_FOR_DATALOSS;
CHECK_FOR_SBC;
/*
* Try out different non-zero values for WRPROTECT.
* They should all fail.
*/
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test ORWRITE with non-zero WRPROTECT");
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
CHECK_FOR_DATALOSS;
CHECK_FOR_SBC;
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = orwrite_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
@@ -56,5 +54,8 @@ test_orwrite_wrprotect(void)
}
CU_ASSERT_EQUAL(ret, 0);
}
return;
}
logging(LOG_NORMAL, "No tests for devices that support protection information yet.");
}

View File

@@ -33,22 +33,22 @@ test_read10_rdprotect(void)
/*
* Try out different non-zero values for RDPROTECT.
* They should all fail.
*/
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test READ10 with non-zero RDPROTECT");
CHECK_FOR_SBC;
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = read10_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
i, 0, 0, 0, 0, NULL);
CU_ASSERT_EQUAL(ret, 0);
}
return;
}
logging(LOG_NORMAL, "No tests for devices that support protection information yet.");
}

View File

@@ -32,17 +32,14 @@ test_read12_rdprotect(void)
/*
* Try out different non-zero values for RDPROTECT.
* They should all fail.
*/
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test READ12 with non-zero RDPROTECT");
CHECK_FOR_SBC;
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = read12_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
@@ -54,5 +51,8 @@ test_read12_rdprotect(void)
}
CU_ASSERT_EQUAL(ret, 0);
}
return;
}
logging(LOG_NORMAL, "No tests for devices that support protection information yet.");
}

View File

@@ -30,18 +30,16 @@ test_read16_rdprotect(void)
{
int i, ret;
CHECK_FOR_SBC;
/*
* Try out different non-zero values for RDPROTECT.
* They should all fail.
*/
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test READ16 with non-zero RDPROTECT");
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
CHECK_FOR_SBC;
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = read16_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
@@ -53,5 +51,7 @@ test_read16_rdprotect(void)
}
CU_ASSERT_EQUAL(ret, 0);
}
return;
}
logging(LOG_NORMAL, "No tests for devices that support protection information yet.");
}

View File

@@ -35,10 +35,11 @@ test_verify10_vrprotect(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test VERIFY10 with non-zero VRPROTECT");
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
CHECK_FOR_SBC;
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = read10(iscsic, tgt_lun, 0, block_size,
block_size, 0, 0, 0, 0, 0, buf);
@@ -53,5 +54,8 @@ test_verify10_vrprotect(void)
}
CU_ASSERT_EQUAL(ret, 0);
}
return;
}
logging(LOG_NORMAL, "No tests for devices that support protection information yet.");
}

View File

@@ -34,10 +34,11 @@ test_verify12_vrprotect(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test VERIFY12 with non-zero VRPROTECT");
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
CHECK_FOR_SBC;
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = read10(iscsic, tgt_lun, 0, block_size,
@@ -52,5 +53,8 @@ test_verify12_vrprotect(void)
}
CU_ASSERT_EQUAL(ret, 0);
}
return;
}
logging(LOG_NORMAL, "No tests for devices that support protection information yet.");
}

View File

@@ -35,10 +35,11 @@ test_verify16_vrprotect(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test VERIFY16 with non-zero VRPROTECT");
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
CHECK_FOR_SBC;
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = read16(iscsic, tgt_lun, 0, block_size,
block_size, 0, 0, 0, 0, 0, buf);
@@ -52,5 +53,8 @@ test_verify16_vrprotect(void)
}
CU_ASSERT_EQUAL(ret, 0);
}
return;
}
logging(LOG_NORMAL, "No tests for devices that support protection information yet.");
}

View File

@@ -32,18 +32,17 @@ test_write10_wrprotect(void)
int i, ret;
unsigned char *buf = alloca(block_size);
CHECK_FOR_DATALOSS;
/*
* Try out different non-zero values for WRPROTECT.
* They should all fail.
*/
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITE10 with non-zero WRPROTECT");
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
CHECK_FOR_DATALOSS;
CHECK_FOR_SBC;
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = write10_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
@@ -55,5 +54,8 @@ test_write10_wrprotect(void)
}
CU_ASSERT_EQUAL(ret, 0);
}
return;
}
logging(LOG_NORMAL, "No tests for devices that support protection information yet.");
}

View File

@@ -32,18 +32,18 @@ test_write12_wrprotect(void)
int i, ret;
unsigned char *buf = alloca(block_size);
CHECK_FOR_DATALOSS;
/*
* Try out different non-zero values for WRPROTECT.
* They should all fail.
*/
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITE12 with non-zero WRPROTECT");
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
CHECK_FOR_DATALOSS;
CHECK_FOR_SBC;
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = write12_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
@@ -55,5 +55,8 @@ test_write12_wrprotect(void)
}
CU_ASSERT_EQUAL(ret, 0);
}
return;
}
logging(LOG_NORMAL, "No tests for devices that support protection information yet.");
}

View File

@@ -32,19 +32,17 @@ test_write16_wrprotect(void)
int i, ret;
unsigned char *buf = alloca(block_size);
CHECK_FOR_DATALOSS;
CHECK_FOR_SBC;
/*
* Try out different non-zero values for WRPROTECT.
* They should all fail.
*/
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITE16 with non-zero WRPROTECT");
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
CHECK_FOR_DATALOSS;
CHECK_FOR_SBC;
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = write16_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
@@ -56,5 +54,8 @@ test_write16_wrprotect(void)
}
CU_ASSERT_EQUAL(ret, 0);
}
return;
}
logging(LOG_NORMAL, "No tests for devices that support protection information yet.");
}

View File

@@ -18,6 +18,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <alloca.h>
#include <CUnit/CUnit.h>
@@ -29,22 +30,19 @@ void
test_writesame10_wrprotect(void)
{
int i, ret;
unsigned char *buf;
unsigned char *buf = alloca(block_size);
/*
* Try out different non-zero values for WRPROTECT.
*/
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITESAME10 with non-zero WRPROTECT");
CHECK_FOR_DATALOSS;
CHECK_FOR_SBC;
/*
* Try out different non-zero values for WRPROTECT.
* They should all fail.
*/
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITESAME10 with non-zero WRPROTECT");
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
buf = malloc(block_size);
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = writesame10_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, 1,
@@ -56,6 +54,8 @@ test_writesame10_wrprotect(void)
}
CU_ASSERT_EQUAL(ret, 0);
}
free(buf);
return;
}
logging(LOG_NORMAL, "No tests for devices that support protection information yet.");
}

View File

@@ -32,19 +32,17 @@ test_writesame16_wrprotect(void)
int i, ret;
unsigned char *buf = alloca(block_size);
CHECK_FOR_DATALOSS;
CHECK_FOR_SBC;
/*
* Try out different non-zero values for WRPROTECT.
* They should all fail.
*/
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITESAME16 with non-zero WRPROTECT");
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
CHECK_FOR_DATALOSS;
CHECK_FOR_SBC;
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = writesame16_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, 1,
@@ -56,5 +54,8 @@ test_writesame16_wrprotect(void)
}
CU_ASSERT_EQUAL(ret, 0);
}
return;
}
logging(LOG_NORMAL, "No tests for devices that support protection information yet.");
}

View File

@@ -32,18 +32,17 @@ test_writeverify10_wrprotect(void)
int i, ret;
unsigned char *buf = alloca(block_size);
CHECK_FOR_DATALOSS;
/*
* Try out different non-zero values for WRPROTECT.
* They should all fail.
*/
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITEVERIFY10 with non-zero WRPROTECT");
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
CHECK_FOR_DATALOSS;
CHECK_FOR_SBC;
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = writeverify10_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
@@ -55,5 +54,8 @@ test_writeverify10_wrprotect(void)
}
CU_ASSERT_EQUAL(ret, 0);
}
return;
}
logging(LOG_NORMAL, "No tests for devices that support protection information yet.");
}

View File

@@ -32,18 +32,17 @@ test_writeverify12_wrprotect(void)
int i, ret;
unsigned char *buf = alloca(block_size);
CHECK_FOR_DATALOSS;
/*
* Try out different non-zero values for WRPROTECT.
* They should all fail.
*/
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITEVERIFY12 with non-zero WRPROTECT");
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
CHECK_FOR_DATALOSS;
CHECK_FOR_SBC;
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = writeverify12_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
@@ -55,5 +54,8 @@ test_writeverify12_wrprotect(void)
}
CU_ASSERT_EQUAL(ret, 0);
}
return;
}
logging(LOG_NORMAL, "No tests for devices that support protection information yet.");
}

View File

@@ -34,19 +34,17 @@ test_writeverify16_wrprotect(void)
unsigned char *buf = alloca(block_size);
CHECK_FOR_DATALOSS;
CHECK_FOR_SBC;
/*
* Try out different non-zero values for WRPROTECT.
* They should all fail.
*/
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITEVERIFY16 with non-zero WRPROTECT");
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
CHECK_FOR_DATALOSS;
CHECK_FOR_SBC;
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = writeverify16_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
@@ -58,5 +56,8 @@ test_writeverify16_wrprotect(void)
}
CU_ASSERT_EQUAL(ret, 0);
}
return;
}
logging(LOG_NORMAL, "No tests for devices that support protection information yet.");
}