TESTS: Add tests for medium access commands when medium is ejected
This commit is contained in:
@@ -188,6 +188,7 @@ bin_iscsi_test_cu_SOURCES = test-tool/iscsi-test-cu.c \
|
||||
test-tool/iscsi-support.c \
|
||||
test-tool/test_get_lba_status_simple.c \
|
||||
test-tool/test_get_lba_status_beyond_eol.c \
|
||||
test-tool/test_nomedia_sbc.c \
|
||||
test-tool/test_orwrite_simple.c \
|
||||
test-tool/test_orwrite_beyond_eol.c \
|
||||
test-tool/test_orwrite_0blocks.c \
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -202,6 +202,12 @@ int verify_write_fails(struct iscsi_context *iscsi, int lun, unsigned char *buf)
|
||||
int inquiry(struct iscsi_context *iscsi, int lun, int evpd, int page_code, int maxsize);
|
||||
int get_lba_status(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t len);
|
||||
int get_lba_status_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t len);
|
||||
int get_lba_status_nomedium(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t len);
|
||||
int orwrite(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 orwrite_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 orwrite_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 orwrite_writeprotected(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 orwrite_nomedium(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 prefetch10(struct iscsi_context *iscsi, int lun, uint32_t lba, int num_blocks, int immed, int group);
|
||||
int prefetch10_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint32_t lba, int num_blocks, int immed, int group);
|
||||
int prefetch10_nomedium(struct iscsi_context *iscsi, int lun, uint32_t lba, int num_blocks, int immed, int group);
|
||||
@@ -213,21 +219,31 @@ int read6_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint32_t lba, uint
|
||||
int read10(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
|
||||
int read10_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
|
||||
int read10_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
|
||||
int read10_nomedium(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
|
||||
int read12(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
|
||||
int read12_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
|
||||
int read12_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
|
||||
int read12_nomedium(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
|
||||
int read16(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_invalidfieldincdb(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 read16_nomedium(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_nomedium(struct iscsi_context *iscsi, int lun, uint32_t lba, int pmi);
|
||||
int readcapacity16(struct iscsi_context *iscsi, int lun, int alloc_len);
|
||||
int readcapacity16_nomedium(struct iscsi_context *iscsi, int lun, int alloc_len);
|
||||
int startstopunit(struct iscsi_context *iscsi, int lun, int immed, int pcm, int pc, int no_flush, int loej, int start);
|
||||
int synchronizecache10(struct iscsi_context *iscsi, int lun, uint32_t lba, int num_blocks, int sync_nv, int immed);
|
||||
int synchronizecache10_nomedium(struct iscsi_context *iscsi, int lun, uint32_t lba, int num_blocks, int sync_nv, int immed);
|
||||
int synchronizecache16(struct iscsi_context *iscsi, int lun, uint64_t lba, int num_blocks, int sync_nv, int immed);
|
||||
int synchronizecache16_nomedium(struct iscsi_context *iscsi, int lun, uint64_t lba, int num_blocks, int sync_nv, int immed);
|
||||
int testunitready_clear_ua(struct iscsi_context *iscsi, int lun);
|
||||
int testunitready(struct iscsi_context *iscsi, int lun);
|
||||
int testunitready_nomedium(struct iscsi_context *iscsi, int lun);
|
||||
int testunitready_conflict(struct iscsi_context *iscsi, int lun);
|
||||
int unmap(struct iscsi_context *iscsi, int lun, int anchor, struct unmap_list *list, int list_len);
|
||||
int unmap_writeprotected(struct iscsi_context *iscsi, int lun, int anchor, struct unmap_list *list, int list_len);
|
||||
int unmap_nomedium(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_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);
|
||||
@@ -247,38 +263,42 @@ int write10(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen
|
||||
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);
|
||||
int write10_writeprotected(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_nomedium(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 write12(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 write12_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 write12_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);
|
||||
int write12_writeprotected(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 write12_nomedium(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 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 write16_writeprotected(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_nomedium(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 writesame10(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int num_blocks, int anchor, int unmap, int wrprotect, int group, unsigned char *data);
|
||||
int writesame10_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int num_blocks, int anchor, int unmap, int wrprotect, int group, unsigned char *data);
|
||||
int writesame10_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int num_blocks, int anchor, int unmap, int wrprotect, int group, unsigned char *data);
|
||||
int writesame10_writeprotected(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int num_blocks, int anchor, int unmap, int wrprotect, int group, unsigned char *data);
|
||||
int writesame10_nomedium(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int num_blocks, int anchor, int unmap, int wrprotect, int group, unsigned char *data);
|
||||
int writesame16(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int num_blocks, int anchor, int unmap, int wrprotect, int group, unsigned char *data);
|
||||
int writesame16_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int num_blocks, int anchor, int unmap, int wrprotect, int group, unsigned char *data);
|
||||
int writesame16_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int num_blocks, int anchor, int unmap, int wrprotect, int group, unsigned char *data);
|
||||
int writesame16_writeprotected(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int num_blocks, int anchor, int unmap, int wrprotect, int group, unsigned char *data);
|
||||
int writesame16_nomedium(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int num_blocks, int anchor, int unmap, int wrprotect, int group, unsigned char *data);
|
||||
int writeverify10(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
int writeverify10_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
int writeverify10_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
int writeverify10_writeprotected(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
int writeverify10_nomedium(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
int writeverify12(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
int writeverify12_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
int writeverify12_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
int writeverify12_writeprotected(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
int writeverify12_nomedium(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
int writeverify16(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
int writeverify16_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
int writeverify16_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
int writeverify16_writeprotected(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
int orwrite(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 orwrite_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 orwrite_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 orwrite_writeprotected(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 writeverify16_nomedium(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -66,6 +66,11 @@ static CU_TestInfo tests_get_lba_status[] = {
|
||||
CU_TEST_INFO_NULL
|
||||
};
|
||||
|
||||
static CU_TestInfo tests_nomedia[] = {
|
||||
{ (char *)"testNoMediaSBC", test_nomedia_sbc },
|
||||
CU_TEST_INFO_NULL
|
||||
};
|
||||
|
||||
static CU_TestInfo tests_orwrite[] = {
|
||||
{ (char *)"testOrWriteSimple", test_orwrite_simple },
|
||||
{ (char *)"testOrWriteBeyondEol", test_orwrite_beyond_eol },
|
||||
@@ -318,6 +323,8 @@ static CU_TestInfo tests_writeverify16[] = {
|
||||
static CU_SuiteInfo suites[] = {
|
||||
{ (char *)"TestGetLBAStatus", test_setup, test_teardown,
|
||||
tests_get_lba_status },
|
||||
{ (char *)"TestNoMedia", test_setup, test_teardown,
|
||||
tests_nomedia },
|
||||
{ (char *)"TestOrWrite", test_setup, test_teardown,
|
||||
tests_orwrite },
|
||||
{ (char *)"TestPrefetch10", test_setup, test_teardown,
|
||||
|
||||
@@ -43,6 +43,8 @@ int test_teardown_pgr(void);
|
||||
void test_get_lba_status_simple(void);
|
||||
void test_get_lba_status_beyond_eol(void);
|
||||
|
||||
void test_nomedia_sbc(void);
|
||||
|
||||
void test_orwrite_simple(void);
|
||||
void test_orwrite_beyond_eol(void);
|
||||
void test_orwrite_0blocks(void);
|
||||
|
||||
250
test-tool/test_nomedia_sbc.c
Normal file
250
test-tool/test_nomedia_sbc.c
Normal file
@@ -0,0 +1,250 @@
|
||||
/*
|
||||
Copyright (C) 2013 by 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_nomedia_sbc(void)
|
||||
{
|
||||
int ret;
|
||||
unsigned char buf[4096];
|
||||
struct unmap_list list[1];
|
||||
|
||||
CHECK_FOR_SBC;
|
||||
|
||||
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
||||
logging(LOG_VERBOSE, "Test that Medium commands fail when medium is ejected on SBC devices");
|
||||
|
||||
if (!removable) {
|
||||
logging(LOG_VERBOSE, "[SKIPPED] LUN is not removable. "
|
||||
"Skipping test.");
|
||||
return;
|
||||
}
|
||||
|
||||
logging(LOG_VERBOSE, "Eject the medium.");
|
||||
ret = startstopunit(iscsic, tgt_lun, 1, 0, 0, 0, 1, 0);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
logging(LOG_VERBOSE, "Test TESTUNITREADY when medium is ejected.");
|
||||
ret = testunitready_nomedium(iscsic, tgt_lun);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
logging(LOG_VERBOSE, "Test SYNCHRONIZECACHE10 when medium is ejected.");
|
||||
ret = synchronizecache10_nomedium(iscsic, tgt_lun, 0, 1, 1, 1);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] target does not support "
|
||||
"SYNCHRONIZECACHE10");
|
||||
} else {
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
logging(LOG_VERBOSE, "Test SYNCHRONIZECACHE16 when medium is ejected.");
|
||||
ret = synchronizecache16_nomedium(iscsic, tgt_lun, 0, 1, 1, 1);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] target does not support "
|
||||
"SYNCHRONIZECACHE16");
|
||||
} else {
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
logging(LOG_VERBOSE, "Test READ10 when medium is ejected.");
|
||||
ret = read10_nomedium(iscsic, tgt_lun, 0, block_size, block_size,
|
||||
0, 0, 0, 0, 0, NULL);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
logging(LOG_VERBOSE, "Test READ12 when medium is ejected.");
|
||||
ret = read12_nomedium(iscsic, tgt_lun, 0, block_size, block_size,
|
||||
0, 0, 0, 0, 0, NULL);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
logging(LOG_VERBOSE, "Test READ16 when medium is ejected.");
|
||||
ret = read16_nomedium(iscsic, tgt_lun, 0, block_size, block_size,
|
||||
0, 0, 0, 0, 0, NULL);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
logging(LOG_VERBOSE, "Test READCAPACITY10 when medium is ejected.");
|
||||
ret = readcapacity10_nomedium(iscsic, tgt_lun, 0, 0);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
logging(LOG_VERBOSE, "Test READCAPACITY16 when medium is ejected.");
|
||||
ret = readcapacity16_nomedium(iscsic, tgt_lun, 15);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
logging(LOG_VERBOSE, "Test GET_LBA_STATUS when medium is ejected.");
|
||||
ret = get_lba_status_nomedium(iscsic, tgt_lun, 0, 24);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] target does not support "
|
||||
"GET_LBA_STATUS");
|
||||
} else {
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
logging(LOG_VERBOSE, "Test PREFETCH10 when medium is ejected.");
|
||||
ret = prefetch10_nomedium(iscsic, tgt_lun, 0, 1, 1, 0);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] target does not support "
|
||||
"PREFETCH10");
|
||||
} else {
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
logging(LOG_VERBOSE, "Test PREFETCH16 when medium is ejected.");
|
||||
ret = prefetch16_nomedium(iscsic, tgt_lun, 0, 1, 1, 0);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] target does not support "
|
||||
"PREFETCH16");
|
||||
} else {
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
logging(LOG_VERBOSE, "Test VERIFY10 when medium is ejected.");
|
||||
ret = verify10_nomedium(iscsic, tgt_lun, 0, block_size, block_size,
|
||||
0, 0, 1, buf);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] target does not support "
|
||||
"VERIFY10");
|
||||
} else {
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
logging(LOG_VERBOSE, "Test VERIFY12 when medium is ejected.");
|
||||
ret = verify12_nomedium(iscsic, tgt_lun, 0, block_size, block_size,
|
||||
0, 0, 1, buf);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] target does not support "
|
||||
"VERIFY102");
|
||||
} else {
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
logging(LOG_VERBOSE, "Test VERIFY16 when medium is ejected.");
|
||||
ret = verify16_nomedium(iscsic, tgt_lun, 0, block_size, block_size,
|
||||
0, 0, 1, buf);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] target does not support "
|
||||
"VERIFY16");
|
||||
} else {
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
if (!data_loss) {
|
||||
logging(LOG_VERBOSE, "[SKIPPING] Dataloss flag not set. Skipping test for WRITE commands");
|
||||
goto finished;
|
||||
}
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITE10 when medium is ejected.");
|
||||
ret = write10_nomedium(iscsic, tgt_lun, 0, block_size, block_size,
|
||||
0, 0, 0, 0, 0, buf);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITE12 when medium is ejected.");
|
||||
ret = write12_nomedium(iscsic, tgt_lun, 0, block_size, block_size,
|
||||
0, 0, 0, 0, 0, buf);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITE16 when medium is ejected.");
|
||||
ret = write16_nomedium(iscsic, tgt_lun, 0, block_size, block_size,
|
||||
0, 0, 0, 0, 0, buf);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITEVERIFY10 when medium is ejected.");
|
||||
ret = writeverify10_nomedium(iscsic, tgt_lun, 0, block_size, block_size,
|
||||
0, 0, 0, 0, buf);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] target does not support "
|
||||
"WRITEVERIFY10");
|
||||
} else {
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITEVERIFY12 when medium is ejected.");
|
||||
ret = writeverify12_nomedium(iscsic, tgt_lun, 0, block_size, block_size,
|
||||
0, 0, 0, 0, buf);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] target does not support "
|
||||
"WRITEVERIFY12");
|
||||
} else {
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITEVERIFY16 when medium is ejected.");
|
||||
ret = writeverify16_nomedium(iscsic, tgt_lun, 0, block_size, block_size,
|
||||
0, 0, 0, 0, buf);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] target does not support "
|
||||
"WRITEVERIFY16");
|
||||
} else {
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
logging(LOG_VERBOSE, "Test ORWRITE when medium is ejected.");
|
||||
ret = orwrite_nomedium(iscsic, tgt_lun, 0, block_size, block_size,
|
||||
0, 0, 0, 0, 0, buf);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] target does not support "
|
||||
"ORWRITE");
|
||||
} else {
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
logging(LOG_VERBOSE, "Test COMPAREWRITE when medium is ejected.");
|
||||
logging(LOG_VERBOSE, "[SKIPPED] Test not implemented yet");
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITESAME10 when medium is ejected.");
|
||||
ret = writesame10_nomedium(iscsic, tgt_lun, 0, block_size,
|
||||
1, 0, 0, 0, 0, buf);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] target does not support "
|
||||
"WRITESAME10");
|
||||
} else {
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITESAME16 when medium is ejected.");
|
||||
ret = writesame16_nomedium(iscsic, tgt_lun, 0, block_size,
|
||||
1, 0, 0, 0, 0, buf);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] target does not support "
|
||||
"WRITESAME16");
|
||||
} else {
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
logging(LOG_VERBOSE, "Test UNMAP when medium is ejected.");
|
||||
list[0].lba = 0;
|
||||
list[0].num = lbppb;
|
||||
ret = unmap_nomedium(iscsic, tgt_lun, 0, list, 1);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] target does not support "
|
||||
"UNMAP");
|
||||
} else {
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
|
||||
finished:
|
||||
logging(LOG_VERBOSE, "Load the medium again.");
|
||||
ret = startstopunit(iscsic, tgt_lun, 1, 0, 0, 0, 1, 1);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
@@ -33,7 +33,7 @@ test_startstopunit_noloej(void)
|
||||
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
||||
logging(LOG_VERBOSE, "Test STARTSTOPUNIT LOEJ==0");
|
||||
if (!removable) {
|
||||
logging(LOG_VERBOSE, "[SKIPPED] LUN is not removalbe. "
|
||||
logging(LOG_VERBOSE, "[SKIPPED] LUN is not removable. "
|
||||
"Skipping test.");
|
||||
return;
|
||||
}
|
||||
@@ -43,7 +43,7 @@ test_startstopunit_noloej(void)
|
||||
0, 0, 0, 0, 0, 0);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
logging(LOG_VERBOSE, "Test TESTNUITREADY that medium is not ejected.");
|
||||
logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected.");
|
||||
ret = testunitready(iscsic, tgt_lun);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
@@ -52,7 +52,7 @@ test_startstopunit_noloej(void)
|
||||
0, 0, 0, 0, 0, 1);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
logging(LOG_VERBOSE, "Test TESTNUITREADY that medium is not ejected.");
|
||||
logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected.");
|
||||
ret = testunitready(iscsic, tgt_lun);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
@@ -61,7 +61,7 @@ test_startstopunit_noloej(void)
|
||||
1, 0, 0, 0, 0, 0);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
logging(LOG_VERBOSE, "Test TESTNUITREADY that medium is not ejected.");
|
||||
logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected.");
|
||||
ret = testunitready(iscsic, tgt_lun);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
@@ -70,7 +70,7 @@ test_startstopunit_noloej(void)
|
||||
1, 0, 0, 0, 0, 1);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
logging(LOG_VERBOSE, "Test TESTNUITREADY that medium is not ejected.");
|
||||
logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected.");
|
||||
ret = testunitready(iscsic, tgt_lun);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
@@ -79,7 +79,7 @@ test_startstopunit_noloej(void)
|
||||
0, 0, 0, 1, 0, 0);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
logging(LOG_VERBOSE, "Test TESTNUITREADY that medium is not ejected.");
|
||||
logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected.");
|
||||
ret = testunitready(iscsic, tgt_lun);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
@@ -88,7 +88,7 @@ test_startstopunit_noloej(void)
|
||||
0, 0, 0, 1, 0, 1);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
logging(LOG_VERBOSE, "Test TESTNUITREADY that medium is not ejected.");
|
||||
logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected.");
|
||||
ret = testunitready(iscsic, tgt_lun);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
@@ -97,7 +97,7 @@ test_startstopunit_noloej(void)
|
||||
1, 0, 0, 1, 0, 0);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
logging(LOG_VERBOSE, "Test TESTNUITREADY that medium is not ejected.");
|
||||
logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected.");
|
||||
ret = testunitready(iscsic, tgt_lun);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
@@ -106,7 +106,7 @@ test_startstopunit_noloej(void)
|
||||
1, 0, 0, 1, 0, 1);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
logging(LOG_VERBOSE, "Test TESTNUITREADY that medium is not ejected.");
|
||||
logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected.");
|
||||
ret = testunitready(iscsic, tgt_lun);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ test_startstopunit_pwrcnd(void)
|
||||
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
||||
logging(LOG_VERBOSE, "Test STARTSTOPUNIT PowerCondition");
|
||||
if (!removable) {
|
||||
logging(LOG_VERBOSE, "[SKIPPED] LUN is not removalbe. "
|
||||
logging(LOG_VERBOSE, "[SKIPPED] LUN is not removable. "
|
||||
"Skipping test.");
|
||||
return;
|
||||
}
|
||||
@@ -44,7 +44,7 @@ test_startstopunit_pwrcnd(void)
|
||||
1, 0, i, 0, 1, 0);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
logging(LOG_VERBOSE, "Test TESTNUITREADY that medium is not ejected.");
|
||||
logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected.");
|
||||
ret = testunitready(iscsic, tgt_lun);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ test_startstopunit_simple(void)
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
|
||||
logging(LOG_VERBOSE, "Test TESTNUITREADY that medium is ejected.");
|
||||
logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is ejected.");
|
||||
ret = testunitready_nomedium(iscsic, tgt_lun);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
@@ -72,7 +72,7 @@ test_startstopunit_simple(void)
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
|
||||
logging(LOG_VERBOSE, "Test TESTNUITREADY that medium is ejected.");
|
||||
logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is ejected.");
|
||||
ret = testunitready_nomedium(iscsic, tgt_lun);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user