Port the python api decorator to use test categories
Summary:
Per discussions on the mailing list, I have implemented a decorator which annotates individual
test methods with categories. I have used this framework to replace the '-a' and '+a'
command-line switches (now '-G pyapi' and '--skip-category pyapi') and the @python_api_test
decorator (now @add_test_categories('pyapi')). The test suite now gives an error message
suggesting the new options if the user specifies the deprecated +/-a switches. If the general
direction is good, I will follow this up with other switches.
Reviewers: tberghammer, tfiala, granata.enrico, zturner
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D14020
llvm-svn: 251277
diff --git a/lldb/test/dotest_args.py b/lldb/test/dotest_args.py
index 5d1bf75..79afcdd 100644
--- a/lldb/test/dotest_args.py
+++ b/lldb/test/dotest_args.py
@@ -55,8 +55,6 @@
# Test filtering options
group = parser.add_argument_group('Test filtering options')
group.add_argument('-N', choices=['dwarf', 'dwo', 'dsym'], help="Don't do test cases marked with the @dsym_test/@dwarf_test/@dwo_test decorator by passing dsym/dwarf/dwo as the option arg")
- X('-a', "Don't do lldb Python API tests")
- X('+a', "Just do lldb Python API tests. Do not specify along with '-a'", dest='plus_a')
X('+b', 'Just do benchmark tests', dest='plus_b')
group.add_argument('-b', metavar='blacklist', help='Read a blacklist file specified after this option')
group.add_argument('-f', metavar='filterspec', action='append', help='Specify a filter, which consists of the test class name, a dot, followed by the test method, to only admit such test into the test suite') # FIXME: Example?
@@ -183,6 +181,13 @@
# Remove the reference to our helper function
del X
+ D = lambda optstr, **kwargs: group.add_argument(optstr, action='store_true', **kwargs)
+ group = parser.add_argument_group('Deprecated options (do not use)')
+ # Deprecated on 23.10.2015. Remove completely after a grace period.
+ D('-a')
+ D('+a', dest='plus_a')
+ del D
+
group = parser.add_argument_group('Test directories')
group.add_argument('args', metavar='test-dir', nargs='*', help='Specify a list of directory names to search for test modules named after Test*.py (test discovery). If empty, search from the current working directory instead.')