This revision was automatically updated to reflect the committed changes.
Closed by commit rL317277: Remove getCategories mechanism of specifying test
categories (authored by labath).
Repository:
rL LLVM
https://reviews.llvm.org/D39515
Files:
lldb/trunk/packages/Python/lldbsuite/test/example/TestSequenceFunctions.py
lldb/trunk/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py
lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/.categories
lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/step_until/.categories
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py
lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/.categories
lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py
lldb/trunk/packages/Python/lldbsuite/test/lang/c/stepping/TestStepAndBreakpoints.py
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-stepping/TestObjCStepping.py
lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
lldb/trunk/packages/Python/lldbsuite/test/test_result.py
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/.categories
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
Index: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-stepping/TestObjCStepping.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-stepping/TestObjCStepping.py
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-stepping/TestObjCStepping.py
@@ -13,9 +13,6 @@
class TestObjCStepping(TestBase):
- def getCategories(self):
- return ['basic_process']
-
mydir = TestBase.compute_mydir(__file__)
def setUp(self):
@@ -35,7 +32,7 @@
self.main_source, '// Step over nil should stop here.')
@skipUnlessDarwin
- @add_test_categories(['pyapi'])
+ @add_test_categories(['pyapi', 'basic_process'])
def test_with_python_api(self):
"""Test stepping through ObjC method dispatch in various forms."""
self.build()
Index: lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py
@@ -14,9 +14,6 @@
mydir = TestBase.compute_mydir(__file__)
- def getCategories(self):
- return ['basic_process']
-
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
Index: lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/.categories
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/.categories
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/.categories
@@ -0,0 +1 @@
+basic_process
Index: lldb/trunk/packages/Python/lldbsuite/test/lang/c/stepping/TestStepAndBreakpoints.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/stepping/TestStepAndBreakpoints.py
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/stepping/TestStepAndBreakpoints.py
@@ -15,16 +15,13 @@
mydir = TestBase.compute_mydir(__file__)
- def getCategories(self):
- return ['basic_process']
-
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
# Find the line numbers that we will step to in main:
self.main_source = "main.c"
- @add_test_categories(['pyapi'])
+ @add_test_categories(['pyapi', 'basic_process'])
@expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr17932')
@expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr14437")
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24777")
Index: lldb/trunk/packages/Python/lldbsuite/test/test_result.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/test_result.py
+++ lldb/trunk/packages/Python/lldbsuite/test/test_result.py
@@ -105,6 +105,32 @@
else:
return str(test)
+ @staticmethod
+ def _getFileBasedCategories(test):
+ """
+ Returns the list of categories to which this test case belongs by
+ looking for a ".categories" file. We start at the folder the test is in
+ an traverse the hierarchy upwards - we guarantee a .categories to exist
+ at the top level directory so we do not end up looping endlessly.
+ """
+ import inspect
+ import os.path
+ folder = inspect.getfile(test.__class__)
+ folder = os.path.dirname(folder)
+ while folder != '/':
+ categories_file_name = os.path.join(folder, ".categories")
+ if os.path.exists(categories_file_name):
+ categories_file = open(categories_file_name, 'r')
+ categories = categories_file.readline()
+ categories_file.close()
+ categories = str.replace(categories, '\n', '')
+ categories = str.replace(categories, '\r', '')
+ return categories.split(',')
+ else:
+ folder = os.path.dirname(folder)
+ continue
+
+
def getCategoriesForTest(self, test):
"""
Gets all the categories for the currently running test method in test case
@@ -114,7 +140,7 @@
if test_method is not None and hasattr(test_method, "categories"):
test_categories.extend(test_method.categories)
- test_categories.extend(test.getCategories())
+ test_categories.extend(self._getFileBasedCategories(test))
return test_categories
Index: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
@@ -1834,30 +1834,6 @@
# Can be overridden by the LLDB_TIME_WAIT_NEXT_LAUNCH environment variable.
timeWaitNextLaunch = 1.0
- # Returns the list of categories to which this test case belongs
- # by default, look for a ".categories" file, and read its contents
- # if no such file exists, traverse the hierarchy - we guarantee
- # a .categories to exist at the top level directory so we do not end up
- # looping endlessly - subclasses are free to define their own categories
- # in whatever way makes sense to them
- def getCategories(self):
- import inspect
- import os.path
- folder = inspect.getfile(self.__class__)
- folder = os.path.dirname(folder)
- while folder != '/':
- categories_file_name = os.path.join(folder, ".categories")
- if os.path.exists(categories_file_name):
- categories_file = open(categories_file_name, 'r')
- categories = categories_file.readline()
- categories_file.close()
- categories = str.replace(categories, '\n', '')
- categories = str.replace(categories, '\r', '')
- return categories.split(',')
- else:
- folder = os.path.dirname(folder)
- continue
-
def generateSource(self, source):
template = source + '.template'
temp = os.path.join(os.getcwd(), template)
Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/.categories
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/.categories
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/.categories
@@ -0,0 +1 @@
+lldb-mi
Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
@@ -14,9 +14,6 @@
myexe = "a.out"
mylog = "child.log"
- def getCategories(self):
- return ['lldb-mi']
-
@classmethod
def classCleanup(cls):
TestBase.RemoveTempFile(cls.myexe)
Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py
@@ -16,15 +16,13 @@
class ExprDoesntDeadlockTestCase(TestBase):
- def getCategories(self):
- return ['basic_process']
-
mydir = TestBase.compute_mydir(__file__)
@expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr17946')
@expectedFailureAll(
oslist=["windows"],
bugnumber="Windows doesn't have pthreads, test needs to be ported")
+ @add_test_categories(["basic_process"])
def test_with_run_command(self):
"""Test that expr will time out and allow other threads to run if it blocks."""
self.build()
Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py
@@ -15,9 +15,6 @@
mydir = TestBase.compute_mydir(__file__)
- def getCategories(self):
- return ['basic_process']
-
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/step_until/.categories
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/step_until/.categories
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/step_until/.categories
@@ -0,0 +1 @@
+basic_process
Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py
@@ -13,9 +13,6 @@
mydir = TestBase.compute_mydir(__file__)
- def getCategories(self):
- return ['basic_process']
-
@expectedFailureAll(
oslist=["linux"],
archs=[
@@ -28,6 +25,7 @@
# Read-write watchpoints not supported on SystemZ
@expectedFailureAll(archs=['s390x'])
@expectedFailureAll(oslist=["ios", "watchos", "tvos", "bridgeos"], bugnumber="<rdar://problem/34027183>") # watchpoint tests aren't working on arm64
+ @add_test_categories(["basic_process"])
def test(self):
"""Test stepping over watchpoints."""
self.build()
Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py
@@ -15,9 +15,6 @@
class HelloWatchpointTestCase(TestBase):
- def getCategories(self):
- return ['basic_process']
-
mydir = TestBase.compute_mydir(__file__)
def setUp(self):
@@ -37,6 +34,7 @@
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ @add_test_categories(["basic_process"])
def test_hello_watchpoint_using_watchpoint_set(self):
"""Test a simple sequence of watchpoint creation and watchpoint hit."""
self.build(dictionary=self.d)
Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/.categories
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/.categories
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/.categories
@@ -0,0 +1 @@
+basic_process
Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
@@ -17,9 +17,6 @@
@skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently
class LoadUnloadTestCase(TestBase):
- def getCategories(self):
- return ['basic_process']
-
mydir = TestBase.compute_mydir(__file__)
def setUp(self):
Index: lldb/trunk/packages/Python/lldbsuite/test/example/TestSequenceFunctions.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/example/TestSequenceFunctions.py
+++ lldb/trunk/packages/Python/lldbsuite/test/example/TestSequenceFunctions.py
@@ -30,8 +30,5 @@
for element in random.sample(self.seq, 5):
self.assertTrue(element in self.seq)
- def getCategories(self):
- return []
-
if __name__ == '__main__':
unittest.main()
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits