From 2f90e02395aa296fe68eaf35dfbf7866149cfac8 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Mon, 21 Jan 2013 11:19:43 -0800 Subject: [PATCH] TESTS: Add tests for WRITE16 to new framework --- Makefile.am | 7 +- test-tool/iscsi-support.c | 134 ++++++++++++++++++++++++++++ test-tool/iscsi-support.h | 5 ++ test-tool/iscsi-test-cu.c | 11 +++ test-tool/iscsi-test-cu.h | 6 ++ test-tool/test_read16_0blocks.c | 5 -- test-tool/test_read16_flags.c | 2 +- test-tool/test_write16_0blocks.c | 59 ++++++++++++ test-tool/test_write16_beyond_eol.c | 89 ++++++++++++++++++ test-tool/test_write16_flags.c | 80 +++++++++++++++++ test-tool/test_write16_simple.c | 67 ++++++++++++++ test-tool/test_write16_wrprotect.c | 55 ++++++++++++ 12 files changed, 513 insertions(+), 7 deletions(-) create mode 100644 test-tool/test_write16_0blocks.c create mode 100644 test-tool/test_write16_beyond_eol.c create mode 100644 test-tool/test_write16_flags.c create mode 100644 test-tool/test_write16_simple.c create mode 100644 test-tool/test_write16_wrprotect.c diff --git a/Makefile.am b/Makefile.am index e72062a..ffc6d5d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -196,7 +196,12 @@ bin_iscsi_test_cu_SOURCES = test-tool/iscsi-test-cu.c \ test-tool/test_read16_0blocks.c \ test-tool/test_read16_rdprotect.c \ test-tool/test_read16_flags.c \ - test-tool/test_readcapacity10_simple.c + test-tool/test_readcapacity10_simple.c \ + test-tool/test_write16_simple.c \ + test-tool/test_write16_beyond_eol.c \ + test-tool/test_write16_0blocks.c \ + test-tool/test_write16_wrprotect.c \ + test-tool/test_write16_flags.c endif diff --git a/test-tool/iscsi-support.c b/test-tool/iscsi-support.c index 7b80d97..20596b6 100644 --- a/test-tool/iscsi-support.c +++ b/test-tool/iscsi-support.c @@ -1865,6 +1865,140 @@ verify16_lbaoutofrange(struct iscsi_context *iscsi, int lun, unsigned char *data return 0; } +int +write16(struct iscsi_context *iscsi, int lun, uint64_t lba, + uint32_t datalen, int blocksize, int wrprotect, + int dpo, int fua, int fua_nv, int group, + unsigned char *data) +{ + struct scsi_task *task; + + logging(LOG_VERBOSE, "Send WRITE16 LBA:%" PRId64 " blocks:%d " + "wrprotect:%d dpo:%d fua:%d fua_nv:%d group:%d", + lba, datalen / blocksize, wrprotect, + dpo, fua, fua_nv, group); + + if (!data_loss) { + printf("--dataloss flag is not set in. Skipping write\n"); + return -1; + } + + task = iscsi_write16_sync(iscsi, lun, lba, + data, datalen, blocksize, + wrprotect, dpo, fua, fua_nv, group); + if (task == NULL) { + logging(LOG_NORMAL, "[FAILED] Failed to send WRITE16 command: %s", + iscsi_get_error(iscsi)); + return -1; + } + if (task->status != SCSI_STATUS_GOOD) { + logging(LOG_NORMAL, "[FAILED] WRITE16 command: " + "failed with sense. %s", iscsi_get_error(iscsi)); + scsi_free_scsi_task(task); + return -1; + } + + scsi_free_scsi_task(task); + logging(LOG_VERBOSE, "[OK] WRITE16 returned SUCCESS."); + return 0; +} + +int +write16_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint64_t lba, + uint32_t datalen, int blocksize, int wrprotect, + int dpo, int fua, int fua_nv, int group, + unsigned char *data) +{ + struct scsi_task *task; + + logging(LOG_VERBOSE, "Send WRITE16 (Expecting INVALID_FIELD_IN_CDB) " + "LBA:%" PRId64 " blocks:%d wrprotect:%d " + "dpo:%d fua:%d fua_nv:%d group:%d", + lba, datalen / blocksize, wrprotect, + dpo, fua, fua_nv, group); + + if (!data_loss) { + printf("--dataloss flag is not set in. Skipping write\n"); + return -1; + } + + task = iscsi_write16_sync(iscsi, lun, lba, data, datalen, blocksize, + wrprotect, dpo, fua, fua_nv, group); + if (task == NULL) { + logging(LOG_NORMAL, "[FAILED] Failed to send WRITE16 command: %s", + iscsi_get_error(iscsi)); + return -1; + } + if (task->status == SCSI_STATUS_GOOD) { + logging(LOG_NORMAL, "[FAILED] WRITE16 successful but should " + "have failed with ILLEGAL_REQUEST/INVALID_FIELD_IN_CDB"); + 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] WRITE16 failed with wrong sense. " + "Should have failed with ILLEGAL_REQUEST/" + "INVALID_FIELD_IN_CDB. Sense:%s\n", + iscsi_get_error(iscsi)); + scsi_free_scsi_task(task); + return -1; + } + + scsi_free_scsi_task(task); + logging(LOG_VERBOSE, "[OK] WRITE16 returned ILLEGAL_REQUEST/INVALID_FIELD_IB_CDB."); + return 0; +} + +int +write16_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint64_t lba, + uint32_t datalen, int blocksize, int wrprotect, + int dpo, int fua, int fua_nv, int group, + unsigned char *data) +{ + struct scsi_task *task; + + logging(LOG_VERBOSE, "Send WRITE16 (Expecting LBA_OUT_OF_RANGE) " + "LBA:%" PRId64 " blocks:%d wrprotect:%d " + "dpo:%d fua:%d fua_nv:%d group:%d", + lba, datalen / blocksize, wrprotect, + dpo, fua, fua_nv, group); + + if (!data_loss) { + printf("--dataloss flag is not set in. Skipping write\n"); + return -1; + } + + task = iscsi_write16_sync(iscsi, lun, lba, data, datalen, blocksize, + wrprotect, dpo, fua, fua_nv, group); + if (task == NULL) { + logging(LOG_NORMAL, "[FAILED] Failed to send WRITE16 command: %s", + iscsi_get_error(iscsi)); + return -1; + } + if (task->status == SCSI_STATUS_GOOD) { + logging(LOG_NORMAL, "[FAILED] WRITE16 successful but should " + "have failed with ILLEGAL_REQUEST/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) { + logging(LOG_NORMAL, "[FAILED] WRITE16 failed with wrong sense. " + "Should have failed with ILLEGAL_REQUEST/" + "LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); + scsi_free_scsi_task(task); + return -1; + } + + scsi_free_scsi_task(task); + logging(LOG_VERBOSE, "[OK] WRITE16 returned ILLEGAL_REQUEST/LBA_OUT_OF_RANGE."); + return 0; +} + + int inquiry(struct iscsi_context *iscsi, int lun, int evpd, int page_code, int maxsize) { diff --git a/test-tool/iscsi-support.h b/test-tool/iscsi-support.h index b8aedcd..6a1d090 100644 --- a/test-tool/iscsi-support.h +++ b/test-tool/iscsi-support.h @@ -143,6 +143,11 @@ int verify16(struct iscsi_context *iscsi, int lun, unsigned char *data, uint32_t 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 write16(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data); +int write16_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data); +int write16_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data); + + int inquiry(struct iscsi_context *iscsi, int lun, int evpd, int page_code, int maxsize); #endif /* _ISCSI_SUPPORT_H_ */ diff --git a/test-tool/iscsi-test-cu.c b/test-tool/iscsi-test-cu.c index 10c1536..9a68d56 100644 --- a/test-tool/iscsi-test-cu.c +++ b/test-tool/iscsi-test-cu.c @@ -102,6 +102,15 @@ static CU_TestInfo tests_readcapacity10[] = { CU_TEST_INFO_NULL }; +static CU_TestInfo tests_write16[] = { + { (char *)"testWrite16Simple", test_write16_simple }, + { (char *)"testWrite16BeyondEol", test_write16_beyond_eol }, + { (char *)"testWrite16ZeroBlocks", test_write16_0blocks }, + { (char *)"testWrite16WriteProtect", test_write16_wrprotect }, + { (char *)"testWrite16Flags", test_write16_flags }, + CU_TEST_INFO_NULL +}; + static CU_SuiteInfo suites[] = { { (char *)"TestTestUnitReady", test_setup, test_teardown, tests_testunitready }, @@ -115,6 +124,8 @@ static CU_SuiteInfo suites[] = { tests_read16 }, { (char *)"TestReadCapacity10", test_setup, test_teardown, tests_readcapacity10 }, + { (char *)"TestWrite16", test_setup, test_teardown, + tests_write16 }, CU_SUITE_INFO_NULL }; diff --git a/test-tool/iscsi-test-cu.h b/test-tool/iscsi-test-cu.h index 1811d05..4e76779 100644 --- a/test-tool/iscsi-test-cu.h +++ b/test-tool/iscsi-test-cu.h @@ -64,4 +64,10 @@ void test_read16_flags(void); void test_readcapacity10_simple(void); +void test_write16_simple(void); +void test_write16_beyond_eol(void); +void test_write16_0blocks(void); +void test_write16_wrprotect(void); +void test_write16_flags(void); + #endif /* _ISCSI_TEST_CU_H_ */ diff --git a/test-tool/test_read16_0blocks.c b/test-tool/test_read16_0blocks.c index 8e7739f..b7aa679 100644 --- a/test-tool/test_read16_0blocks.c +++ b/test-tool/test_read16_0blocks.c @@ -34,11 +34,6 @@ test_read16_0blocks(void) 0, 0, 0, 0, 0, NULL); CU_ASSERT_EQUAL(ret, 0); - if (num_blocks > 0x80000000) { - CU_PASS("[SKIPPED] LUN is too big"); - return; - } - logging(LOG_VERBOSE, "Test READ16 0-blocks one block past end-of-LUN"); ret = read16_lbaoutofrange(iscsic, tgt_lun, num_blocks + 1, 0, block_size, 0, 0, 0, 0, 0, NULL); diff --git a/test-tool/test_read16_flags.c b/test-tool/test_read16_flags.c index 1ca971c..8213b92 100644 --- a/test-tool/test_read16_flags.c +++ b/test-tool/test_read16_flags.c @@ -69,7 +69,7 @@ test_read16_flags(void) logging(LOG_VERBOSE, "Test READ16 with DPO==1 FUA==1 FUA_NV==1"); - ret = read12(iscsic, tgt_lun, 0, + ret = read16(iscsic, tgt_lun, 0, block_size, block_size, 0, 1, 1, 1, 0, NULL); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_write16_0blocks.c b/test-tool/test_write16_0blocks.c new file mode 100644 index 0000000..87d72ad --- /dev/null +++ b/test-tool/test_write16_0blocks.c @@ -0,0 +1,59 @@ +/* + Copyright (C) 2013 Ronnie Sahlberg + + 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 . +*/ + +#include + +#include + +#include "iscsi.h" +#include "scsi-lowlevel.h" +#include "iscsi-test-cu.h" + +void +test_write16_0blocks(void) +{ + int ret; + + if (!data_loss) { + CU_PASS("[SKIPPED] --dataloss flag is not set. Skipping test."); + CU_PASS("[SKIPPED] --dataloss flag is not set. Skipping test."); + return; + } + + logging(LOG_VERBOSE, ""); + logging(LOG_VERBOSE, "Test WRITE16 0-blocks at LBA==0"); + ret = write16(iscsic, tgt_lun, 0, 0, block_size, + 0, 0, 0, 0, 0, NULL); + CU_ASSERT_EQUAL(ret, 0); + + logging(LOG_VERBOSE, "Test WRITE16 0-blocks one block past end-of-LUN"); + ret = write16_lbaoutofrange(iscsic, tgt_lun, num_blocks + 1, 0, + block_size, 0, 0, 0, 0, 0, NULL); + CU_ASSERT_EQUAL(ret, 0); + + + logging(LOG_VERBOSE, "Test WRITE16 0-blocks at LBA==2^63"); + ret = write16_lbaoutofrange(iscsic, tgt_lun, 0x8000000000000000, 0, + block_size, 0, 0, 0, 0, 0, NULL); + CU_ASSERT_EQUAL(ret, 0); + + + logging(LOG_VERBOSE, "Test WRITE16 0-blocks at LBA==-1"); + ret = write16_lbaoutofrange(iscsic, tgt_lun, -1, 0, block_size, + 0, 0, 0, 0, 0, NULL); + CU_ASSERT_EQUAL(ret, 0); +} diff --git a/test-tool/test_write16_beyond_eol.c b/test-tool/test_write16_beyond_eol.c new file mode 100644 index 0000000..eadcf04 --- /dev/null +++ b/test-tool/test_write16_beyond_eol.c @@ -0,0 +1,89 @@ +/* + Copyright (C) 2013 Ronnie Sahlberg + + 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 . +*/ + +#include + +#include + +#include "iscsi.h" +#include "scsi-lowlevel.h" +#include "iscsi-test-cu.h" + + +void +test_write16_beyond_eol(void) +{ + int i, ret; + + if (!data_loss) { + CU_PASS("[SKIPPED] --dataloss flag is not set. Skipping test."); + return; + } + + /* This test is only valid for SBC devices */ + if (device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) { + CU_PASS("[SKIPPED] LUN is not SBC device. Skipping test"); + return; + } + + logging(LOG_VERBOSE, ""); + logging(LOG_VERBOSE, "Test WRITE16 1-256 blocks one block beyond the end"); + for (i = 1; i <= 256; i++) { + unsigned char *buf = malloc(block_size * i); + + ret = write16_lbaoutofrange(iscsic, tgt_lun, num_blocks + 2 - i, + i * block_size, block_size, + 0, 0, 0, 0, 0, buf); + free(buf); + CU_ASSERT_EQUAL(ret, 0); + } + + + logging(LOG_VERBOSE, "Test WRITE16 1-256 blocks at LBA==2^63"); + for (i = 1; i <= 256; i++) { + unsigned char *buf = malloc(block_size * i); + + ret = write16_lbaoutofrange(iscsic, tgt_lun, 0x8000000000000000, + i * block_size, block_size, + 0, 0, 0, 0, 0, buf); + free(buf); + CU_ASSERT_EQUAL(ret, 0); + } + + + logging(LOG_VERBOSE, "Test WRITE16 1-256 blocks at LBA==-1"); + for (i = 1; i <= 256; i++) { + unsigned char *buf = malloc(block_size * i); + + ret = write16_lbaoutofrange(iscsic, tgt_lun, -1, i * block_size, + block_size, 0, 0, 0, 0, 0, buf); + free(buf); + CU_ASSERT_EQUAL(ret, 0); + } + + + logging(LOG_VERBOSE, "Test WRITE16 2-256 blocks all but one block beyond the end"); + for (i = 2; i <= 256; i++) { + unsigned char *buf = malloc(block_size * i); + + ret = write16_lbaoutofrange(iscsic, tgt_lun, num_blocks, + i * block_size, block_size, + 0, 0, 0, 0, 0, buf); + free(buf); + CU_ASSERT_EQUAL(ret, 0); + } +} diff --git a/test-tool/test_write16_flags.c b/test-tool/test_write16_flags.c new file mode 100644 index 0000000..656377a --- /dev/null +++ b/test-tool/test_write16_flags.c @@ -0,0 +1,80 @@ +/* + Copyright (C) 2013 Ronnie Sahlberg + + 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 . +*/ + +#include +#include +#include + +#include + +#include "iscsi.h" +#include "scsi-lowlevel.h" +#include "iscsi-test-cu.h" + +void +test_write16_flags(void) +{ + int ret; + + logging(LOG_VERBOSE, ""); + logging(LOG_VERBOSE, "Test WRITE16 flags"); + + if (!data_loss) { + CU_PASS("[SKIPPED] --dataloss flag is not set. Skipping test."); + return; + } + + /* This test is only valid for SBC devices */ + if (device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) { + CU_PASS("[SKIPPED] LUN is not SBC device. Skipping test"); + return; + } + + logging(LOG_VERBOSE, "Test WRITE16 with DPO==1"); + ret = write16(iscsic, tgt_lun, 0, + block_size, block_size, + 0, 1, 0, 0, 0, NULL); + CU_ASSERT_EQUAL(ret, 0); + + + logging(LOG_VERBOSE, "Test WRITE16 with FUA==1 FUA_NV==0"); + ret = write16(iscsic, tgt_lun, 0, + block_size, block_size, + 0, 0, 1, 0, 0, NULL); + CU_ASSERT_EQUAL(ret, 0); + + + logging(LOG_VERBOSE, "Test WRITE16 with FUA==1 FUA_NV==1"); + ret = write16(iscsic, tgt_lun, 0, + block_size, block_size, + 0, 0, 1, 1, 0, NULL); + CU_ASSERT_EQUAL(ret, 0); + + + logging(LOG_VERBOSE, "Test WRITE16 with FUA==0 FUA_NV==1"); + ret = write16(iscsic, tgt_lun, 0, + block_size, block_size, + 0, 0, 0, 1, 0, NULL); + CU_ASSERT_EQUAL(ret, 0); + + + logging(LOG_VERBOSE, "Test WRITE16 with DPO==1 FUA==1 FUA_NV==1"); + ret = write16(iscsic, tgt_lun, 0, + block_size, block_size, + 0, 1, 1, 1, 0, NULL); + CU_ASSERT_EQUAL(ret, 0); +} diff --git a/test-tool/test_write16_simple.c b/test-tool/test_write16_simple.c new file mode 100644 index 0000000..4ef5029 --- /dev/null +++ b/test-tool/test_write16_simple.c @@ -0,0 +1,67 @@ + +/* + Copyright (C) 2013 Ronnie Sahlberg + + 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 . +*/ + +#include + +#include + +#include "iscsi.h" +#include "scsi-lowlevel.h" +#include "iscsi-support.h" +#include "iscsi-test-cu.h" + + +void +test_write16_simple(void) +{ + int i, ret; + + if (!data_loss) { + CU_PASS("[SKIPPED] --dataloss flag is not set. Skipping test."); + return; + } + + /* This test is only valid for SBC devices */ + if (device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) { + CU_PASS("[SKIPPED] LUN is not SBC device. Skipping test"); + return; + } + + logging(LOG_VERBOSE, ""); + logging(LOG_VERBOSE, "Test WRITE16 of 1-256 blocks at the start of the LUN"); + + for (i = 1; i <= 256; i++) { + unsigned char *buf = malloc(block_size * i); + + ret = write16(iscsic, tgt_lun, 0, i * block_size, + block_size, 0, 0, 0, 0, 0, buf); + free(buf); + CU_ASSERT_EQUAL(ret, 0); + } + + logging(LOG_VERBOSE, "Test WRITE16 of 1-256 blocks at the end of the LUN"); + for (i = 1; i <= 256; i++) { + unsigned char *buf = malloc(block_size * i); + + ret = write16(iscsic, tgt_lun, num_blocks +1 - i, + i * block_size, block_size, 0, 0, 0, 0, 0, buf); + free(buf); + CU_ASSERT_EQUAL(ret, 0); + } + +} diff --git a/test-tool/test_write16_wrprotect.c b/test-tool/test_write16_wrprotect.c new file mode 100644 index 0000000..692a085 --- /dev/null +++ b/test-tool/test_write16_wrprotect.c @@ -0,0 +1,55 @@ +/* + Copyright (C) 2013 Ronnie Sahlberg + + 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 . +*/ + +#include +#include +#include + +#include + +#include "iscsi.h" +#include "scsi-lowlevel.h" +#include "iscsi-test-cu.h" + +void +test_write16_wrprotect(void) +{ + int i, ret; + + if (!data_loss) { + CU_PASS("[SKIPPED] --dataloss flag is not set. Skipping test."); + return; + } + + if (device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) { + CU_PASS("[SKIPPED] LUN is not SBC device. Skipping test"); + return; + } + + /* + * Try out different non-zero values for WRPROTECT. + * They should all fail. + */ + logging(LOG_VERBOSE, ""); + logging(LOG_VERBOSE, "Test WRITE16 with non-zero WRPROTECT"); + for (i = 1; i < 8; i++) { + ret = write16_invalidfieldincdb(iscsic, tgt_lun, 0, + block_size, block_size, + i, 0, 0, 0, 0, NULL); + CU_ASSERT_EQUAL(ret, 0); + } +}