[Lldb-commits] [lldb] r358088 - [testsuite] Split Obj-C foundation test
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Wed Apr 10 07:30:01 PDT 2019
Author: jdevlieghere
Date: Wed Apr 10 07:30:00 2019
New Revision: 358088
URL: http://llvm.org/viewvc/llvm-project?rev=358088&view=rev
Log:
[testsuite] Split Obj-C foundation test
TestObjCMethods2.py was the third-longest running test on Darwin. By
splitting it up, lit can exploit parallelism to reduce the total wall
clock time.
Added:
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethodsNSArray.py
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethodsNSError.py
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethodsString.py
Modified:
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods2.py
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods2.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods2.py?rev=358088&r1=358087&r2=358088&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods2.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods2.py Wed Apr 10 07:30:00 2019
@@ -5,8 +5,6 @@ Test more expression command sequences w
from __future__ import print_function
-import os
-import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
@@ -18,40 +16,36 @@ class FoundationTestCase2(TestBase):
mydir = TestBase.compute_mydir(__file__)
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Find the line numbers to break at.
- self.lines = []
- self.lines.append(
+ def test_expr_commands(self):
+ """More expression commands for objective-c."""
+ self.build()
+ exe = self.getBuildArtifact("a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+ lines = []
+ lines.append(
line_number(
'main.m',
'// Break here for selector: tests'))
- self.lines.append(
+ lines.append(
line_number(
'main.m',
'// Break here for NSArray tests'))
- self.lines.append(
+ lines.append(
line_number(
'main.m',
'// Break here for NSString tests'))
- self.lines.append(
+ lines.append(
line_number(
'main.m',
'// Break here for description test'))
- self.lines.append(
+ lines.append(
line_number(
'main.m',
'// Set break point at this line'))
- def test_more_expr_commands(self):
- """More expression commands for objective-c."""
- self.build()
- exe = self.getBuildArtifact("a.out")
- self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
# Create a bunch of breakpoints.
- for line in self.lines:
+ for line in lines:
lldbutil.run_break_set_by_file_and_line(
self, "main.m", line, num_expected_locations=1, loc_exact=True)
@@ -80,126 +74,3 @@ class FoundationTestCase2(TestBase):
"description"])
self.runCmd("process continue")
-
- def test_NSArray_expr_commands(self):
- """Test expression commands for NSArray."""
- self.build()
- exe = self.getBuildArtifact("a.out")
- self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
- # Break inside Test_NSArray:
- line = self.lines[1]
- lldbutil.run_break_set_by_file_and_line(
- self, "main.m", line, num_expected_locations=1, loc_exact=True)
-
- self.runCmd("run", RUN_SUCCEEDED)
-
- # Test_NSArray:
- self.runCmd("thread backtrace")
- self.expect("expression (int)[nil_mutable_array count]",
- patterns=["\(int\) \$.* = 0"])
- self.expect("expression (int)[array1 count]",
- patterns=["\(int\) \$.* = 3"])
- self.expect("expression (int)[array2 count]",
- patterns=["\(int\) \$.* = 3"])
- self.expect("expression (int)array1.count",
- patterns=["\(int\) \$.* = 3"])
- self.expect("expression (int)array2.count",
- patterns=["\(int\) \$.* = 3"])
- self.runCmd("process continue")
-
- def test_NSString_expr_commands(self):
- """Test expression commands for NSString."""
- self.build()
- exe = self.getBuildArtifact("a.out")
- self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
- # Break inside Test_NSString:
- line = self.lines[2]
- lldbutil.run_break_set_by_file_and_line(
- self, "main.m", line, num_expected_locations=1, loc_exact=True)
-
- self.runCmd("run", RUN_SUCCEEDED)
-
- # Test_NSString:
- self.runCmd("thread backtrace")
- self.expect("expression (int)[str length]",
- patterns=["\(int\) \$.* ="])
- self.expect("expression (int)[str_id length]",
- patterns=["\(int\) \$.* ="])
- self.expect("expression (id)[str description]",
- patterns=["\(id\) \$.* = 0x"])
- self.expect("expression (id)[str_id description]",
- patterns=["\(id\) \$.* = 0x"])
- self.expect("expression str.length")
- self.expect('expression str = @"new"')
- self.runCmd("image lookup -t NSString")
- self.expect('expression str = (id)[NSString stringWithCString: "new"]')
- self.runCmd("process continue")
-
- @expectedFailureAll(archs=["i[3-6]86"], bugnumber="<rdar://problem/28814052>")
- def test_MyString_dump_with_runtime(self):
- """Test dump of a known Objective-C object by dereferencing it."""
- self.build()
- exe = self.getBuildArtifact("a.out")
- self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
- line = self.lines[4]
-
- lldbutil.run_break_set_by_file_and_line(
- self, "main.m", line, num_expected_locations=1, loc_exact=True)
-
- self.runCmd("run", RUN_SUCCEEDED)
-
- self.expect(
- "expression --show-types -- *my",
- patterns=[
- "\(MyString\) \$.* = ",
- "\(MyBase\)"])
- self.runCmd("process continue")
-
- @expectedFailureAll(archs=["i[3-6]86"], bugnumber="<rdar://problem/28814052>")
- def test_runtime_types(self):
- """Test commands that require runtime types"""
- self.build()
- exe = self.getBuildArtifact("a.out")
- self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
- # Break inside Test_NSString:
- line = self.lines[2]
- lldbutil.run_break_set_by_source_regexp(
- self, "NSString tests")
-
- self.runCmd("run", RUN_SUCCEEDED)
-
- # Test_NSString:
- self.runCmd("thread backtrace")
- self.expect("expression [str length]",
- patterns=["\(NSUInteger\) \$.* ="])
- self.expect("expression str.length")
- self.expect('expression str = [NSString stringWithCString: "new"]')
- self.expect(
- 'po [NSError errorWithDomain:@"Hello" code:35 userInfo:@{@"NSDescription" : @"be completed."}]',
- substrs=[
- "Error Domain=Hello",
- "Code=35",
- "be completed."])
- self.runCmd("process continue")
-
- @expectedFailureAll(archs=["i[3-6]86"], bugnumber="<rdar://problem/28814052>")
- def test_NSError_p(self):
- """Test that p of the result of an unknown method does require a cast."""
- self.build()
- exe = self.getBuildArtifact("a.out")
- self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
- line = self.lines[4]
-
- lldbutil.run_break_set_by_file_and_line(
- self, "main.m", line, num_expected_locations=1, loc_exact=True)
-
- self.runCmd("run", RUN_SUCCEEDED)
-
- self.expect("p [NSError thisMethodIsntImplemented:0]", error=True, patterns=[
- "no known method", "cast the message send to the method's return type"])
- self.runCmd("process continue")
Added: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethodsNSArray.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethodsNSArray.py?rev=358088&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethodsNSArray.py (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethodsNSArray.py Wed Apr 10 07:30:00 2019
@@ -0,0 +1,37 @@
+"""
+Test more expression command sequences with objective-c.
+"""
+
+from __future__ import print_function
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+ at skipUnlessDarwin
+class FoundationTestCaseNSArray(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def test_NSArray_expr_commands(self):
+ """Test expression commands for NSArray."""
+ self.build()
+ self.target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
+ self, '// Break here for NSArray tests',
+ lldb.SBFileSpec('main.m', False))
+
+ self.runCmd("thread backtrace")
+ self.expect("expression (int)[nil_mutable_array count]",
+ patterns=["\(int\) \$.* = 0"])
+ self.expect("expression (int)[array1 count]",
+ patterns=["\(int\) \$.* = 3"])
+ self.expect("expression (int)[array2 count]",
+ patterns=["\(int\) \$.* = 3"])
+ self.expect("expression (int)array1.count",
+ patterns=["\(int\) \$.* = 3"])
+ self.expect("expression (int)array2.count",
+ patterns=["\(int\) \$.* = 3"])
+ self.runCmd("process continue")
Added: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethodsNSError.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethodsNSError.py?rev=358088&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethodsNSError.py (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethodsNSError.py Wed Apr 10 07:30:00 2019
@@ -0,0 +1,50 @@
+"""
+Test more expression command sequences with objective-c.
+"""
+
+from __future__ import print_function
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+ at skipUnlessDarwin
+class FoundationTestCaseNSError(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ @expectedFailureAll(archs=["i[3-6]86"], bugnumber="<rdar://problem/28814052>")
+ def test_runtime_types(self):
+ """Test commands that require runtime types"""
+ self.build()
+ self.target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
+ self, '// Break here for NSString tests',
+ lldb.SBFileSpec('main.m', False))
+
+ # Test_NSString:
+ self.runCmd("thread backtrace")
+ self.expect("expression [str length]",
+ patterns=["\(NSUInteger\) \$.* ="])
+ self.expect("expression str.length")
+ self.expect('expression str = [NSString stringWithCString: "new"]')
+ self.expect(
+ 'po [NSError errorWithDomain:@"Hello" code:35 userInfo:@{@"NSDescription" : @"be completed."}]',
+ substrs=[
+ "Error Domain=Hello",
+ "Code=35",
+ "be completed."])
+ self.runCmd("process continue")
+
+ @expectedFailureAll(archs=["i[3-6]86"], bugnumber="<rdar://problem/28814052>")
+ def test_NSError_p(self):
+ """Test that p of the result of an unknown method does require a cast."""
+ self.build()
+ self.target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
+ self, '// Set break point at this line',
+ lldb.SBFileSpec('main.m', False))
+ self.expect("p [NSError thisMethodIsntImplemented:0]", error=True, patterns=[
+ "no known method", "cast the message send to the method's return type"])
+ self.runCmd("process continue")
Added: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethodsString.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethodsString.py?rev=358088&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethodsString.py (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethodsString.py Wed Apr 10 07:30:00 2019
@@ -0,0 +1,54 @@
+"""
+Test more expression command sequences with objective-c.
+"""
+
+from __future__ import print_function
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+ at skipUnlessDarwin
+class FoundationTestCaseString(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def test_NSString_expr_commands(self):
+ """Test expression commands for NSString."""
+ self.build()
+ self.target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
+ self, '// Break here for NSString tests',
+ lldb.SBFileSpec('main.m', False))
+
+ # Test_NSString:
+ self.runCmd("thread backtrace")
+ self.expect("expression (int)[str length]",
+ patterns=["\(int\) \$.* ="])
+ self.expect("expression (int)[str_id length]",
+ patterns=["\(int\) \$.* ="])
+ self.expect("expression (id)[str description]",
+ patterns=["\(id\) \$.* = 0x"])
+ self.expect("expression (id)[str_id description]",
+ patterns=["\(id\) \$.* = 0x"])
+ self.expect("expression str.length")
+ self.expect('expression str = @"new"')
+ self.runCmd("image lookup -t NSString")
+ self.expect('expression str = (id)[NSString stringWithCString: "new"]')
+ self.runCmd("process continue")
+
+ @expectedFailureAll(archs=["i[3-6]86"], bugnumber="<rdar://problem/28814052>")
+ def test_MyString_dump_with_runtime(self):
+ """Test dump of a known Objective-C object by dereferencing it."""
+ self.build()
+ self.target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
+ self, '// Set break point at this line',
+ lldb.SBFileSpec('main.m', False))
+ self.expect(
+ "expression --show-types -- *my",
+ patterns=[
+ "\(MyString\) \$.* = ",
+ "\(MyBase\)"])
+ self.runCmd("process continue")
More information about the lldb-commits
mailing list