summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/modules-app-update
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2020-08-03 14:33:06 +0000
committerpatrick <patrick@openbsd.org>2020-08-03 14:33:06 +0000
commit061da546b983eb767bad15e67af1174fb0bcf31c (patch)
tree83c78b820819d70aa40c36d90447978b300078c5 /gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/modules-app-update
parentImport LLVM 10.0.0 release including clang, lld and lldb. (diff)
downloadwireguard-openbsd-061da546b983eb767bad15e67af1174fb0bcf31c.tar.xz
wireguard-openbsd-061da546b983eb767bad15e67af1174fb0bcf31c.zip
Import LLVM 10.0.0 release including clang, lld and lldb.
ok hackroom tested by plenty
Diffstat (limited to 'gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/modules-app-update')
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/modules-app-update/Makefile5
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/modules-app-update/TestClangModulesAppUpdate.py57
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/modules-app-update/foo.m7
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/modules-app-update/main.m17
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/modules-app-update/module.modulemap4
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/modules-app-update/umbrella.h1
6 files changed, 91 insertions, 0 deletions
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/modules-app-update/Makefile b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/modules-app-update/Makefile
new file mode 100644
index 00000000000..0d8068b3085
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/modules-app-update/Makefile
@@ -0,0 +1,5 @@
+CFLAGS_EXTRAS = -I$(BUILDDIR)
+USE_PRIVATE_MODULE_CACHE := YES
+OBJC_SOURCES := main.m foo.m
+
+include Makefile.rules
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/modules-app-update/TestClangModulesAppUpdate.py b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/modules-app-update/TestClangModulesAppUpdate.py
new file mode 100644
index 00000000000..4bd136b7285
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/modules-app-update/TestClangModulesAppUpdate.py
@@ -0,0 +1,57 @@
+
+import unittest2
+import os
+import shutil
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestClangModuleAppUpdate(TestBase):
+ mydir = TestBase.compute_mydir(__file__)
+
+ @skipUnlessDarwin
+ @skipIf(debug_info=no_match(["gmodules"]))
+ def test_rebuild_app_modules_untouched(self):
+ with open(self.getBuildArtifact("module.modulemap"), "w") as f:
+ f.write("""
+ module Foo { header "f.h" }
+ """)
+ with open(self.getBuildArtifact("f.h"), "w") as f:
+ f.write("""
+ @import Foundation;
+ @interface Foo : NSObject {
+ int i;
+ }
+ +(instancetype)init;
+ @end
+ """)
+
+ mod_cache = self.getBuildArtifact("private-module-cache")
+ import os
+ if os.path.isdir(mod_cache):
+ shutil.rmtree(mod_cache)
+ self.build()
+ self.assertTrue(os.path.isdir(mod_cache), "module cache exists")
+
+ target, process, _, bkpt = lldbutil.run_to_source_breakpoint(
+ self, "break here", lldb.SBFileSpec("main.m"))
+ bar = target.FindTypes('Bar').GetTypeAtIndex(0)
+ foo = bar.GetDirectBaseClassAtIndex(0).GetType()
+ self.assertEqual(foo.GetNumberOfFields(), 1)
+ self.assertEqual(foo.GetFieldAtIndex(0).GetName(), "i")
+
+ # Rebuild.
+ process.Kill()
+ os.remove(self.getBuildArtifact('main.o'))
+ os.remove(self.getBuildArtifact('a.out'))
+ self.build()
+
+ # Reattach.
+ target, process, _, _ = lldbutil.run_to_breakpoint_do_run(self, target, bkpt)
+ bar = target.FindTypes('Bar').GetTypeAtIndex(0)
+ foo = bar.GetDirectBaseClassAtIndex(0).GetType()
+ self.assertEqual(foo.GetNumberOfFields(), 1)
+ self.assertEqual(foo.GetFieldAtIndex(0).GetName(), "i")
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/modules-app-update/foo.m b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/modules-app-update/foo.m
new file mode 100644
index 00000000000..83a5abc04e2
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/modules-app-update/foo.m
@@ -0,0 +1,7 @@
+@import Foundation;
+@import Foo;
+@implementation Foo
++(instancetype)init {
+ return [super init];
+}
+@end
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/modules-app-update/main.m b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/modules-app-update/main.m
new file mode 100644
index 00000000000..37ec1f37b57
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/modules-app-update/main.m
@@ -0,0 +1,17 @@
+@import Umbrella;
+
+@interface Bar : Foo
++(instancetype)init;
+@end
+
+@implementation Bar
++(instancetype)init {
+ return [super init];
+}
+@end
+
+int main(int argc, char **argv) {
+ id bar = [Bar new];
+ [bar i]; // break here
+ return 0;
+}
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/modules-app-update/module.modulemap b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/modules-app-update/module.modulemap
new file mode 100644
index 00000000000..c142410cd07
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/modules-app-update/module.modulemap
@@ -0,0 +1,4 @@
+module Umbrella {
+ header "umbrella.h"
+ export *
+}
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/modules-app-update/umbrella.h b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/modules-app-update/umbrella.h
new file mode 100644
index 00000000000..375d3ea2a04
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/objc/modules-app-update/umbrella.h
@@ -0,0 +1 @@
+@import Foo;