[Lldb-commits] [lldb] 25675d4 - [lldb][test][NFC] Create a separate LLDB_TEST_SRC var to allow moving tests.
Jordan Rupprecht via lldb-commits
lldb-commits at lists.llvm.org
Fri Feb 7 15:24:10 PST 2020
Author: Jordan Rupprecht
Date: 2020-02-07T15:18:36-08:00
New Revision: 25675d4eaab6ed8e97528d4886131ec85f1c8c7c
URL: https://github.com/llvm/llvm-project/commit/25675d4eaab6ed8e97528d4886131ec85f1c8c7c
DIFF: https://github.com/llvm/llvm-project/commit/25675d4eaab6ed8e97528d4886131ec85f1c8c7c.diff
LOG: [lldb][test][NFC] Create a separate LLDB_TEST_SRC var to allow moving tests.
Summary:
This creates a separate LLDB_TEST_SRC var to match the existing LLDB_TEST var. LLDB_TEST points to the test framework, LLDB_TEST_SRC points to the tests themselves.
The var points to the same place, but a future patch will move the tree + update var.
Reviewers: labath, JDevlieghere
Reviewed By: labath
Subscribers: merge_guards_bot, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D71150
Added:
Modified:
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
Removed:
################################################################################
diff --git a/lldb/packages/Python/lldbsuite/__init__.py b/lldb/packages/Python/lldbsuite/__init__.py
index 4b59e4119b2a..9efa05c7f454 100644
--- a/lldb/packages/Python/lldbsuite/__init__.py
+++ b/lldb/packages/Python/lldbsuite/__init__.py
@@ -20,10 +20,13 @@ def find_lldb_root():
# 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")
diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py
index d45a57204a8a..4863004c0b72 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -504,6 +504,7 @@ def setupSysPath():
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
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index 8db081b61905..fa93cce73be5 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -498,7 +498,7 @@ def compute_mydir(test_file):
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 @@ def setUpClass(cls):
# 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 clean_working_directory():
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 @@ def getLogBasenameForCurrentTest(self, prefix=None):
<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)
diff --git a/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py b/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py
index aede03da14ca..0f30f70546fa 100644
--- a/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py
+++ b/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py
@@ -61,12 +61,13 @@ def getMake(test_subdir, test_name):
# 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):
More information about the lldb-commits
mailing list