This revision was automatically updated to reflect the committed changes.
Closed by commit rG03a242bd41ee: [lldb][test] Handle .categories lookup for 
inline tests. (authored by rupprecht).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71099/new/

https://reviews.llvm.org/D71099

Files:
  lldb/packages/Python/lldbsuite/test/test_result.py


Index: lldb/packages/Python/lldbsuite/test/test_result.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/test_result.py
+++ lldb/packages/Python/lldbsuite/test/test_result.py
@@ -113,8 +113,14 @@
         """
         import inspect
         import os.path
-        folder = inspect.getfile(test.__class__)
-        folder = os.path.dirname(folder)
+        # Use test.test_filename if the test was created with
+        # lldbinline.MakeInlineTest().
+        if hasattr(test, 'test_filename'):
+            start_path = test.test_filename
+        else:
+            start_path = inspect.getfile(test.__class__)
+
+        folder = os.path.dirname(start_path)
         while folder != '/':
             categories_file_name = os.path.join(folder, ".categories")
             if os.path.exists(categories_file_name):
@@ -127,6 +133,7 @@
             else:
                 folder = os.path.dirname(folder)
                 continue
+        raise Exception("Did not find a .categories file, starting at: %s" % 
start_path)
 
 
     def getCategoriesForTest(self, test):


Index: lldb/packages/Python/lldbsuite/test/test_result.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/test_result.py
+++ lldb/packages/Python/lldbsuite/test/test_result.py
@@ -113,8 +113,14 @@
         """
         import inspect
         import os.path
-        folder = inspect.getfile(test.__class__)
-        folder = os.path.dirname(folder)
+        # Use test.test_filename if the test was created with
+        # lldbinline.MakeInlineTest().
+        if hasattr(test, 'test_filename'):
+            start_path = test.test_filename
+        else:
+            start_path = inspect.getfile(test.__class__)
+
+        folder = os.path.dirname(start_path)
         while folder != '/':
             categories_file_name = os.path.join(folder, ".categories")
             if os.path.exists(categories_file_name):
@@ -127,6 +133,7 @@
             else:
                 folder = os.path.dirname(folder)
                 continue
+        raise Exception("Did not find a .categories file, starting at: %s" % start_path)
 
 
     def getCategoriesForTest(self, test):
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
  • [Lldb-commits] [PA... Jordan Rupprecht via Phabricator via lldb-commits
    • [Lldb-commits... pre-merge checks [bot] via Phabricator via lldb-commits
    • [Lldb-commits... Jordan Rupprecht via Phabricator via lldb-commits

Reply via email to