aboutsummaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/plugins/builder_base.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/Python/lldbsuite/test/plugins/builder_base.py')
-rw-r--r--packages/Python/lldbsuite/test/plugins/builder_base.py42
1 files changed, 36 insertions, 6 deletions
diff --git a/packages/Python/lldbsuite/test/plugins/builder_base.py b/packages/Python/lldbsuite/test/plugins/builder_base.py
index c4e3dff5301c..a467a458d5de 100644
--- a/packages/Python/lldbsuite/test/plugins/builder_base.py
+++ b/packages/Python/lldbsuite/test/plugins/builder_base.py
@@ -12,9 +12,16 @@ Same idea holds for LLDB_ARCH environment variable, which maps to the ARCH make
variable.
"""
-import os, sys
+# System imports
+import os
import platform
+import subprocess
+import sys
+
+# Our imports
import lldbsuite.test.lldbtest as lldbtest
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test_event import build_exception
def getArchitecture():
"""Returns the architecture in effect the test suite is running with."""
@@ -22,7 +29,9 @@ def getArchitecture():
def getCompiler():
"""Returns the compiler in effect the test suite is running with."""
- return os.environ["CC"] if "CC" in os.environ else "clang"
+ compiler = os.environ.get("CC", "clang")
+ compiler = lldbutil.which(compiler)
+ return os.path.realpath(compiler)
def getArchFlag():
"""Returns the flag required to specify the arch"""
@@ -90,6 +99,16 @@ def getCmdLine(d):
return cmdline
+def runBuildCommands(commands, sender):
+ try:
+ lldbtest.system(commands, sender=sender)
+ except subprocess.CalledProcessError as called_process_error:
+ # Convert to a build-specific error.
+ # We don't do that in lldbtest.system() since that
+ # is more general purpose.
+ raise build_exception.BuildError(called_process_error)
+
+
def buildDefault(sender=None, architecture=None, compiler=None, dictionary=None, clean=True):
"""Build the binaries the default way."""
commands = []
@@ -97,7 +116,7 @@ def buildDefault(sender=None, architecture=None, compiler=None, dictionary=None,
commands.append([getMake(), "clean", getCmdLine(dictionary)])
commands.append([getMake(), getArchSpec(architecture), getCCSpec(compiler), getCmdLine(dictionary)])
- lldbtest.system(commands, sender=sender)
+ runBuildCommands(commands, sender=sender)
# True signifies that we can handle building default.
return True
@@ -109,7 +128,7 @@ def buildDwarf(sender=None, architecture=None, compiler=None, dictionary=None, c
commands.append([getMake(), "clean", getCmdLine(dictionary)])
commands.append([getMake(), "MAKE_DSYM=NO", getArchSpec(architecture), getCCSpec(compiler), getCmdLine(dictionary)])
- lldbtest.system(commands, sender=sender)
+ runBuildCommands(commands, sender=sender)
# True signifies that we can handle building dwarf.
return True
@@ -120,10 +139,21 @@ def buildDwo(sender=None, architecture=None, compiler=None, dictionary=None, cle
commands.append([getMake(), "clean", getCmdLine(dictionary)])
commands.append([getMake(), "MAKE_DSYM=NO", "MAKE_DWO=YES", getArchSpec(architecture), getCCSpec(compiler), getCmdLine(dictionary)])
- lldbtest.system(commands, sender=sender)
+ runBuildCommands(commands, sender=sender)
# True signifies that we can handle building dwo.
return True
+def buildGModules(sender=None, architecture=None, compiler=None, dictionary=None, clean=True):
+ """Build the binaries with dwarf debug info."""
+ commands = []
+ if clean:
+ commands.append([getMake(), "clean", getCmdLine(dictionary)])
+ commands.append([getMake(), "MAKE_DSYM=NO", "MAKE_GMODULES=YES", getArchSpec(architecture), getCCSpec(compiler), getCmdLine(dictionary)])
+
+ lldbtest.system(commands, sender=sender)
+ # True signifies that we can handle building with gmodules.
+ return True
+
def cleanup(sender=None, dictionary=None):
"""Perform a platform-specific cleanup after the test."""
#import traceback
@@ -132,6 +162,6 @@ def cleanup(sender=None, dictionary=None):
if os.path.isfile("Makefile"):
commands.append([getMake(), "clean", getCmdLine(dictionary)])
- lldbtest.system(commands, sender=sender)
+ runBuildCommands(commands, sender=sender)
# True signifies that we can handle cleanup.
return True