diff options
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
6 files changed, 53 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/Bar.h b/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/Bar.h new file mode 100644 index 00000000000..3d9a88c024d --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/Bar.h @@ -0,0 +1 @@ +struct Bar { int success; }; diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/Foo.h b/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/Foo.h new file mode 100644 index 00000000000..1fe02e89786 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/Foo.h @@ -0,0 +1 @@ +struct Foo {}; diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/Makefile b/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/Makefile new file mode 100644 index 00000000000..796b4dc5ef3 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/Makefile @@ -0,0 +1,6 @@ +LEVEL = ../../../make +CXX_SOURCES := main.cpp + +CFLAGS += $(MANDATORY_MODULE_BUILD_CFLAGS) + +include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/TestCXXModulesImport.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/TestCXXModulesImport.py new file mode 100644 index 00000000000..9601db2586a --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/TestCXXModulesImport.py @@ -0,0 +1,31 @@ +"""Test that importing modules in C++ works as expected.""" + +from __future__ import print_function + + +from distutils.version import StrictVersion +import unittest2 +import os +import time +import lldb +import platform + +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class CXXModulesImportTestCase(TestBase): + + mydir = TestBase.compute_mydir(__file__) + + @skipUnlessDarwin + @skipIf(macos_version=["<", "10.12"]) + def test_expr(self): + self.build() + exe = self.getBuildArtifact("a.out") + target, process, thread, bkpt = lldbutil.run_to_source_breakpoint( + self, 'break here', lldb.SBFileSpec('main.cpp')) + + self.expect("expr -- @import Bar") + self.expect("expr -- Bar()", substrs = ["success"]) diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/main.cpp b/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/main.cpp new file mode 100644 index 00000000000..a6acf9a1a69 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/main.cpp @@ -0,0 +1,7 @@ +#include "Foo.h" + +int main(int argc, char **argv) { + Foo foo; + // break here. + return 0; +} diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/module.modulemap b/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/module.modulemap new file mode 100644 index 00000000000..4221d0f9134 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/modules-import/module.modulemap @@ -0,0 +1,7 @@ +module Foo { + header "Foo.h" +} + +module Bar { + header "Bar.h" +} |