TEST add simple UNMAP test
This commit is contained in:
@@ -199,6 +199,7 @@ bin_iscsi_test_cu_SOURCES = test-tool/iscsi-test-cu.c \
|
|||||||
test-tool/test_readcapacity10_simple.c \
|
test-tool/test_readcapacity10_simple.c \
|
||||||
test-tool/test_readcapacity16_simple.c \
|
test-tool/test_readcapacity16_simple.c \
|
||||||
test-tool/test_readcapacity16_alloclen.c \
|
test-tool/test_readcapacity16_alloclen.c \
|
||||||
|
test-tool/test_unmap_simple.c \
|
||||||
test-tool/test_verify10_simple.c \
|
test-tool/test_verify10_simple.c \
|
||||||
test-tool/test_verify10_beyond_eol.c \
|
test-tool/test_verify10_beyond_eol.c \
|
||||||
test-tool/test_verify10_0blocks.c \
|
test-tool/test_verify10_0blocks.c \
|
||||||
|
|||||||
@@ -1460,6 +1460,36 @@ readcapacity16(struct iscsi_context *iscsi, int lun, int alloc_len)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
unmap(struct iscsi_context *iscsi, int lun, int anchor, struct unmap_list *list, int list_len)
|
||||||
|
{
|
||||||
|
struct scsi_task *task;
|
||||||
|
|
||||||
|
logging(LOG_VERBOSE, "Send UNMAP list_len:%d anchor:%d", list_len, anchor);
|
||||||
|
task = iscsi_unmap_sync(iscsi, lun, anchor, 0, list, list_len);
|
||||||
|
if (task == NULL) {
|
||||||
|
logging(LOG_NORMAL, "[FAILED] Failed to send UNMAP 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] UNMAP is not implemented on target");
|
||||||
|
scsi_free_scsi_task(task);
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
if (task->status != SCSI_STATUS_GOOD) {
|
||||||
|
logging(LOG_NORMAL, "[FAILED] UNMAP 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] UNMAP returned SUCCESS.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
verify10(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int vprotect, int dpo, int bytchk, unsigned char *data)
|
verify10(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int vprotect, int dpo, int bytchk, unsigned char *data)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,6 +35,39 @@ extern int loglevel;
|
|||||||
#define LOG_VERBOSE 2
|
#define LOG_VERBOSE 2
|
||||||
void logging(int level, const char *format, ...);
|
void logging(int level, const char *format, ...);
|
||||||
|
|
||||||
|
#define CHECK_FOR_DATALOSS \
|
||||||
|
do { \
|
||||||
|
if (!data_loss) { \
|
||||||
|
logging(LOG_VERBOSE, "[SKIPPED] --dataloss flag is not " \
|
||||||
|
"set. Skipping test."); \
|
||||||
|
CU_PASS("[SKIPPED] --dataloss flag is not set. " \
|
||||||
|
"Skipping test."); \
|
||||||
|
return; \
|
||||||
|
} \
|
||||||
|
} while (0);
|
||||||
|
|
||||||
|
#define CHECK_FOR_THIN_PROVISIONING \
|
||||||
|
do { \
|
||||||
|
if (lbpme == 0){ \
|
||||||
|
logging(LOG_VERBOSE, "[SKIPPED] Logical unit is fully" \
|
||||||
|
" provisioned. Skipping test"); \
|
||||||
|
CU_PASS("[SKIPPED] Logical unit is fully provisioned." \
|
||||||
|
" Skipping test"); \
|
||||||
|
return; \
|
||||||
|
} \
|
||||||
|
} while (0);
|
||||||
|
|
||||||
|
#define CHECK_FOR_SBC \
|
||||||
|
do { \
|
||||||
|
if (device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {\
|
||||||
|
logging(LOG_VERBOSE, "[SKIPPED] Not SBC device." \
|
||||||
|
" Skipping test"); \
|
||||||
|
CU_PASS("[SKIPPED] Not SBC device." \
|
||||||
|
" Skipping test"); \
|
||||||
|
return; \
|
||||||
|
} \
|
||||||
|
} while (0);
|
||||||
|
|
||||||
extern uint32_t block_size;
|
extern uint32_t block_size;
|
||||||
extern uint64_t num_blocks;
|
extern uint64_t num_blocks;
|
||||||
extern int lbpme;
|
extern int lbpme;
|
||||||
@@ -132,6 +165,7 @@ int read16_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint64_t lba,
|
|||||||
int read16_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
|
int read16_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
|
||||||
int readcapacity10(struct iscsi_context *iscsi, int lun, uint32_t lba, int pmi);
|
int readcapacity10(struct iscsi_context *iscsi, int lun, uint32_t lba, int pmi);
|
||||||
int readcapacity16(struct iscsi_context *iscsi, int lun, int alloc_len);
|
int readcapacity16(struct iscsi_context *iscsi, int lun, int alloc_len);
|
||||||
|
int unmap(struct iscsi_context *iscsi, int lun, int anchor, struct unmap_list *list, int list_len);
|
||||||
int verify10(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int vprotect, int dpo, int bytchk, unsigned char *data);
|
int verify10(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int vprotect, int dpo, int bytchk, unsigned char *data);
|
||||||
int verify10_nomedium(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int vprotect, int dpo, int bytchk, unsigned char *data);
|
int verify10_nomedium(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int vprotect, int dpo, int bytchk, unsigned char *data);
|
||||||
int verify10_miscompare(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int vprotect, int dpo, int bytchk, unsigned char *data);
|
int verify10_miscompare(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int vprotect, int dpo, int bytchk, unsigned char *data);
|
||||||
|
|||||||
@@ -108,6 +108,11 @@ static CU_TestInfo tests_readcapacity16[] = {
|
|||||||
CU_TEST_INFO_NULL
|
CU_TEST_INFO_NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static CU_TestInfo tests_unmap[] = {
|
||||||
|
{ (char *)"testUnmapSimple", test_unmap_simple },
|
||||||
|
CU_TEST_INFO_NULL
|
||||||
|
};
|
||||||
|
|
||||||
static CU_TestInfo tests_verify10[] = {
|
static CU_TestInfo tests_verify10[] = {
|
||||||
{ (char *)"testVerify10Simple", test_verify10_simple },
|
{ (char *)"testVerify10Simple", test_verify10_simple },
|
||||||
{ (char *)"testVerify10BeyondEol", test_verify10_beyond_eol },
|
{ (char *)"testVerify10BeyondEol", test_verify10_beyond_eol },
|
||||||
@@ -183,6 +188,8 @@ static CU_SuiteInfo suites[] = {
|
|||||||
tests_readcapacity10 },
|
tests_readcapacity10 },
|
||||||
{ (char *)"TestReadCapacity16", test_setup, test_teardown,
|
{ (char *)"TestReadCapacity16", test_setup, test_teardown,
|
||||||
tests_readcapacity16 },
|
tests_readcapacity16 },
|
||||||
|
{ (char *)"TestUnmap", test_setup, test_teardown,
|
||||||
|
tests_unmap },
|
||||||
{ (char *)"TestVerify10", test_setup, test_teardown,
|
{ (char *)"TestVerify10", test_setup, test_teardown,
|
||||||
tests_verify10 },
|
tests_verify10 },
|
||||||
{ (char *)"TestVerify12", test_setup, test_teardown,
|
{ (char *)"TestVerify12", test_setup, test_teardown,
|
||||||
|
|||||||
@@ -67,6 +67,8 @@ void test_readcapacity10_simple(void);
|
|||||||
void test_readcapacity16_simple(void);
|
void test_readcapacity16_simple(void);
|
||||||
void test_readcapacity16_alloclen(void);
|
void test_readcapacity16_alloclen(void);
|
||||||
|
|
||||||
|
void test_unmap_simple(void);
|
||||||
|
|
||||||
void test_verify10_simple(void);
|
void test_verify10_simple(void);
|
||||||
void test_verify10_beyond_eol(void);
|
void test_verify10_beyond_eol(void);
|
||||||
void test_verify10_0blocks(void);
|
void test_verify10_0blocks(void);
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ test_read16_0blocks(void)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
CHECK_FOR_SBC;
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "");
|
logging(LOG_VERBOSE, "");
|
||||||
logging(LOG_VERBOSE, "Test READ16 0-blocks at LBA==0");
|
logging(LOG_VERBOSE, "Test READ16 0-blocks at LBA==0");
|
||||||
ret = read16(iscsic, tgt_lun, 0, 0, block_size,
|
ret = read16(iscsic, tgt_lun, 0, 0, block_size,
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ test_read16_beyond_eol(void)
|
|||||||
{
|
{
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
|
CHECK_FOR_SBC;
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "");
|
logging(LOG_VERBOSE, "");
|
||||||
logging(LOG_VERBOSE, "Test READ16 1-256 blocks one block beyond the end");
|
logging(LOG_VERBOSE, "Test READ16 1-256 blocks one block beyond the end");
|
||||||
for (i = 1; i <= 256; i++) {
|
for (i = 1; i <= 256; i++) {
|
||||||
|
|||||||
@@ -30,16 +30,11 @@ test_read16_flags(void)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
CHECK_FOR_SBC;
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "");
|
logging(LOG_VERBOSE, "");
|
||||||
logging(LOG_VERBOSE, "Test READ16 flags");
|
logging(LOG_VERBOSE, "Test READ16 flags");
|
||||||
|
|
||||||
/* 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 READ16 with DPO==1");
|
logging(LOG_VERBOSE, "Test READ16 with DPO==1");
|
||||||
ret = read16(iscsic, tgt_lun, 0,
|
ret = read16(iscsic, tgt_lun, 0,
|
||||||
block_size, block_size,
|
block_size, block_size,
|
||||||
|
|||||||
@@ -30,11 +30,7 @@ test_read16_rdprotect(void)
|
|||||||
{
|
{
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
|
CHECK_FOR_SBC;
|
||||||
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 RDPROTECT.
|
* Try out different non-zero values for RDPROTECT.
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ test_read16_simple(void)
|
|||||||
{
|
{
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
|
CHECK_FOR_SBC;
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "");
|
logging(LOG_VERBOSE, "");
|
||||||
logging(LOG_VERBOSE, "Test READ16 of 1-256 blocks at the start of the LUN");
|
logging(LOG_VERBOSE, "Test READ16 of 1-256 blocks at the start of the LUN");
|
||||||
|
|||||||
56
test-tool/test_unmap_simple.c
Normal file
56
test-tool/test_unmap_simple.c
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
|
||||||
|
/*
|
||||||
|
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_unmap_simple(void)
|
||||||
|
{
|
||||||
|
int i, ret;
|
||||||
|
struct unmap_list list[257];
|
||||||
|
|
||||||
|
CHECK_FOR_DATALOSS;
|
||||||
|
CHECK_FOR_THIN_PROVISIONING;
|
||||||
|
CHECK_FOR_SBC;
|
||||||
|
|
||||||
|
logging(LOG_VERBOSE, "");
|
||||||
|
logging(LOG_VERBOSE, "Test UNMAP of 1-256 blocks at the start of the LUN as a single descriptor");
|
||||||
|
for (i = 1; i <= 256; i++) {
|
||||||
|
list[0].lba = 0;
|
||||||
|
list[0].num = i;
|
||||||
|
ret = unmap(iscsic, tgt_lun, 0, list, 1);
|
||||||
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
logging(LOG_VERBOSE, "Test UNMAP of 1-256 blocks at the start of the LUN with one descriptor per block");
|
||||||
|
for (i = 1; i <= 256; i++) {
|
||||||
|
list[i].lba = i-1;
|
||||||
|
list[i].num = 1;
|
||||||
|
ret = unmap(iscsic, tgt_lun, 0, list, i);
|
||||||
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -28,10 +28,7 @@ test_write10_0blocks(void)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!data_loss) {
|
CHECK_FOR_DATALOSS;
|
||||||
CU_PASS("[SKIPPED] --dataloss flag is not set. Skipping test.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (num_blocks >= 0x80000000) {
|
if (num_blocks >= 0x80000000) {
|
||||||
CU_PASS("LUN is too big for read-beyond-eol tests with WRITE10. Skipping test.\n");
|
CU_PASS("LUN is too big for read-beyond-eol tests with WRITE10. Skipping test.\n");
|
||||||
|
|||||||
@@ -29,10 +29,7 @@ test_write10_beyond_eol(void)
|
|||||||
{
|
{
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
if (!data_loss) {
|
CHECK_FOR_DATALOSS;
|
||||||
CU_PASS("[SKIPPED] --dataloss flag is not set. Skipping test.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (num_blocks >= 0x80000000) {
|
if (num_blocks >= 0x80000000) {
|
||||||
CU_PASS("LUN is too big for write-beyond-eol tests with WRITE10. Skipping test.\n");
|
CU_PASS("LUN is too big for write-beyond-eol tests with WRITE10. Skipping test.\n");
|
||||||
|
|||||||
@@ -31,14 +31,11 @@ test_write10_flags(void)
|
|||||||
int ret;
|
int ret;
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
|
|
||||||
|
CHECK_FOR_DATALOSS;
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "");
|
logging(LOG_VERBOSE, "");
|
||||||
logging(LOG_VERBOSE, "Test WRITE10 flags");
|
logging(LOG_VERBOSE, "Test WRITE10 flags");
|
||||||
|
|
||||||
if (!data_loss) {
|
|
||||||
CU_PASS("[SKIPPED] --dataloss flag is not set. Skipping test.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
buf = malloc(block_size);
|
buf = malloc(block_size);
|
||||||
logging(LOG_VERBOSE, "Test WRITE10 with DPO==1");
|
logging(LOG_VERBOSE, "Test WRITE10 with DPO==1");
|
||||||
ret = write10(iscsic, tgt_lun, 0,
|
ret = write10(iscsic, tgt_lun, 0,
|
||||||
|
|||||||
@@ -31,10 +31,7 @@ test_write10_simple(void)
|
|||||||
{
|
{
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
if (!data_loss) {
|
CHECK_FOR_DATALOSS;
|
||||||
CU_PASS("[SKIPPED] --dataloss flag is not set. Skipping test.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "");
|
logging(LOG_VERBOSE, "");
|
||||||
logging(LOG_VERBOSE, "Test WRITE10 of 1-256 blocks at the start of the LUN");
|
logging(LOG_VERBOSE, "Test WRITE10 of 1-256 blocks at the start of the LUN");
|
||||||
|
|||||||
@@ -31,10 +31,7 @@ test_write10_wrprotect(void)
|
|||||||
int i, ret;
|
int i, ret;
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
|
|
||||||
if (!data_loss) {
|
CHECK_FOR_DATALOSS;
|
||||||
CU_PASS("[SKIPPED] --dataloss flag is not set. Skipping test.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Try out different non-zero values for WRPROTECT.
|
* Try out different non-zero values for WRPROTECT.
|
||||||
|
|||||||
@@ -28,10 +28,7 @@ test_write12_0blocks(void)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!data_loss) {
|
CHECK_FOR_DATALOSS;
|
||||||
CU_PASS("[SKIPPED] --dataloss flag is not set. Skipping test.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (num_blocks >= 0x80000000) {
|
if (num_blocks >= 0x80000000) {
|
||||||
CU_PASS("LUN is too big for read-beyond-eol tests with WRITE12. Skipping test.\n");
|
CU_PASS("LUN is too big for read-beyond-eol tests with WRITE12. Skipping test.\n");
|
||||||
|
|||||||
@@ -29,10 +29,7 @@ test_write12_beyond_eol(void)
|
|||||||
{
|
{
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
if (!data_loss) {
|
CHECK_FOR_DATALOSS;
|
||||||
CU_PASS("[SKIPPED] --dataloss flag is not set. Skipping test.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (num_blocks >= 0x80000000) {
|
if (num_blocks >= 0x80000000) {
|
||||||
CU_PASS("LUN is too big for write-beyond-eol tests with WRITE12. Skipping test.\n");
|
CU_PASS("LUN is too big for write-beyond-eol tests with WRITE12. Skipping test.\n");
|
||||||
|
|||||||
@@ -31,14 +31,11 @@ test_write12_flags(void)
|
|||||||
int ret;
|
int ret;
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
|
|
||||||
|
CHECK_FOR_DATALOSS;
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "");
|
logging(LOG_VERBOSE, "");
|
||||||
logging(LOG_VERBOSE, "Test WRITE12 flags");
|
logging(LOG_VERBOSE, "Test WRITE12 flags");
|
||||||
|
|
||||||
if (!data_loss) {
|
|
||||||
CU_PASS("[SKIPPED] --dataloss flag is not set. Skipping test.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
buf = malloc(block_size);
|
buf = malloc(block_size);
|
||||||
logging(LOG_VERBOSE, "Test WRITE12 with DPO==1");
|
logging(LOG_VERBOSE, "Test WRITE12 with DPO==1");
|
||||||
ret = write12(iscsic, tgt_lun, 0,
|
ret = write12(iscsic, tgt_lun, 0,
|
||||||
|
|||||||
@@ -31,10 +31,7 @@ test_write12_simple(void)
|
|||||||
{
|
{
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
if (!data_loss) {
|
CHECK_FOR_DATALOSS;
|
||||||
CU_PASS("[SKIPPED] --dataloss flag is not set. Skipping test.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "");
|
logging(LOG_VERBOSE, "");
|
||||||
logging(LOG_VERBOSE, "Test WRITE12 of 1-256 blocks at the start of the LUN");
|
logging(LOG_VERBOSE, "Test WRITE12 of 1-256 blocks at the start of the LUN");
|
||||||
|
|||||||
@@ -31,10 +31,7 @@ test_write12_wrprotect(void)
|
|||||||
int i, ret;
|
int i, ret;
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
|
|
||||||
if (!data_loss) {
|
CHECK_FOR_DATALOSS;
|
||||||
CU_PASS("[SKIPPED] --dataloss flag is not set. Skipping test.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Try out different non-zero values for WRPROTECT.
|
* Try out different non-zero values for WRPROTECT.
|
||||||
|
|||||||
@@ -28,16 +28,8 @@ test_write16_0blocks(void)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!data_loss) {
|
CHECK_FOR_DATALOSS;
|
||||||
CU_PASS("[SKIPPED] --dataloss flag is not set. Skipping test.");
|
CHECK_FOR_SBC;
|
||||||
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, "");
|
||||||
logging(LOG_VERBOSE, "Test WRITE16 0-blocks at LBA==0");
|
logging(LOG_VERBOSE, "Test WRITE16 0-blocks at LBA==0");
|
||||||
|
|||||||
@@ -29,16 +29,8 @@ test_write16_beyond_eol(void)
|
|||||||
{
|
{
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
if (!data_loss) {
|
CHECK_FOR_DATALOSS;
|
||||||
CU_PASS("[SKIPPED] --dataloss flag is not set. Skipping test.");
|
CHECK_FOR_SBC;
|
||||||
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, "");
|
||||||
logging(LOG_VERBOSE, "Test WRITE16 1-256 blocks one block beyond the end");
|
logging(LOG_VERBOSE, "Test WRITE16 1-256 blocks one block beyond the end");
|
||||||
|
|||||||
@@ -31,20 +31,12 @@ test_write16_flags(void)
|
|||||||
int ret;
|
int ret;
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
|
|
||||||
|
CHECK_FOR_DATALOSS;
|
||||||
|
CHECK_FOR_SBC;
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "");
|
logging(LOG_VERBOSE, "");
|
||||||
logging(LOG_VERBOSE, "Test WRITE16 flags");
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
buf = malloc(block_size);
|
buf = malloc(block_size);
|
||||||
logging(LOG_VERBOSE, "Test WRITE16 with DPO==1");
|
logging(LOG_VERBOSE, "Test WRITE16 with DPO==1");
|
||||||
ret = write16(iscsic, tgt_lun, 0,
|
ret = write16(iscsic, tgt_lun, 0,
|
||||||
|
|||||||
@@ -31,16 +31,8 @@ test_write16_simple(void)
|
|||||||
{
|
{
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
if (!data_loss) {
|
CHECK_FOR_DATALOSS;
|
||||||
CU_PASS("[SKIPPED] --dataloss flag is not set. Skipping test.");
|
CHECK_FOR_SBC;
|
||||||
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, "");
|
||||||
logging(LOG_VERBOSE, "Test WRITE16 of 1-256 blocks at the start of the LUN");
|
logging(LOG_VERBOSE, "Test WRITE16 of 1-256 blocks at the start of the LUN");
|
||||||
|
|||||||
@@ -31,15 +31,8 @@ test_write16_wrprotect(void)
|
|||||||
int i, ret;
|
int i, ret;
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
|
|
||||||
if (!data_loss) {
|
CHECK_FOR_DATALOSS;
|
||||||
CU_PASS("[SKIPPED] --dataloss flag is not set. Skipping test.");
|
CHECK_FOR_SBC;
|
||||||
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.
|
* Try out different non-zero values for WRPROTECT.
|
||||||
|
|||||||
Reference in New Issue
Block a user