Skip to content

Commit af61b65

Browse files
author
Enrico Granata
committedFeb 10, 2015
Add a test case for the launch via argdumper globbing mechanism
llvm-svn: 228659
1 parent d7a83a9 commit af61b65

File tree

8 files changed

+80
-0
lines changed

8 files changed

+80
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
LEVEL = ../../make
2+
3+
CXX_SOURCES := main.cpp
4+
5+
include $(LEVEL)/Makefile.rules
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
"""
2+
Test that argdumper is a viable launching strategy.
3+
"""
4+
import commands
5+
import lldb
6+
import os
7+
import time
8+
import unittest2
9+
from lldbtest import *
10+
import lldbutil
11+
12+
class LaunchWithGlobTestCase(TestBase):
13+
14+
mydir = TestBase.compute_mydir(__file__)
15+
16+
17+
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
18+
@dsym_test
19+
def test_with_dsym (self):
20+
self.buildDsym()
21+
self.do_test ()
22+
23+
24+
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
25+
@dwarf_test
26+
def test_with_dwarf (self):
27+
self.buildDwarf()
28+
self.do_test ()
29+
30+
def do_test (self):
31+
exe = os.path.join (os.getcwd(), "a.out")
32+
33+
self.runCmd("target create %s" % exe)
34+
35+
# Create the target
36+
target = self.dbg.CreateTarget(exe)
37+
38+
# Create any breakpoints we need
39+
breakpoint = target.BreakpointCreateBySourceRegex ('break here', lldb.SBFileSpec ("main.cpp", False))
40+
self.assertTrue(breakpoint, VALID_BREAKPOINT)
41+
42+
self.runCmd("process launch -G true -w %s -- fi*.tx?" % (os.getcwd()))
43+
44+
process = self.process()
45+
46+
self.assertTrue(process.GetState() == lldb.eStateStopped,
47+
STOPPED_DUE_TO_BREAKPOINT)
48+
49+
thread = process.GetThreadAtIndex (0)
50+
51+
self.assertTrue (thread.IsValid(),
52+
"Process stopped at 'main' should have a valid thread");
53+
54+
stop_reason = thread.GetStopReason()
55+
56+
self.assertTrue (stop_reason == lldb.eStopReasonBreakpoint,
57+
"Thread in process stopped in 'main' should have a stop reason of eStopReasonBreakpoint");
58+
59+
self.expect("frame variable argv[1]", substrs=['file1.txt'])
60+
self.expect("frame variable argv[2]", substrs=['file2.txt'])
61+
self.expect("frame variable argv[3]", substrs=['file3.txt'])
62+
self.expect("frame variable argv[4]", substrs=['file4.txy'])
63+
self.expect("frame variable argv[5]", substrs=['file5.tyx'], matching=False)
64+
65+
if __name__ == '__main__':
66+
import atexit
67+
lldb.SBDebugger.Initialize()
68+
atexit.register(lambda: lldb.SBDebugger.Terminate())
69+
unittest2.main()
70+

‎lldb/test/functionalities/launch_with_glob/file1.txt

Whitespace-only changes.

‎lldb/test/functionalities/launch_with_glob/file2.txt

Whitespace-only changes.

‎lldb/test/functionalities/launch_with_glob/file3.txt

Whitespace-only changes.

‎lldb/test/functionalities/launch_with_glob/file4.txy

Whitespace-only changes.

‎lldb/test/functionalities/launch_with_glob/file5.tyx

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
int
2+
main (int argc, char const **argv)
3+
{
4+
return 0; // break here
5+
}

0 commit comments

Comments
 (0)
Please sign in to comment.