diff options
author | Chris Bieneman <beanz@apple.com> | 2016-10-31 04:48:19 +0000 |
---|---|---|
committer | Chris Bieneman <beanz@apple.com> | 2016-10-31 04:48:19 +0000 |
commit | f8ac2da11454d2c2edb9e6254d10e99aa6dc110d (patch) | |
tree | e662669d8418efc677c855bfd4e2b82a20dfbda8 /lldb/packages/Python/lldbsuite/test/lldbtest.py | |
parent | bd6d69987c36d947746d061421b3eb99cf86a6bb (diff) | |
download | bcm5719-llvm-f8ac2da11454d2c2edb9e6254d10e99aa6dc110d.tar.gz bcm5719-llvm-f8ac2da11454d2c2edb9e6254d10e99aa6dc110d.zip |
[Test Suite] Pull generateSource into lldbtest
Summary:
Convert tests using LLDB headers to use generateSource to put the right include paths in place regardless of whether or not you're building a framework.
This also abstracted generateSource out of TestPublicAPIHeaders.py into lldbtest.py.
Reviewers: tfiala, zturner
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D25887
llvm-svn: 285542
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/lldbtest.py')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/lldbtest.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py index 2047bb75a77..924bac2be8a 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbtest.py +++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -1848,6 +1848,33 @@ class TestBase(Base): folder = os.path.dirname(folder) continue + def generateSource(self, source): + template = source + '.template' + temp = os.path.join(os.getcwd(), template) + with open(temp, 'r') as f: + content = f.read() + + public_api_dir = os.path.join( + os.environ["LLDB_SRC"], "include", "lldb", "API") + + # Look under the include/lldb/API directory and add #include statements + # for all the SB API headers. + public_headers = os.listdir(public_api_dir) + # For different platforms, the include statement can vary. + if self.hasDarwinFramework(): + include_stmt = "'#include <%s>' % os.path.join('LLDB', header)" + else: + include_stmt = "'#include <%s>' % os.path.join(public_api_dir, header)" + list = [eval(include_stmt) for header in public_headers if ( + header.startswith("SB") and header.endswith(".h"))] + includes = '\n'.join(list) + new_content = content.replace('%include_SB_APIs%', includes) + src = os.path.join(os.getcwd(), source) + with open(src, 'w') as f: + f.write(new_content) + + self.addTearDownHook(lambda: os.remove(src)) + def setUp(self): #import traceback # traceback.print_stack() |