test-tool: remove the --usb argument and use BLCSECTGET to read max xfer
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This commit is contained in:
@@ -2,12 +2,12 @@
|
|||||||
.\" Title: iscsi-test-cu
|
.\" Title: iscsi-test-cu
|
||||||
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
|
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
|
||||||
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
|
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
|
||||||
.\" Date: 03/26/2014
|
.\" Date: 02/16/2015
|
||||||
.\" Manual: iscsi-test-cu: iSCSI/SCSI protocol test suite
|
.\" Manual: iscsi-test-cu: iSCSI/SCSI protocol test suite
|
||||||
.\" Source: iscsi-test-cu
|
.\" Source: iscsi-test-cu
|
||||||
.\" Language: English
|
.\" Language: English
|
||||||
.\"
|
.\"
|
||||||
.TH "ISCSI\-TEST\-CU" "1" "03/26/2014" "iscsi\-test\-cu" "iscsi\-test\-cu: iSCSI/SCSI pr"
|
.TH "ISCSI\-TEST\-CU" "1" "02/16/2015" "iscsi\-test\-cu" "iscsi\-test\-cu: iSCSI/SCSI pr"
|
||||||
.\" -----------------------------------------------------------------
|
.\" -----------------------------------------------------------------
|
||||||
.\" * Define some portability stuff
|
.\" * Define some portability stuff
|
||||||
.\" -----------------------------------------------------------------
|
.\" -----------------------------------------------------------------
|
||||||
@@ -33,7 +33,7 @@ iscsi-test-cu \- iSCSI/SCSI test suite
|
|||||||
.HP \w'\fBiscsi\-test\-cu\ [\ OPTIONS\ ]\ <ISCSI\-PORTAL>\fR\ 'u
|
.HP \w'\fBiscsi\-test\-cu\ [\ OPTIONS\ ]\ <ISCSI\-PORTAL>\fR\ 'u
|
||||||
\fBiscsi\-test\-cu [ OPTIONS ] <ISCSI\-PORTAL>\fR
|
\fBiscsi\-test\-cu [ OPTIONS ] <ISCSI\-PORTAL>\fR
|
||||||
.HP \w'\fBiscsi\-test\-cu\fR\ 'u
|
.HP \w'\fBiscsi\-test\-cu\fR\ 'u
|
||||||
\fBiscsi\-test\-cu\fR [\-i\ \-\-initiator\-name=<IQN>] [\-I\ \-\-initiator\-name\-2=<IQN>] [\-l\ \-\-list] [\-t\ \-\-test=<family>|*[\&.<suite>|*[\&.<test>|*]]] [\-d\ \-\-dataloss] [\-s\ \-\-allow\-sanitize] [\-u\ \-\-usb] [\-V\ \-\-Verbose\-scsi] [\-x\ \-\-xml] [\-?\ \-\-help]
|
\fBiscsi\-test\-cu\fR [\-i\ \-\-initiator\-name=<IQN>] [\-I\ \-\-initiator\-name\-2=<IQN>] [\-l\ \-\-list] [\-t\ \-\-test=<family>|*[\&.<suite>|*[\&.<test>|*]]] [\-d\ \-\-dataloss] [\-s\ \-\-allow\-sanitize] [\-V\ \-\-Verbose\-scsi] [\-x\ \-\-xml] [\-?\ \-\-help]
|
||||||
.SH "DESCRIPTION"
|
.SH "DESCRIPTION"
|
||||||
.PP
|
.PP
|
||||||
iscsi\-test\-cu is a test suite for iSCSI/SCSI\&.
|
iscsi\-test\-cu is a test suite for iSCSI/SCSI\&.
|
||||||
@@ -151,13 +151,6 @@ The SBC SANITIZE opcode is expected to take significant time before it completes
|
|||||||
By default any SBC SANITIZE tests will be skipped\&. Use these arguments if you really want to perform SANITIZE tests\&.
|
By default any SBC SANITIZE tests will be skipped\&. Use these arguments if you really want to perform SANITIZE tests\&.
|
||||||
.RE
|
.RE
|
||||||
.PP
|
.PP
|
||||||
\-u \-\-usb
|
|
||||||
.RS 4
|
|
||||||
SCSI devices that sit behind a USB bus are on linux limited to maximum 120k for any single SCSI Read*/Write*\&.
|
|
||||||
.sp
|
|
||||||
When testing against a USB SCSI device you need to specify these arguments so that the tests will clamp the read/write size to a maximum of 120k\&.
|
|
||||||
.RE
|
|
||||||
.PP
|
|
||||||
\-V \-\-Verbose\-scsi
|
\-V \-\-Verbose\-scsi
|
||||||
.RS 4
|
.RS 4
|
||||||
The tests aims to be self\-documenting\&. By specifying the \-V flag the test tool will print all SCSI commands that are sent to the device, the arguments and the expected result\&.
|
The tests aims to be self\-documenting\&. By specifying the \-V flag the test tool will print all SCSI commands that are sent to the device, the arguments and the expected result\&.
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
<arg choice="opt">-t --test=<family>|*[.<suite>|*[.<test>|*]]</arg>
|
<arg choice="opt">-t --test=<family>|*[.<suite>|*[.<test>|*]]</arg>
|
||||||
<arg choice="opt">-d --dataloss</arg>
|
<arg choice="opt">-d --dataloss</arg>
|
||||||
<arg choice="opt">-s --allow-sanitize</arg>
|
<arg choice="opt">-s --allow-sanitize</arg>
|
||||||
<arg choice="opt">-u --usb</arg>
|
|
||||||
<arg choice="opt">-V --Verbose-scsi</arg>
|
<arg choice="opt">-V --Verbose-scsi</arg>
|
||||||
<arg choice="opt">-x --xml</arg>
|
<arg choice="opt">-x --xml</arg>
|
||||||
<arg choice="opt">-? --help</arg>
|
<arg choice="opt">-? --help</arg>
|
||||||
@@ -186,20 +185,6 @@ iscsi-test-cu --test=~/tests-to-run
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry><term>-u --usb</term>
|
|
||||||
<listitem>
|
|
||||||
<para>
|
|
||||||
SCSI devices that sit behind a USB bus are on linux limited
|
|
||||||
to maximum 120k for any single SCSI Read*/Write*.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
When testing against a USB SCSI device you need to specify these
|
|
||||||
arguments so that the tests will clamp the read/write size to
|
|
||||||
a maximum of 120k.
|
|
||||||
</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term>-V --Verbose-scsi</term>
|
<varlistentry><term>-V --Verbose-scsi</term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <scsi/sg.h>
|
#include <scsi/sg.h>
|
||||||
|
#include <sys/mount.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <CUnit/CUnit.h>
|
#include <CUnit/CUnit.h>
|
||||||
@@ -54,6 +55,7 @@
|
|||||||
|
|
||||||
int loglevel = LOG_NORMAL;
|
int loglevel = LOG_NORMAL;
|
||||||
struct scsi_device *sd;
|
struct scsi_device *sd;
|
||||||
|
static unsigned int maxsectbytes;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* this allows us to redefine how PDU are queued, at times, for
|
* this allows us to redefine how PDU are queued, at times, for
|
||||||
@@ -630,9 +632,6 @@ print_usage(void)
|
|||||||
" -f|--fail Error Action: FAIL if any tests fail\n");
|
" -f|--fail Error Action: FAIL if any tests fail\n");
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
" -A|--abort Error Action: ABORT if any tests fail\n");
|
" -A|--abort Error Action: ABORT if any tests fail\n");
|
||||||
fprintf(stderr,
|
|
||||||
" -u|--usb The device is attached to a USB bus.\n"
|
|
||||||
" Additional restrictions apply, such as maximum transfer length 120kb.\n");
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
" -s|--silent Test Mode: Silent\n");
|
" -s|--silent Test Mode: Silent\n");
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
@@ -885,7 +884,7 @@ static int connect_scsi_device(struct scsi_device *sdev, const char *initiatorna
|
|||||||
if (sdev->sgio_dev) {
|
if (sdev->sgio_dev) {
|
||||||
int version;
|
int version;
|
||||||
|
|
||||||
if ((sdev->sgio_fd = open(sdev->sgio_dev, O_RDWR)) == -1) {
|
if ((sdev->sgio_fd = open(sdev->sgio_dev, O_RDWR|O_NONBLOCK)) == -1) {
|
||||||
fprintf(stderr, "Failed to open SG_IO device %s. Error:%s\n", sdev->sgio_dev,
|
fprintf(stderr, "Failed to open SG_IO device %s. Error:%s\n", sdev->sgio_dev,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
@@ -895,6 +894,11 @@ static int connect_scsi_device(struct scsi_device *sdev, const char *initiatorna
|
|||||||
close(sdev->sgio_fd);
|
close(sdev->sgio_fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (ioctl(sdev->sgio_fd, BLKSECTGET, &maxsectbytes) < 0) {
|
||||||
|
fprintf(stderr, "%s failed to read BLKMAXSECT\n", sdev->sgio_dev);
|
||||||
|
close(sdev->sgio_fd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -943,7 +947,6 @@ main(int argc, char *argv[])
|
|||||||
struct scsi_task *rc16_task = NULL;
|
struct scsi_task *rc16_task = NULL;
|
||||||
struct scsi_task *rsop_task = NULL;
|
struct scsi_task *rsop_task = NULL;
|
||||||
int full_size;
|
int full_size;
|
||||||
int is_usb = 0;
|
|
||||||
int xml_mode = 0;
|
int xml_mode = 0;
|
||||||
static struct option long_opts[] = {
|
static struct option long_opts[] = {
|
||||||
{ "help", no_argument, 0, '?' },
|
{ "help", no_argument, 0, '?' },
|
||||||
@@ -958,7 +961,6 @@ main(int argc, char *argv[])
|
|||||||
{ "abort", no_argument, 0, 'A' },
|
{ "abort", no_argument, 0, 'A' },
|
||||||
{ "silent", no_argument, 0, 's' },
|
{ "silent", no_argument, 0, 's' },
|
||||||
{ "normal", no_argument, 0, 'n' },
|
{ "normal", no_argument, 0, 'n' },
|
||||||
{ "usb", no_argument, 0, 'u' },
|
|
||||||
{ "verbose", no_argument, 0, 'v' },
|
{ "verbose", no_argument, 0, 'v' },
|
||||||
{ "xml", no_argument, 0, 'x' },
|
{ "xml", no_argument, 0, 'x' },
|
||||||
{ "Verbose-scsi", no_argument, 0, 'V' },
|
{ "Verbose-scsi", no_argument, 0, 'V' },
|
||||||
@@ -971,7 +973,7 @@ main(int argc, char *argv[])
|
|||||||
memset(sd, '\0', sizeof(struct scsi_device));
|
memset(sd, '\0', sizeof(struct scsi_device));
|
||||||
sd->sgio_fd = -1;
|
sd->sgio_fd = -1;
|
||||||
|
|
||||||
while ((c = getopt_long(argc, argv, "?hli:I:t:sdgfAsSnuvxV", long_opts,
|
while ((c = getopt_long(argc, argv, "?hli:I:t:sdgfAsSnvxV", long_opts,
|
||||||
&opt_idx)) > 0) {
|
&opt_idx)) > 0) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'h':
|
case 'h':
|
||||||
@@ -1011,9 +1013,6 @@ main(int argc, char *argv[])
|
|||||||
case 'n':
|
case 'n':
|
||||||
mode = CU_BRM_NORMAL;
|
mode = CU_BRM_NORMAL;
|
||||||
break;
|
break;
|
||||||
case 'u':
|
|
||||||
is_usb = 1;
|
|
||||||
break;
|
|
||||||
case 'v':
|
case 'v':
|
||||||
mode = CU_BRM_VERBOSE; /* default */
|
mode = CU_BRM_VERBOSE; /* default */
|
||||||
break;
|
break;
|
||||||
@@ -1259,9 +1258,10 @@ main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
|
|
||||||
if (is_usb) {
|
if (maxsectbytes) {
|
||||||
printf("USB device. Clamping maximum transfer length to 120k\n");
|
maximum_transfer_length = maxsectbytes / block_size;
|
||||||
maximum_transfer_length = 120 *1024 / block_size;
|
printf("Bus transfer size is limited to %d bytes. Clamping "
|
||||||
|
"max transfers accordingly.\n", maxsectbytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CU_initialize_registry() != 0) {
|
if (CU_initialize_registry() != 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user