summaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/plugins/builder_base.py
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2018-07-28 11:09:23 +0000
committerDimitry Andric <dim@FreeBSD.org>2018-07-28 11:09:23 +0000
commitf73363f1dd94996356cefbf24388f561891acf0b (patch)
treee3c31248bdb36eaec5fd833490d4278162dba2a0 /packages/Python/lldbsuite/test/plugins/builder_base.py
parent160ee69dd7ae18978f4068116777639ea98dc951 (diff)
Notes
Diffstat (limited to 'packages/Python/lldbsuite/test/plugins/builder_base.py')
-rw-r--r--packages/Python/lldbsuite/test/plugins/builder_base.py75
1 files changed, 43 insertions, 32 deletions
diff --git a/packages/Python/lldbsuite/test/plugins/builder_base.py b/packages/Python/lldbsuite/test/plugins/builder_base.py
index bd6656bd5e87b..be891da2d0867 100644
--- a/packages/Python/lldbsuite/test/plugins/builder_base.py
+++ b/packages/Python/lldbsuite/test/plugins/builder_base.py
@@ -50,13 +50,32 @@ def getArchFlag():
return ("ARCHFLAG=" + archflag) if archflag else ""
-
-def getMake():
- """Returns the name for GNU make"""
+def getMake(test_subdir, test_name):
+ """Returns the invocation for GNU make.
+ The first argument is a tuple of the relative path to the testcase
+ and its filename stem."""
if platform.system() == "FreeBSD" or platform.system() == "NetBSD":
- return "gmake"
+ make = "gmake"
else:
- return "make"
+ make = "make"
+
+ # Construct the base make invocation.
+ lldb_test = os.environ["LLDB_TEST"]
+ 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))):
+ 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)
+ # 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):
+ makefile = os.path.join(build_dir, "Makefile")
+ return [make,
+ "VPATH="+src_dir,
+ "-C", build_dir,
+ "-I", src_dir,
+ "-f", makefile]
def getArchSpec(architecture):
@@ -121,12 +140,11 @@ def buildDefault(
architecture=None,
compiler=None,
dictionary=None,
- clean=True):
+ testdir=None,
+ testname=None):
"""Build the binaries the default way."""
commands = []
- if clean:
- commands.append([getMake(), "clean", getCmdLine(dictionary)])
- commands.append([getMake(), getArchSpec(architecture),
+ commands.append(getMake(testdir, testname) + ["all", getArchSpec(architecture),
getCCSpec(compiler), getCmdLine(dictionary)])
runBuildCommands(commands, sender=sender)
@@ -140,13 +158,13 @@ def buildDwarf(
architecture=None,
compiler=None,
dictionary=None,
- clean=True):
+ testdir=None,
+ testname=None):
"""Build the binaries with dwarf debug info."""
commands = []
- if clean:
- commands.append([getMake(), "clean", getCmdLine(dictionary)])
- commands.append([getMake(), "MAKE_DSYM=NO", getArchSpec(
- architecture), getCCSpec(compiler), getCmdLine(dictionary)])
+ commands.append(getMake(testdir, testname) +
+ ["MAKE_DSYM=NO", getArchSpec(architecture),
+ getCCSpec(compiler), getCmdLine(dictionary)])
runBuildCommands(commands, sender=sender)
# True signifies that we can handle building dwarf.
@@ -158,13 +176,15 @@ def buildDwo(
architecture=None,
compiler=None,
dictionary=None,
- clean=True):
+ testdir=None,
+ testname=None):
"""Build the binaries with dwarf debug info."""
commands = []
- if clean:
- commands.append([getMake(), "clean", getCmdLine(dictionary)])
- commands.append([getMake(), "MAKE_DSYM=NO", "MAKE_DWO=YES", getArchSpec(
- architecture), getCCSpec(compiler), getCmdLine(dictionary)])
+ commands.append(getMake(testdir, testname) +
+ ["MAKE_DSYM=NO", "MAKE_DWO=YES",
+ getArchSpec(architecture),
+ getCCSpec(compiler),
+ getCmdLine(dictionary)])
runBuildCommands(commands, sender=sender)
# True signifies that we can handle building dwo.
@@ -176,13 +196,12 @@ def buildGModules(
architecture=None,
compiler=None,
dictionary=None,
- clean=True):
+ testdir=None,
+ testname=None):
"""Build the binaries with dwarf debug info."""
commands = []
- if clean:
- commands.append([getMake(), "clean", getCmdLine(dictionary)])
- commands.append([getMake(),
- "MAKE_DSYM=NO",
+ commands.append(getMake(testdir, testname) +
+ ["MAKE_DSYM=NO",
"MAKE_GMODULES=YES",
getArchSpec(architecture),
getCCSpec(compiler),
@@ -195,12 +214,4 @@ def buildGModules(
def cleanup(sender=None, dictionary=None):
"""Perform a platform-specific cleanup after the test."""
- #import traceback
- # traceback.print_stack()
- commands = []
- if os.path.isfile("Makefile"):
- commands.append([getMake(), "clean", getCmdLine(dictionary)])
-
- runBuildCommands(commands, sender=sender)
- # True signifies that we can handle cleanup.
return True