aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/tc-testing
diff options
context:
space:
mode:
authorBrenda J. Butler <bjb@mojatatu.com>2018-02-28 15:36:19 -0500
committerDavid S. Miller <davem@davemloft.net>2018-03-04 13:31:15 -0500
commitefab163bbc19e5dbd2b7756c1f26defc9c27d6ba (patch)
tree61752422d14dcf012578ae075546390b1ff932c5 /tools/testing/selftests/tc-testing
parentb33cc2cec9e2e58ec5d220e26f1111117ea782d9 (diff)
tools: tc-testing: Add notap option
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/testing/selftests/tc-testing')
-rwxr-xr-xtools/testing/selftests/tc-testing/tdc.py34
1 files changed, 23 insertions, 11 deletions
diff --git a/tools/testing/selftests/tc-testing/tdc.py b/tools/testing/selftests/tc-testing/tdc.py
index 7b50775abaf6..241eea37e4a4 100755
--- a/tools/testing/selftests/tc-testing/tdc.py
+++ b/tools/testing/selftests/tc-testing/tdc.py
@@ -241,12 +241,17 @@ def test_runner(pm, args, filtered_tests):
241 testlist = filtered_tests 241 testlist = filtered_tests
242 tcount = len(testlist) 242 tcount = len(testlist)
243 index = 1 243 index = 1
244 tap = str(index) + ".." + str(tcount) + "\n" 244 tap = ''
245 badtest = None 245 badtest = None
246 stage = None 246 stage = None
247 emergency_exit = False 247 emergency_exit = False
248 emergency_exit_message = '' 248 emergency_exit_message = ''
249 249
250 if args.notap:
251 if args.verbose:
252 tap = 'notap requested: omitting test plan\n'
253 else:
254 tap = str(index) + ".." + str(tcount) + "\n"
250 try: 255 try:
251 pm.call_pre_suite(tcount, [tidx['id'] for tidx in testlist]) 256 pm.call_pre_suite(tcount, [tidx['id'] for tidx in testlist])
252 except Exception as ee: 257 except Exception as ee:
@@ -303,15 +308,16 @@ def test_runner(pm, args, filtered_tests):
303 # if we failed in setup or teardown, 308 # if we failed in setup or teardown,
304 # fill in the remaining tests with ok-skipped 309 # fill in the remaining tests with ok-skipped
305 count = index 310 count = index
306 tap += 'about to flush the tap output if tests need to be skipped\n' 311 if not args.notap:
307 if tcount + 1 != index: 312 tap += 'about to flush the tap output if tests need to be skipped\n'
308 for tidx in testlist[index - 1:]: 313 if tcount + 1 != index:
309 msg = 'skipped - previous {} failed'.format(stage) 314 for tidx in testlist[index - 1:]:
310 tap += 'ok {} - {} # {} {} {}\n'.format( 315 msg = 'skipped - previous {} failed'.format(stage)
311 count, tidx['id'], msg, index, badtest.get('id', '--Unknown--')) 316 tap += 'ok {} - {} # {} {} {}\n'.format(
312 count += 1 317 count, tidx['id'], msg, index, badtest.get('id', '--Unknown--'))
313 318 count += 1
314 tap += 'done flushing skipped test tap output\n' 319
320 tap += 'done flushing skipped test tap output\n'
315 pm.call_post_suite(index) 321 pm.call_post_suite(index)
316 322
317 return tap 323 return tap
@@ -389,6 +395,9 @@ def set_args(parser):
389 parser.add_argument( 395 parser.add_argument(
390 '-v', '--verbose', action='count', default=0, 396 '-v', '--verbose', action='count', default=0,
391 help='Show the commands that are being run') 397 help='Show the commands that are being run')
398 parser.add_argument(
399 '-N', '--notap', action='store_true',
400 help='Suppress tap results for command under test')
392 parser.add_argument('-d', '--device', 401 parser.add_argument('-d', '--device',
393 help='Execute the test case in flower category') 402 help='Execute the test case in flower category')
394 return parser 403 return parser
@@ -601,7 +610,10 @@ def set_operation_mode(pm, args):
601 catresults = test_runner(pm, args, alltests) 610 catresults = test_runner(pm, args, alltests)
602 else: 611 else:
603 catresults = 'No tests found\n' 612 catresults = 'No tests found\n'
604 print('All test results: \n\n{}'.format(catresults)) 613 if args.notap:
614 print('Tap output suppression requested\n')
615 else:
616 print('All test results: \n\n{}'.format(catresults))
605 617
606def main(): 618def main():
607 """ 619 """