TESTS: Add support to specify multiple test glob expressions

This commit is contained in:
Ronnie Sahlberg
2014-03-26 18:35:07 -07:00
parent 68610bd7cf
commit 458764a77d
3 changed files with 29 additions and 7 deletions
+7 -3
View File
@@ -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/25/2014 .\" Date: 03/26/2014
.\" 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/25/2014" "iscsi\-test\-cu" "iscsi\-test\-cu: iSCSI/SCSI pr" .TH "ISCSI\-TEST\-CU" "1" "03/26/2014" "iscsi\-test\-cu" "iscsi\-test\-cu: iSCSI/SCSI pr"
.\" ----------------------------------------------------------------- .\" -----------------------------------------------------------------
.\" * Define some portability stuff .\" * Define some portability stuff
.\" ----------------------------------------------------------------- .\" -----------------------------------------------------------------
@@ -105,6 +105,7 @@ ALL\&.GetLBAStatus\&.BeyondEol
.PP .PP
\-t \-\-test=<family>|*[\&.<suite>|*[\&.<test>|*]] \-t \-\-test=<family>|*[\&.<suite>|*[\&.<test>|*]]
.RS 4 .RS 4
This argument specifies a comma\-separated list of the test expressions to run\&. If this argument is omitted then all tests will be executed\&.
.sp .sp
.if n \{\ .if n \{\
.RS 4 .RS 4
@@ -120,7 +121,10 @@ iscsi\-test\-cu \-\-test=SCSI\&.Read16\&.* \e
To just run a single specific test: To just run a single specific test:
iscsi\-test\-cu \-\-test=iSCSI\&.iSCSIResiduals\&.Read10Invalid \e iscsi\-test\-cu \-\-test=iSCSI\&.iSCSIResiduals\&.Read10Invalid \e
iscsi://192\&.0\&.2\&.1/iqn\&.ronnie/test/1 iscsi://192\&.0\&.2\&.1/iqn\&.ronnie/test/1
\&.\&.\&.
Run all tests in the TestUnitReady suite and also the Reaqd16\&.Flags test
iscsi\-test\-cu \-\-test=SCSI\&.TestUnitReady\&.*,SCSI\&.Read16\&.Flags \e
iscsi://192\&.0\&.2\&.1/iqn\&.ronnie/test/1
.fi .fi
.if n \{\ .if n \{\
+7 -1
View File
@@ -129,6 +129,9 @@ ALL.GetLBAStatus.BeyondEol
<varlistentry><term>-t --test=&lt;family&gt;|*[.&lt;suite&gt;|*[.&lt;test&gt;|*]]</term> <varlistentry><term>-t --test=&lt;family&gt;|*[.&lt;suite&gt;|*[.&lt;test&gt;|*]]</term>
<listitem> <listitem>
<para> <para>
This argument specifies a comma-separated list of the test
expressions to run. If this argument is omitted then all tests
will be executed.
<screen format="linespecific"> <screen format="linespecific">
To run all tests: To run all tests:
iscsi-test-cu --test=ALL iscsi://192.0.2.1/iqn.ronnie/test/1 iscsi-test-cu --test=ALL iscsi://192.0.2.1/iqn.ronnie/test/1
@@ -140,7 +143,10 @@ iscsi-test-cu --test=SCSI.Read16.* \
To just run a single specific test: To just run a single specific test:
iscsi-test-cu --test=iSCSI.iSCSIResiduals.Read10Invalid \ iscsi-test-cu --test=iSCSI.iSCSIResiduals.Read10Invalid \
iscsi://192.0.2.1/iqn.ronnie/test/1 iscsi://192.0.2.1/iqn.ronnie/test/1
...
Run all tests in the TestUnitReady suite and also the Reaqd16.Flags test
iscsi-test-cu --test=SCSI.TestUnitReady.*,SCSI.Read16.Flags \
iscsi://192.0.2.1/iqn.ronnie/test/1
</screen> </screen>
</para> </para>
</listitem> </listitem>
+15 -3
View File
@@ -846,7 +846,7 @@ add_tests(const char *testname_re)
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
char *testname_re = NULL; char *testname_re = NULL, *testname;
int lun; int lun;
CU_BasicRunMode mode = CU_BRM_VERBOSE; CU_BasicRunMode mode = CU_BRM_VERBOSE;
CU_ErrorAction error_action = CUEA_IGNORE; CU_ErrorAction error_action = CUEA_IGNORE;
@@ -1172,11 +1172,25 @@ main(int argc, char *argv[])
exit(1); exit(1);
} }
if (testname_re != NULL) {
while ((testname = strrchr(testname_re, ',')) != NULL) {
if (add_tests(testname + 1) != CUE_SUCCESS) {
fprintf(stderr, "error: suite registration "
"failed: %s\n", CU_get_error_msg());
exit(1);
}
*testname = 0;
}
}
if (add_tests(testname_re) != CUE_SUCCESS) { if (add_tests(testname_re) != CUE_SUCCESS) {
fprintf(stderr, "error: suite registration failed: %s\n", fprintf(stderr, "error: suite registration failed: %s\n",
CU_get_error_msg()); CU_get_error_msg());
exit(1); exit(1);
} }
if (testname_re) {
free(testname_re);
}
CU_basic_set_mode(mode); CU_basic_set_mode(mode);
CU_set_error_action(error_action); CU_set_error_action(error_action);
printf("\n"); printf("\n");
@@ -1194,8 +1208,6 @@ main(int argc, char *argv[])
} }
CU_cleanup_registry(); CU_cleanup_registry();
if (testname_re)
free(testname_re);
free(discard_const(tgt_url)); free(discard_const(tgt_url));
if (inq_task != NULL) { if (inq_task != NULL) {