Index: packages/Python/lldbsuite/test/test_result.py =================================================================== --- packages/Python/lldbsuite/test/test_result.py +++ packages/Python/lldbsuite/test/test_result.py @@ -107,26 +107,26 @@ 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 + collecting values of ".categories" files. We start at the folder the test is in + and 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) + categories = set() 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_str = categories_file.readline().strip() categories_file.close() - categories = str.replace(categories, '\n', '') - categories = str.replace(categories, '\r', '') - return categories.split(',') - else: - folder = os.path.dirname(folder) - continue + categories.update(categories_str.split(',')) + + folder = os.path.dirname(folder) + + return list(categories) def getCategoriesForTest(self, test):