diff options
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/plugins/builder_base.py')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/plugins/builder_base.py | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py b/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py index 0cff14c2269..6b8373b453c 100644 --- a/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py +++ b/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py @@ -12,10 +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.""" @@ -93,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 = [] @@ -100,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 @@ -112,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 @@ -123,7 +139,7 @@ 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 @@ -135,6 +151,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 |