[Lldb-commits] [lldb] r324655 - Rewrite testcase to not depend on Foundation implementation details.

Adrian Prantl via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 8 13:52:28 PST 2018


Author: adrian
Date: Thu Feb  8 13:52:28 2018
New Revision: 324655

URL: http://llvm.org/viewvc/llvm-project?rev=324655&view=rev
Log:
Rewrite testcase to not depend on Foundation implementation details.

TODO: Add a separate testcase testing *only* Foundation implementation details!

<rdar://problem/37252738>

Added:
    lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/minmax.h
Modified:
    lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/Makefile
    lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/TestIncompleteModules.py
    lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/main.m
    lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/module.map
    lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/myModule.h
    lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/myModule.m

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/Makefile?rev=324655&r1=324654&r2=324655&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/Makefile Thu Feb  8 13:52:28 2018
@@ -4,5 +4,5 @@ OBJC_SOURCES := main.m myModule.m
 
 include $(LEVEL)/Makefile.rules
 
-CFLAGS += $(MANDATORY_MODULE_BUILD_CFLAGS) -I$(PWD)
+CFLAGS += $(MANDATORY_MODULE_BUILD_CFLAGS)
 LDFLAGS += -framework Foundation

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/TestIncompleteModules.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/TestIncompleteModules.py?rev=324655&r1=324654&r2=324655&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/TestIncompleteModules.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/TestIncompleteModules.py Thu Feb  8 13:52:28 2018
@@ -22,15 +22,12 @@ class IncompleteModulesTestCase(TestBase
         # Find the line number to break inside main().
         self.line = line_number('main.m', '// Set breakpoint 0 here.')
 
-    @skipIfDarwin
     @skipUnlessDarwin
-    @skipIf(macos_version=["<", "10.12"], debug_info=no_match(["gmodules"]))
+    @skipIf(debug_info=no_match(["gmodules"]))
     def test_expr(self):
         self.build()
         exe = self.getBuildArtifact("a.out")
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
-        # Break inside the foo function which takes a bar_ptr argument.
         lldbutil.run_break_set_by_file_and_line(
             self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
 
@@ -54,14 +51,14 @@ class IncompleteModulesTestCase(TestBase
                     substrs=["int", "3"])
 
         self.expect(
-            "expr [myObject privateMethod]",
+            "expr private_func()",
             VARIABLES_DISPLAYED_CORRECTLY,
             substrs=[
                 "int",
                 "5"])
 
-        self.expect("expr MIN(2,3)", "#defined macro was found",
+        self.expect("expr MY_MIN(2,3)", "#defined macro was found",
                     substrs=["int", "2"])
 
-        self.expect("expr MAX(2,3)", "#undefd macro was correcltly not found",
+        self.expect("expr MY_MAX(2,3)", "#undefd macro was correctly not found",
                     error=True)

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/main.m?rev=324655&r1=324654&r2=324655&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/main.m (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/main.m Thu Feb  8 13:52:28 2018
@@ -1,11 +1,7 @@
- at import Foundation;
 @import myModule;
+ at import minmax;
 
-int main()
-{
-    @autoreleasepool
-    {
-        MyClass *myObject = [MyClass alloc];
-        [myObject publicMethod]; // Set breakpoint 0 here.
-    }
+int main(int argc, char **argv) {
+  public_func(); // Set breakpoint 0 here.
+  return 0;
 }

Added: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/minmax.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/minmax.h?rev=324655&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/minmax.h (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/minmax.h Thu Feb  8 13:52:28 2018
@@ -0,0 +1,2 @@
+#define MY_MIN(A, B) (((A) < (B)) ? (A) : (B))
+#define MY_MAX(A, B) (((A) < (B)) ? (B) : (A))

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/module.map
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/module.map?rev=324655&r1=324654&r2=324655&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/module.map (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/module.map Thu Feb  8 13:52:28 2018
@@ -2,3 +2,8 @@ module myModule {
   header "myModule.h"
   export *
 }
+
+module minmax {
+  header "minmax.h"
+  export *
+}

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/myModule.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/myModule.h?rev=324655&r1=324654&r2=324655&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/myModule.h (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/myModule.h Thu Feb  8 13:52:28 2018
@@ -1,8 +1,5 @@
- at import Foundation;
+ at import minmax;
 
-#undef MAX
+#undef MY_MAX
 
- at interface MyClass : NSObject {
-};
--(void)publicMethod;
- at end
+extern void public_func();

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/myModule.m
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/myModule.m?rev=324655&r1=324654&r2=324655&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/myModule.m (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/myModule.m Thu Feb  8 13:52:28 2018
@@ -1,14 +1,8 @@
 #include "myModule.h"
-#include "stdio.h"
 
- at implementation MyClass {
-};
--(void)publicMethod {
-  printf("Hello public!\n");
-}
--(int)privateMethod {
-  printf("Hello private!\n");
+void public_func() {}
+
+int private_func() {
   return 5;
 }
- at end
 




More information about the lldb-commits mailing list