Commit Graph

7044 Commits

Author SHA1 Message Date
Johnny Chen
bc1857ba36 These two files should have been in r113596. Oops!
llvm-svn: 113598
2010-09-10 18:28:27 +00:00
Johnny Chen
94de55d5c2 Added the capability to specify a one-liner Python script as the callback
command for a breakpoint, for example:

(lldb) breakpoint command add -p 1 "conditional_break.stop_if_called_from_a()"

The ScriptInterpreter interface has an extra method:

    /// Set a one-liner as the callback for the breakpoint command.
    virtual void 
    SetBreakpointCommandCallback (CommandInterpreter &interpreter,
                                  BreakpointOptions *bp_options,
                                  const char *oneliner);

to accomplish the above.

Also added a test case to demonstrate lldb's use of breakpoint callback command
to stop at function c() only when its immediate caller is function a().  The
following session shows the user entering the following commands:

1) command source .lldb (set up executable, breakpoint, and breakpoint command)
2) run (the callback mechanism will skip two breakpoints where c()'s immeidate caller is not a())
3) bt (to see that indeed c()'s immediate caller is a())
4) c (to continue and finish the program)

test/conditional_break $ ../../build/Debug/lldb
(lldb) command source .lldb
Executing commands in '.lldb'.
(lldb) file a.out
Current executable set to 'a.out' (x86_64).
(lldb) breakpoint set -n c
Breakpoint created: 1: name = 'c', locations = 1
(lldb) script import sys, os
(lldb) script sys.path.append(os.path.join(os.getcwd(), os.pardir))
(lldb) script import conditional_break
(lldb) breakpoint command add -p 1 "conditional_break.stop_if_called_from_a()"
(lldb) run
run
Launching '/Volumes/data/lldb/svn/trunk/test/conditional_break/a.out'  (x86_64)
(lldb) Checking call frames...
Stack trace for thread id=0x2e03 name=None queue=com.apple.main-thread:
  frame #0: a.out`c at main.c:39
  frame #1: a.out`b at main.c:34
  frame #2: a.out`a at main.c:25
  frame #3: a.out`main at main.c:44
  frame #4: a.out`start
c called from b
Continuing...
Checking call frames...
Stack trace for thread id=0x2e03 name=None queue=com.apple.main-thread:
  frame #0: a.out`c at main.c:39
  frame #1: a.out`b at main.c:34
  frame #2: a.out`main at main.c:47
  frame #3: a.out`start
c called from b
Continuing...
Checking call frames...
Stack trace for thread id=0x2e03 name=None queue=com.apple.main-thread:
  frame #0: a.out`c at main.c:39
  frame #1: a.out`a at main.c:27
  frame #2: a.out`main at main.c:50
  frame #3: a.out`start
c called from a
Stopped at c() with immediate caller as a().
a(1) returns 4
b(2) returns 5
Process 20420 Stopped
* thread #1: tid = 0x2e03, 0x0000000100000de8 a.out`c + 7 at main.c:39, stop reason = breakpoint 1.1, queue = com.apple.main-thread
  36   	
  37   	int c(int val)
  38   	{
  39 ->	    return val + 3;
  40   	}
  41   	
  42   	int main (int argc, char const *argv[])
(lldb) bt
bt
thread #1: tid = 0x2e03, stop reason = breakpoint 1.1, queue = com.apple.main-thread
  frame #0: 0x0000000100000de8 a.out`c + 7 at main.c:39
  frame #1: 0x0000000100000dbc a.out`a + 44 at main.c:27
  frame #2: 0x0000000100000e4b a.out`main + 91 at main.c:50
  frame #3: 0x0000000100000d88 a.out`start + 52
(lldb) c
c
Resuming process 20420
Process 20420 Exited
a(3) returns 6
(lldb) 

llvm-svn: 113596
2010-09-10 18:21:10 +00:00
Johnny Chen
43a651c609 Added GetStackFrames(thread) utility function.
llvm-svn: 113460
2010-09-09 00:55:07 +00:00
Johnny Chen
30ee4ef308 Added a lldbutil.py module, which contains utility functions which can be used
from scripting applications.  An example usage from TestConditionalBreak.py is:

            import lldbutil
            lldbutil.PrintStackTrace(thread)

./dotest.py -v conditional_break
----------------------------------------------------------------------
Collected 2 tests

test_with_dsym (TestConditionalBreak.ConditionalBreakTestCase)
Exercise some thread and frame APIs to break if c() is called by a(). ... Stack trace for thread id=0x2e03 name=None queue=com.apple.main-thread:
  frame #0: a.out`c at main.c:39
  frame #1: a.out`b at main.c:34
  frame #2: a.out`a at main.c:25
  frame #3: a.out`main at main.c:44
  frame #4: a.out`start
Stack trace for thread id=0x2e03 name=None queue=com.apple.main-thread:
  frame #0: a.out`c at main.c:39
  frame #1: a.out`b at main.c:34
  frame #2: a.out`main at main.c:47
  frame #3: a.out`start
Stack trace for thread id=0x2e03 name=None queue=com.apple.main-thread:
  frame #0: a.out`c at main.c:39
  frame #1: a.out`a at main.c:27
  frame #2: a.out`main at main.c:50
  frame #3: a.out`start
ok
test_with_dwarf (TestConditionalBreak.ConditionalBreakTestCase)
Exercise some thread and frame APIs to break if c() is called by a(). ... Stack trace for thread id=0x2e03 name=None queue=com.apple.main-thread:
  frame #0: a.out`c at main.c:39
  frame #1: a.out`b at main.c:34
  frame #2: a.out`a at main.c:25
  frame #3: a.out`main at main.c:44
  frame #4: a.out`start
Stack trace for thread id=0x2e03 name=None queue=com.apple.main-thread:
  frame #0: a.out`c at main.c:39
  frame #1: a.out`b at main.c:34
  frame #2: a.out`main at main.c:47
  frame #3: a.out`start
Stack trace for thread id=0x2e03 name=None queue=com.apple.main-thread:
  frame #0: a.out`c at main.c:39
  frame #1: a.out`a at main.c:27
  frame #2: a.out`main at main.c:50
  frame #3: a.out`start
ok

----------------------------------------------------------------------
Ran 2 tests in 7.803s

OK

llvm-svn: 113432
2010-09-08 22:54:46 +00:00
Johnny Chen
2634032c66 Added '-d' option to the test driver to spit out the process id and do a delay
of 10 seconds in order for the debugger to attach.

llvm-svn: 113407
2010-09-08 20:56:16 +00:00
Johnny Chen
e027b57b56 Minor tweak to add expected matching strings.
llvm-svn: 113327
2010-09-08 00:55:12 +00:00
Johnny Chen
06d73a0c5f Added a test case which exercises some thread and frame APIs to break only when
the call site of c() is a().

llvm-svn: 113325
2010-09-08 00:46:08 +00:00
Greg Clayton
d003a778d9 Added an objective C test that creates some NSString, NSArray and NSDictionary
objects and populates them so we can test making expression calls with these
objects. We will need to make this test case more complete as time goes on to
make sure we can evaluate all functions.

llvm-svn: 113314
2010-09-07 23:55:31 +00:00
Johnny Chen
ea772bbba0 The output for term-width setting has single quotes around the (int) value.
And added a trace output for the stop function name to breakAfterLaunch() method.

llvm-svn: 113251
2010-09-07 18:55:50 +00:00
Johnny Chen
41cb55a916 Converted TestUnsignedTypespy and TestStructTypes.py to Dsym/Dwarf combination.
llvm-svn: 113244
2010-09-07 18:32:57 +00:00
Johnny Chen
165a0798a1 Converted TestSTL.py to Dsym/Dwarf combination.
llvm-svn: 113241
2010-09-07 18:27:35 +00:00
Johnny Chen
42aa5e3e22 Converted TestSetValues.py to Dsym/Dwarf combination.
llvm-svn: 113238
2010-09-07 18:19:13 +00:00
Johnny Chen
a37764b5ae Added a test case for setting term-width, too.
llvm-svn: 113219
2010-09-07 17:31:05 +00:00
Johnny Chen
881c371af3 Added comments.
llvm-svn: 113214
2010-09-07 17:12:10 +00:00
Johnny Chen
773777727a Added a simple test case for the "settings set" command for instance variable 'prompt'.
llvm-svn: 113211
2010-09-07 17:06:13 +00:00
Johnny Chen
ecf9ded375 LLDB command "set term-width 0" needs to be changed to "settings set term-width 0"
after the recent checkin.

llvm-svn: 113206
2010-09-07 16:19:35 +00:00
Johnny Chen
070ebd93d2 Added a default build phase at the beginning of test_load_unload() test case.
llvm-svn: 113039
2010-09-03 23:52:15 +00:00
Johnny Chen
1b1b9accd1 Marked test_process_launch_for_universal() test case as requiring 'darwin' and 'i386'
in order to be run.  And added a default build phase at the beginning of the method.

llvm-svn: 113037
2010-09-03 23:49:16 +00:00
Johnny Chen
bd588549d5 Converted TestGlobalVariables.py to Dsym/Dwarf combination.
llvm-svn: 113030
2010-09-03 23:16:49 +00:00
Johnny Chen
1cdadddf36 Converted TestFunctionTypes.py to Dsym/Dwarf combination.
llvm-svn: 113029
2010-09-03 23:14:26 +00:00
Johnny Chen
84c96b84bd Converted TestEnumTypes.py to Dsym/Dwarf combination.
Marked test_with_dwarf() as expectedFailure where 'image lookup -t days' returns nothing.

llvm-svn: 113028
2010-09-03 23:10:24 +00:00
Johnny Chen
725945d568 Fixed an lldb infrastructure bug, where the debugger should reaaly update its
execution context only when the process is still alive.  When running the test
suite, the debugger is launching and killing processes constantly.

This might be the cause of the test hang as reported in rdar://problem/8377854,
where the debugger was looping infinitely trying to update a supposedly stale
thread list.

llvm-svn: 113022
2010-09-03 22:35:47 +00:00
Johnny Chen
57b47384cc Added comments regarding the two mechanisms of process cleanup to lldbtest.py.
Also changed the expected strings to be matched since "thread list" changed its
output format. 

llvm-svn: 112880
2010-09-02 22:25:47 +00:00
Johnny Chen
7d1d7537cf Moved the process cleanup of Script-Bridge-based APIs into TestBase.tearDown()
method where they belong.  Also fixed a logic error in maintaining the command
interface flag (runStarted) indicating whether the lldb "run"/"process launch"
command has been issued.  It was erroneously cleared.

Modified the test cases to take advantage of the refactoring.

llvm-svn: 112863
2010-09-02 21:23:12 +00:00
Johnny Chen
979e796692 (query-replace "variable list" "frame variable")
llvm-svn: 112824
2010-09-02 15:59:20 +00:00
Johnny Chen
b92555c334 Fixed comment.
llvm-svn: 112750
2010-09-01 22:10:09 +00:00
Johnny Chen
13639089c6 Put the little dances done after SBTarget.LaunchProcess() into the base class.
llvm-svn: 112749
2010-09-01 22:08:51 +00:00
Johnny Chen
cbb4be0c93 Changed the test case class names to be noun-like instead of verb-like.
llvm-svn: 112732
2010-09-01 19:59:58 +00:00
Johnny Chen
db3d874351 Updated to add plugins directory to PYTHONPATH.
llvm-svn: 112688
2010-09-01 00:55:36 +00:00
Johnny Chen
63dfb27647 Avoid killing the inferior process twice by passing a setCookie=False keyword
argument when issuing a "run" lldb command within the test case meant to
exercise the Python APIs, but is using the command interface due to certain
reason (such as target.LaunchProcess() does not reliably bring up the inferior).

llvm-svn: 112682
2010-09-01 00:15:19 +00:00
Johnny Chen
11c34a0488 Converted TestDeadStrip.py to Dsym/Dwarf combination.
llvm-svn: 112670
2010-08-31 23:12:15 +00:00
Johnny Chen
9129998061 Converted TestClassTypes.py to Dsym/Dwarf combination. Marked one test case as
expectedFailure because in dwarf format, "variable list this" returns an error.

llvm-svn: 112660
2010-08-31 22:26:16 +00:00
Johnny Chen
65a6524d00 Converted TestBitfields.py to Dsym/Dwarf combination.
llvm-svn: 112646
2010-08-31 21:49:24 +00:00
Johnny Chen
517210b0f3 Updated to reflect the "plugins" directory.
llvm-svn: 112607
2010-08-31 17:51:08 +00:00
Johnny Chen
8d55a34a34 Changed the buildDsym()/buildDwarf() TestBase methods to use a plugin framework
to delegate the building of binaries to a sys.platform-sepcific plugin.

Modified the dotest.py test driver to add the "plugins" directory to the
PYTHONPATH as well.

darwin.py is the Mac OS X plugin module.

llvm-svn: 112606
2010-08-31 17:42:54 +00:00
Johnny Chen
324355b9a1 Added doc strings to the array_types test cases. And terminate the current
process being debugged in the TestBase.tearDown() instead of letting it continue
and finish.

llvm-svn: 112556
2010-08-30 23:44:39 +00:00
Johnny Chen
a33a93cbde Converted TestArrayTypes.py to Dsym/Dwarf combination, and added verbose output
of os command to lldbtest.TestBase.system() method.

llvm-svn: 112547
2010-08-30 23:08:52 +00:00
Johnny Chen
2f1ad5e2bd Added buildDsym() and buildDwarf() methods to lldbtest.TestBase class, and call
them from test cases instead of issuing "make clean; make ..." os command.

llvm-svn: 112542
2010-08-30 22:26:48 +00:00
Johnny Chen
8952a2d5b6 Added a system() method to the TestBase class of lldbtest.py, which is actually
taken from Python 2.7's subprocess.check_output() convenience function.  The
purpose of this method is to run the os command with arguments and return its
output as a byte string.

Modified hello_world/TestHelloWorld.py to have two test cases:

o test_with_dsym_and_run_command
o test_with_dwarf_and_process_launch_api

with the dsym case conditioned on sys.platform.startswith("darwin") being true.
The two cases utilize the system() method to invoke "make clean; make MAKE_DYSM=YES/NO"
to prepare for the appropriate debugging format before running the test logic.

llvm-svn: 112530
2010-08-30 21:35:00 +00:00
Johnny Chen
269457515a Fail early, fail fast.
llvm-svn: 112328
2010-08-27 23:53:00 +00:00
Johnny Chen
5ee881948a Added a test case test_breakpoint_creation_by_filespec_python() which creates a
breakpoint by FileSpec and line number and exercises some FileSpec APIs.

Also, RUN_STOPPED is a bad assert name, RUN_SUCCEEDED is better.

llvm-svn: 112327
2010-08-27 23:47:36 +00:00
Johnny Chen
fd8967a82f Fixed a typo in the method name.
llvm-svn: 112311
2010-08-27 22:39:49 +00:00
Johnny Chen
ccd570da6b Trivial doc string mod.
llvm-svn: 112293
2010-08-27 21:15:57 +00:00
Johnny Chen
82d404c886 Added TestHelloWorld.py which exercises the Python APIs for target, breakpoint,
and process.  Added comment within the file about issues of using LaunchProcess
of SBTarget to launch a process (rdar://problem/8364687).

llvm-svn: 112276
2010-08-27 18:08:58 +00:00
Johnny Chen
827edffafd Added a test case to bitfields which uses the Python APIs from lldb.py.
Added a utility method to TestBase class to debug print an SBValue object.

llvm-svn: 112247
2010-08-27 00:15:48 +00:00
Johnny Chen
c19e3a0946 Modified method doc string for verbose test description output.
llvm-svn: 112236
2010-08-26 22:38:51 +00:00
Johnny Chen
bf325e4a37 Changed from dbg.GetCurrentTarget() to dbg.GetSelectedTarget().
llvm-svn: 112231
2010-08-26 22:06:03 +00:00
Johnny Chen
2771d7bf49 Added comment about target.LaunchProcess() not working.
llvm-svn: 112226
2010-08-26 21:53:26 +00:00
Johnny Chen
27c412320e Added a utility function EnvArray() to lldbtest.py.
llvm-svn: 112223
2010-08-26 21:49:29 +00:00
Johnny Chen
5fca8ca8cd o Added a test case for array_types which uses the Python APIs from lldb.py,
with the only exception of launching the process from SBTarget which is under
  investigation.

o build-swig-Python.sh should also checks the timestamp of ${swig_input_file}
  for update eligibility.  Also, once an update is in order, there's no need
  to check the remaining header files for timestamps.

o Coaches swig to treat StopReason as an int type, instead of a C++ class.

llvm-svn: 112210
2010-08-26 20:04:17 +00:00
Johnny Chen
61703c96f2 Minor doc string modification.
llvm-svn: 112103
2010-08-25 22:56:10 +00:00
Johnny Chen
f3c59231b3 Added logic to TestUniversal.py to exercise the python APIs:
o SBDebugger.GetCurrentTarget()
o SBTarget.GetProcess()
o SBProcess.GetAddressByteSize()

in order to make sure that, indeed, 64-bit, followed by 32-bit processes have
been launched.

Added invoke() method to TestBase to factor in the tracing logic in one place.
This method allows an object to call a method with no arg reflectively.

llvm-svn: 112102
2010-08-25 22:52:45 +00:00
Johnny Chen
981463d670 Fixed a logic error in the expect() method. If the start string does not match,
there's no point matching further sub strings; the expect() already fails.

Also cleaned up the assert message for VARIABLES_DISPLAYED_CORRECTLY.

llvm-svn: 112074
2010-08-25 19:00:04 +00:00
Johnny Chen
f2b70237e6 Allow command retries in case of process launch failures. This recovery
mechanism seems to work fine on my MacBook Pro in some limited test cases.

The default maxLaunchCount and timeWait variables used in the scheme can be
overridden by the env variables LLDB_MAX_LAUNCH_COUNT and LLDB_TIME_WAIT.

llvm-svn: 112071
2010-08-25 18:49:48 +00:00
Johnny Chen
c7c9fcfbd6 More descriptive trace messages for the matchings of start and sub strings.
llvm-svn: 112000
2010-08-24 23:48:10 +00:00
Johnny Chen
536b7d2d26 Removed the @unitest2.expectedFailure decorator. The i386 process launch works
correctly after all.  It was my own configuration error (I was building x86_64
only).

llvm-svn: 111992
2010-08-24 23:14:47 +00:00
Johnny Chen
3c884a014c Added a test for launching a universal binary. Launch of i386 architecture
currently fails: rdar://problem/8349784.

Forgot to check in lldbtest.py in the previous commit r111958.

llvm-svn: 111975
2010-08-24 22:07:56 +00:00
Johnny Chen
9c194e3e75 Converted to Makefile.rules.
llvm-svn: 111961
2010-08-24 20:54:26 +00:00
Johnny Chen
9d2bd8301d More descriptive method doc string.
llvm-svn: 111960
2010-08-24 20:48:28 +00:00
Johnny Chen
6b900c5dcd Added a test case which uses "image lookup" command on an enum data type.
llvm-svn: 111958
2010-08-24 20:44:33 +00:00
Johnny Chen
f2b1419acc Need a better method name.
llvm-svn: 111939
2010-08-24 18:46:00 +00:00
Johnny Chen
f0dec3cf31 Converted to Makefile.rules.
llvm-svn: 111938
2010-08-24 18:41:52 +00:00
Johnny Chen
ea920fe8b4 Added test case TestBitfields.py for rdar://problem/8348251, where
"variable list bits" display bits variable correctly, but not "variable list".

llvm-svn: 111937
2010-08-24 18:21:23 +00:00
Johnny Chen
734cdb58f1 Converted to Makefile.rules.
llvm-svn: 111928
2010-08-24 17:43:34 +00:00
Johnny Chen
e3dc0f048a Generates the .d prerequisite file for dylib as well.
llvm-svn: 111920
2010-08-24 16:35:00 +00:00
Johnny Chen
9bc867aaf5 Makefile refactoring for the test suite. Added a make directory under test,
which hosts the Makefile.rules and modified most of the Makefiles under each
test case directories to utilize Mekefile.rules.

Added a description of 'make' directory into README-TestSuite file.

llvm-svn: 111868
2010-08-23 23:56:08 +00:00
Johnny Chen
d0190a6182 Changed the keyword argument for runCmd()/expect() from 'verbose' to 'trace',
which, defaults to False, and if set to True, will trace lldb command execution
and result.

Added "-t" command option to the test driver dotest.py which sets the
LLDB_COMMAND_TRACE environment variable to "YES" and as a result always turns on
command tracing regardless of the 'trace' keyword argument to runCmd()/expect().

llvm-svn: 111811
2010-08-23 17:10:44 +00:00
Johnny Chen
ff3d01d0b7 Print the verbose output of runCmd()/expect() to stderr instead of stdout.
And converted the rest of the test cases to runCmd()/expect().

llvm-svn: 111677
2010-08-20 21:03:09 +00:00
Johnny Chen
74f26b8188 Changed TestBase.expect() to allow default 'msg' arg. Converted TestHelp.py.
llvm-svn: 111671
2010-08-20 19:17:39 +00:00
Johnny Chen
b145bbaf4b Added more verbose output when string match fails. Converted TestGlobalVariables.py.
llvm-svn: 111666
2010-08-20 18:25:15 +00:00
Johnny Chen
5bbb88ff97 Added verbose option to runCmd()/expect() in lldbtest.py. Converted TestFunctionTypes.py.
llvm-svn: 111658
2010-08-20 17:57:32 +00:00
Johnny Chen
617cca957e Converted some more test cases to use runCmd()/expect().
llvm-svn: 111652
2010-08-20 17:04:20 +00:00
Johnny Chen
f85b0b866c Converted to use runCmd() and expect() for more abstraction.
llvm-svn: 111593
2010-08-20 00:27:37 +00:00
Johnny Chen
a6480c124e Use cmd.startswith("run") instead of string equivalence test.
llvm-svn: 111587
2010-08-19 23:53:55 +00:00
Johnny Chen
27f212d1e6 Abstracted the running of command through the command interpreter and checking
its return status into lldbtest.TestBase.runCmd(); and runCmd() in combination
with checking the output against matching substrings (including startswith) into
lldbtest.TestBase.expect().

TestUnsignedTypes.py is refactored to use the abstracted APIs.  Other test cases
to be modified later.

llvm-svn: 111572
2010-08-19 23:26:59 +00:00
Johnny Chen
0c19186352 Added more informational assert message strings.
llvm-svn: 111536
2010-08-19 18:17:48 +00:00
Johnny Chen
5a2133909d Simplify the assert matched-string criterion.
llvm-svn: 111429
2010-08-18 21:28:35 +00:00
Jim Ingham
ea480e507c Added call stacks with inlined functions higher on the stack, and non-inlined functions at the bottom.
llvm-svn: 111379
2010-08-18 18:28:17 +00:00
Johnny Chen
83072afbcd Write out the informational message about the total number of test cases to be
run to stderr, instead of stdout.  The same as what the unittest framework uses.

llvm-svn: 111319
2010-08-17 23:00:13 +00:00
Johnny Chen
8a05de4d29 Add the ability to specify logging options for lldb and gdb-remote through two
additional env variables.

llvm-svn: 111295
2010-08-17 21:36:09 +00:00
Johnny Chen
e76896c987 Specify a more meaningful assert message for TestDeadStrip.py.
llvm-svn: 111294
2010-08-17 21:33:31 +00:00
Johnny Chen
46c2614b99 Added logging for process.gdb-remote by defining an environment variable named
GDB_REMOTE_LOG which specifies the log file pathname.

llvm-svn: 111198
2010-08-16 22:37:45 +00:00
Johnny Chen
6ca006c7c1 Factored the "continue" command execution of the inferior process as part of the
cleanup before finish into the test fixture in lldbtest.TestBase.tearDown().

Derivatives of TestBase is responsible for setting self.runStarted to True if an
inferior process has been started.

llvm-svn: 111188
2010-08-16 21:28:10 +00:00
Johnny Chen
dd63f5dbe1 Added a workaround for test suite hang while terminating by checking env variable
LLDB_TESTSUITE_FORCE_FINISH and, if defined, kill the test suite.

llvm-svn: 111056
2010-08-13 22:58:44 +00:00
Johnny Chen
f288803a95 Added a test case to exercise persistent variables in combination with the "expr" command.
llvm-svn: 111035
2010-08-13 20:12:05 +00:00
Jim Ingham
4512065130 Test files (but no test cases yet) for handling Universal files.
llvm-svn: 110893
2010-08-12 01:21:40 +00:00
Jim Ingham
b0be442408 Few little fixes to reading in inlined functions. Also added a test case with some inlining.
llvm-svn: 110892
2010-08-12 01:20:14 +00:00
Johnny Chen
edcbecfb1f Call lldb.SBDebugger.Terminate() at the end of test suite run through the atexit
handler similar to what's happening for the individual test case run.

llvm-svn: 110719
2010-08-10 20:23:55 +00:00
Johnny Chen
1794184ada Modified the remaining test cases to display more meaningful assert messages.
Added a generic message generator to the lldbtest.py base module.

llvm-svn: 110625
2010-08-09 23:44:24 +00:00
Johnny Chen
0077809bc2 Added some commonly used assert messages to the lldbtest.py module which houses
the TestBase.  Modified TestArrayTypes.py to use the assert messages.  Other
files to follow.

llvm-svn: 110611
2010-08-09 22:01:17 +00:00
Johnny Chen
f4804c696d Install the SIGINT (control-c) handler before invoking the text test runner.
llvm-svn: 110595
2010-08-09 20:40:52 +00:00
Johnny Chen
9289a65f75 Commented out "import traceback".
llvm-svn: 110497
2010-08-07 01:13:18 +00:00
Johnny Chen
f5957e0603 Putting out messages about the number of test cases to be run before running the
whole test suite.

llvm-svn: 110487
2010-08-07 00:16:07 +00:00
Johnny Chen
ead526a056 Added more comments about unittest2.
llvm-svn: 110470
2010-08-06 21:07:38 +00:00
Johnny Chen
ae9fea401d Added description about unittest2.
llvm-svn: 110400
2010-08-05 23:47:51 +00:00
Johnny Chen
73258830f3 o Added unittest2 which has added the new features in unittest for Python 2.7
backported to Python 2.3+.  Some of the features desired include better
  verbose reporting in unittest2.TextTestRunner and decorator support for
  skipping tests and expected failures.

  http://pypi.python.org/pypi/unittest2

o Modified the existing .py tests to use unittest2 and decorated
  TestSTL.test_step_into_stl(), which is known to always fail currently, with
  @unittest2.expectedFailure.

llvm-svn: 110397
2010-08-05 23:42:46 +00:00
Johnny Chen
a21249597e When running a single test case, lldb.SBDebugger.Terminate() is not being called
because unittest.main() calls sys.exit() before returning.  Fixed by registering
an exit handler for this situation.

llvm-svn: 110379
2010-08-05 21:23:45 +00:00
Johnny Chen
fee57bb464 Added README file for the test suite.
llvm-svn: 110160
2010-08-03 22:12:11 +00:00
Greg Clayton
b0b9fe610a Added support for objective C built-in types: id, Class, and SEL. This
involved watching for the objective C built-in types in DWARF and making sure
when we convert the DWARF types into clang types that we use the appropriate
ASTContext types.

Added a way to find and dump types in lldb (something equivalent to gdb's 
"ptype" command):

    image lookup --type <TYPENAME>

This only works for looking up types by name and won't work with variables.
It also currently dumps out verbose internal information. I will modify it
to dump more appropriate user level info in my next submission.

Hookup up the "FindTypes()" functions in the SymbolFile and SymbolVendor so
we can lookup types by name in one or more images.

Fixed "image lookup --address <ADDRESS>" to be able to correctly show all
symbol context information, but it will only show this extra information when
the new "--verbose" flag is used.

Updated to latest LLVM to get a few needed fixes.

llvm-svn: 110089
2010-08-03 00:35:52 +00:00
Johnny Chen
7f5f2809e8 Added comment.
llvm-svn: 110066
2010-08-02 21:26:00 +00:00
Johnny Chen
8402832e50 Cleanup of test case. Added more comments.
llvm-svn: 110064
2010-08-02 21:19:08 +00:00
Johnny Chen
7dc2e4784e We can do better when reporting the status of one-liner script execution.
Change the prototype of ScriptInterpreter::ExecuteOneLine() to return bool
instead of void and take one additional parameter as CommandReturnObject *.

Propagate the status of one-liner execution back appropriately.

llvm-svn: 109899
2010-07-30 22:33:14 +00:00
Johnny Chen
b9e7c0aef6 Add a test case to test that lldb command "command source" works correctly.
llvm-svn: 109806
2010-07-29 21:42:28 +00:00
Johnny Chen
c0599ea1e7 Removed redundant import statement.
llvm-svn: 109803
2010-07-29 20:49:07 +00:00
Greg Clayton
2d5cdf0615 Added an objective C test case.
llvm-svn: 109798
2010-07-29 20:08:39 +00:00
Johnny Chen
ed4377eded Removed debug stmts checked into the previous commit.
llvm-svn: 109712
2010-07-29 00:40:06 +00:00
Johnny Chen
588ddc1c58 Add some comment about possible related bug info.
llvm-svn: 109678
2010-07-28 22:00:42 +00:00
Johnny Chen
377a8ed913 Added a test case to test that we can successfully step into an STL function.
This test case currently always fails.

llvm-svn: 109674
2010-07-28 21:24:31 +00:00
Johnny Chen
571bfd6a2d Added a test case to test that break on a struct declaration has no effect.
Instead, the first executable statement is set as the breakpoint.

llvm-svn: 109552
2010-07-27 22:48:46 +00:00
Johnny Chen
ef2f552de4 Added a test case for showing variables of unsigned types.
llvm-svn: 109545
2010-07-27 21:49:20 +00:00
Johnny Chen
3c39a980d7 Renaming from TestOrder.py to TestOrderFile.py.
llvm-svn: 109540
2010-07-27 21:03:55 +00:00
Johnny Chen
49583c207f Fixed typos from cut-and-paste errors.
llvm-svn: 109539
2010-07-27 20:59:06 +00:00
Johnny Chen
364b0e72d1 Add a test case (incomplete) to check that settings and readings of program
variabes work.

llvm-svn: 107914
2010-07-08 21:38:07 +00:00
Johnny Chen
acfbeff17e Test that debug symbols have the correct order as specified by the order file.
llvm-svn: 107844
2010-07-08 00:17:29 +00:00
Johnny Chen
529728e82a Fixed typos in the comments.
llvm-svn: 107829
2010-07-07 22:49:43 +00:00
Johnny Chen
41a3c9a5f8 Test that breakpoint by symbol name works correctly dlopen'ing a dynamic lib.
llvm-svn: 107812
2010-07-07 21:10:55 +00:00
Johnny Chen
51991b549b Enable a test clause since rdar://problem/8163668 is fixed by http://llvm.org/viewvc/llvm-project?rev=107729&view=rev.
llvm-svn: 107733
2010-07-06 23:41:17 +00:00
Johnny Chen
f031b71f7e if -1 => evaluates to True
oops!

llvm-svn: 107724
2010-07-06 23:26:16 +00:00
Johnny Chen
0e38f42f0a Test that breakpoint works correctly in the presence of dead-code stripping.
llvm-svn: 107719
2010-07-06 22:52:00 +00:00
Johnny Chen
f02ec12796 Make it fail fast if 'mydir' attribute is not overridden by subclasses of
lldbtest.TestBase.

Also removed some debug prints.

llvm-svn: 107575
2010-07-03 20:41:42 +00:00
Johnny Chen
bf6ffa3b89 Abstracted the lldb-specific unittest.TestCase.setUp()/tearDown() in a separate
module lldbtest.py and refactored the existing test cases to derive from the
abstract base class lldbtest.TestBase.

MOdified the test driver (dotest.py and dotest.pl) to set up additional
PYTHONPATH component for locating the lldbtest module, which sits in the same
directory.

llvm-svn: 107563
2010-07-03 03:41:59 +00:00
Johnny Chen
f1d2ac7c01 Test variable with function ptr type and that break on the function works.
llvm-svn: 107545
2010-07-02 23:50:37 +00:00
Johnny Chen
03813ec687 Also verified the values of global variables.
llvm-svn: 107525
2010-07-02 22:12:25 +00:00
Johnny Chen
85d6948f3d Add a test to show global variables and to verify that they do display as having
global scopes.

llvm-svn: 107522
2010-07-02 22:04:42 +00:00
Johnny Chen
c653d4c574 Fixed logic error; checking return status and raising exception should only be
done if the environment variable LLDB_LOG is defined.

llvm-svn: 107508
2010-07-02 20:35:23 +00:00
Johnny Chen
3d7e687245 A dumber way to invoke the test suite.
Use this script to visit each python test case under the specified directory and
run python unittest.main() on each test case.

llvm-svn: 107447
2010-07-01 23:01:23 +00:00
Johnny Chen
119b53ea6d Turn on logging for debugging purposes if ${LLDB_LOG} environment variable is
is defined.  Use ${LLDB_LOG} to specify the log file.

Create a singleton SBDebugger in the lldb namespace, that gets used when running
the entire test suite.

llvm-svn: 107445
2010-07-01 22:52:57 +00:00
Johnny Chen
79046273dd Removed most of the time delay introduced in the test scripts.
Left some and added some print statements for debugging purpose.

llvm-svn: 107386
2010-07-01 05:31:44 +00:00
Johnny Chen
8c3f9187f9 Added some delay (100 ms) after executing each 'command interpreter' command;
this seems to alleviate the intermittent failure observed while running the
whole test suite.

llvm-svn: 107357
2010-07-01 00:18:39 +00:00
Johnny Chen
41a2ad5f85 Added comments.
llvm-svn: 107333
2010-06-30 22:22:37 +00:00
Johnny Chen
6ea3fc5a9f Added TestClassTypes.py to test setting a breakpoint on a class constructor and
do 'variable list this' command when stopped.

Applied some cleanup on TestArrayTypes.py.  In particular, specify the absolute
path to the object file in order not to confuse the debugger.

llvm-svn: 107330
2010-06-30 22:16:25 +00:00
Johnny Chen
20faefd329 Fixed a typo.
llvm-svn: 107318
2010-06-30 20:43:35 +00:00
Johnny Chen
94a6899e23 Add some delay before calling SBDebugger.Terminate().
llvm-svn: 107221
2010-06-29 23:17:15 +00:00
Johnny Chen
cb9b857959 Added TestArrayTypes.py for test/array_types directory.
Also modified dotest.py so that it sets the LLDB_TEST environment variable
so that individual test cases can locate their supporting files correctly.

llvm-svn: 107220
2010-06-29 23:10:39 +00:00
Johnny Chen
4657be6e63 For the time being, let's bracket the test runner within the
lldb.SBDebugger.Initialize()/Terminate() pair.

Change TestHelp.py to use synchronous debugging, which is easier to work with.

llvm-svn: 107198
2010-06-29 19:44:16 +00:00
Johnny Chen
7e363f5571 Added test for a previously fixed bug where invoking lldb command from an emacs
shell and issuing 'help' would hang (was actually infinitely looping).

llvm-svn: 107066
2010-06-28 20:55:57 +00:00
Johnny Chen
c43d789a38 No need to add the test script containing directory to sys.path more than once.
llvm-svn: 106929
2010-06-26 00:19:32 +00:00
Johnny Chen
6d436d63ff Removed debug print statements.
llvm-svn: 106913
2010-06-25 23:34:17 +00:00
Johnny Chen
f94c8c2bf9 Use lldb.SBDebugger.Create() factory method to create an instance first.
llvm-svn: 106910
2010-06-25 23:22:48 +00:00
Johnny Chen
9320d4ab60 A simple test of 'help' command and its output.
llvm-svn: 106909
2010-06-25 23:15:47 +00:00
Johnny Chen
a765c28db3 A simple testing framework for lldb using python's unit testing framework.
Tests for lldb are written as python scripts which take advantage of the script
bridging provided by LLDB.framework to interact with lldb core.

A specific naming pattern is followed by the .py script to be recognized as
a module which implements a test scenario, namely, Test*.py.

To specify the directories where "Test*.py" python test scripts are located,
you need to pass in a list of directory names.  By default, the current
working directory is searched if nothing is specified on the command line.

An example:

[14:10:20] johnny:/Volumes/data/lldb/svn/trunk/test $ ./dotest.py -v example
test_choice (TestSequenceFunctions.TestSequenceFunctions) ... ok
test_sample (TestSequenceFunctions.TestSequenceFunctions) ... ok
test_shuffle (TestSequenceFunctions.TestSequenceFunctions) ... ok

----------------------------------------------------------------------
Ran 3 tests in 0.000s

OK

llvm-svn: 106890
2010-06-25 21:14:08 +00:00
Johnny Chen
7c3f7fee41 Left a debug statement in the previous checkin.
llvm-svn: 106510
2010-06-22 00:13:20 +00:00
Johnny Chen
a02199f5e7 Remove stale reference to the lldb path component.
llvm-svn: 106509
2010-06-22 00:11:26 +00:00
Chris Lattner
30fdc8d841 Initial checkin of lldb code from internal Apple repo.
llvm-svn: 105619
2010-06-08 16:52:24 +00:00