Commit Graph

561 Commits

Author SHA1 Message Date
Johnny Chen 0a3d1ca28e Add TestBreakpointIgnoreCount.py to exercise the breakpoint ignore count features,
with both command line and Python API tests.

llvm-svn: 121717
2010-12-13 21:49:58 +00:00
Johnny Chen 68300da996 Make the test case SourceManagerTestCase.display_source_python stronger by also
matching the source line number displayed.

llvm-svn: 121706
2010-12-13 18:59:27 +00:00
Johnny Chen f6eaba85a8 Add test_display_source_python() test case to TestSourceManager.py which uses
the lldb PyThon API SBSourceManager to display source files.

To accomodate this, the C++ SBSourceManager API has been changed to take an
lldb::SBStream as the destination for display of source lines.  Modify SBStream::ctor()
so that its opaque pointer is initialized with an StreamString instance.

llvm-svn: 121605
2010-12-11 01:20:39 +00:00
Johnny Chen de1451ef4b Make sure that @python_api_test is only used to decorate a test method, not the
test class.

llvm-svn: 121538
2010-12-10 21:33:31 +00:00
Johnny Chen 240f8c7dd1 Do not specify both '-a' and '+a' at the same time.
llvm-svn: 121501
2010-12-10 19:02:23 +00:00
Johnny Chen f3e22ac3c7 Add a '+a' command line option to the test driver to run only the Python API tests.
Add an attribute __python_api_test__ (set to True) to the @python_api_test decorated
test method to distinguish them from the lldb command line tests.

llvm-svn: 121500
2010-12-10 18:52:10 +00:00
Johnny Chen 47ed69e72c Add the @python_api_test decorator for two test cases.
llvm-svn: 121499
2010-12-10 18:42:07 +00:00
Johnny Chen 63d045d560 Fix some typo in method names and docstrings.
llvm-svn: 121494
2010-12-10 17:15:34 +00:00
Jim Ingham 484ef8003e Added some tests for ObjC stepping, step into ordinary and stret methods, and stepping
through a KVO swizzled object's method calls.

llvm-svn: 121457
2010-12-10 02:33:02 +00:00
Johnny Chen a47d7cb9b9 Add @python_api_test decorator to the remaining Test*.py files.
llvm-svn: 121448
2010-12-10 01:21:27 +00:00
Johnny Chen 8906814057 Fix a test method docstring.
llvm-svn: 121446
2010-12-10 00:58:18 +00:00
Johnny Chen 7c7d936e48 Add an infrastructure to mark the Python APIs only test using a decorator.
Example:

    @python_api_test
    def test_evaluate_expression_python(self):
        """Test SBFrame.EvaluateExpression() API for evaluating an expression."""
    ...

The opposite of Python APIs only test is an lldb command line test, which sends
commands to the lldb command interpreter.  Add a '-a' option to the test driver
to skip Python API only tests.

Modify TestExprs.py to mark a test as @python_api_test and remove an @expectedFailure
decorator as the bug has been fixed.

llvm-svn: 121442
2010-12-10 00:51:23 +00:00
Jim Ingham a58f548369 Added the source file for some ObjC stepping tests. No test yet.
llvm-svn: 121440
2010-12-10 00:27:27 +00:00
Johnny Chen 2bac54fe0c Add more module docstring.
llvm-svn: 121421
2010-12-09 22:11:59 +00:00
Johnny Chen de2c8bd877 Minor docstring change.
llvm-svn: 121419
2010-12-09 22:06:05 +00:00
Johnny Chen 67f73ac7f2 Remove unnecessary imports.
llvm-svn: 121393
2010-12-09 18:38:52 +00:00
Johnny Chen 5b3a357dec Add a test/source-manager directory for testing lldb core component SourceManager.
Initial test case test_modify_source_file_while_debugging() in TestSourceManager.py
tests the caching mechanism of the source manager.

llvm-svn: 121389
2010-12-09 18:22:12 +00:00
Johnny Chen b340e6bb15 Add more docstring for the lldb_iter() utility function which provides a compact
way of iterating through an aggregate data structure.  The added example usage
is from an actual use in test/foundation/TestSymbolTable.py:

    2. Pass a container of aggregate which provides APIs to get to the size and
       the element of the aggregate:

    # Module is a container of symbol table 
    module = target.FindModule(filespec)
    for symbol in lldb_iter(module, 'GetNumSymbols', 'GetSymbolAtIndex'):
        name = symbol.GetName()
        ...

llvm-svn: 121271
2010-12-08 19:19:08 +00:00
Johnny Chen 7b81dfd1cc Modify the TestObjCMethods2.py test to fix a typo (should be str_id, not id).
Also, add bug info for expected failures that remain:

    <rdar://problem/8741897> Expressions should support properties

llvm-svn: 121268
2010-12-08 18:14:20 +00:00
Johnny Chen 025d1b8f95 For SBTarget.Launch()/LaunchProcess(), there's no need to pass an empty string
as the args and the envs to the launched process.

o lldbtest.py:

  Forgot to check in some assertion messages changes for lldbtest.py.

o dotest.py:

  Also add "api" category to the default lldb log option list.

llvm-svn: 121220
2010-12-08 01:25:21 +00:00
Johnny Chen 0ecec99eb2 Add test_evaluate_expression_python() to exercise SBFrame.EvaluateExpression() Python API.
Launch the process with ['X', 'Y', 'Z'] as the args to make argc == 4 and verify that's the case,
plus some other EvaluateExpression() calls.

llvm-svn: 121218
2010-12-08 01:08:27 +00:00
Johnny Chen aa92f631b4 Use Python raw string literal to avoid escaping the escape sequence and to make
the command given to lldb command interpreter more readable.

llvm-svn: 121199
2010-12-07 23:12:51 +00:00
Johnny Chen 56d8ac4e80 Make the various expression command test sequences more strict by also verifying
the results against our golden ones.

llvm-svn: 121185
2010-12-07 21:17:12 +00:00
Johnny Chen 74481444ab Add a test sequence for test_expr_commands_can_handle_quotes(self):
# runCmd: command alias print_hi expression printf ("\n\tHi!")
        # output: 
        self.runCmd('command alias print_hi expression printf ("\\n\\tHi!")')
        # This fails currently.
        self.runCmd('print_hi')

and modify existing test sequences to escape the escape character '\ to prevent it
from being interpreted by Python before passing on to the lldb command interpreter.

llvm-svn: 121183
2010-12-07 20:52:36 +00:00
Johnny Chen 5be1db9c71 Remove comment no longer applied.
llvm-svn: 121178
2010-12-07 20:22:32 +00:00
Caroline Tice d9d63369df - Fix alias-building & resolving to properly handle optional arguments for command options.
- Add logging for command resolution ('log enable lldb commands')
- Fix alias resolution to properly handle commands that take raw input (resolve the alias, but
  don't muck up the raw arguments).

Net result:  Among other things, 'expr' command can now take strings with escaped characters and
not have the command handling & alias resolution code muck up the escaped characters. E.g.
 'expr printf ("\n\n\tHello there!")' should now work properly.


Not working yet:  Creating aliases with raw input for commands that take raw input.  Working on that.
e.g. 'command alias print_hi expr printf ("\n\tHi!")' does not work yet.

llvm-svn: 121171
2010-12-07 19:58:26 +00:00
Johnny Chen d43384f608 Add test/foundation/TestSymbolTable.py to exercise accessing the symbol table
entries (including synthesized properties) through the lldb Python APIs.

llvm-svn: 121168
2010-12-07 19:37:52 +00:00
Johnny Chen d732156bed 'thread backtrace', not 'thread backtrac'.
llvm-svn: 121151
2010-12-07 17:10:46 +00:00
Johnny Chen 74721273c6 The do_simple_disasm() also needs to be modified to accommodate the recent changes
to main.m.

llvm-svn: 121150
2010-12-07 17:08:16 +00:00
Johnny Chen 50ca1a4328 Add expect matching patterns for some self.expect() statements.
llvm-svn: 121077
2010-12-07 00:31:29 +00:00
Johnny Chen 3f4dc2a8a6 Add TestObjCMethods2.py to exercise more expression command sequences with objc.
Mark NSArray_expr() and NSString_expr() as currently failing.  Both are called
from dsym and dwarf builds.  So that makes the num of expected failures equal 4.

----------------------------------------------------------------------
Ran 6 tests in 19.856s

OK (expected failures=4)

llvm-svn: 121068
2010-12-06 23:50:52 +00:00
Johnny Chen 8dcb6b96c5 Minor comment string change.
llvm-svn: 121063
2010-12-06 22:51:46 +00:00
Johnny Chen e0e7febe1a More descriptive comment string.
llvm-svn: 121062
2010-12-06 22:49:11 +00:00
Johnny Chen 35986634bc Modify Test_Selector's comment string, too.
llvm-svn: 121052
2010-12-06 22:34:54 +00:00
Johnny Chen 3a820b5e54 Disambiguate the comment strings in order to be used from the .py test file.
llvm-svn: 121051
2010-12-06 22:33:00 +00:00
Johnny Chen 73b7b93d42 Modified main.m and TestObjCMethods.py to unbreak the test/foundation directory.
llvm-svn: 121046
2010-12-06 22:09:04 +00:00
Johnny Chen ccdf435a96 Forgot to also check in this file with the previous r121036 change:
/lldb/trunk/test/load_unload/TestLoadUnload.py

llvm-svn: 121045
2010-12-06 22:07:36 +00:00
Johnny Chen 224af79e80 Fail fast by raising an exception if the 'string_to_match' cannot be located
within the file 'filename'.

llvm-svn: 121039
2010-12-06 21:48:08 +00:00
Johnny Chen 42dd3ce1ae Add a test case test_lldb_process_load_and_unload_commands() for using lldb commands
'process load' and 'process unload' to load and unload shared library from lldb command
lines.

llvm-svn: 121036
2010-12-06 21:08:51 +00:00
Greg Clayton 6125206e80 Added more test case functions to cover more objective C functionality.
llvm-svn: 121027
2010-12-06 19:08:45 +00:00
Johnny Chen 761c205274 Add two test cases to exercise many expression commands:
o test_many_expr_commands()
    o test_expr_commands_can_handle_quotes()

Mark test_expr_commands_can_handle_quotes()
as @expectedFailure:

    # rdar://problem/8686536
    # CommandInterpreter::HandleCommand is stripping \'s from input for WantsRawCommand commands

llvm-svn: 121019
2010-12-06 18:24:18 +00:00
Greg Clayton 39e746e7cf Use full command to avoid "expr" alias.
Add bug number for current expected failures.

llvm-svn: 120976
2010-12-06 02:47:48 +00:00
Greg Clayton f4b0c83e69 Added a simple test case that can be used to test out the expression parser
more completely. Example expressions are in the comments.

llvm-svn: 120975
2010-12-06 02:44:26 +00:00
Johnny Chen 80554b804d Add a test method test_pass_host_env_vars to 'class SettingsCommandTestCase(TestBase)'
which tests the recently added lldb feature of automatically passing the host environment
variables to the launched process.

llvm-svn: 120871
2010-12-04 00:44:56 +00:00
Johnny Chen f10af38ba5 Forgot to also check in this file along with the TestBreakpointConditions.py change.
llvm-svn: 120861
2010-12-04 00:07:24 +00:00
Johnny Chen 038d436ac8 Test that "breakpoint modify -c ''" clears the condition for the last created
breakpoint, so that when the breakpoint hits, val = 1 instead of 3.

llvm-svn: 120859
2010-12-03 23:57:17 +00:00
Johnny Chen 729c339a1c Add the '-F' option to the test driver, which makes the running of test suite failfast.
As soon as an error or a failure is encountered, it stops the test suite.

llvm-svn: 120837
2010-12-03 19:59:35 +00:00
Johnny Chen eb3411dc41 Log just the thread name, not process/thread id for easier human reading.
llvm-svn: 120751
2010-12-02 23:31:02 +00:00
Johnny Chen 7528af2f86 When logging, enable process and thread ID recordings. Also add 'state' to the lldb
log-categories, so it now becomes "event process expr state".

llvm-svn: 120745
2010-12-02 22:47:52 +00:00
Johnny Chen 20d0b2198b For lldb loggings, prepend log lines with a timestamp. And change the default log options:
o lldb => event process expr
o gdb-remote => packets process

llvm-svn: 120725
2010-12-02 18:35:13 +00:00
Johnny Chen 5f46b89df2 On second thought, inserting a delay of 1.0 second slows down the test suite
for the types directory quite a bit and masking out potential problems.  Enable
the delay via an environment variable, instead.

llvm-svn: 120719
2010-12-02 18:03:37 +00:00
Johnny Chen 560befce38 GenericTester.generic_type_expr_tester():
Don't overwhelm the expression mechanism.  Previously, there was no delay
    between successive invocations of 'expression' command.  The test suite
    run has experienced 'Resume timed out' or similar error messages.  Now we
    currently add a sleep of 1.0 second before issuing the next 'expression'
    command.

llvm-svn: 120626
2010-12-01 23:46:33 +00:00
Johnny Chen b91cb31490 Add a mechanism of overwriting the default 1.0 second wait time between test
cases when specifying '-w' to the test driver, by using an environment variable
LLDB_TIME_WAIT_BETWEEN_TEST_CASES.

llvm-svn: 120625
2010-12-01 23:35:13 +00:00
Johnny Chen d6c05708eb Remove @expectedFailure decorator as the bug has been fixed.
llvm-svn: 120624
2010-12-01 23:15:58 +00:00
Johnny Chen 6bc1366366 TestBase.setUp() needs to make sure lldb.blacklist is not None
before iterating on it.

llvm-svn: 120623
2010-12-01 23:07:36 +00:00
Johnny Chen 75739045d3 Add a '-b blacklistFile' option to the test driver to take a file specifying the
test classes or test cases to be excludued from the test suite.

Check in an example blacklist file: blacklist.py:

"""
'blacklist' is a Python dictionary, it stores the mapping of a string describing
either a testclass or a testcase, i.e, testclass.testmethod, to the reason (a
string) it is blacklisted.

Following is an example which states that test class IntegerTypesExprTestCase
should be skipped because 'This test class crashed' and the test case
FoundationTestCase.test_data_type_and_expr_with_dsym should be skipped because
it is 'Temporarily disabled'.

blacklist = {'IntegerTypesExprTestCase': 'This test class crashed',
             'FoundationTestCase.test_data_type_and_expr_with_dsym': 'Temporarily disabled'
             }
"""

blacklist = {}

An example of invoking the test driver and specifying a blacklist file:

./dotest.py -b blacklist.py -v types

This runs the tests under 'types' directory but excludes the tests specified in
balcklist.py.

llvm-svn: 120620
2010-12-01 22:47:54 +00:00
Johnny Chen 5237e90cbe Add test cases to test that:
1. 'help image du sym' is ambiguous.
2. 'help image du line' is not ambiguous.

llvm-svn: 120587
2010-12-01 19:10:59 +00:00
Johnny Chen 19e302bc70 Remove the @expectedFailure decorator as the bug has been fixed.
llvm-svn: 120515
2010-12-01 01:01:23 +00:00
Johnny Chen c7c03d919a Add @expectedFailure decorator for a known bug:
rdar://problem/8689814 test failure: test/macosx/universal (the i386 slice does not break?)

llvm-svn: 120505
2010-12-01 00:03:17 +00:00
Johnny Chen be6fb3a85f Add expectedFailure decorator for test_help_image_dump_symtab_should_not_crash().
Possibly due to http://llvm.org/viewvc/llvm-project?rev=120484&view=rev.

llvm-svn: 120503
2010-11-30 23:57:58 +00:00
Johnny Chen 1922a8dbea Remove @skip decorators for fixed crashes.
llvm-svn: 120479
2010-11-30 22:34:19 +00:00
Johnny Chen 876e6b31f5 Skip two test classes due to:
rdar://problem/8710994 Assertion failed: (reg_info) GDBRemoteRegisterContext.cpp, line 199

llvm-svn: 120462
2010-11-30 21:09:06 +00:00
Johnny Chen 4bb6ceb764 Entire test class skipped due to:
rdar://problem/8710994 Assertion failed: (reg_info) GDBRemoteRegisterContext.cpp, line 199

llvm-svn: 120434
2010-11-30 17:59:40 +00:00
Johnny Chen ed6b6055b4 Entire test class skipped due to:
rdar://problem/8710994 Assertion failed: (reg_info) GDBRemoteRegisterContext.cpp, line 199

llvm-svn: 120432
2010-11-30 17:53:12 +00:00
Johnny Chen ad6e34609d Skipped two test cases due to seg fault while hadnling command:
Application Specific Information:
HandleCommand(command = "expression self->str")


radar:8711052

llvm-svn: 120431
2010-11-30 17:46:46 +00:00
Johnny Chen aa9bc2eca5 Entire test class skipped due to:
rdar://problem/8710994 Assertion failed: (reg_info) GDBRemoteRegisterContext.cpp, line 199

llvm-svn: 120430
2010-11-30 17:35:58 +00:00
Johnny Chen a994070040 Add comment for a branch of test logic which applies to ['clang', 'llvm-gcc'] only.
llvm-svn: 120355
2010-11-29 23:58:04 +00:00
Johnny Chen 11d2bae187 Minor comment fix.
llvm-svn: 120352
2010-11-29 23:47:40 +00:00
Johnny Chen c9ea0f8425 Add an expect() statement within breakpoint_conditions() method which tests that
the process status is indeed 'stopped' before invoking 'frame variable -t val'
command to inspect the frame variable.  When I run the test suite, it sometimes
emits an output like:

runCmd: frame variable -t val
runCmd failed!
error: you must be stopped in a valid stack frame to view frame variables.

The expect() statement inserted is to make sure that the process is stopped and
we have a valid frame.

llvm-svn: 120318
2010-11-29 20:49:09 +00:00
Johnny Chen 4921b11320 Change the variable TestBase.timeWait to the more descriptive timeWaitNextLaunch.
Increase the delta between successive test cases, enabled with the '-w' option to
the test driver, from 0.5 to 1.0 second, to arrive at a cleaner state before the
next test case.

llvm-svn: 120315
2010-11-29 20:20:34 +00:00
Johnny Chen bbda8ed39a Add comment.
llvm-svn: 120295
2010-11-29 17:52:43 +00:00
Johnny Chen 46389e9ddf When looping through the test suite more than once (repeat count > 1), we should
ignore and not enforce the signleton pattern for the LLDBTestResult class.

llvm-svn: 120294
2010-11-29 17:50:10 +00:00
Johnny Chen 601e72c88a Add TestSignedTypes.py to test that variables with signed types display correctly.
llvm-svn: 119836
2010-11-19 20:35:15 +00:00
Johnny Chen beae523a20 Fill in more test sequences for Python API SBFrame.LookupVarInScope(name, scope).
Change SBFrame::LookupVarInScope() to also work with "global" scope in addition
to "local" and "parameter" scope.

llvm-svn: 119811
2010-11-19 18:07:14 +00:00
Johnny Chen 835a88cb15 Add Python API tests for file and class static variables, too.
llvm-svn: 119758
2010-11-18 23:33:43 +00:00
Johnny Chen 3df7f94fd0 Add a test for displaying file and class static variables.
llvm-svn: 119734
2010-11-18 20:35:54 +00:00
Johnny Chen b4d59f477b Remove whitespace chars.
llvm-svn: 119732
2010-11-18 20:20:18 +00:00
Jim Ingham 0d8bcc79f4 Added an "Interrupted" bit to the ProcessEventData. Halt now generates an event
with the Interrupted bit set.  Process::HandlePrivateEvent ignores Interrupted events.
DoHalt is changed to ensure that the stop even is processed, and an event with
the Interrupted event is posted.  Finally ClangFunction is rationalized to use this
facility so the that Halt is handled more deterministically.

llvm-svn: 119453
2010-11-17 02:32:00 +00:00
Johnny Chen 80e6db9c79 Make the string matching for 'frame variable' more stringent with respect to
output from clang and llvm-gcc compiled program; both generate the correct debug
info with respect to the typedef scoped inside a namespace.

Add a TestBase.getCompiler(self) method which returns the compiler in effect the
test suite is now running with.  Subclasses (like TestNamespace) can use it to
distinguish among different compilers.

llvm-svn: 119445
2010-11-17 00:52:41 +00:00
Johnny Chen ecb072d840 Add an option '-# count' to run the specified test suite for a said number of times.
This is not to be used during normal test suite run, but to be used to stress test
specific test sequences repeatedly.

Example:

./dotest.py -# 3 -v breakpoint_conditions

will repeat the test suite 3 times for tests under the breakpoint_conditions directory.

llvm-svn: 119399
2010-11-16 22:42:58 +00:00
Johnny Chen 7826b0a721 Disambiguate the name lookup for the data type of anon_uint variable.
llvm-svn: 119353
2010-11-16 18:11:55 +00:00
Johnny Chen 13e64a7411 Check in a test case for rdar://problem/8668740:
'frame variable' output for namespace variables look wrong

llvm-svn: 119172
2010-11-15 19:10:53 +00:00
Johnny Chen 8ed80e6360 Add radar info for failed expression command test sequences which are now commented out.
llvm-svn: 119171
2010-11-15 18:49:03 +00:00
Johnny Chen 913af510c7 Also add a test for "frame variable '(anonymous namespace)::i'",
plus expression command using fully qualified names.

llvm-svn: 119168
2010-11-15 18:40:06 +00:00
Johnny Chen 6ba9d1f944 Add test sequences for 'frame variable' address-of operator and 'frame variable' fully-qualified name variable.
Also add some comments.

llvm-svn: 119165
2010-11-15 18:27:57 +00:00
Johnny Chen 92dac7ae1b Add test sequence for 'frame variable this' and 'expression this' when stopped
inside a ctor.

llvm-svn: 119162
2010-11-15 18:04:54 +00:00
Johnny Chen deac523f7c Remove the @expectedFailure decorator and uncomment 'expression -- i + j" test,
as both rdar://problem/8659840 and rdar://problem/8660275 have been fixed.

llvm-svn: 119160
2010-11-15 17:42:22 +00:00
Greg Clayton cb7e3b3505 Added quotes around names that are being lookup up or inspected in the
expression logging.

Added some properties to the "objc" test. The expression parser can currently
display properties that are backed by the default functions "expr myStr.string"
will work. But it won't currently work when the property is backed by a 
different function such as "expr myStr.date".

llvm-svn: 119103
2010-11-15 01:47:11 +00:00
Greg Clayton 5a2c6d583d Fixed the initWithNSString: function to properly initialize self.
llvm-svn: 119091
2010-11-14 23:12:29 +00:00
Johnny Chen 27e50be528 Implement TODO's of using expression command to set vaiables and to verify that
they are displayed correctly.

llvm-svn: 118930
2010-11-12 21:50:28 +00:00
Johnny Chen 6df2cd3fbf Add information for two bugs exposed by this test file.
llvm-svn: 118869
2010-11-12 01:00:56 +00:00
Johnny Chen 99ff489086 Run commands 'expression self->str' and 'expression self->date'.
They should not fail.

llvm-svn: 118868
2010-11-12 00:55:31 +00:00
Johnny Chen 064d7f5e4e Fix the @expectedFailure usage error and add a commented out section of code to
exercise 'expression' command on namespaced variables.

llvm-svn: 118867
2010-11-12 00:50:45 +00:00
Johnny Chen 1e57493196 Add @expectedFailure decorator for test_with_dwarf_and_run_command() test method:
rdar://problem/8659840
    test failure: ./dotest.py -v -t -f NamespaceTestCase.test_with_dwarf_and_run_command

llvm-svn: 118861
2010-11-12 00:00:15 +00:00
Johnny Chen 285371e32a The session log entry containing the command to rerun the same test now also includes
the architecture and compiler specs.

llvm-svn: 118860
2010-11-11 23:54:12 +00:00
Johnny Chen 3d57ee7b43 Add TestNamespace.py to exercise printing of anonymous and named namespace variables.
llvm-svn: 118856
2010-11-11 23:29:54 +00:00
Johnny Chen 667429d6b1 Simplify Makefile.
llvm-svn: 118851
2010-11-11 22:58:37 +00:00
Johnny Chen 5f98696f51 Add help message for the scenario of using lldb.py module distributed by Xcode4
to invoke the test driver.

llvm-svn: 118847
2010-11-11 22:14:56 +00:00
Johnny Chen cdab9f1933 Make clang happy.
llvm-svn: 118839
2010-11-11 21:22:12 +00:00
Johnny Chen c043de11e8 Fixed compilation warnings emitted by clang.
Plus make finding the break line number in main.cpp more robust.

llvm-svn: 118832
2010-11-11 20:18:36 +00:00