summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/objc/modules-cache/Makefile4
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/objc/modules-cache/TestClangModulesCache.py40
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/objc/modules-cache/f.h1
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/objc/modules-cache/main.m5
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/objc/modules-cache/module.modulemap3
-rw-r--r--lldb/packages/Python/lldbsuite/test/lldbtest.py4
6 files changed, 55 insertions, 2 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/modules-cache/Makefile b/lldb/packages/Python/lldbsuite/test/lang/objc/modules-cache/Makefile
new file mode 100644
index 00000000000..de6a8e20d3d
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/lang/objc/modules-cache/Makefile
@@ -0,0 +1,4 @@
+LEVEL = ../../../make
+OBJC_SOURCES := main.m
+include $(LEVEL)/Makefile.rules
+CFLAGS += $(MANDATORY_MODULE_BUILD_CFLAGS) -I$(SRCDIR)
diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/modules-cache/TestClangModulesCache.py b/lldb/packages/Python/lldbsuite/test/lang/objc/modules-cache/TestClangModulesCache.py
new file mode 100644
index 00000000000..180dbae6e25
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/lang/objc/modules-cache/TestClangModulesCache.py
@@ -0,0 +1,40 @@
+"""Test that the clang modules cache directory can be controlled."""
+
+from __future__ import print_function
+
+
+import unittest2
+import os
+import time
+import platform
+import shutil
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class ObjCModulesTestCase(TestBase):
+ NO_DEBUG_INFO_TESTCASE = True
+ mydir = TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ TestBase.setUp(self)
+
+ def test_expr(self):
+ self.build()
+ self.main_source_file = lldb.SBFileSpec("main.m")
+ self.runCmd("settings set target.auto-import-clang-modules true")
+ mod_cache = self.getBuildArtifact("my-clang-modules-cache")
+ if os.path.isdir(mod_cache):
+ shutil.rmtree(mod_cache)
+ self.assertFalse(os.path.isdir(mod_cache),
+ "module cache should not exist")
+ self.runCmd('settings set clang.modules-cache-path "%s"' % mod_cache)
+ self.runCmd('settings set target.clang-module-search-paths "%s"'
+ % self.getSourceDir())
+ (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
+ self, "Set breakpoint here", self.main_source_file)
+ self.runCmd("expr @import Darwin")
+ self.assertTrue(os.path.isdir(mod_cache), "module cache exists")
diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/modules-cache/f.h b/lldb/packages/Python/lldbsuite/test/lang/objc/modules-cache/f.h
new file mode 100644
index 00000000000..56757a701bf
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/lang/objc/modules-cache/f.h
@@ -0,0 +1 @@
+void f() {}
diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/modules-cache/main.m b/lldb/packages/Python/lldbsuite/test/lang/objc/modules-cache/main.m
new file mode 100644
index 00000000000..a502a85b638
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/lang/objc/modules-cache/main.m
@@ -0,0 +1,5 @@
+@import Foo;
+int main() {
+ f(); // Set breakpoint here.
+ return 0;
+}
diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/modules-cache/module.modulemap b/lldb/packages/Python/lldbsuite/test/lang/objc/modules-cache/module.modulemap
new file mode 100644
index 00000000000..f54534a1c07
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/lang/objc/modules-cache/module.modulemap
@@ -0,0 +1,3 @@
+module Foo {
+ header "f.h"
+}
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index 613b42f5c83..1bae7aaa476 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1921,8 +1921,8 @@ class TestBase(Base):
if self.child:
assert(self.getDebugInfo() == 'default')
mod_cache = os.path.join(self.getBuildDir(), "module-cache")
- self.runCmd("settings set target.clang-modules-cache-path "
- + mod_cache)
+ self.runCmd('settings set clang.modules-cache-path "%s"'
+ % mod_cache)
if "LLDB_MAX_LAUNCH_COUNT" in os.environ:
OpenPOWER on IntegriCloud