sanitycheck: move export-tests handling and deduplicate code

Reuse the same code used for other options.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2020-05-07 10:33:55 -04:00 committed by Carles Cufí
commit 60ae507783

View file

@ -830,16 +830,15 @@ def main():
return
if options.export_tests:
cnt = 0
tests = suite.get_all_tests()
export_tests(options.export_tests, tests)
return
if options.list_tests or options.test_tree or options.list_test_duplicates or options.sub_test:
if options.list_tests or options.test_tree or options.list_test_duplicates \
or options.sub_test or options.export_tests:
cnt = 0
all_tests = suite.get_all_tests()
if options.export_tests:
export_tests(options.export_tests, all_tests)
return
if options.list_test_duplicates:
import collections
dupes = [item for item, count in collections.Counter(all_tests).items() if count > 1]