Merge remote-tracking branch 'aredlich/master'
Conflicts: lib/init.c lib/socket.c
This commit is contained in:
@@ -274,7 +274,7 @@ int iscsi_process_reject(struct iscsi_context *iscsi,
|
|||||||
int iscsi_send_target_nop_out(struct iscsi_context *iscsi, uint32_t ttt);
|
int iscsi_send_target_nop_out(struct iscsi_context *iscsi, uint32_t ttt);
|
||||||
|
|
||||||
void iscsi_set_error(struct iscsi_context *iscsi, const char *error_string,
|
void iscsi_set_error(struct iscsi_context *iscsi, const char *error_string,
|
||||||
...);
|
...) __attribute__((format(printf, 2, 3)));
|
||||||
|
|
||||||
unsigned char *iscsi_get_user_in_buffer(struct iscsi_context *iscsi, struct iscsi_in_pdu *in, uint32_t pos, ssize_t *count);
|
unsigned char *iscsi_get_user_in_buffer(struct iscsi_context *iscsi, struct iscsi_in_pdu *in, uint32_t pos, ssize_t *count);
|
||||||
unsigned char *scsi_task_get_data_in_buffer(struct scsi_task *task, uint32_t pos, ssize_t *count);
|
unsigned char *scsi_task_get_data_in_buffer(struct scsi_task *task, uint32_t pos, ssize_t *count);
|
||||||
@@ -295,4 +295,3 @@ void iscsi_set_noautoreconnect(struct iscsi_context *iscsi, int state);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __iscsi_private_h__ */
|
#endif /* __iscsi_private_h__ */
|
||||||
|
|
||||||
|
|||||||
@@ -342,10 +342,10 @@ iscsi_parse_url(struct iscsi_context *iscsi, const char *url, int full)
|
|||||||
char *portal;
|
char *portal;
|
||||||
char *user = NULL;
|
char *user = NULL;
|
||||||
char *passwd = NULL;
|
char *passwd = NULL;
|
||||||
char *target;
|
char *target = NULL;
|
||||||
char *lun;
|
char *lun;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
int l;
|
int l = 0;
|
||||||
|
|
||||||
if (strncmp(url, "iscsi://", 8)) {
|
if (strncmp(url, "iscsi://", 8)) {
|
||||||
if (full) {
|
if (full) {
|
||||||
@@ -429,12 +429,13 @@ iscsi_parse_url(struct iscsi_context *iscsi, const char *url, int full)
|
|||||||
iscsi_url = iscsi_malloc(iscsi, sizeof(struct iscsi_url));
|
iscsi_url = iscsi_malloc(iscsi, sizeof(struct iscsi_url));
|
||||||
else
|
else
|
||||||
iscsi_url = malloc(sizeof(struct iscsi_url));
|
iscsi_url = malloc(sizeof(struct iscsi_url));
|
||||||
|
|
||||||
if (iscsi_url == NULL) {
|
if (iscsi_url == NULL) {
|
||||||
iscsi_set_error(iscsi, "Out-of-memory: Failed to allocate iscsi_url structure");
|
iscsi_set_error(iscsi, "Out-of-memory: Failed to allocate iscsi_url structure");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memset(iscsi_url, 0, sizeof(struct iscsi_url));
|
memset(iscsi_url, 0, sizeof(struct iscsi_url));
|
||||||
iscsi_url->iscsi= iscsi;
|
iscsi_url->iscsi= iscsi;
|
||||||
|
|
||||||
strncpy(iscsi_url->portal,portal,MAX_STRING_SIZE);
|
strncpy(iscsi_url->portal,portal,MAX_STRING_SIZE);
|
||||||
|
|
||||||
|
|||||||
@@ -441,7 +441,7 @@ iscsi_write_to_socket(struct iscsi_context *iscsi)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int
|
static inline int
|
||||||
iscsi_service_reconnect_if_loggedin(struct iscsi_context *iscsi)
|
iscsi_service_reconnect_if_loggedin(struct iscsi_context *iscsi)
|
||||||
{
|
{
|
||||||
if (iscsi->is_loggedin) {
|
if (iscsi->is_loggedin) {
|
||||||
@@ -647,4 +647,3 @@ int iscsi_set_tcp_keepalive(struct iscsi_context *iscsi, int idle, int count, in
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ int T0000_testunitready_simple(const char *initiator, const char *url, int data_
|
|||||||
{
|
{
|
||||||
struct iscsi_context *iscsi;
|
struct iscsi_context *iscsi;
|
||||||
struct scsi_task *task;
|
struct scsi_task *task;
|
||||||
int ret, i, lun;
|
int ret, lun;
|
||||||
|
|
||||||
printf("0000_testunitready_simple:\n");
|
printf("0000_testunitready_simple:\n");
|
||||||
printf("===================\n");
|
printf("===================\n");
|
||||||
@@ -49,20 +49,18 @@ int T0000_testunitready_simple(const char *initiator, const char *url, int data_
|
|||||||
printf("[FAILED]\n");
|
printf("[FAILED]\n");
|
||||||
printf("Failed to send TEST UNIT READY command: %s\n", iscsi_get_error(iscsi));
|
printf("Failed to send TEST UNIT READY command: %s\n", iscsi_get_error(iscsi));
|
||||||
ret++;
|
ret++;
|
||||||
goto test2;
|
goto finished;
|
||||||
}
|
}
|
||||||
if (task->status != SCSI_STATUS_GOOD) {
|
if (task->status != SCSI_STATUS_GOOD) {
|
||||||
printf("[FAILED]\n");
|
printf("[FAILED]\n");
|
||||||
printf("TEST UNIT READY command: failed with sense %s\n", iscsi_get_error(iscsi));
|
printf("TEST UNIT READY command: failed with sense %s\n", iscsi_get_error(iscsi));
|
||||||
ret++;
|
ret++;
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
goto test2;
|
goto finished;
|
||||||
}
|
}
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
printf("[OK]\n");
|
printf("[OK]\n");
|
||||||
|
|
||||||
test2:
|
|
||||||
|
|
||||||
finished:
|
finished:
|
||||||
iscsi_logout_sync(iscsi);
|
iscsi_logout_sync(iscsi);
|
||||||
iscsi_destroy_context(iscsi);
|
iscsi_destroy_context(iscsi);
|
||||||
|
|||||||
@@ -120,7 +120,8 @@ int T0105_read10_invalid(const char *initiator, const char *url, int data_loss _
|
|||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
goto test2;
|
goto test2;
|
||||||
}
|
}
|
||||||
if (task->residual_status != SCSI_RESIDUAL_OVERFLOW || task->residual != block_size) {
|
if (task->residual_status != SCSI_RESIDUAL_OVERFLOW ||
|
||||||
|
task->residual != (int64_t)block_size) {
|
||||||
printf("[FAILED]\n");
|
printf("[FAILED]\n");
|
||||||
printf("Read10 returned incorrect residual overflow.\n");
|
printf("Read10 returned incorrect residual overflow.\n");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
@@ -166,7 +167,8 @@ test2:
|
|||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
goto test3;
|
goto test3;
|
||||||
}
|
}
|
||||||
if (task->residual_status != SCSI_RESIDUAL_UNDERFLOW || task->residual != block_size) {
|
if (task->residual_status != SCSI_RESIDUAL_UNDERFLOW ||
|
||||||
|
task->residual != (int64_t)block_size) {
|
||||||
printf("[FAILED]\n");
|
printf("[FAILED]\n");
|
||||||
printf("Read10 returned incorrect residual underflow.\n");
|
printf("Read10 returned incorrect residual underflow.\n");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
@@ -209,7 +211,8 @@ test3:
|
|||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
goto test4;
|
goto test4;
|
||||||
}
|
}
|
||||||
if (task->residual_status != SCSI_RESIDUAL_OVERFLOW || task->residual != block_size - 200) {
|
if (task->residual_status != SCSI_RESIDUAL_OVERFLOW ||
|
||||||
|
task->residual != (int64_t)(block_size - 200)) {
|
||||||
printf("[FAILED]\n");
|
printf("[FAILED]\n");
|
||||||
printf("Read10 returned incorrect residual overflow.\n");
|
printf("Read10 returned incorrect residual overflow.\n");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
@@ -251,7 +254,8 @@ test4:
|
|||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
goto test5;
|
goto test5;
|
||||||
}
|
}
|
||||||
if (task->residual_status != SCSI_RESIDUAL_OVERFLOW || task->residual != block_size) {
|
if (task->residual_status != SCSI_RESIDUAL_OVERFLOW ||
|
||||||
|
task->residual != (int64_t)block_size) {
|
||||||
printf("[FAILED]\n");
|
printf("[FAILED]\n");
|
||||||
printf("Read10 returned incorrect residual overflow.\n");
|
printf("Read10 returned incorrect residual overflow.\n");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "iscsi.h"
|
#include "iscsi.h"
|
||||||
|
#include "iscsi-private.h"
|
||||||
#include "scsi-lowlevel.h"
|
#include "scsi-lowlevel.h"
|
||||||
#include "iscsi-test.h"
|
#include "iscsi-test.h"
|
||||||
|
|
||||||
@@ -118,7 +119,8 @@ int T0122_read6_invalid(const char *initiator, const char *url, int data_loss _U
|
|||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
goto test2;
|
goto test2;
|
||||||
}
|
}
|
||||||
if (task->residual_status != SCSI_RESIDUAL_OVERFLOW || task->residual != block_size) {
|
if (task->residual_status != SCSI_RESIDUAL_OVERFLOW ||
|
||||||
|
task->residual != (ssize_t)block_size) {
|
||||||
printf("[FAILED]\n");
|
printf("[FAILED]\n");
|
||||||
printf("Read6 returned incorrect residual overflow.\n");
|
printf("Read6 returned incorrect residual overflow.\n");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
@@ -164,7 +166,8 @@ test2:
|
|||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
goto test3;
|
goto test3;
|
||||||
}
|
}
|
||||||
if (task->residual_status != SCSI_RESIDUAL_UNDERFLOW || task->residual != block_size) {
|
if (task->residual_status != SCSI_RESIDUAL_UNDERFLOW ||
|
||||||
|
task->residual != (ssize_t)block_size) {
|
||||||
printf("[FAILED]\n");
|
printf("[FAILED]\n");
|
||||||
printf("Read6 returned incorrect residual underflow.\n");
|
printf("Read6 returned incorrect residual underflow.\n");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
@@ -207,7 +210,8 @@ test3:
|
|||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
goto test4;
|
goto test4;
|
||||||
}
|
}
|
||||||
if (task->residual_status != SCSI_RESIDUAL_OVERFLOW || task->residual != block_size - 200) {
|
if (task->residual_status != SCSI_RESIDUAL_OVERFLOW ||
|
||||||
|
task->residual != (ssize_t)block_size - 200) {
|
||||||
printf("[FAILED]\n");
|
printf("[FAILED]\n");
|
||||||
printf("Read6 returned incorrect residual overflow.\n");
|
printf("Read6 returned incorrect residual overflow.\n");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
@@ -249,7 +253,8 @@ test4:
|
|||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
goto test5;
|
goto test5;
|
||||||
}
|
}
|
||||||
if (task->residual_status != SCSI_RESIDUAL_OVERFLOW || task->residual != block_size) {
|
if (task->residual_status != SCSI_RESIDUAL_OVERFLOW ||
|
||||||
|
task->residual != (ssize_t)block_size) {
|
||||||
printf("[FAILED]\n");
|
printf("[FAILED]\n");
|
||||||
printf("Read6 returned incorrect residual overflow.\n");
|
printf("Read6 returned incorrect residual overflow.\n");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ int T0161_readcapacity16_alloclen(const char *initiator, const char *url, int da
|
|||||||
{
|
{
|
||||||
struct iscsi_context *iscsi;
|
struct iscsi_context *iscsi;
|
||||||
struct scsi_task *task;
|
struct scsi_task *task;
|
||||||
struct iscsi_data data;
|
|
||||||
int ret, lun;
|
int ret, lun;
|
||||||
|
|
||||||
printf("0161_readcapacity16_alloclen:\n");
|
printf("0161_readcapacity16_alloclen:\n");
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ int T0241_prefetch10_flags(const char *initiator, const char *url, int data_loss
|
|||||||
struct scsi_task *task;
|
struct scsi_task *task;
|
||||||
struct scsi_readcapacity16 *rc16;
|
struct scsi_readcapacity16 *rc16;
|
||||||
int ret, i, lun;
|
int ret, i, lun;
|
||||||
uint64_t num_blocks;
|
|
||||||
|
|
||||||
printf("0241_prefetch10_flags:\n");
|
printf("0241_prefetch10_flags:\n");
|
||||||
printf("===================\n");
|
printf("===================\n");
|
||||||
@@ -64,7 +63,7 @@ int T0241_prefetch10_flags(const char *initiator, const char *url, int data_loss
|
|||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
num_blocks = rc16->returned_lba;
|
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ int T0251_prefetch16_flags(const char *initiator, const char *url, int data_loss
|
|||||||
struct scsi_task *task;
|
struct scsi_task *task;
|
||||||
struct scsi_readcapacity16 *rc16;
|
struct scsi_readcapacity16 *rc16;
|
||||||
int ret, i, lun;
|
int ret, i, lun;
|
||||||
uint64_t num_blocks;
|
|
||||||
|
|
||||||
printf("0251_prefetch16_flags:\n");
|
printf("0251_prefetch16_flags:\n");
|
||||||
printf("===================\n");
|
printf("===================\n");
|
||||||
@@ -64,7 +63,7 @@ int T0251_prefetch16_flags(const char *initiator, const char *url, int data_loss
|
|||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
num_blocks = rc16->returned_lba;
|
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|||||||
@@ -22,7 +22,8 @@
|
|||||||
#include "scsi-lowlevel.h"
|
#include "scsi-lowlevel.h"
|
||||||
#include "iscsi-test.h"
|
#include "iscsi-test.h"
|
||||||
|
|
||||||
int T0400_inquiry_basic(const char *initiator, const char *url, int data_loss, int show_info)
|
int T0400_inquiry_basic(const char *initiator, const char *url, int data_loss _U_,
|
||||||
|
int show_info)
|
||||||
{
|
{
|
||||||
struct iscsi_context *iscsi;
|
struct iscsi_context *iscsi;
|
||||||
struct scsi_task *task;
|
struct scsi_task *task;
|
||||||
@@ -100,7 +101,6 @@ int T0400_inquiry_basic(const char *initiator, const char *url, int data_loss, i
|
|||||||
}
|
}
|
||||||
printf("[OK]\n");
|
printf("[OK]\n");
|
||||||
|
|
||||||
test2:
|
|
||||||
printf("Check that standard data is >= 36 bytes in size ... ");
|
printf("Check that standard data is >= 36 bytes in size ... ");
|
||||||
if (full_size < 36) {
|
if (full_size < 36) {
|
||||||
printf("[FAILED]\n");
|
printf("[FAILED]\n");
|
||||||
@@ -111,8 +111,6 @@ test2:
|
|||||||
}
|
}
|
||||||
printf("[OK]\n");
|
printf("[OK]\n");
|
||||||
|
|
||||||
|
|
||||||
test3:
|
|
||||||
printf("Check device-type is either of DISK, TAPE or CD/DVD ... ");
|
printf("Check device-type is either of DISK, TAPE or CD/DVD ... ");
|
||||||
switch (inq->device_type) {
|
switch (inq->device_type) {
|
||||||
case SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS:
|
case SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS:
|
||||||
|
|||||||
@@ -22,13 +22,12 @@
|
|||||||
#include "scsi-lowlevel.h"
|
#include "scsi-lowlevel.h"
|
||||||
#include "iscsi-test.h"
|
#include "iscsi-test.h"
|
||||||
|
|
||||||
int T0401_inquiry_alloclen(const char *initiator, const char *url, int data_loss, int show_info)
|
int T0401_inquiry_alloclen(const char *initiator, const char *url, int data_loss _U_,
|
||||||
|
int show_info)
|
||||||
{
|
{
|
||||||
struct iscsi_context *iscsi;
|
struct iscsi_context *iscsi;
|
||||||
struct scsi_task *task;
|
struct scsi_task *task;
|
||||||
struct scsi_inquiry_standard *inq;
|
|
||||||
int ret, lun, i;
|
int ret, lun, i;
|
||||||
int full_size;
|
|
||||||
|
|
||||||
printf("0401_inquiry_alloclen:\n");
|
printf("0401_inquiry_alloclen:\n");
|
||||||
printf("===================\n");
|
printf("===================\n");
|
||||||
@@ -57,22 +56,19 @@ int T0401_inquiry_alloclen(const char *initiator, const char *url, int data_loss
|
|||||||
printf("[FAILED]\n");
|
printf("[FAILED]\n");
|
||||||
printf("Failed to send INQUIRY command : %s\n", iscsi_get_error(iscsi));
|
printf("Failed to send INQUIRY command : %s\n", iscsi_get_error(iscsi));
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto test2;
|
goto finished;
|
||||||
}
|
}
|
||||||
if (task->status != SCSI_STATUS_GOOD) {
|
if (task->status != SCSI_STATUS_GOOD) {
|
||||||
printf("[FAILED]\n");
|
printf("[FAILED]\n");
|
||||||
printf("INQUIRY command with alloclen:%d failed : %s\n", i, iscsi_get_error(iscsi));
|
printf("INQUIRY command with alloclen:%d failed : %s\n", i, iscsi_get_error(iscsi));
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto test2;
|
goto finished;
|
||||||
}
|
}
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
}
|
}
|
||||||
printf("[OK]\n");
|
printf("[OK]\n");
|
||||||
|
|
||||||
test2:
|
|
||||||
|
|
||||||
|
|
||||||
finished:
|
finished:
|
||||||
iscsi_logout_sync(iscsi);
|
iscsi_logout_sync(iscsi);
|
||||||
iscsi_destroy_context(iscsi);
|
iscsi_destroy_context(iscsi);
|
||||||
|
|||||||
@@ -22,7 +22,8 @@
|
|||||||
#include "scsi-lowlevel.h"
|
#include "scsi-lowlevel.h"
|
||||||
#include "iscsi-test.h"
|
#include "iscsi-test.h"
|
||||||
|
|
||||||
int T0402_inquiry_evpd(const char *initiator, const char *url, int data_loss, int show_info)
|
int T0402_inquiry_evpd(const char *initiator, const char *url, int data_loss _U_,
|
||||||
|
int show_info)
|
||||||
{
|
{
|
||||||
struct iscsi_context *iscsi;
|
struct iscsi_context *iscsi;
|
||||||
struct scsi_task *task;
|
struct scsi_task *task;
|
||||||
@@ -55,14 +56,14 @@ int T0402_inquiry_evpd(const char *initiator, const char *url, int data_loss, in
|
|||||||
printf("[FAILED]\n");
|
printf("[FAILED]\n");
|
||||||
printf("Failed to send INQUIRY command : %s\n", iscsi_get_error(iscsi));
|
printf("Failed to send INQUIRY command : %s\n", iscsi_get_error(iscsi));
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto test2;
|
goto finished;
|
||||||
}
|
}
|
||||||
if (task->status == SCSI_STATUS_GOOD) {
|
if (task->status == SCSI_STATUS_GOOD) {
|
||||||
printf("[FAILED]\n");
|
printf("[FAILED]\n");
|
||||||
printf("INQUIRY should have failed with CHECK_CONDITION/ILLEGAL_REQUEST/INVALID_FIELD_IN_CDB %s\n", iscsi_get_error(iscsi));
|
printf("INQUIRY should have failed with CHECK_CONDITION/ILLEGAL_REQUEST/INVALID_FIELD_IN_CDB %s\n", iscsi_get_error(iscsi));
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto test2;
|
goto finished;
|
||||||
}
|
}
|
||||||
if (task->status != SCSI_STATUS_CHECK_CONDITION
|
if (task->status != SCSI_STATUS_CHECK_CONDITION
|
||||||
|| task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST
|
|| task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST
|
||||||
@@ -71,15 +72,12 @@ int T0402_inquiry_evpd(const char *initiator, const char *url, int data_loss, in
|
|||||||
printf("INQUIRY should have failed with wrong sense code. It failed with %s but should have failed with ILLEGAL_REQUEST/INVALID_FIELD_IN_CDB\n", iscsi_get_error(iscsi));
|
printf("INQUIRY should have failed with wrong sense code. It failed with %s but should have failed with ILLEGAL_REQUEST/INVALID_FIELD_IN_CDB\n", iscsi_get_error(iscsi));
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto test2;
|
goto finished;
|
||||||
}
|
}
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
}
|
}
|
||||||
printf("[OK]\n");
|
printf("[OK]\n");
|
||||||
|
|
||||||
test2:
|
|
||||||
|
|
||||||
|
|
||||||
finished:
|
finished:
|
||||||
iscsi_logout_sync(iscsi);
|
iscsi_logout_sync(iscsi);
|
||||||
iscsi_destroy_context(iscsi);
|
iscsi_destroy_context(iscsi);
|
||||||
|
|||||||
@@ -22,12 +22,14 @@
|
|||||||
#include "scsi-lowlevel.h"
|
#include "scsi-lowlevel.h"
|
||||||
#include "iscsi-test.h"
|
#include "iscsi-test.h"
|
||||||
|
|
||||||
int T0403_inquiry_supported_vpd(const char *initiator, const char *url, int data_loss, int show_info)
|
int T0403_inquiry_supported_vpd(const char *initiator, const char *url,
|
||||||
|
int data_loss _U_, int show_info)
|
||||||
{
|
{
|
||||||
struct iscsi_context *iscsi;
|
struct iscsi_context *iscsi;
|
||||||
struct scsi_task *task;
|
struct scsi_task *task;
|
||||||
struct scsi_inquiry_supported_pages *inq;
|
struct scsi_inquiry_supported_pages *inq;
|
||||||
int ret, lun, i, j;
|
size_t i;
|
||||||
|
int ret, lun, j;
|
||||||
int full_size;
|
int full_size;
|
||||||
int page_code;
|
int page_code;
|
||||||
enum scsi_inquiry_pagecode required_spc_pages[] = {
|
enum scsi_inquiry_pagecode required_spc_pages[] = {
|
||||||
@@ -51,11 +53,8 @@ int T0403_inquiry_supported_vpd(const char *initiator, const char *url, int data
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
printf("Read SUPPORTED VPD data ... ");
|
printf("Read SUPPORTED VPD data ... ");
|
||||||
/* See how big this inquiry data is */
|
/* See how big this inquiry data is */
|
||||||
page_code = SCSI_INQUIRY_PAGECODE_SUPPORTED_VPD_PAGES;
|
page_code = SCSI_INQUIRY_PAGECODE_SUPPORTED_VPD_PAGES;
|
||||||
@@ -95,7 +94,6 @@ int T0403_inquiry_supported_vpd(const char *initiator, const char *url, int data
|
|||||||
}
|
}
|
||||||
printf("[OK]\n");
|
printf("[OK]\n");
|
||||||
|
|
||||||
test2:
|
|
||||||
printf("Verify we have all mandatory SPC VPD pages:\n");
|
printf("Verify we have all mandatory SPC VPD pages:\n");
|
||||||
for (i = 0; i < sizeof(required_spc_pages) / sizeof(enum scsi_inquiry_pagecode); i++) {
|
for (i = 0; i < sizeof(required_spc_pages) / sizeof(enum scsi_inquiry_pagecode); i++) {
|
||||||
printf("Verify the target supports page 0x%02x ... ", required_spc_pages[i]);
|
printf("Verify the target supports page 0x%02x ... ", required_spc_pages[i]);
|
||||||
@@ -113,8 +111,6 @@ test2:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
test3:
|
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
|
|
||||||
finished:
|
finished:
|
||||||
|
|||||||
@@ -22,7 +22,8 @@
|
|||||||
#include "scsi-lowlevel.h"
|
#include "scsi-lowlevel.h"
|
||||||
#include "iscsi-test.h"
|
#include "iscsi-test.h"
|
||||||
|
|
||||||
int T0404_inquiry_all_reported_vpd(const char *initiator, const char *url, int data_loss, int show_info)
|
int T0404_inquiry_all_reported_vpd(const char *initiator, const char *url,
|
||||||
|
int data_loss _U_, int show_info)
|
||||||
{
|
{
|
||||||
struct iscsi_context *iscsi;
|
struct iscsi_context *iscsi;
|
||||||
struct scsi_task *task;
|
struct scsi_task *task;
|
||||||
@@ -91,7 +92,6 @@ int T0404_inquiry_all_reported_vpd(const char *initiator, const char *url, int d
|
|||||||
}
|
}
|
||||||
printf("[OK]\n");
|
printf("[OK]\n");
|
||||||
|
|
||||||
test2:
|
|
||||||
printf("Read each page and verify qualifier, type and page code:\n");
|
printf("Read each page and verify qualifier, type and page code:\n");
|
||||||
for (i = 0; i < inq->num_pages; i++) {
|
for (i = 0; i < inq->num_pages; i++) {
|
||||||
struct scsi_task *pc_task;
|
struct scsi_task *pc_task;
|
||||||
@@ -116,7 +116,8 @@ test2:
|
|||||||
printf("Verify page 0x%02x qualifier ... ", inq->pages[i]);
|
printf("Verify page 0x%02x qualifier ... ", inq->pages[i]);
|
||||||
if ((pc_task->datain.data[0] & 0xe0) >> 5 != inq->qualifier) {
|
if ((pc_task->datain.data[0] & 0xe0) >> 5 != inq->qualifier) {
|
||||||
printf("[FAILED]\n");
|
printf("[FAILED]\n");
|
||||||
printf("Qualifier differs between VPD pages\n", iscsi_get_error(iscsi));
|
printf("Qualifier differs between VPD pages: %x != %x\n",
|
||||||
|
pc_task->datain.data[0] & 0xe0, inq->qualifier);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
scsi_free_scsi_task(pc_task);
|
scsi_free_scsi_task(pc_task);
|
||||||
continue;
|
continue;
|
||||||
@@ -125,9 +126,10 @@ test2:
|
|||||||
}
|
}
|
||||||
|
|
||||||
printf("Verify page 0x%02x device type ... ", inq->pages[i]);
|
printf("Verify page 0x%02x device type ... ", inq->pages[i]);
|
||||||
if (pc_task->datain.data[0] & 0x1f != inq->device_type) {
|
if ((pc_task->datain.data[0] & 0x1f) != inq->device_type) {
|
||||||
printf("[FAILED]\n");
|
printf("[FAILED]\n");
|
||||||
printf("Device Type differs between VPD pages\n", iscsi_get_error(iscsi));
|
printf("Device Type differs between VPD pages: %x != %x\n",
|
||||||
|
pc_task->datain.data[0] & 0x1f, inq->device_type);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
scsi_free_scsi_task(pc_task);
|
scsi_free_scsi_task(pc_task);
|
||||||
continue;
|
continue;
|
||||||
@@ -138,7 +140,8 @@ test2:
|
|||||||
printf("Verify page 0x%02x page code ... ", inq->pages[i]);
|
printf("Verify page 0x%02x page code ... ", inq->pages[i]);
|
||||||
if (pc_task->datain.data[1] != inq->pages[i]) {
|
if (pc_task->datain.data[1] != inq->pages[i]) {
|
||||||
printf("[FAILED]\n");
|
printf("[FAILED]\n");
|
||||||
printf("Page code is wrong\n", iscsi_get_error(iscsi));
|
printf("Page code is wrong: %x != %x\n",
|
||||||
|
pc_task->datain.data[1], inq->pages[i]);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
scsi_free_scsi_task(pc_task);
|
scsi_free_scsi_task(pc_task);
|
||||||
continue;
|
continue;
|
||||||
@@ -149,8 +152,6 @@ test2:
|
|||||||
scsi_free_scsi_task(pc_task);
|
scsi_free_scsi_task(pc_task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
test3:
|
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
|
|
||||||
finished:
|
finished:
|
||||||
|
|||||||
@@ -22,7 +22,8 @@
|
|||||||
#include "scsi-lowlevel.h"
|
#include "scsi-lowlevel.h"
|
||||||
#include "iscsi-test.h"
|
#include "iscsi-test.h"
|
||||||
|
|
||||||
int T0410_readtoc_basic(const char *initiator, const char *url, int data_loss, int show_info)
|
int T0410_readtoc_basic(const char *initiator, const char *url, int data_loss _U_,
|
||||||
|
int show_info)
|
||||||
{
|
{
|
||||||
struct iscsi_context *iscsi;
|
struct iscsi_context *iscsi;
|
||||||
struct scsi_task *task, *task1;
|
struct scsi_task *task, *task1;
|
||||||
@@ -229,7 +230,6 @@ test1:
|
|||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (task->status != SCSI_STATUS_GOOD) {
|
if (task->status != SCSI_STATUS_GOOD) {
|
||||||
printf("[FAILED]\n");
|
printf("[FAILED]\n");
|
||||||
printf("READTOC command failed : %s\n", iscsi_get_error(iscsi));
|
printf("READTOC command failed : %s\n", iscsi_get_error(iscsi));
|
||||||
@@ -239,9 +239,6 @@ test1:
|
|||||||
}
|
}
|
||||||
printf("[OK]\n");
|
printf("[OK]\n");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
test2:
|
|
||||||
/* If we get here, there is a disk loaded and it contains data */
|
/* If we get here, there is a disk loaded and it contains data */
|
||||||
printf("Verify we got at least 4 bytes of data for track 0 ... ");
|
printf("Verify we got at least 4 bytes of data for track 0 ... ");
|
||||||
full_size = scsi_datain_getfullsize(task);
|
full_size = scsi_datain_getfullsize(task);
|
||||||
@@ -262,8 +259,6 @@ test2:
|
|||||||
}
|
}
|
||||||
printf("[OK]\n");
|
printf("[OK]\n");
|
||||||
|
|
||||||
|
|
||||||
test3:
|
|
||||||
printf("Verify we can READTOC format 0000b (TOC) track 1 ... ");
|
printf("Verify we can READTOC format 0000b (TOC) track 1 ... ");
|
||||||
task1 = iscsi_readtoc_sync(iscsi, lun, 0, 1, 0, 255);
|
task1 = iscsi_readtoc_sync(iscsi, lun, 0, 1, 0, 255);
|
||||||
if (task1 == NULL) {
|
if (task1 == NULL) {
|
||||||
@@ -284,8 +279,6 @@ test3:
|
|||||||
}
|
}
|
||||||
printf("[OK]\n");
|
printf("[OK]\n");
|
||||||
|
|
||||||
|
|
||||||
test4:
|
|
||||||
printf("Verify we got at least 4 bytes of data for track 1 ... ");
|
printf("Verify we got at least 4 bytes of data for track 1 ... ");
|
||||||
full_size = scsi_datain_getfullsize(task1);
|
full_size = scsi_datain_getfullsize(task1);
|
||||||
if (full_size < 4) {
|
if (full_size < 4) {
|
||||||
@@ -307,7 +300,6 @@ test4:
|
|||||||
}
|
}
|
||||||
printf("[OK]\n");
|
printf("[OK]\n");
|
||||||
|
|
||||||
test5:
|
|
||||||
printf("Verify track 0 and 1 both returned the same data ... ");
|
printf("Verify track 0 and 1 both returned the same data ... ");
|
||||||
if (list->num != list1->num ||
|
if (list->num != list1->num ||
|
||||||
list->first != list1->first ||
|
list->first != list1->first ||
|
||||||
|
|||||||
@@ -22,7 +22,8 @@
|
|||||||
#include "scsi-lowlevel.h"
|
#include "scsi-lowlevel.h"
|
||||||
#include "iscsi-test.h"
|
#include "iscsi-test.h"
|
||||||
|
|
||||||
int T0420_reserve6_simple(const char *initiator, const char *url, int data_loss, int show_info)
|
int T0420_reserve6_simple(const char *initiator, const char *url, int data_loss _U_,
|
||||||
|
int show_info)
|
||||||
{
|
{
|
||||||
struct iscsi_context *iscsi, *iscsi2;
|
struct iscsi_context *iscsi, *iscsi2;
|
||||||
struct scsi_task *task;
|
struct scsi_task *task;
|
||||||
@@ -51,7 +52,7 @@ int T0420_reserve6_simple(const char *initiator, const char *url, int data_loss,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
iscsi2 = iscsi_context_login(initiator2, url, &lun);
|
iscsi2 = iscsi_context_login(initiatorname2, url, &lun);
|
||||||
if (iscsi2 == NULL) {
|
if (iscsi2 == NULL) {
|
||||||
printf("Failed to login to target\n");
|
printf("Failed to login to target\n");
|
||||||
ret = 1;
|
ret = 1;
|
||||||
@@ -108,8 +109,6 @@ int T0420_reserve6_simple(const char *initiator, const char *url, int data_loss,
|
|||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
printf("[OK]\n");
|
printf("[OK]\n");
|
||||||
|
|
||||||
|
|
||||||
test2:
|
|
||||||
printf("Test that reservation works.\n");
|
printf("Test that reservation works.\n");
|
||||||
printf("Send RESERVE6 from Initiator 1. ... ");
|
printf("Send RESERVE6 from Initiator 1. ... ");
|
||||||
task = iscsi_reserve6_sync(iscsi, lun);
|
task = iscsi_reserve6_sync(iscsi, lun);
|
||||||
@@ -148,7 +147,6 @@ test2:
|
|||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
printf("[OK]\n");
|
printf("[OK]\n");
|
||||||
|
|
||||||
test3:
|
|
||||||
printf("Send RESERVE6 from Initiator 2. Expect conflict. ... ");
|
printf("Send RESERVE6 from Initiator 2. Expect conflict. ... ");
|
||||||
task = iscsi_reserve6_sync(iscsi2, lun);
|
task = iscsi_reserve6_sync(iscsi2, lun);
|
||||||
if (task == NULL) {
|
if (task == NULL) {
|
||||||
@@ -168,7 +166,6 @@ test3:
|
|||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
printf("[OK]\n");
|
printf("[OK]\n");
|
||||||
|
|
||||||
test3a:
|
|
||||||
printf("Send RELEASE6 from Initiator 2..Expect NO-OP. ... ");
|
printf("Send RELEASE6 from Initiator 2..Expect NO-OP. ... ");
|
||||||
task = iscsi_release6_sync(iscsi2, lun);
|
task = iscsi_release6_sync(iscsi2, lun);
|
||||||
if (task == NULL) {
|
if (task == NULL) {
|
||||||
@@ -211,7 +208,6 @@ test4:
|
|||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
printf("[OK]\n");
|
printf("[OK]\n");
|
||||||
|
|
||||||
test5:
|
|
||||||
printf("Send TESTUNITREADY from Initiator 2. Expect conflict. ... ");
|
printf("Send TESTUNITREADY from Initiator 2. Expect conflict. ... ");
|
||||||
task = iscsi_testunitready_sync(iscsi2, lun);
|
task = iscsi_testunitready_sync(iscsi2, lun);
|
||||||
if (task == NULL) {
|
if (task == NULL) {
|
||||||
@@ -230,7 +226,6 @@ test5:
|
|||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
printf("[OK]\n");
|
printf("[OK]\n");
|
||||||
|
|
||||||
test6:
|
|
||||||
printf("Test that release actually works\n");
|
printf("Test that release actually works\n");
|
||||||
printf("Send RELEASE6 from Initiator 1 ... ");
|
printf("Send RELEASE6 from Initiator 1 ... ");
|
||||||
task = iscsi_release6_sync(iscsi, lun);
|
task = iscsi_release6_sync(iscsi, lun);
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ static void mgmt_cb(struct iscsi_context *iscsi _U_, int status _U_,
|
|||||||
mgmt_task->finished = 1;
|
mgmt_task->finished = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int T0421_reserve6_lun_reset(const char *initiator, const char *url, int data_loss, int show_info)
|
int T0421_reserve6_lun_reset(const char *initiator, const char *url,
|
||||||
|
int data_loss _U_, int show_info)
|
||||||
{
|
{
|
||||||
struct iscsi_context *iscsi, *iscsi2;
|
struct iscsi_context *iscsi, *iscsi2;
|
||||||
struct scsi_task *task;
|
struct scsi_task *task;
|
||||||
@@ -65,7 +66,7 @@ int T0421_reserve6_lun_reset(const char *initiator, const char *url, int data_lo
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
iscsi2 = iscsi_context_login(initiator2, url, &lun);
|
iscsi2 = iscsi_context_login(initiatorname2, url, &lun);
|
||||||
if (iscsi2 == NULL) {
|
if (iscsi2 == NULL) {
|
||||||
printf("Failed to login to target\n");
|
printf("Failed to login to target\n");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -148,7 +149,6 @@ test3:
|
|||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
printf("[OK]\n");
|
printf("[OK]\n");
|
||||||
|
|
||||||
test4:
|
|
||||||
printf("Send a LUN Reset to the target ... ");
|
printf("Send a LUN Reset to the target ... ");
|
||||||
iscsi_task_mgmt_lun_reset_async(iscsi, lun, mgmt_cb, &mgmt_task);
|
iscsi_task_mgmt_lun_reset_async(iscsi, lun, mgmt_cb, &mgmt_task);
|
||||||
while (mgmt_task.finished == 0) {
|
while (mgmt_task.finished == 0) {
|
||||||
|
|||||||
@@ -22,7 +22,8 @@
|
|||||||
#include "scsi-lowlevel.h"
|
#include "scsi-lowlevel.h"
|
||||||
#include "iscsi-test.h"
|
#include "iscsi-test.h"
|
||||||
|
|
||||||
int T0422_reserve6_logout(const char *initiator, const char *url, int data_loss, int show_info)
|
int T0422_reserve6_logout(const char *initiator, const char *url, int data_loss _U_,
|
||||||
|
int show_info)
|
||||||
{
|
{
|
||||||
struct iscsi_context *iscsi, *iscsi2;
|
struct iscsi_context *iscsi, *iscsi2;
|
||||||
struct scsi_task *task;
|
struct scsi_task *task;
|
||||||
@@ -48,7 +49,7 @@ int T0422_reserve6_logout(const char *initiator, const char *url, int data_loss,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
iscsi2 = iscsi_context_login(initiator2, url, &lun);
|
iscsi2 = iscsi_context_login(initiatorname2, url, &lun);
|
||||||
if (iscsi2 == NULL) {
|
if (iscsi2 == NULL) {
|
||||||
printf("Failed to login to target\n");
|
printf("Failed to login to target\n");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -131,13 +132,11 @@ test3:
|
|||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
printf("[OK]\n");
|
printf("[OK]\n");
|
||||||
|
|
||||||
test4:
|
|
||||||
printf("Logout the first initiator ... ");
|
printf("Logout the first initiator ... ");
|
||||||
iscsi_logout_sync(iscsi);
|
iscsi_logout_sync(iscsi);
|
||||||
iscsi_destroy_context(iscsi);
|
iscsi_destroy_context(iscsi);
|
||||||
printf("[OK]\n");
|
printf("[OK]\n");
|
||||||
|
|
||||||
test5:
|
|
||||||
printf("Verify we can access the LUN from the second initiator ... ");
|
printf("Verify we can access the LUN from the second initiator ... ");
|
||||||
task = iscsi_testunitready_sync(iscsi2, lun);
|
task = iscsi_testunitready_sync(iscsi2, lun);
|
||||||
if (task == NULL) {
|
if (task == NULL) {
|
||||||
|
|||||||
@@ -22,7 +22,8 @@
|
|||||||
#include "scsi-lowlevel.h"
|
#include "scsi-lowlevel.h"
|
||||||
#include "iscsi-test.h"
|
#include "iscsi-test.h"
|
||||||
|
|
||||||
int T0423_reserve6_sessionloss(const char *initiator, const char *url, int data_loss, int show_info)
|
int T0423_reserve6_sessionloss(const char *initiator, const char *url,
|
||||||
|
int data_loss _U_, int show_info)
|
||||||
{
|
{
|
||||||
struct iscsi_context *iscsi, *iscsi2;
|
struct iscsi_context *iscsi, *iscsi2;
|
||||||
struct scsi_task *task;
|
struct scsi_task *task;
|
||||||
@@ -48,7 +49,7 @@ int T0423_reserve6_sessionloss(const char *initiator, const char *url, int data_
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
iscsi2 = iscsi_context_login(initiator2, url, &lun);
|
iscsi2 = iscsi_context_login(initiatorname2, url, &lun);
|
||||||
if (iscsi2 == NULL) {
|
if (iscsi2 == NULL) {
|
||||||
printf("Failed to login to target\n");
|
printf("Failed to login to target\n");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -131,12 +132,10 @@ test3:
|
|||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
printf("[OK]\n");
|
printf("[OK]\n");
|
||||||
|
|
||||||
test4:
|
|
||||||
printf("Drop the session to the first initiator ... ");
|
printf("Drop the session to the first initiator ... ");
|
||||||
iscsi_destroy_context(iscsi);
|
iscsi_destroy_context(iscsi);
|
||||||
printf("[OK]\n");
|
printf("[OK]\n");
|
||||||
|
|
||||||
test5:
|
|
||||||
printf("Verify we can access the LUN from the second initiator ... ");
|
printf("Verify we can access the LUN from the second initiator ... ");
|
||||||
task = iscsi_testunitready_sync(iscsi2, lun);
|
task = iscsi_testunitready_sync(iscsi2, lun);
|
||||||
if (task == NULL) {
|
if (task == NULL) {
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ static void mgmt_cb(struct iscsi_context *iscsi _U_, int status _U_,
|
|||||||
mgmt_task->finished = 1;
|
mgmt_task->finished = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int T0424_reserve6_target_reset(const char *initiator, const char *url, int data_loss, int show_info)
|
int T0424_reserve6_target_reset(const char *initiator, const char *url,
|
||||||
|
int data_loss _U_, int show_info)
|
||||||
{
|
{
|
||||||
struct iscsi_context *iscsi, *iscsi2;
|
struct iscsi_context *iscsi, *iscsi2;
|
||||||
struct scsi_task *task;
|
struct scsi_task *task;
|
||||||
@@ -65,7 +66,7 @@ int T0424_reserve6_target_reset(const char *initiator, const char *url, int data
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
iscsi2 = iscsi_context_login(initiator2, url, &lun);
|
iscsi2 = iscsi_context_login(initiatorname2, url, &lun);
|
||||||
if (iscsi2 == NULL) {
|
if (iscsi2 == NULL) {
|
||||||
printf("Failed to login to target\n");
|
printf("Failed to login to target\n");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -73,9 +74,6 @@ int T0424_reserve6_target_reset(const char *initiator, const char *url, int data
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
printf("Send RESERVE6 from the first initiator ... ");
|
printf("Send RESERVE6 from the first initiator ... ");
|
||||||
task = iscsi_reserve6_sync(iscsi, lun);
|
task = iscsi_reserve6_sync(iscsi, lun);
|
||||||
if (task == NULL) {
|
if (task == NULL) {
|
||||||
@@ -105,7 +103,6 @@ int T0424_reserve6_target_reset(const char *initiator, const char *url, int data
|
|||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
printf("[OK]\n");
|
printf("[OK]\n");
|
||||||
|
|
||||||
|
|
||||||
test2:
|
test2:
|
||||||
printf("Verify we can access the LUN from the first initiator ... ");
|
printf("Verify we can access the LUN from the first initiator ... ");
|
||||||
task = iscsi_testunitready_sync(iscsi, lun);
|
task = iscsi_testunitready_sync(iscsi, lun);
|
||||||
@@ -148,7 +145,6 @@ test3:
|
|||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
printf("[OK]\n");
|
printf("[OK]\n");
|
||||||
|
|
||||||
test4:
|
|
||||||
printf("Send a Target Cold-Reset ... ");
|
printf("Send a Target Cold-Reset ... ");
|
||||||
iscsi_task_mgmt_target_cold_reset_async(iscsi, mgmt_cb, &mgmt_task);
|
iscsi_task_mgmt_target_cold_reset_async(iscsi, mgmt_cb, &mgmt_task);
|
||||||
while (mgmt_task.finished == 0) {
|
while (mgmt_task.finished == 0) {
|
||||||
|
|||||||
@@ -23,14 +23,16 @@
|
|||||||
#include "scsi-lowlevel.h"
|
#include "scsi-lowlevel.h"
|
||||||
#include "iscsi-test.h"
|
#include "iscsi-test.h"
|
||||||
|
|
||||||
int T0430_report_all_supported_ops(const char *initiator, const char *url, int data_loss, int show_info)
|
int T0430_report_all_supported_ops(const char *initiator, const char *url,
|
||||||
|
int data_loss _U_, int show_info)
|
||||||
{
|
{
|
||||||
struct iscsi_context *iscsi;
|
struct iscsi_context *iscsi;
|
||||||
struct scsi_task *task;
|
struct scsi_task *task;
|
||||||
struct scsi_report_supported_op_codes *rsoc;
|
struct scsi_report_supported_op_codes *rsoc;
|
||||||
struct scsi_command_descriptor *desc;
|
struct scsi_command_descriptor *desc;
|
||||||
int ret, lun, i;
|
int ret, lun;
|
||||||
int full_size, desc_size;
|
int full_size, desc_size;
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
printf("0430_report_all_supported_ops:\n");
|
printf("0430_report_all_supported_ops:\n");
|
||||||
printf("===================\n");
|
printf("===================\n");
|
||||||
@@ -101,7 +103,7 @@ int T0430_report_all_supported_ops(const char *initiator, const char *url, int d
|
|||||||
|
|
||||||
printf("Supported Commands: %d\n", rsoc->num_descriptors);
|
printf("Supported Commands: %d\n", rsoc->num_descriptors);
|
||||||
printf("=======================\n");
|
printf("=======================\n");
|
||||||
for (i=0; i < rsoc->num_descriptors; i++) {
|
for (i = 0; i < rsoc->num_descriptors; i++) {
|
||||||
printf("op:%x\tsa:%x\tcdb length:%d\n",
|
printf("op:%x\tsa:%x\tcdb length:%d\n",
|
||||||
rsoc->descriptors[i].op_code,
|
rsoc->descriptors[i].op_code,
|
||||||
rsoc->descriptors[i].service_action,
|
rsoc->descriptors[i].service_action,
|
||||||
@@ -111,8 +113,6 @@ int T0430_report_all_supported_ops(const char *initiator, const char *url, int d
|
|||||||
printf("\n[OK]\n");
|
printf("\n[OK]\n");
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
|
|
||||||
|
|
||||||
test2:
|
|
||||||
/*Report All Supported Operations including timeout info.*/
|
/*Report All Supported Operations including timeout info.*/
|
||||||
printf("See if Report Supported Opcodes with Timeouts is supported... ");
|
printf("See if Report Supported Opcodes with Timeouts is supported... ");
|
||||||
/* See how big data is */
|
/* See how big data is */
|
||||||
@@ -170,7 +170,7 @@ test2:
|
|||||||
desc_size = sizeof (struct scsi_command_descriptor)
|
desc_size = sizeof (struct scsi_command_descriptor)
|
||||||
+ sizeof (struct scsi_op_timeout_descriptor);
|
+ sizeof (struct scsi_op_timeout_descriptor);
|
||||||
desc = &rsoc->descriptors[0];
|
desc = &rsoc->descriptors[0];
|
||||||
for (i=0; i < rsoc->num_descriptors; i++) {
|
for (i = 0; i < rsoc->num_descriptors; i++) {
|
||||||
printf("op:%x\tsa:%x\tcdb_length:%d\ttimeout info: length:%d\tcommand specific:%x\tnominal processing%d\trecommended%d\n",
|
printf("op:%x\tsa:%x\tcdb_length:%d\ttimeout info: length:%d\tcommand specific:%x\tnominal processing%d\trecommended%d\n",
|
||||||
desc->op_code,
|
desc->op_code,
|
||||||
desc->service_action,
|
desc->service_action,
|
||||||
|
|||||||
@@ -41,13 +41,13 @@ static void test_cb(struct iscsi_context *iscsi _U_, int status,
|
|||||||
|
|
||||||
int T1030_unsolicited_data_overflow(const char *initiator, const char *url, int data_loss, int show_info)
|
int T1030_unsolicited_data_overflow(const char *initiator, const char *url, int data_loss, int show_info)
|
||||||
{
|
{
|
||||||
struct iscsi_context *iscsi, *iscsi2;
|
struct iscsi_context *iscsi = NULL;
|
||||||
|
struct iscsi_context *iscsi2 = NULL;
|
||||||
struct scsi_task *task;
|
struct scsi_task *task;
|
||||||
struct scsi_readcapacity16 *rc16;
|
struct scsi_readcapacity16 *rc16;
|
||||||
int ret, lun;
|
int ret, lun;
|
||||||
unsigned char *buf = NULL;
|
unsigned char *buf = NULL;
|
||||||
struct iscsi_async_state test_state;
|
struct iscsi_async_state test_state;
|
||||||
uint32_t old_first_burst_len;
|
|
||||||
|
|
||||||
printf("1030_unsolicited_data_overflow:\n");
|
printf("1030_unsolicited_data_overflow:\n");
|
||||||
printf("===============================\n");
|
printf("===============================\n");
|
||||||
@@ -99,7 +99,7 @@ int T1030_unsolicited_data_overflow(const char *initiator, const char *url, int
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
iscsi->use_immediate_data = ISCSI_IMMEDIATE_DATA_YES;
|
iscsi->use_immediate_data = ISCSI_IMMEDIATE_DATA_YES;
|
||||||
old_first_burst_len = iscsi->first_burst_length;
|
|
||||||
/* make first burst REAL big */
|
/* make first burst REAL big */
|
||||||
iscsi->first_burst_length *= 16;
|
iscsi->first_burst_length *= 16;
|
||||||
buf = malloc(iscsi->first_burst_length);
|
buf = malloc(iscsi->first_burst_length);
|
||||||
@@ -141,9 +141,7 @@ test2:
|
|||||||
printf("[OK]\n");
|
printf("[OK]\n");
|
||||||
|
|
||||||
finished:
|
finished:
|
||||||
if (buf) {
|
free(buf);
|
||||||
free(buf);
|
|
||||||
}
|
|
||||||
iscsi_destroy_context(iscsi);
|
iscsi_destroy_context(iscsi);
|
||||||
iscsi_destroy_context(iscsi2);
|
iscsi_destroy_context(iscsi2);
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
uint32_t block_size;
|
uint32_t block_size;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
my_iscsi_add_data(struct iscsi_context *iscsi, struct iscsi_data *data,
|
my_iscsi_add_data(struct iscsi_context *iscsi _U_, struct iscsi_data *data,
|
||||||
unsigned char *dptr, int dsize, int pdualignment)
|
unsigned char *dptr, int dsize, int pdualignment)
|
||||||
{
|
{
|
||||||
int len, aligned;
|
int len, aligned;
|
||||||
@@ -149,9 +149,11 @@ my_iscsi_allocate_pdu_with_itt_flags(struct iscsi_context *iscsi, enum iscsi_opc
|
|||||||
return pdu;
|
return pdu;
|
||||||
}
|
}
|
||||||
|
|
||||||
int T1031_unsolicited_data_out(const char *initiator, const char *url, int data_loss, int show_info)
|
int T1031_unsolicited_data_out(const char *initiator, const char *url,
|
||||||
|
int data_loss _U_, int show_info)
|
||||||
{
|
{
|
||||||
struct iscsi_context *iscsi, *iscsi2;
|
struct iscsi_context *iscsi = NULL;
|
||||||
|
struct iscsi_context *iscsi2 = NULL;
|
||||||
struct scsi_task *task;
|
struct scsi_task *task;
|
||||||
struct scsi_readcapacity16 *rc16;
|
struct scsi_readcapacity16 *rc16;
|
||||||
int i, ret, lun;
|
int i, ret, lun;
|
||||||
|
|||||||
@@ -34,8 +34,8 @@
|
|||||||
#include "iscsi-private.h"
|
#include "iscsi-private.h"
|
||||||
#include "iscsi-test.h"
|
#include "iscsi-test.h"
|
||||||
|
|
||||||
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:iscsi-test";
|
const char *initiatorname1 = "iqn.2007-10.com.github:sahlberg:libiscsi:iscsi-test";
|
||||||
const char *initiator2 = "iqn.2007-10.com.github:sahlberg:libiscsi:iscsi-test-2";
|
const char *initiatorname2 = "iqn.2007-10.com.github:sahlberg:libiscsi:iscsi-test-2";
|
||||||
|
|
||||||
static int data_loss = 0;
|
static int data_loss = 0;
|
||||||
static int show_info = 0;
|
static int show_info = 0;
|
||||||
@@ -387,8 +387,8 @@ int main(int argc, const char *argv[])
|
|||||||
{ "help", '?', POPT_ARG_NONE, &show_help, 0, "Show this help message", NULL },
|
{ "help", '?', POPT_ARG_NONE, &show_help, 0, "Show this help message", NULL },
|
||||||
{ "usage", 0, POPT_ARG_NONE, &show_usage, 0, "Display brief usage message", NULL },
|
{ "usage", 0, POPT_ARG_NONE, &show_usage, 0, "Display brief usage message", NULL },
|
||||||
{ "list", 'l', POPT_ARG_NONE, &list_tests, 0, "List all tests", NULL },
|
{ "list", 'l', POPT_ARG_NONE, &list_tests, 0, "List all tests", NULL },
|
||||||
{ "initiator-name", 'i', POPT_ARG_STRING, &initiator, 0, "Initiatorname to use", "iqn-name" },
|
{ "initiator-name", 'i', POPT_ARG_STRING, &initiatorname1, 0, "Initiatorname to use", "iqn-name" },
|
||||||
{ "initiator-name-2", 'I', POPT_ARG_STRING, &initiator, 0, "Second initiatorname to use for tests using more two sessions", "iqn-name" },
|
{ "initiator-name-2", 'I', POPT_ARG_STRING, &initiatorname2, 0, "Second initiatorname to use for tests using more than one session", "iqn-name" },
|
||||||
{ "test", 't', POPT_ARG_STRING, &testname, 0, "Which test to run", "testname" },
|
{ "test", 't', POPT_ARG_STRING, &testname, 0, "Which test to run", "testname" },
|
||||||
{ "skip", 's', POPT_ARG_STRING, &skipname, 0, "Which test to skip", "skipname" },
|
{ "skip", 's', POPT_ARG_STRING, &skipname, 0, "Which test to skip", "skipname" },
|
||||||
{ "info", 0, POPT_ARG_NONE, &show_info, 0, "Show information about the test", "testname" },
|
{ "info", 0, POPT_ARG_NONE, &show_info, 0, "Show information about the test", "testname" },
|
||||||
@@ -427,7 +427,7 @@ int main(int argc, const char *argv[])
|
|||||||
for (test = &tests[0]; test->name; test++) {
|
for (test = &tests[0]; test->name; test++) {
|
||||||
printf("%s\n", test->name);
|
printf("%s\n", test->name);
|
||||||
if (show_info) {
|
if (show_info) {
|
||||||
test->test(initiator, url, data_loss, show_info);
|
test->test(initiatorname1, url, data_loss, show_info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exit(0);
|
exit(0);
|
||||||
@@ -438,7 +438,7 @@ int main(int argc, const char *argv[])
|
|||||||
fprintf(stderr, "You must specify the URL\n");
|
fprintf(stderr, "You must specify the URL\n");
|
||||||
print_usage();
|
print_usage();
|
||||||
free(skipname);
|
free(skipname);
|
||||||
free(testname);
|
free(testname);
|
||||||
exit(10);
|
exit(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -463,7 +463,7 @@ int main(int argc, const char *argv[])
|
|||||||
if (skip) continue;
|
if (skip) continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = test->test(initiator, url, data_loss, show_info);
|
res = test->test(initiatorname1, url, data_loss, show_info);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
printf("TEST %s [OK]\n", test->name);
|
printf("TEST %s [OK]\n", test->name);
|
||||||
} else if (res == -2) {
|
} else if (res == -2) {
|
||||||
@@ -482,4 +482,3 @@ int main(int argc, const char *argv[])
|
|||||||
|
|
||||||
return num_failed ? num_failed : num_skipped ? 77 : 0;
|
return num_failed ? num_failed : num_skipped ? 77 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern const char *initiator;
|
extern const char *initiatorname1;
|
||||||
extern const char *initiator2;
|
extern const char *initiatorname2;
|
||||||
|
|
||||||
struct iscsi_context *iscsi_context_login(const char *initiatorname, const char *url, int *lun);
|
struct iscsi_context *iscsi_context_login(const char *initiatorname, const char *url, int *lun);
|
||||||
|
|
||||||
@@ -182,4 +182,3 @@ int T1010_datasn_invalid(const char *initiator, const char *url, int data_loss,
|
|||||||
int T1020_bufferoffset_invalid(const char *initiator, const char *url, int data_loss, int show_info);
|
int T1020_bufferoffset_invalid(const char *initiator, const char *url, int data_loss, int show_info);
|
||||||
int T1030_unsolicited_data_overflow(const char *initiator, const char *url, int data_loss, int show_info);
|
int T1030_unsolicited_data_overflow(const char *initiator, const char *url, int data_loss, int show_info);
|
||||||
int T1031_unsolicited_data_out(const char *initiator, const char *url, int data_loss, int show_info);
|
int T1031_unsolicited_data_out(const char *initiator, const char *url, int data_loss, int show_info);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user