lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 31 Oct 2017 14:30:16 -0400
From:   "Brenda J. Butler" <bjb@...atatu.com>
To:     davem@...emloft.net
Cc:     jhs@...atatu.com, xiyou.wangcong@...il.com, jiri@...nulli.us,
        chrism@...lanox.com, lucasb@...atatu.com, aring@...atatu.com,
        mrv@...atatu.com, netdev@...r.kernel.org,
        "Brenda J. Butler" <bjb@...atatu.com>
Subject: [PATCH net-next] tc-testing: "show" action shows all selected tests

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@...atatu.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ