summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/lldbtest.py
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/lldbtest.py')
-rw-r--r--lldb/packages/Python/lldbsuite/test/lldbtest.py33
1 files changed, 29 insertions, 4 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index 7b4dfa4f078..602f68344fa 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1589,10 +1589,10 @@ class Base(unittest2.TestCase):
def findBuiltClang(self):
"""Tries to find and use Clang from the build directory as the compiler (instead of the system compiler)."""
paths_to_try = [
- "llvm-build/Release+Asserts/x86_64/Release+Asserts/bin/clang",
- "llvm-build/Debug+Asserts/x86_64/Debug+Asserts/bin/clang",
- "llvm-build/Release/x86_64/Release/bin/clang",
- "llvm-build/Debug/x86_64/Debug/bin/clang",
+ "llvm-build/Release+Asserts/x86_64/bin/clang",
+ "llvm-build/Debug+Asserts/x86_64/bin/clang",
+ "llvm-build/Release/x86_64/bin/clang",
+ "llvm-build/Debug/x86_64/bin/clang",
]
lldb_root_path = os.path.join(
os.path.dirname(__file__), "..", "..", "..", "..")
@@ -1608,6 +1608,31 @@ class Base(unittest2.TestCase):
return os.environ["CC"]
+ def findYaml2obj(self):
+ """
+ Get the path to the yaml2obj executable, which can be used to create
+ test object files from easy to write yaml instructions.
+
+ Throws an Exception if the executable cannot be found.
+ """
+ # Tries to find yaml2obj at the same folder as clang
+ clang_dir = os.path.dirname(self.findBuiltClang())
+ path = os.path.join(clang_dir, "yaml2obj")
+ if os.path.exists(path):
+ return path
+ raise Exception("yaml2obj executable not found")
+
+
+ def yaml2obj(self, yaml_path, obj_path):
+ """
+ Create an object file at the given path from a yaml file.
+
+ Throws subprocess.CalledProcessError if the object could not be created.
+ """
+ yaml2obj = self.findYaml2obj()
+ command = [yaml2obj, "-o=%s" % obj_path, yaml_path]
+ system([command])
+
def getBuildFlags(
self,
use_cpp11=True,
OpenPOWER on IntegriCloud