Commit Graph

44 Commits

Author SHA1 Message Date
Ed Maste 135f6abd48 Fix help test cases after r226068
From: Ilia K <ki.stfu@gmail.com>
Differential Revision: http://reviews.llvm.org/D7066

llvm-svn: 226568
2015-01-20 15:13:01 +00:00
Greg Clayton 4570d3eba0 Massive test suite cleanup to stop everyone from manually having to compute "mydir" inside each test case.
This has led to many test suite failures because of copy and paste where new test cases were based off of other test cases and the "mydir" variable wasn't updated.

Now you can call your superclasses "compute_mydir()" function with "__file__" as the sole argument and the relative path will be computed for you. 

llvm-svn: 196985
2013-12-10 23:19:29 +00:00
Daniel Malea e7322b3a6f Re-apply TestHelp.py fix
llvm-svn: 185570
2013-07-03 19:29:46 +00:00
Daniel Malea 9a71a7d81b Revert commits that cause broken builds on GCC buildbots
- build fails due to PyCallable template definition inside an extern "C" scope

This commit reverts 185240, 184893 and 184608.

llvm-svn: 185560
2013-07-03 17:58:31 +00:00
Enrico Granata c20eed4280 Lots of cleanup on the SWIG wrapping layer
Now, the way SWIG wrappers call into Python is through a utility PyCallable object, which overloads operator () to look like a normal function call
Plus, using the SBTypeToSWIGWrapper() family of functions, we can call python functions transparently as if they were plain C functions
Using this new technique should make adding new Python call points easier and quicker

The PyCallable is a generally useful facility, and we might want to consider moving it to a separate layer where other parts of LLDB can use it

llvm-svn: 184608
2013-06-21 23:27:16 +00:00
Greg Clayton 1a400cf485 Fixed the version test for darwin.
llvm-svn: 178595
2013-04-03 00:04:27 +00:00
Daniel Malea 3b92f0095e Remove LLDB dependency on xcodeworkspace (on Linux) for version number
- make LLDB version number match Clang (and the Debian package)
- use the same revision detection magic that Clang uses to report SVN/Git revisions
- update test case as per above

Example output:

  $ lldb -v
  lldb version 3.3 (https://dmalea@llvm.org/svn/llvm-project/lldb/trunk revision 176211 clang revision 176208 llvm revision 176208)
ss

This line, and those below, will be ignored--

M    source/lldb.cpp
M    test/help/TestHelp.py
M    source/Makefile

llvm-svn: 176268
2013-02-28 16:51:15 +00:00
Greg Clayton 67cc06366c Reimplemented the code that backed the "settings" in lldb. There were many issues with the previous implementation:
- no setting auto completion
- very manual and error prone way of getting/setting variables
- tons of code duplication
- useless instance names for processes, threads

Now settings can easily be defined like option values. The new settings makes use of the "OptionValue" classes so we can re-use the option value code that we use to set settings in command options. No more instances, just "does the right thing".

llvm-svn: 162366
2012-08-22 17:17:09 +00:00
Johnny Chen ca7835c685 rdar://problem/11535045
Make 'help arch' return the list of supported architectures.
Add a convenience method StringList::Join(const char *separator) which is called from the help function for 'arch'.
Also add a simple test case.

llvm-svn: 157507
2012-05-26 00:32:39 +00:00
Johnny Chen 5ec8fcbf0c Fix the problem that 'help breakpoint set' is printing a lot of redundant lines.
Correctly specify the LLDB_OPT_SET's that the 'shlib' command option belongs to by using a newly added macro like this:

    #define LLDB_OPT_NOT_10 ( LLDB_OPT_SET_FROM(1, 10) & ~LLDB_OPT_SET_10 )

rdar://problem/11393864

llvm-svn: 156337
2012-05-07 23:04:49 +00:00
Johnny Chen 2ffa754a6f After discussions with Jim and Greg, modify the 'watchpoint set' command to become a mutiword command
with subcommand 'expression' and 'variable'.  The first subcommand is for supplying an expression to
be evaluated into an address to watch for, while the second is for watching a variable.

'watchpoint set expression' is a raw command, which means that you need to use the "--" option terminator
to end the '-w' or '-x' option processing and to start typing your expression.

Also update several test cases to comply and add a couple of test cases into TestCompletion.py,
in particular, test that 'watchpoint set ex' completes to 'watchpoint set expression ' and that
'watchpoint set var' completes to 'watchpoint set variable '.

llvm-svn: 150109
2012-02-08 22:37:48 +00:00
Johnny Chen 34ddc8db22 Refine the 'watchpoint set' command to now require either the '-v' option (for watching of a variable) or
the '-e' option (for watching of an address) to be present.

Update some existing test cases with the required option and add some more test cases.

Since the '-v' option takes <variable-name> and the '-e' option takes <expr> as the command arg,
the existing infrastructure for generating the option usage can produce confusing help message,
like:

  watchpoint set -e [-w <watch-type>] [-x <byte-size>] <variable-name | expr>
  watchpoint set -v [-w <watch-type>] [-x <byte-size>] <variable-name | expr>

The solution adopted is to provide an extra member field to the struct CommandArgumentData called
(uint32_t)arg_opt_set_association, whose purpose is to link this particular argument data with some
option set(s).  Also modify the signature of CommandObject::GetFormattedCommandArguments() to:

  GetFormattedCommandArguments (Stream &str, uint32_t opt_set_mask = LLDB_OPT_SET_ALL)

it now takes an additional opt_set_mask which can be used to generate a filtered formatted command
args for help message.

Options::GenerateOptionUsage() impl is modified to call the GetFormattedCommandArguments() appropriately.
So that the help message now looks like:

  watchpoint set -e [-w <watch-type>] [-x <byte-size>] <expr>
  watchpoint set -v [-w <watch-type>] [-x <byte-size>] <variable-name>

rdar://problem/10703256

llvm-svn: 150032
2012-02-08 01:13:31 +00:00
Johnny Chen 84128e640d Add a simple test case for 'help watchpoint', 'help watchpt-id', and 'help watchpt-id-list'.
llvm-svn: 140393
2011-09-23 17:57:49 +00:00
Enrico Granata 08633eea20 Adding two new options to the 'help' command:
--show-aliases (-a) shows aliases for commands, as well as built-in commands
 --hide-user-defined (-u) hides user defined commands
by default 'help' without arguments does not show aliases anymore. to see them, add --show-aliases
to have only built-in commands appear, use 'help --hide-user-defined' ; there is currently no way to hide
built-in commands from the help output
'help command' is not changed by this commit, and help is shown even if command is an alias and -a is not specified

llvm-svn: 139377
2011-09-09 17:49:36 +00:00
Johnny Chen 4cd2a8e2f4 Update the test case in light of recent change of LLDB-Info.plist to track Apple Generic Version number
from the Xcode project file.

llvm-svn: 138677
2011-08-26 23:50:10 +00:00
Johnny Chen 81ab3f5d31 Fix the 'target variable' help syntax to output one or more <variable-name>'s.
Add a simple test case for that.

llvm-svn: 138281
2011-08-22 22:22:00 +00:00
Johnny Chen 331eff3995 Fixed a crasher where entering 'help disasm' on the command line would crash lldb.
The reasom of the crash is because of a missing entry in the argument table corresponding to eArgTypeUnsignedInteger.
Add such entry and modify the call site of the crash to go through a fail-fast API to retrieve the argument table.

Add a regression test to TestHelp.py.

llvm-svn: 135206
2011-07-14 22:20:12 +00:00
Peter Collingbourne d6824de00e Modify TestHelp to search for LLDB-Info.plist in the correct place
This is required to run the test suite outside of the source tree
or on a case sensitive file system.

llvm-svn: 133460
2011-06-20 19:06:45 +00:00
Johnny Chen 24f3490467 Add comments about 'image' being an alias for 'target modules'.
llvm-svn: 130806
2011-05-03 23:55:05 +00:00
Johnny Chen 5aceec3319 Update the golden output strings to match against after the recent change.
llvm-svn: 130804
2011-05-03 23:18:45 +00:00
Johnny Chen b13ee84c26 Print out a more meaningful exception message when/if CFBundleVersion matching failed.
llvm-svn: 122985
2011-01-07 00:17:44 +00:00
Johnny Chen 849398910f Modify test_help_version() test case to be more precise in matching the version
number string as found in the resources/LLDB-info.plist file.

llvm-svn: 122930
2011-01-06 00:03:01 +00:00
Johnny Chen 31c39dac6d Add a simple command: 'version' to the command interpreter, and an accompanying
test case test_help_version().

llvm-svn: 122515
2010-12-23 20:21:44 +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 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 65045f2168 o TestStdCXXDisassembly.py:
Update the expected match string.

o lldbtest.py:

  Indicate when a command fails, even if there is nothing in the error stream.

o TestHelp.py:

  Add a regression test case for 'help image dump symtab'.

o CommandObjectHelp.cpp:

  Some of the logic branches with successful help command results were not tagged
  with a Success Status.  They are fixed now.  This is important for Python
  interaction.

llvm-svn: 116062
2010-10-08 17:21:27 +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 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 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 0c19186352 Added more informational assert message strings.
llvm-svn: 111536
2010-08-19 18:17:48 +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 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 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 7f5f2809e8 Added comment.
llvm-svn: 110066
2010-08-02 21:26:00 +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 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 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 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 9320d4ab60 A simple test of 'help' command and its output.
llvm-svn: 106909
2010-06-25 23:15:47 +00:00