[Lldb-commits] [PATCH] D71905: [lldb][tests] Take into account all parent's categories when traverse folders upwards
Tatyana Krasnukha via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Dec 26 08:41:21 PST 2019
tatyana-krasnukha created this revision.
tatyana-krasnukha added reviewers: labath, teemperor.
Herald added subscribers: lldb-commits, JDevlieghere.
Herald added a project: LLDB.
This is needed to not "re-write" parent's categories by categories of a nested folder,
e.g. commands/expression/completion specify "cmdline" category, however it still belongs
to parent's "expression" category.
Repository:
rLLDB LLDB
https://reviews.llvm.org/D71905
Files:
packages/Python/lldbsuite/test/test_result.py
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):
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71905.235348.patch
Type: text/x-patch
Size: 1811 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191226/11ecc479/attachment.bin>
More information about the lldb-commits
mailing list