netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] tc-testing: "show" action shows all selected tests
@ 2017-10-31 18:30 Brenda J. Butler
  2017-10-31 18:45 ` Lucas Bates
  2017-11-01  2:07 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Brenda J. Butler @ 2017-10-31 18:30 UTC (permalink / raw)
  To: davem
  Cc: jhs, xiyou.wangcong, jiri, chrism, lucasb, aring, mrv, netdev,
	Brenda J. Butler

The -s "show" option takes an argument to specify which test
to show.  Change the option so it does not take an argument,
but outputs all the tests that were selected with the other
arguments.

It is still possible to output a single test, by using the -e
option, but now more than one test can be displayed with
one command.

Signed-off-by: Brenda J. Butler <bjb@mojatatu.com>
---
 tools/testing/selftests/tc-testing/tdc.py        |  7 ++++---
 tools/testing/selftests/tc-testing/tdc_helper.py | 12 +++---------
 2 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/tools/testing/selftests/tc-testing/tdc.py b/tools/testing/selftests/tc-testing/tdc.py
index 5508730ee1ea..26dcf8dd106c 100755
--- a/tools/testing/selftests/tc-testing/tdc.py
+++ b/tools/testing/selftests/tc-testing/tdc.py
@@ -211,8 +211,8 @@ def set_args(parser):
                         help='Run tests from the specified file')
     parser.add_argument('-l', '--list', type=str, nargs='?', const="++", metavar='CATEGORY',
                         help='List all test cases, or those only within the specified category')
-    parser.add_argument('-s', '--show', type=str, nargs=1, metavar='ID', dest='showID',
-                        help='Display the test case with specified id')
+    parser.add_argument('-s', '--show', action='store_true', dest='showID',
+                        help='Display the selected test cases')
     parser.add_argument('-e', '--execute', type=str, nargs=1, metavar='ID',
                         help='Execute the single test case with specified ID')
     parser.add_argument('-i', '--id', action='store_true', dest='gen_id',
@@ -344,7 +344,8 @@ def set_operation_mode(args):
     ucat = get_test_categories(alltests)
 
     if args.showID:
-        show_test_case_by_id(alltests, args.showID[0])
+        for atest in alltests:
+            print_test_case(atest)
         exit(0)
 
     if args.execute:
diff --git a/tools/testing/selftests/tc-testing/tdc_helper.py b/tools/testing/selftests/tc-testing/tdc_helper.py
index c3254f861fb2..bca1d3fed4a5 100644
--- a/tools/testing/selftests/tc-testing/tdc_helper.py
+++ b/tools/testing/selftests/tc-testing/tdc_helper.py
@@ -56,20 +56,14 @@ def print_sll(items):
 
 def print_test_case(tcase):
     """ Pretty-printing of a given test case. """
+    print('\n==============\nTest {}\t{}\n'.format(tcase['id'], tcase['name']))
     for k in tcase.keys():
         if (type(tcase[k]) == list):
             print(k + ":")
             print_list(tcase[k])
         else:
-            print(k + ": " + tcase[k])
+            if not ((k == 'id') or (k == 'name')):
+                print(k + ": " + str(tcase[k]))
 
 
-def show_test_case_by_id(testlist, caseID):
-    """ Find the specified test case to pretty-print. """
-    if not any(d.get('id', None) == caseID for d in testlist):
-        print("That ID does not exist.")
-        exit(1)
-    else:
-        print_test_case(next((d for d in testlist if d['id'] == caseID)))
-
 
-- 
2.15.0.rc0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-11-01  2:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-31 18:30 [PATCH net-next] tc-testing: "show" action shows all selected tests Brenda J. Butler
2017-10-31 18:45 ` Lucas Bates
2017-11-01  2:07 ` David Miller
     [not found]   ` <CAEj_wPSU-h7N0Mpa1JPRvroY=pvejyHRotv1vJbPgg0L-gx-iA@mail.gmail.com>
2017-11-01  2:30     ` Brenda Butler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).