diff options
Diffstat (limited to 'lldb/test/lldbtest.py')
-rw-r--r-- | lldb/test/lldbtest.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lldb/test/lldbtest.py b/lldb/test/lldbtest.py index b14eacd02c5..4aa3f861cd0 100644 --- a/lldb/test/lldbtest.py +++ b/lldb/test/lldbtest.py @@ -946,6 +946,30 @@ class TestBase(Base): waitTime = float(os.environ["LLDB_TIME_WAIT_BETWEEN_TEST_CASES"]) time.sleep(waitTime) + # 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 setUp(self): #import traceback #traceback.print_stack() |