summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/plugins')
-rw-r--r--lldb/packages/Python/lldbsuite/test/plugins/builder_base.py71
-rw-r--r--lldb/packages/Python/lldbsuite/test/plugins/builder_darwin.py13
-rw-r--r--lldb/packages/Python/lldbsuite/test/plugins/builder_freebsd.py3
-rw-r--r--lldb/packages/Python/lldbsuite/test/plugins/builder_linux.py3
-rw-r--r--lldb/packages/Python/lldbsuite/test/plugins/builder_netbsd.py3
-rw-r--r--lldb/packages/Python/lldbsuite/test/plugins/builder_win32.py3
6 files changed, 60 insertions, 36 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py b/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py
index bd6656bd5e8..ab9c39acbc3 100644
--- a/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py
+++ b/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py
@@ -50,13 +50,31 @@ def getArchFlag():
return ("ARCHFLAG=" + archflag) if archflag else ""
-
-def getMake():
- """Returns the name for GNU make"""
+def getMake(test_subdir):
+ """Returns the invocation for GNU make.
+ The argument test_subdir is the relative path to the testcase."""
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
+ (not os.path.isabs(test_subdir))):
+ raise Exception("Could not derive test directories")
+ build_dir = os.path.join(lldb_build, test_subdir)
+ test_dir = os.path.join(lldb_test, test_subdir)
+ # This is a bit of a hack to make inline testcases work.
+ makefile = os.path.join(test_dir, "Makefile")
+ if not os.path.isfile(makefile):
+ makefile = os.path.join(build_dir, "Makefile")
+ return [make,
+ "VPATH="+test_dir,
+ "-C", build_dir,
+ "-I", test_dir,
+ "-f", makefile]
def getArchSpec(architecture):
@@ -121,12 +139,13 @@ def buildDefault(
architecture=None,
compiler=None,
dictionary=None,
- clean=True):
+ clean=True,
+ testdir=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) + ["clean", getCmdLine(dictionary)])
+ commands.append(getMake(testdir) + [getArchSpec(architecture),
getCCSpec(compiler), getCmdLine(dictionary)])
runBuildCommands(commands, sender=sender)
@@ -140,12 +159,13 @@ def buildDwarf(
architecture=None,
compiler=None,
dictionary=None,
- clean=True):
+ clean=True,
+ testdir=None):
"""Build the binaries with dwarf debug info."""
commands = []
if clean:
- commands.append([getMake(), "clean", getCmdLine(dictionary)])
- commands.append([getMake(), "MAKE_DSYM=NO", getArchSpec(
+ commands.append(getMake(testdir) + ["clean", getCmdLine(dictionary)])
+ commands.append(getMake(testdir) + ["MAKE_DSYM=NO", getArchSpec(
architecture), getCCSpec(compiler), getCmdLine(dictionary)])
runBuildCommands(commands, sender=sender)
@@ -158,13 +178,17 @@ def buildDwo(
architecture=None,
compiler=None,
dictionary=None,
- clean=True):
+ clean=True,
+ testdir=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) + ["clean", getCmdLine(dictionary)])
+ commands.append(getMake(testdir) +
+ ["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 +200,14 @@ def buildGModules(
architecture=None,
compiler=None,
dictionary=None,
- clean=True):
+ clean=True,
+ testdir=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) + ["clean", getCmdLine(dictionary)])
+ commands.append(getMake(testdir) +
+ ["MAKE_DSYM=NO",
"MAKE_GMODULES=YES",
getArchSpec(architecture),
getCCSpec(compiler),
@@ -195,12 +220,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
diff --git a/lldb/packages/Python/lldbsuite/test/plugins/builder_darwin.py b/lldb/packages/Python/lldbsuite/test/plugins/builder_darwin.py
index 06a2a86d47a..d71bc3b1fee 100644
--- a/lldb/packages/Python/lldbsuite/test/plugins/builder_darwin.py
+++ b/lldb/packages/Python/lldbsuite/test/plugins/builder_darwin.py
@@ -5,20 +5,23 @@ import lldbsuite.test.lldbtest as lldbtest
from builder_base import *
-
def buildDsym(
sender=None,
architecture=None,
compiler=None,
dictionary=None,
- clean=True):
+ clean=True,
+ testdir=None):
"""Build the binaries with dsym debug info."""
commands = []
if clean:
- commands.append(["make", "clean", getCmdLine(dictionary)])
- commands.append(["make", "MAKE_DSYM=YES", getArchSpec(
- architecture), getCCSpec(compiler), getCmdLine(dictionary)])
+ commands.append(getMake(testdir) + ["clean", getCmdLine(dictionary)])
+ commands.append(getMake(testdir) +
+ ["MAKE_DSYM=YES",
+ getArchSpec(architecture),
+ getCCSpec(compiler),
+ "all", getCmdLine(dictionary)])
runBuildCommands(commands, sender=sender)
diff --git a/lldb/packages/Python/lldbsuite/test/plugins/builder_freebsd.py b/lldb/packages/Python/lldbsuite/test/plugins/builder_freebsd.py
index d9e654dc32f..e980336ff9d 100644
--- a/lldb/packages/Python/lldbsuite/test/plugins/builder_freebsd.py
+++ b/lldb/packages/Python/lldbsuite/test/plugins/builder_freebsd.py
@@ -6,5 +6,6 @@ def buildDsym(
architecture=None,
compiler=None,
dictionary=None,
- clean=True):
+ clean=True,
+ testdir=None):
return False
diff --git a/lldb/packages/Python/lldbsuite/test/plugins/builder_linux.py b/lldb/packages/Python/lldbsuite/test/plugins/builder_linux.py
index d9e654dc32f..e980336ff9d 100644
--- a/lldb/packages/Python/lldbsuite/test/plugins/builder_linux.py
+++ b/lldb/packages/Python/lldbsuite/test/plugins/builder_linux.py
@@ -6,5 +6,6 @@ def buildDsym(
architecture=None,
compiler=None,
dictionary=None,
- clean=True):
+ clean=True,
+ testdir=None):
return False
diff --git a/lldb/packages/Python/lldbsuite/test/plugins/builder_netbsd.py b/lldb/packages/Python/lldbsuite/test/plugins/builder_netbsd.py
index d9e654dc32f..e980336ff9d 100644
--- a/lldb/packages/Python/lldbsuite/test/plugins/builder_netbsd.py
+++ b/lldb/packages/Python/lldbsuite/test/plugins/builder_netbsd.py
@@ -6,5 +6,6 @@ def buildDsym(
architecture=None,
compiler=None,
dictionary=None,
- clean=True):
+ clean=True,
+ testdir=None):
return False
diff --git a/lldb/packages/Python/lldbsuite/test/plugins/builder_win32.py b/lldb/packages/Python/lldbsuite/test/plugins/builder_win32.py
index d9e654dc32f..e980336ff9d 100644
--- a/lldb/packages/Python/lldbsuite/test/plugins/builder_win32.py
+++ b/lldb/packages/Python/lldbsuite/test/plugins/builder_win32.py
@@ -6,5 +6,6 @@ def buildDsym(
architecture=None,
compiler=None,
dictionary=None,
- clean=True):
+ clean=True,
+ testdir=None):
return False
OpenPOWER on IntegriCloud