xref: /llvm-project/lldb/examples/test/usage-lldb-loggings (revision e97b991eef63663d1f635813fe375354edb7b51a)
1c50ce977SJohnny Chen#
2c50ce977SJohnny Chen# The following example shows how to utilize the pre-flight config file to route the lldb gdb-remote log messages
3c50ce977SJohnny Chen# into individual log destinations.
4c50ce977SJohnny Chen#
5c50ce977SJohnny Chen# See also .lldb-loggings in this directory as well as the tmp dir which contains the two log files abridged due
6c50ce977SJohnny Chen# to their log sizes.
7c50ce977SJohnny Chen#
8c50ce977SJohnny Chen
9c50ce977SJohnny Chen[11:31:34] johnny:/Volumes/data/lldb/svn/ToT/test $ ./dotest.py -A x86_64 -v -c ../examples/test/.lldb-loggings functionalities/breakpoint/breakpoint_command
10c50ce977SJohnny Chenconfig: {'pre_flight': <function pre_flight at 0x107042140>}
11c50ce977SJohnny ChenLLDB build dir: /Volumes/data/lldb/svn/ToT/build/Debug
12c50ce977SJohnny ChenLLDB-165
13c50ce977SJohnny ChenPath: /Volumes/data/lldb/svn/ToT
14c50ce977SJohnny ChenURL: https://johnny@llvm.org/svn/llvm-project/lldb/trunk
15c50ce977SJohnny ChenRepository Root: https://johnny@llvm.org/svn/llvm-project
16c50ce977SJohnny ChenRepository UUID: 91177308-0d34-0410-b5e6-96231b3b80d8
17c50ce977SJohnny ChenRevision: 162231
18c50ce977SJohnny ChenNode Kind: directory
19c50ce977SJohnny ChenSchedule: normal
20c50ce977SJohnny ChenLast Changed Author: johnny
21c50ce977SJohnny ChenLast Changed Rev: 162228
22c50ce977SJohnny ChenLast Changed Date: 2012-08-20 14:16:02 -0700 (Mon, 20 Aug 2012)
23c50ce977SJohnny Chen
24c50ce977SJohnny Chen
25c50ce977SJohnny Chenlldb.pre_flight: def pre_flight(self):
26c50ce977SJohnny Chen    import os
27c50ce977SJohnny Chen    import lldb
28c50ce977SJohnny Chen    import lldbtest
29c50ce977SJohnny Chen
30c50ce977SJohnny Chen    dest = os.path.join("/tmp", "lldb_log-%s-%s-%s.txt" % (self.getArchitecture(), self.getCompiler(), self.id()))
31c50ce977SJohnny Chen    print "\nEnabling lldb logging for test case:", self
32c50ce977SJohnny Chen    print "with log destination:", dest
33c50ce977SJohnny Chen    self.runCmd("log enable -f %s gdb-remote packets process" % dest)
34c50ce977SJohnny Chen
35c50ce977SJohnny Chenlldb.post_flight: None
36c50ce977SJohnny Chen
37c50ce977SJohnny ChenSession logs for test failures/errors/unexpected successes will go into directory '2012-08-22-11_36_37'
38c50ce977SJohnny ChenCommand invoked: python ./dotest.py -A x86_64 -v -c ../examples/test/.lldb-loggings functionalities/breakpoint/breakpoint_command
39c50ce977SJohnny Chencompilers=['clang']
40c50ce977SJohnny Chen
41c50ce977SJohnny ChenConfiguration: arch=x86_64 compiler=clang
42c50ce977SJohnny Chen----------------------------------------------------------------------
43c50ce977SJohnny ChenCollected 2 tests
44c50ce977SJohnny Chen
45c50ce977SJohnny Chen1: test_with_dsym (TestBreakpointCommand.BreakpointCommandTestCase)
46c50ce977SJohnny Chen   Test a sequence of breakpoint command add, list, and delete. ...
47c50ce977SJohnny ChenEnabling lldb logging for test case: test_with_dsym (TestBreakpointCommand.BreakpointCommandTestCase)
48c50ce977SJohnny Chenwith log destination: /tmp/lldb_log-x86_64-clang-TestBreakpointCommand.BreakpointCommandTestCase.test_with_dsym.txt
49c50ce977SJohnny Chenok
50c50ce977SJohnny Chen2: test_with_dwarf (TestBreakpointCommand.BreakpointCommandTestCase)
51c50ce977SJohnny Chen   Test a sequence of breakpoint command add, list, and delete. ...
52c50ce977SJohnny ChenEnabling lldb logging for test case: test_with_dwarf (TestBreakpointCommand.BreakpointCommandTestCase)
53c50ce977SJohnny Chenwith log destination: /tmp/lldb_log-x86_64-clang-TestBreakpointCommand.BreakpointCommandTestCase.test_with_dwarf.txt
54c50ce977SJohnny Chenok
55c50ce977SJohnny Chen
56c50ce977SJohnny Chen----------------------------------------------------------------------
57c50ce977SJohnny ChenRan 2 tests in 7.826s
58c50ce977SJohnny Chen
59c50ce977SJohnny ChenOK
60c50ce977SJohnny Chen[11:36:44] johnny:/Volumes/data/lldb/svn/ToT/test $ ls -l /tmp/lldb_log*
61c50ce977SJohnny Chen-rw-r-----  1 johnny  wheel  614614 Aug 22 11:36 /tmp/lldb_log-x86_64-clang-TestBreakpointCommand.BreakpointCommandTestCase.test_with_dsym.txt
62c50ce977SJohnny Chen-rw-r-----  1 johnny  wheel  614614 Aug 22 11:36 /tmp/lldb_log-x86_64-clang-TestBreakpointCommand.BreakpointCommandTestCase.test_with_dwarf.txt
63c50ce977SJohnny Chen[11:37:09] johnny:/Volumes/data/lldb/svn/ToT/test $
64d79f06cfSJohnny Chen
65d79f06cfSJohnny Chen#
66d79f06cfSJohnny Chen# And this shows the log files go into the session directory.
67d79f06cfSJohnny Chen# Note that the .lldb-loggings file is modified to get the session directory now.
68d79f06cfSJohnny Chen#
69d79f06cfSJohnny Chen
70d79f06cfSJohnny Chen[11:37:09] johnny:/Volumes/data/lldb/svn/ToT/test $ ./dotest.py -A x86_64 -v -c ../examples/test/.lldb-loggings functionalities/breakpoint/breakpoint_command
71d79f06cfSJohnny Chenconfig: {'pre_flight': <function pre_flight at 0x10ca5c1b8>}
72d79f06cfSJohnny ChenLLDB build dir: /Volumes/data/lldb/svn/ToT/build/Debug
73d79f06cfSJohnny ChenLLDB-165
74d79f06cfSJohnny ChenPath: /Volumes/data/lldb/svn/ToT
75d79f06cfSJohnny ChenURL: https://johnny@llvm.org/svn/llvm-project/lldb/trunk
76d79f06cfSJohnny ChenRepository Root: https://johnny@llvm.org/svn/llvm-project
77d79f06cfSJohnny ChenRepository UUID: 91177308-0d34-0410-b5e6-96231b3b80d8
78d79f06cfSJohnny ChenRevision: 162231
79d79f06cfSJohnny ChenNode Kind: directory
80d79f06cfSJohnny ChenSchedule: normal
81d79f06cfSJohnny ChenLast Changed Author: johnny
82d79f06cfSJohnny ChenLast Changed Rev: 162228
83d79f06cfSJohnny ChenLast Changed Date: 2012-08-20 14:16:02 -0700 (Mon, 20 Aug 2012)
84d79f06cfSJohnny Chen
85d79f06cfSJohnny Chen
86d79f06cfSJohnny Chenlldb.pre_flight: def pre_flight(self):
87d79f06cfSJohnny Chen    import os
88d79f06cfSJohnny Chen    import lldb
89d79f06cfSJohnny Chen    import lldbtest
90d79f06cfSJohnny Chen
91*e97b991eSRaphael Isemann    dname = os.path.join(os.environ["LLDB_TEST"])
92d79f06cfSJohnny Chen    if not os.path.isdir(dname):
93d79f06cfSJohnny Chen        os.mkdir(dname)
94d79f06cfSJohnny Chen    dest = os.path.join(dname, "lldb_log-%s-%s-%s.txt" % (self.getArchitecture(), self.getCompiler(), self.id()))
95d79f06cfSJohnny Chen    print "\nEnabling lldb logging for test case:", self
96d79f06cfSJohnny Chen    print "with log destination:", dest
97d79f06cfSJohnny Chen    self.runCmd("log enable -f %s gdb-remote packets process" % dest)
98d79f06cfSJohnny Chen
99d79f06cfSJohnny Chenlldb.post_flight: None
100d79f06cfSJohnny Chen
101d79f06cfSJohnny ChenSession logs for test failures/errors/unexpected successes will go into directory '2012-08-22-13_21_46'
102d79f06cfSJohnny ChenCommand invoked: python ./dotest.py -A x86_64 -v -c ../examples/test/.lldb-loggings functionalities/breakpoint/breakpoint_command
103d79f06cfSJohnny Chencompilers=['clang']
104d79f06cfSJohnny Chen
105d79f06cfSJohnny ChenConfiguration: arch=x86_64 compiler=clang
106d79f06cfSJohnny Chen----------------------------------------------------------------------
107d79f06cfSJohnny ChenCollected 2 tests
108d79f06cfSJohnny Chen
109d79f06cfSJohnny Chen1: test_with_dsym (TestBreakpointCommand.BreakpointCommandTestCase)
110d79f06cfSJohnny Chen   Test a sequence of breakpoint command add, list, and delete. ...
111d79f06cfSJohnny ChenEnabling lldb logging for test case: test_with_dsym (TestBreakpointCommand.BreakpointCommandTestCase)
112d79f06cfSJohnny Chenwith log destination: /Volumes/data/lldb/svn/ToT/test/2012-08-22-13_21_46/lldb_log-x86_64-clang-TestBreakpointCommand.BreakpointCommandTestCase.test_with_dsym.txt
113d79f06cfSJohnny Chenok
114d79f06cfSJohnny Chen2: test_with_dwarf (TestBreakpointCommand.BreakpointCommandTestCase)
115d79f06cfSJohnny Chen   Test a sequence of breakpoint command add, list, and delete. ...
116d79f06cfSJohnny ChenEnabling lldb logging for test case: test_with_dwarf (TestBreakpointCommand.BreakpointCommandTestCase)
117d79f06cfSJohnny Chenwith log destination: /Volumes/data/lldb/svn/ToT/test/2012-08-22-13_21_46/lldb_log-x86_64-clang-TestBreakpointCommand.BreakpointCommandTestCase.test_with_dwarf.txt
118d79f06cfSJohnny Chenok
119d79f06cfSJohnny Chen
120d79f06cfSJohnny Chen----------------------------------------------------------------------
121d79f06cfSJohnny ChenRan 2 tests in 8.575s
122d79f06cfSJohnny Chen
123d79f06cfSJohnny ChenOK
124d79f06cfSJohnny Chen[13:21:55] johnny:/Volumes/data/lldb/svn/ToT/test $
125