[Lldb-commits] [PATCH] D71150: [lldb][test] Create a separate LLDB_TEST_SRC var to allow moving tests.

Jordan Rupprecht via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 7 15:29:13 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG25675d4eaab6: [lldb][test][NFC] Create a separate LLDB_TEST_SRC var to allow moving tests. (authored by rupprecht).

Changed prior to commit:
  https://reviews.llvm.org/D71150?vs=232656&id=243301#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71150

Files:
  lldb/packages/Python/lldbsuite/__init__.py
  lldb/packages/Python/lldbsuite/test/dotest.py
  lldb/packages/Python/lldbsuite/test/lldbtest.py
  lldb/packages/Python/lldbsuite/test/plugins/builder_base.py


Index: lldb/packages/Python/lldbsuite/test/plugins/builder_base.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/plugins/builder_base.py
+++ lldb/packages/Python/lldbsuite/test/plugins/builder_base.py
@@ -61,12 +61,13 @@
 
     # Construct the base make invocation.
     lldb_test = os.environ["LLDB_TEST"]
+    lldb_test_src = os.environ["LLDB_TEST_SRC"]
     lldb_build = os.environ["LLDB_BUILD"]
-    if not (lldb_test and lldb_build and test_subdir and test_name and
-            (not os.path.isabs(test_subdir))):
+    if not (lldb_test and lldb_test_src and lldb_build and test_subdir and
+            test_name and (not os.path.isabs(test_subdir))):
         raise Exception("Could not derive test directories")
     build_dir = os.path.join(lldb_build, test_subdir, test_name)
-    src_dir = os.path.join(lldb_test, test_subdir)
+    src_dir = os.path.join(lldb_test_src, test_subdir)
     # This is a bit of a hack to make inline testcases work.
     makefile = os.path.join(src_dir, "Makefile")
     if not os.path.isfile(makefile):
Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -498,7 +498,7 @@
             mydir = TestBase.compute_mydir(__file__)
         '''
         # /abs/path/to/packages/group/subdir/mytest.py -> group/subdir
-        rel_prefix = test_file[len(os.environ["LLDB_TEST"]) + 1:]
+        rel_prefix = test_file[len(os.environ["LLDB_TEST_SRC"]) + 1:]
         return os.path.dirname(rel_prefix)
 
     def TraceOn(self):
@@ -518,10 +518,10 @@
         # Save old working directory.
         cls.oldcwd = os.getcwd()
 
-        # Change current working directory if ${LLDB_TEST} is defined.
-        # See also dotest.py which sets up ${LLDB_TEST}.
-        if ("LLDB_TEST" in os.environ):
-            full_dir = os.path.join(os.environ["LLDB_TEST"],
+        # Change current working directory if ${LLDB_TEST_SRC} is defined.
+        # See also dotest.py which sets up ${LLDB_TEST_SRC}.
+        if ("LLDB_TEST_SRC" in os.environ):
+            full_dir = os.path.join(os.environ["LLDB_TEST_SRC"],
                                     cls.mydir)
             if traceAlways:
                 print("Change dir to:", full_dir, file=sys.stderr)
@@ -656,7 +656,7 @@
 
     def getSourceDir(self):
         """Return the full path to the current test."""
-        return os.path.join(os.environ["LLDB_TEST"], self.mydir)
+        return os.path.join(os.environ["LLDB_TEST_SRC"], self.mydir)
 
     def getBuildDirBasename(self):
         return self.__class__.__module__ + "." + self.testMethodName
@@ -1089,7 +1089,7 @@
 
         <session-dir>/<arch>-<compiler>-<test-file>.<test-class>.<test-method>
         """
-        dname = os.path.join(os.environ["LLDB_TEST"],
+        dname = os.path.join(os.environ["LLDB_TEST_SRC"],
                              os.environ["LLDB_SESSION_DIRNAME"])
         if not os.path.isdir(dname):
             os.mkdir(dname)
Index: lldb/packages/Python/lldbsuite/test/dotest.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -504,6 +504,7 @@
         sys.exit(-1)
 
     os.environ["LLDB_TEST"] = scriptPath
+    os.environ["LLDB_TEST_SRC"] = lldbsuite.lldb_test_root
 
     # Set up the root build directory.
     builddir = configuration.test_build_dir
Index: lldb/packages/Python/lldbsuite/__init__.py
===================================================================
--- lldb/packages/Python/lldbsuite/__init__.py
+++ lldb/packages/Python/lldbsuite/__init__.py
@@ -20,10 +20,13 @@
 # lldbsuite.lldb_root refers to the root of the git/svn source checkout
 lldb_root = find_lldb_root()
 
-# lldbsuite.lldb_test_root refers to the root of the python test tree
+# lldbsuite.lldb_test_src_root refers to the root of the python test case tree
+# (i.e. the actual unit tests).
 lldb_test_root = os.path.join(
     lldb_root,
     "packages",
     "Python",
     "lldbsuite",
     "test")
+# TODO(rupprecht): update the above definition after moving test cases:
+# lldb_test_root = os.path.join(lldb_root, "test", "API")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71150.243301.patch
Type: text/x-patch
Size: 4357 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200207/d0f6be71/attachment.bin>


More information about the lldb-commits mailing list