summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2016-09-01 18:09:01 +0000
committerEnrico Granata <egranata@apple.com>2016-09-01 18:09:01 +0000
commitdf43d25fd366d96cd7af1ead8938ed0d2394e2fb (patch)
treeb9a9bcb87e3831384559c79976341616170b1a0b /lldb/packages/Python/lldbsuite/test
parent5c7c2307a83665c4861e173a8f4ec4f514c0bbd6 (diff)
downloadbcm5719-llvm-df43d25fd366d96cd7af1ead8938ed0d2394e2fb.tar.gz
bcm5719-llvm-df43d25fd366d96cd7af1ead8938ed0d2394e2fb.zip
Change the formula for tagged NSIndexPath data formatting
Fixes rdar://25192935 llvm-svn: 280389
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/Makefile9
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/TestDataFormatterNSIndexPath.py70
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/main.m31
3 files changed, 110 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/Makefile
new file mode 100644
index 00000000000..0d94c2247f1
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+OBJC_SOURCES := main.m
+
+CFLAGS_EXTRAS += -w
+
+include $(LEVEL)/Makefile.rules
+
+LDFLAGS += -framework Foundation
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/TestDataFormatterNSIndexPath.py b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/TestDataFormatterNSIndexPath.py
new file mode 100644
index 00000000000..89145553d35
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/TestDataFormatterNSIndexPath.py
@@ -0,0 +1,70 @@
+# encoding: utf-8
+"""
+Test lldb data formatter subsystem.
+"""
+
+from __future__ import print_function
+
+
+
+import os, time
+import datetime
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class NSIndexPathDataFormatterTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def appkit_tester_impl(self,commands):
+ self.build()
+ self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+
+ lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs = ['stopped',
+ 'stop reason = breakpoint'])
+
+ # This is the function to remove the custom formats in order to have a
+ # clean slate for the next test case.
+ def cleanup():
+ self.runCmd('type format clear', check=False)
+ self.runCmd('type summary clear', check=False)
+ self.runCmd('type synth clear', check=False)
+
+
+ # Execute the cleanup function during test case tear down.
+ self.addTearDownHook(cleanup)
+ commands()
+
+ @skipUnlessDarwin
+ def test_nsindexpath_with_run_command(self):
+ """Test formatters for NSIndexPath."""
+ self.appkit_tester_impl(self.nsindexpath_data_formatter_commands)
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+ # Find the line number to break at.
+ self.line = line_number('main.m', '// break here')
+
+ def nsindexpath_data_formatter_commands(self):
+ # check 'frame variable'
+ self.expect('frame variable --ptr-depth=1 -d run -- indexPath1', substrs = ['[0] = 1'])
+ self.expect('frame variable --ptr-depth=1 -d run -- indexPath2', substrs = ['[0] = 1', '[1] = 2'])
+ self.expect('frame variable --ptr-depth=1 -d run -- indexPath3', substrs = ['[0] = 1', '[1] = 2', '[2] = 3'])
+ self.expect('frame variable --ptr-depth=1 -d run -- indexPath4', substrs = ['[0] = 1', '[1] = 2', '[2] = 3', '[3] = 4'])
+ self.expect('frame variable --ptr-depth=1 -d run -- indexPath5', substrs = ['[0] = 1', '[1] = 2', '[2] = 3', '[3] = 4', '[4] = 5'])
+
+ # and 'expression'
+ self.expect('expression --ptr-depth=1 -d run -- indexPath1', substrs = ['[0] = 1'])
+ self.expect('expression --ptr-depth=1 -d run -- indexPath2', substrs = ['[0] = 1', '[1] = 2'])
+ self.expect('expression --ptr-depth=1 -d run -- indexPath3', substrs = ['[0] = 1', '[1] = 2', '[2] = 3'])
+ self.expect('expression --ptr-depth=1 -d run -- indexPath4', substrs = ['[0] = 1', '[1] = 2', '[2] = 3', '[3] = 4'])
+ self.expect('expression --ptr-depth=1 -d run -- indexPath5', substrs = ['[0] = 1', '[1] = 2', '[2] = 3', '[3] = 4', '[4] = 5'])
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/main.m b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/main.m
new file mode 100644
index 00000000000..baaff180e34
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/main.m
@@ -0,0 +1,31 @@
+//===-- main.m ------------------------------------------------*- ObjC -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#import <Foundation/Foundation.h>
+
+int main(int argc, const char **argv)
+{
+ @autoreleasepool
+ {
+ const NSUInteger values[] = { 1, 2, 3, 4, 5 };
+
+ NSIndexPath* indexPath1 = [NSIndexPath indexPathWithIndexes:values length:1];
+ NSIndexPath* indexPath2 = [NSIndexPath indexPathWithIndexes:values length:2];
+ NSIndexPath* indexPath3 = [NSIndexPath indexPathWithIndexes:values length:3];
+ NSIndexPath* indexPath4 = [NSIndexPath indexPathWithIndexes:values length:4];
+ NSIndexPath* indexPath5 = [NSIndexPath indexPathWithIndexes:values length:5];
+
+ NSLog(@"%@", indexPath1); // break here
+ NSLog(@"%@", indexPath2);
+ NSLog(@"%@", indexPath3);
+ NSLog(@"%@", indexPath4);
+ NSLog(@"%@", indexPath5);
+ }
+ return 0;
+}
OpenPOWER on IntegriCloud