Commit 96f38967 authored by Li Zhijian's avatar Li Zhijian Committed by David S. Miller

selftests/tc-testing: add exit code

Mark the summary result as FAIL to prevent from confusing the selftest
framework if some of them are failed.

Previously, the selftest framework always treats it as *ok* even though
some of them are failed actually. That's because the script tdc.sh always
return 0.

 # All test results:
 #
 # 1..97
 # ok 1 83be - Create FQ-PIE with invalid number of flows
 # ok 2 8b6e - Create RED with no flags
[...snip]
 # ok 6 5f15 - Create RED with flags ECN, harddrop
 # ok 7 53e8 - Create RED with flags ECN, nodrop
 # ok 8 d091 - Fail to create RED with only nodrop flag
 # ok 9 af8e - Create RED with flags ECN, nodrop, harddrop
 # not ok 10 ce7d - Add mq Qdisc to multi-queue device (4 queues)
 #       Could not match regex pattern. Verify command output:
 # qdisc mq 1: root
 # qdisc fq_codel 0: parent 1:4 limit 10240p flows 1024 quantum 1514 target 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64
 # qdisc fq_codel 0: parent 1:3 limit 10240p flows 1024 quantum 1514 target 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64
[...snip]
 # ok 96 6979 - Change quantum of a strict ETS band
 # ok 97 9a7d - Change ETS strict band without quantum
 #
 #
 #
 #
 ok 1 selftests: tc-testing: tdc.sh <<< summary result

CC: Philip Li <philip.li@intel.com>
Reported-by: default avatarkernel test robot <lkp@intel.com>
Signed-off-by: default avatarLi Zhijian <zhijianx.li@intel.com>
Acked-by: default avatarDavide Caratti <dcaratti@redhat.com>
Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f6071e5e
...@@ -716,6 +716,7 @@ def set_operation_mode(pm, parser, args, remaining): ...@@ -716,6 +716,7 @@ def set_operation_mode(pm, parser, args, remaining):
list_test_cases(alltests) list_test_cases(alltests)
exit(0) exit(0)
exit_code = 0 # KSFT_PASS
if len(alltests): if len(alltests):
req_plugins = pm.get_required_plugins(alltests) req_plugins = pm.get_required_plugins(alltests)
try: try:
...@@ -724,6 +725,8 @@ def set_operation_mode(pm, parser, args, remaining): ...@@ -724,6 +725,8 @@ def set_operation_mode(pm, parser, args, remaining):
print('The following plugins were not found:') print('The following plugins were not found:')
print('{}'.format(pde.missing_pg)) print('{}'.format(pde.missing_pg))
catresults = test_runner(pm, args, alltests) catresults = test_runner(pm, args, alltests)
if catresults.count_failures() != 0:
exit_code = 1 # KSFT_FAIL
if args.format == 'none': if args.format == 'none':
print('Test results output suppression requested\n') print('Test results output suppression requested\n')
else: else:
...@@ -748,6 +751,8 @@ def set_operation_mode(pm, parser, args, remaining): ...@@ -748,6 +751,8 @@ def set_operation_mode(pm, parser, args, remaining):
gid=int(os.getenv('SUDO_GID'))) gid=int(os.getenv('SUDO_GID')))
else: else:
print('No tests found\n') print('No tests found\n')
exit_code = 4 # KSFT_SKIP
exit(exit_code)
def main(): def main():
""" """
...@@ -767,8 +772,5 @@ def main(): ...@@ -767,8 +772,5 @@ def main():
set_operation_mode(pm, parser, args, remaining) set_operation_mode(pm, parser, args, remaining)
exit(0)
if __name__ == "__main__": if __name__ == "__main__":
main() main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment