Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: kernel test robot <lkp@intel.com>
Signed-off-by: Li Zhijian <zhijianx.li@intel.com>
Acked-by: Davide Caratti <dcaratti@redhat.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Li Zhijian and committed by
David S. Miller
96f38967 f6071e5e

+5 -3
+5 -3
tools/testing/selftests/tc-testing/tdc.py
··· 716 716 list_test_cases(alltests) 717 717 exit(0) 718 718 719 + exit_code = 0 # KSFT_PASS 719 720 if len(alltests): 720 721 req_plugins = pm.get_required_plugins(alltests) 721 722 try: ··· 725 724 print('The following plugins were not found:') 726 725 print('{}'.format(pde.missing_pg)) 727 726 catresults = test_runner(pm, args, alltests) 727 + if catresults.count_failures() != 0: 728 + exit_code = 1 # KSFT_FAIL 728 729 if args.format == 'none': 729 730 print('Test results output suppression requested\n') 730 731 else: ··· 751 748 gid=int(os.getenv('SUDO_GID'))) 752 749 else: 753 750 print('No tests found\n') 751 + exit_code = 4 # KSFT_SKIP 752 + exit(exit_code) 754 753 755 754 def main(): 756 755 """ ··· 771 766 print('args is {}'.format(args)) 772 767 773 768 set_operation_mode(pm, parser, args, remaining) 774 - 775 - exit(0) 776 - 777 769 778 770 if __name__ == "__main__": 779 771 main()