* [PATCH net-next 1/2] tools: tc-testing: Better tap output
2018-02-27 17:45 [PATCH net-next 0/2] tools: tc-testing: notap option Brenda J. Butler
@ 2018-02-27 17:45 ` Brenda J. Butler
2018-02-28 16:12 ` David Miller
2018-02-27 17:45 ` [PATCH net-next 2/2] tools: tc-testing: Add notap option Brenda J. Butler
1 sibling, 1 reply; 4+ messages in thread
From: Brenda J. Butler @ 2018-02-27 17:45 UTC (permalink / raw)
To: davem
Cc: jhs, xiyou.wangcong, jiri, chrism, lucasb, aring, mrv,
batuhanosmantaskaya, netdev, kernel, Brenda J. Butler
Make it easier for automated test platforms to parse the test results.
Signed-off-by: Brenda J. Butler <bjb@mojatatu.com>
---
tools/testing/selftests/tc-testing/plugin-lib/valgrindPlugin.py | 2 +-
tools/testing/selftests/tc-testing/tdc.py | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/tc-testing/plugin-lib/valgrindPlugin.py b/tools/testing/selftests/tc-testing/plugin-lib/valgrindPlugin.py
index 477a7bd7d7fb..432c164ef6ad 100644
--- a/tools/testing/selftests/tc-testing/plugin-lib/valgrindPlugin.py
+++ b/tools/testing/selftests/tc-testing/plugin-lib/valgrindPlugin.py
@@ -131,7 +131,7 @@ class SubPlugin(TdcPlugin):
if (def_num > 0) or (ind_num > 0) or (pos_num > 0) or (nle_num > 0):
mem_results += 'not '
- mem_results += 'ok {} - {}-mem # {}\n'.format(
+ mem_results += 'ok {} {}-mem - {}\n'.format(
self.args.test_ordinal, self.args.testid, 'memory leak check')
self._add_to_tap(mem_results)
if mem_results.startswith('not '):
diff --git a/tools/testing/selftests/tc-testing/tdc.py b/tools/testing/selftests/tc-testing/tdc.py
index 7b50775abaf6..2ac0a9e4c597 100755
--- a/tools/testing/selftests/tc-testing/tdc.py
+++ b/tools/testing/selftests/tc-testing/tdc.py
@@ -213,7 +213,7 @@ def run_one_test(pm, args, index, tidx):
if not result:
tresult += 'not '
- tresult += 'ok {} - {} # {}\n'.format(str(index), tidx['id'], tidx['name'])
+ tresult += 'ok {} {} - {}\n'.format(str(index), tidx['id'], tidx['name'])
tap += tresult
if result == False:
@@ -307,8 +307,8 @@ def test_runner(pm, args, filtered_tests):
if tcount + 1 != index:
for tidx in testlist[index - 1:]:
msg = 'skipped - previous {} failed'.format(stage)
- tap += 'ok {} - {} # {} {} {}\n'.format(
- count, tidx['id'], msg, index, badtest.get('id', '--Unknown--'))
+ tap += 'ok {} {} - {} # {} {} {}\n'.format(
+ count, tidx['id'], tidx['name'], msg, index, badtest.get('id', '--Unknown--'))
count += 1
tap += 'done flushing skipped test tap output\n'
--
2.15.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH net-next 2/2] tools: tc-testing: Add notap option
2018-02-27 17:45 [PATCH net-next 0/2] tools: tc-testing: notap option Brenda J. Butler
2018-02-27 17:45 ` [PATCH net-next 1/2] tools: tc-testing: Better tap output Brenda J. Butler
@ 2018-02-27 17:45 ` Brenda J. Butler
1 sibling, 0 replies; 4+ messages in thread
From: Brenda J. Butler @ 2018-02-27 17:45 UTC (permalink / raw)
To: davem
Cc: jhs, xiyou.wangcong, jiri, chrism, lucasb, aring, mrv,
batuhanosmantaskaya, netdev, kernel, Brenda J. Butler
Add a command line arg to suppress tap output. Handy in case
all the tap output is being supplied by the plugins.
Signed-off-by: Brenda J. Butler <bjb@mojatatu.com>
---
tools/testing/selftests/tc-testing/tdc.py | 36 +++++++++++++++++++++----------
1 file changed, 25 insertions(+), 11 deletions(-)
diff --git a/tools/testing/selftests/tc-testing/tdc.py b/tools/testing/selftests/tc-testing/tdc.py
index 2ac0a9e4c597..3cc309d7b369 100755
--- a/tools/testing/selftests/tc-testing/tdc.py
+++ b/tools/testing/selftests/tc-testing/tdc.py
@@ -241,12 +241,18 @@ def test_runner(pm, args, filtered_tests):
testlist = filtered_tests
tcount = len(testlist)
index = 1
- tap = str(index) + ".." + str(tcount) + "\n"
+ tap = ''
badtest = None
stage = None
emergency_exit = False
emergency_exit_message = ''
+ if args.notap:
+ if args.verbose:
+ tap = 'notap requested: omitting test plan\n'
+ else:
+ tap = str(index) + ".." + str(tcount) + "\n"
+
try:
pm.call_pre_suite(tcount, [tidx['id'] for tidx in testlist])
except Exception as ee:
@@ -303,15 +309,17 @@ def test_runner(pm, args, filtered_tests):
# if we failed in setup or teardown,
# fill in the remaining tests with ok-skipped
count = index
- tap += 'about to flush the tap output if tests need to be skipped\n'
- if tcount + 1 != index:
- for tidx in testlist[index - 1:]:
- msg = 'skipped - previous {} failed'.format(stage)
- tap += 'ok {} {} - {} # {} {} {}\n'.format(
- count, tidx['id'], tidx['name'], msg, index, badtest.get('id', '--Unknown--'))
- count += 1
-
- tap += 'done flushing skipped test tap output\n'
+ if not args.notap:
+ tap += 'about to flush the tap output if tests need to be skipped\n'
+ if tcount + 1 != index:
+ for tidx in testlist[index - 1:]:
+ msg = 'skipped - previous {} failed'.format(stage)
+ tap += 'ok {} {} - {} # {} {} {}\n'.format(
+ count, tidx['id'], tidx['name'], msg, index,
+ badtest.get('id', '--Unknown--'))
+ count += 1
+ tap += 'done flushing skipped test tap output\n'
+
pm.call_post_suite(index)
return tap
@@ -389,6 +397,9 @@ def set_args(parser):
parser.add_argument(
'-v', '--verbose', action='count', default=0,
help='Show the commands that are being run')
+ parser.add_argument(
+ '-N', '--notap', action='store_true',
+ help='Suppress tap results for command under test')
parser.add_argument('-d', '--device',
help='Execute the test case in flower category')
return parser
@@ -601,7 +612,10 @@ def set_operation_mode(pm, args):
catresults = test_runner(pm, args, alltests)
else:
catresults = 'No tests found\n'
- print('All test results: \n\n{}'.format(catresults))
+ if args.notap:
+ print('Tap output suppression requested\n')
+ else:
+ print('All test results: \n\n{}'.format(catresults))
def main():
"""
--
2.15.1
^ permalink raw reply related [flat|nested] 4+ messages in thread