forked from OSchip/llvm-project
[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
This commit is contained in:
parent
c10b9f0bde
commit
25675d4eaa
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -498,7 +498,7 @@ class Base(unittest2.TestCase):
|
|||
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 @@ class Base(unittest2.TestCase):
|
|||
# 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 @@ class Base(unittest2.TestCase):
|
|||
|
||||
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 @@ class Base(unittest2.TestCase):
|
|||
|
||||
<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)
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue