From f3fbd1c0586ff6ec7895991e6c28f61a503c36a8 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 23 Jul 2016 20:50:09 +0000 Subject: Vendor import of lldb release_39 branch r276489: https://llvm.org/svn/llvm-project/lldb/branches/release_39@276489 --- .../Python/lldbsuite/test/plugins/builder_base.py | 42 ++++++++++++++++++---- .../lldbsuite/test/plugins/builder_darwin.py | 4 +-- .../Python/lldbsuite/test/plugins/builder_linux.py | 4 +++ .../lldbsuite/test/plugins/builder_linux2.py | 4 --- 4 files changed, 41 insertions(+), 13 deletions(-) create mode 100644 packages/Python/lldbsuite/test/plugins/builder_linux.py delete mode 100644 packages/Python/lldbsuite/test/plugins/builder_linux2.py (limited to 'packages/Python/lldbsuite/test/plugins') 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 diff --git a/packages/Python/lldbsuite/test/plugins/builder_darwin.py b/packages/Python/lldbsuite/test/plugins/builder_darwin.py index dd07206e323b..8a907ccec2da 100644 --- a/packages/Python/lldbsuite/test/plugins/builder_darwin.py +++ b/packages/Python/lldbsuite/test/plugins/builder_darwin.py @@ -5,8 +5,6 @@ import lldbsuite.test.lldbtest as lldbtest from builder_base import * -#print("Hello, darwin plugin!") - def buildDsym(sender=None, architecture=None, compiler=None, dictionary=None, clean=True): """Build the binaries with dsym debug info.""" commands = [] @@ -15,7 +13,7 @@ def buildDsym(sender=None, architecture=None, compiler=None, dictionary=None, cl commands.append(["make", "clean", getCmdLine(dictionary)]) commands.append(["make", "MAKE_DSYM=YES", getArchSpec(architecture), getCCSpec(compiler), getCmdLine(dictionary)]) - lldbtest.system(commands, sender=sender) + runBuildCommands(commands, sender=sender) # True signifies that we can handle building dsym. return True diff --git a/packages/Python/lldbsuite/test/plugins/builder_linux.py b/packages/Python/lldbsuite/test/plugins/builder_linux.py new file mode 100644 index 000000000000..e56be429823e --- /dev/null +++ b/packages/Python/lldbsuite/test/plugins/builder_linux.py @@ -0,0 +1,4 @@ +from builder_base import * + +def buildDsym(sender=None, architecture=None, compiler=None, dictionary=None, clean=True): + return False diff --git a/packages/Python/lldbsuite/test/plugins/builder_linux2.py b/packages/Python/lldbsuite/test/plugins/builder_linux2.py deleted file mode 100644 index e56be429823e..000000000000 --- a/packages/Python/lldbsuite/test/plugins/builder_linux2.py +++ /dev/null @@ -1,4 +0,0 @@ -from builder_base import * - -def buildDsym(sender=None, architecture=None, compiler=None, dictionary=None, clean=True): - return False -- cgit v1.2.3