From 458764a77d10d3d981b05084c5f094cb435c6c9f Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Wed, 26 Mar 2014 18:35:07 -0700 Subject: [PATCH] TESTS: Add support to specify multiple test glob expressions --- doc/iscsi-test-cu.1 | 10 +++++++--- doc/iscsi-test-cu.xml | 8 +++++++- test-tool/iscsi-test-cu.c | 18 +++++++++++++++--- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/doc/iscsi-test-cu.1 b/doc/iscsi-test-cu.1 index cc7798a..9561471 100644 --- a/doc/iscsi-test-cu.1 +++ b/doc/iscsi-test-cu.1 @@ -2,12 +2,12 @@ .\" Title: iscsi-test-cu .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 03/25/2014 +.\" Date: 03/26/2014 .\" Manual: iscsi-test-cu: iSCSI/SCSI protocol test suite .\" Source: iscsi-test-cu .\" 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 .\" ----------------------------------------------------------------- @@ -105,6 +105,7 @@ ALL\&.GetLBAStatus\&.BeyondEol .PP \-t \-\-test=|*[\&.|*[\&.|*]] .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 .if n \{\ .RS 4 @@ -120,7 +121,10 @@ iscsi\-test\-cu \-\-test=SCSI\&.Read16\&.* \e To just run a single specific test: iscsi\-test\-cu \-\-test=iSCSI\&.iSCSIResiduals\&.Read10Invalid \e 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 .if n \{\ diff --git a/doc/iscsi-test-cu.xml b/doc/iscsi-test-cu.xml index 6a70d0a..51d0078 100644 --- a/doc/iscsi-test-cu.xml +++ b/doc/iscsi-test-cu.xml @@ -129,6 +129,9 @@ ALL.GetLBAStatus.BeyondEol -t --test=<family>|*[.<suite>|*[.<test>|*]] + This argument specifies a comma-separated list of the test + expressions to run. If this argument is omitted then all tests + will be executed. To run all tests: 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: iscsi-test-cu --test=iSCSI.iSCSIResiduals.Read10Invalid \ 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 diff --git a/test-tool/iscsi-test-cu.c b/test-tool/iscsi-test-cu.c index 1c4b35b..8cd802b 100644 --- a/test-tool/iscsi-test-cu.c +++ b/test-tool/iscsi-test-cu.c @@ -846,7 +846,7 @@ add_tests(const char *testname_re) int main(int argc, char *argv[]) { - char *testname_re = NULL; + char *testname_re = NULL, *testname; int lun; CU_BasicRunMode mode = CU_BRM_VERBOSE; CU_ErrorAction error_action = CUEA_IGNORE; @@ -1172,11 +1172,25 @@ main(int argc, char *argv[]) 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) { fprintf(stderr, "error: suite registration failed: %s\n", CU_get_error_msg()); exit(1); } + if (testname_re) { + free(testname_re); + } + CU_basic_set_mode(mode); CU_set_error_action(error_action); printf("\n"); @@ -1194,8 +1208,6 @@ main(int argc, char *argv[]) } CU_cleanup_registry(); - if (testname_re) - free(testname_re); free(discard_const(tgt_url)); if (inq_task != NULL) {