summaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'packages/Python/lldbsuite/test/plugins')
-rw-r--r--packages/Python/lldbsuite/test/plugins/builder_base.py42
-rw-r--r--packages/Python/lldbsuite/test/plugins/builder_darwin.py4
-rw-r--r--packages/Python/lldbsuite/test/plugins/builder_linux.py (renamed from packages/Python/lldbsuite/test/plugins/builder_linux2.py)0
3 files changed, 37 insertions, 9 deletions
diff --git a/packages/Python/lldbsuite/test/plugins/builder_base.py b/packages/Python/lldbsuite/test/plugins/builder_base.py
index c4e3dff5301c8..a467a458d5de0 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 dd07206e323bb..8a907ccec2da4 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_linux2.py b/packages/Python/lldbsuite/test/plugins/builder_linux.py
index e56be429823ea..e56be429823ea 100644
--- a/packages/Python/lldbsuite/test/plugins/builder_linux2.py
+++ b/packages/Python/lldbsuite/test/plugins/builder_linux.py