Commit Graph

50 Commits

Author SHA1 Message Date
Todd Fiala 6817df65f0 Modify TestSettings test for stderr.txt/stdout.txt to ignore an
optional path prior to the file base name.

On Linux x86_64 (Ubuntu 12.04) I am sometimes getting a full path
on the stderr.txt.  This changes the test for target.error-path and
target.output-path settings to ignore any optional directory before
the expected file base name.

llvm-svn: 207272
2014-04-25 21:04:48 +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
Ed Maste 0508125cd4 test: FreeBSD calls the 64-bit x86 platform amd64
Also add decorator for an issue that this uncovered: llvm.org/pr18200

llvm-svn: 196920
2013-12-10 14:25:28 +00:00
Richard Mitton 5c98c9a216 Fixed TestSettings.py to correctly restore the frame format string.
This fixes TestBreakpointCommand.

llvm-svn: 191868
2013-10-03 01:50:35 +00:00
Ashok Thirumurthi bb82b84c34 Cache and restore the frame-format, so that test_set_frame_format doesn't modify the default, as required for TestInferiorAssert.py.
- Also fixes this test case to set/verify a non-default frame-format and explain the intent.

llvm-svn: 191378
2013-09-25 15:30:14 +00:00
Daniel Malea e0f8f574c7 merge lldb-platform-work branch (and assorted fixes) into trunk
Summary:
    This merge brings in the improved 'platform' command that knows how to
    interface with remote machines; that is, query OS/kernel information, push
    and pull files, run shell commands, etc... and implementation for the new
    communication packets that back that interface, at least on Darwin based
    operating systems via the POSIXPlatform class. Linux support is coming soon.

    Verified the test suite runs cleanly on Linux (x86_64), build OK on Mac OS
    X Mountain Lion.

    Additional improvements (not in the source SVN branch 'lldb-platform-work'):
    - cmake build scripts for lldb-platform
    - cleanup test suite
    - documentation stub for qPlatform_RunCommand
    - use log class instead of printf() directly
    - reverted work-in-progress-looking changes from test/types/TestAbstract.py that work towards running the test suite remotely.
    - add new logging category 'platform'

    Reviewers: Matt Kopec, Greg Clayton

    Review: http://llvm-reviews.chandlerc.com/D1493

llvm-svn: 189295
2013-08-26 23:57:52 +00:00
Daniel Malea d79ae05080 New settings: target.use-hex-immediates and target.hex-immediates-style
- Immediates can be shown as hex (either Intel or MASM style)
- See TestSettings.py for usage examples
- Verified to cause no regressions on Linux x86_64 (Ubuntu 12.10)

Patch by Richard Mitton!

llvm-svn: 187921
2013-08-07 21:54:09 +00:00
Daniel Malea 7dadf4999a Assorted test suite fixes as a result of GCC 4.8 validation efforts
- disable some TestConcurrentEvents cases (which are affected by llvm.org/pr16714 -- watchpoints in multithreaded programs)
- relax number-of-bp-locations check in TestUniqueTypes/TestUnsignedTypes
- skip TestDataFormatterStdVector cases with GCC 4.8 (known failure due to llvm.org/pr15301)
- workaround for race condition in TestHelloWorld.py
- update TestSettings.py to work on distros (like Fedora) that have /bin/cat hardlinked to /usr/bin/cat

After these changes, the test suite should run cleanly against GCC 4.8 (with DWARF v4)!

llvm-svn: 187451
2013-07-30 21:34:44 +00:00
Greg Clayton 00108408ac Added tests to test for "settings set" with trailing whitespaces after the values.
llvm-svn: 176579
2013-03-06 21:17:06 +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
Filipe Cabecinhas 0eec15acf2 Continue the cleanup started on r158737
Adds a utility class method to TestBase that checks and removes a temp
file.
Removed every use of system() to execute rm -f.

llvm-svn: 158809
2012-06-20 10:13:40 +00:00
Filipe Cabecinhas 5158f3de24 Cleanup a custom thread-format so we don't fail TestLoadUnload when running the
test suite for two architectures (the full path to d.c would appear).

llvm-svn: 157077
2012-05-18 21:35:43 +00:00
Johnny Chen 24086bc93b Second batch of adding @dsym_test/@dwarf_test decorators to existing test cases.
Plus some minor cleanup of test method names.
Third and final batch is coming.

llvm-svn: 154197
2012-04-06 19:54:10 +00:00
Johnny Chen 8cc80b2914 Followup check in for http://llvm.org/viewvc/llvm-project?rev=148491&view=rev,
where we changed the CommandObjectSettingsSet object impl to require raw command string.

Do the same for CommandObjectSettingsAppend/InsertBefore/InsertAfter classes and
add test cases for basic functionalities as well as for variable name completion.

llvm-svn: 148719
2012-01-23 19:49:28 +00:00
Johnny Chen 5928f64e2c Followup check in for http://llvm.org/viewvc/llvm-project?rev=148491&view=rev,
where we changed the CommandObjectSettingsSet object impl to require raw command string.

Do the same for CommandObjectSettingsReplace class and add two test cases; one for
the "settings replace" command and the other to ensure that completion for variable
name still works. 

llvm-svn: 148615
2012-01-21 01:45:18 +00:00
Johnny Chen a28b89c700 rdar://problem/10712130
Fixed an issue where backtick char is not properly honored when setting the frame-format variable, like the following:

(lldb) settings set frame-format frame #${frame.index}: ${frame.pc}{ ${module.file.basename}{`${function.name-with-args}${function.pc-offset}}}{ at ${line.file.basename}:${line.number}}\n
(lldb) settings show frame-format
frame-format (string) = "frame #${frame.index}: ${frame.pc}{ `${module.file.basename}{${function.name-with-args}${function.pc-offset}}}{` at ${line.file.basename}:${line.number}}\n"
(lldb)

o CommandObjectSettings.h/.cpp:

  Modify the command object impl to require raw command string instead of parsed command string,
  which also fixes an outstanding issue that customizing the prompt with trailing spaces doesn't
  work.

o Args.cpp:

  During CommandInterpreter::HandleCommand(), there is a PreprocessCommand phase which already
  strips/processes pairs of backticks as an expression eval step.  There's no need to treat
  a backtick as starting a quote.

o TestAbbreviations.py and change_prompt.lldb:

  Fixed incorrect test case/logic.

o TestSettings.py:

  Remove expectedFailure decorator.

llvm-svn: 148491
2012-01-19 19:22:41 +00:00
Johnny Chen 41b780d704 Add a test case where 'settings set frame-format' supplies a format string containing, among other things, a single backtick character.
rdar://problem/10712130

llvm-svn: 148403
2012-01-18 19:07:08 +00:00
Greg Clayton 1d8859668f Moved many of the "settings" that used to be in "target.process.*" to just
be in the target. All of the environment, args, stdin/out/err files, etc have
all been moved. Also re-enabled the ability to launch a process in a separate
terminal on MacOSX.

llvm-svn: 144061
2011-11-08 02:43:13 +00:00
Greg Clayton 4c20717a8f General cleanup on the UserSettingsController stuff. There were 5 different
places that were dumping values for the settings. Centralized all of the
value dumping into a single place. When dumping values that aren't strings
we no longer surround the value with single quotes. When dumping values that
are strings, surround the string value with double quotes. When dumping array
values, assume they are always string values, and don't put quotes around
dictionary values.

llvm-svn: 129826
2011-04-19 22:32:36 +00:00
Greg Clayton 357132eb9a Added the ability to get the min and max instruction byte size for
an architecture into ArchSpec:

uint32_t
ArchSpec::GetMinimumOpcodeByteSize() const;

uint32_t
ArchSpec::GetMaximumOpcodeByteSize() const;

Added an AddressClass to the Instruction class in Disassembler.h.
This allows decoded instructions to know know if they are code,
code with alternate ISA (thumb), or even data which can be mixed
into code. The instruction does have an address, but it is a good
idea to cache this value so we don't have to look it up more than 
once.

Fixed an issue in Opcode::SetOpcodeBytes() where the length wasn't
getting set.

Changed:

	bool
	SymbolContextList::AppendIfUnique (const SymbolContext& sc);

To:
	bool
	SymbolContextList::AppendIfUnique (const SymbolContext& sc, 
									   bool merge_symbol_into_function);

This function was typically being used when looking up functions
and symbols. Now if you lookup a function, then find the symbol,
they can be merged into the same symbol context and not cause
multiple symbol contexts to appear in a symbol context list that
describes the same function.

Fixed the SymbolContext not equal operator which was causing mixed
mode disassembly to not work ("disassembler --mixed --name main").

Modified the disassembler classes to know about the fact we know,
for a given architecture, what the min and max opcode byte sizes
are. The InstructionList class was modified to return the max
opcode byte size for all of the instructions in its list.
These two fixes means when disassemble a list of instructions and dump 
them and show the opcode bytes, we can format the output more 
intelligently when showing opcode bytes. This affects any architectures
that have varying opcode byte sizes (x86_64 and i386). Knowing the max
opcode byte size also helps us to be able to disassemble N instructions
without having to re-read data if we didn't read enough bytes.

Added the ability to set the architecture for the disassemble command.
This means you can easily cross disassemble data for any supported 
architecture. I also added the ability to specify "thumb" as an 
architecture so that we can force disassembly into thumb mode when
needed. In GDB this was done using a hack of specifying an odd
address when disassembling. I don't want to repeat this hack in LLDB,
so the auto detection between ARM and thumb is failing, just specify
thumb when disassembling:

(lldb) disassemble --arch thumb --name main

You can also have data in say an x86_64 file executable and disassemble
data as any other supported architecture:
% lldb a.out
Current executable set to 'a.out' (x86_64).
(lldb) b main
(lldb) run
(lldb) disassemble --arch thumb --count 2 --start-address 0x0000000100001080 --bytes
0x100001080:  0xb580 push   {r7, lr}
0x100001082:  0xaf00 add    r7, sp, #0

Fixed Target::ReadMemory(...) to be able to deal with Address argument object
that isn't section offset. When an address object was supplied that was
out on the heap or stack, target read memory would fail. Disassembly uses
Target::ReadMemory(...), and the example above where we disassembler thumb
opcodes in an x86 binary was failing do to this bug.

llvm-svn: 128347
2011-03-26 19:14:58 +00:00
Caroline Tice b904ca5015 Add a test case to make sure that all the settings that currently ought to
exist are actually there.

llvm-svn: 127431
2011-03-10 22:29:54 +00:00
Johnny Chen 7fa6c95b05 Add test_apropos_should_also_search_settings_description() to make sure that:
apropos 'environment variable'

searches all settings description and returns a topic related to:

    target.process.env-vars

llvm-svn: 124841
2011-02-04 00:50:49 +00:00
Caroline Tice c9c235e796 Add a few more settings tests.
llvm-svn: 124589
2011-01-31 18:18:54 +00:00
Johnny Chen 93b0c8b2aa Remove the expectedFailure decorator for the fixed bug:
rdar://problem/8435794
    settings set target.process.output-path does not seem to work

Also change the test case from test_set_output_path to test_set_error_output_path
as it now exercises both setting target.process.error-path and target.process.output-path.

llvm-svn: 124198
2011-01-25 17:39:43 +00:00
Johnny Chen 622220b66d Change the test case test_set_prompt() to no longer require quotes around lldb2 in:
# Set prompt to 'lldb2'.
   self.runCmd("settings set prompt lldb2")

llvm-svn: 122272
2010-12-20 21:29:34 +00:00
Johnny Chen f48b645423 Rearrange some statements so that the adding of teardown hook follows immediately
after the statement it wants to revert the effect of.

llvm-svn: 121813
2010-12-14 23:47:55 +00:00
Johnny Chen a245f933ba Make the TestSettings.py test cases use different output filenames:
o "output1.txt" for test_pass_host_env_vars() test case
o "output2.txt" for test_run_args_and_env_vars_with_dsym() test case
o "output2.txt" for test_run_args_and_env_vars_with_dwarf() test case

and add teardown hook to test_pass_host_env_vars() in order to properly
unset the host environment variables set while running the test case.

llvm-svn: 121811
2010-12-14 23:43:29 +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 a91b9474da Add text about test class cleanup.
llvm-svn: 117148
2010-10-22 21:06:04 +00:00
Johnny Chen 707d8228df Restoring the original setting should be done more robustly by adding a hook function
to be run during tearDown() to effect the restore action instead of executing it inline
during the test method, because the test may already fail and bailout before the inline
restore action.

Fix test_set_output_path() and pass_run_args_and_env_vars() to use this mechanism.

llvm-svn: 116881
2010-10-19 23:40:13 +00:00
Johnny Chen 030709d085 test_set_output_path() should restore the original setting of target.process.output-path
after running the program.

llvm-svn: 116873
2010-10-19 22:31:50 +00:00
Johnny Chen a913ea479e Add more descriptive messages to expect() instead of using the default assert messages.
llvm-svn: 116850
2010-10-19 19:39:20 +00:00
Johnny Chen 3343f04bf8 Add a little helper function SETTING_MSG(setting) to be used from TestSettings.test_set_output_path().
llvm-svn: 116847
2010-10-19 19:11:38 +00:00
Johnny Chen 5a7b94d97d Remove out-dated comments.
llvm-svn: 116748
2010-10-18 21:14:58 +00:00
Johnny Chen 3e9c50c7c0 Add a case to test that after 'set auto-confirm true', manual confirmation should not kick in.
Also add a more useful assert message for test_set_output_path(), which is currently decorated
with @expectedFailure.

llvm-svn: 116718
2010-10-18 17:51:45 +00:00
Johnny Chen 277c8f0f1d Wrap the rest of file reading operations inside a with block and convert a assertTrue()
usage to self.expect() which is more descriptive.

llvm-svn: 116115
2010-10-08 22:10:42 +00:00
Johnny Chen be7da21d33 Convert two instances of assertTrue() and string matching usages to self.expect()
which is more descriptive.  And wrap the file open operation inside a with block
so that close() is automatically called upon exiting the block.

llvm-svn: 116096
2010-10-08 20:01:03 +00:00
Johnny Chen 138532af06 The expected term-width output string should be put within a list, not as a list of characters.
Also uncomment the cleanup of "stdout.txt" file as part of the class cleanup routine even though
test_set_output_path() is failing right now.

llvm-svn: 116023
2010-10-08 00:47:30 +00:00
Johnny Chen bcbb69856d Change the expected term-width output string to be a substring instead of a startstring
for the test case test_set_term_width() after the recent changes.

llvm-svn: 115820
2010-10-06 19:42:37 +00:00
Johnny Chen 23cb3716df Updated test case to "settings set prompt 'lldb2'" since the '-o' option is gone.
Also added "settings set -r prompt" to reset the prompt afterwards.

llvm-svn: 114846
2010-09-27 17:36:59 +00:00
Caroline Tice daccaa9e83 Add UserSettings to Target class, making Target settings
the parent of Process settings;   add 'default-arch' as a
class-wide setting for Target.    Replace            lldb::GetDefaultArchitecture
with Target::GetDefaultArchitecture & Target::SetDefaultArchitecture.

Add 'use-external-editor' as user setting to Debugger class & update
code appropriately.

Add Error parameter to methods that get user settings, for easier
reporting of bad requests.

Fix various other minor related bugs.

Fix test cases to work with new changes.

llvm-svn: 114352
2010-09-20 20:44:43 +00:00
Johnny Chen ea9fc18163 Fixed lldb 'settings set term-widt 70' command not working.
rdar://problem/8449849

llvm-svn: 114328
2010-09-20 16:36:43 +00:00
Johnny Chen 8409284a32 Added @expectedFailure decorator for test_set_term_width().
llvm-svn: 114307
2010-09-19 02:47:18 +00:00
Johnny Chen 2fcc0e5555 Added a test case for the settings command which sets process.output-path and
checks that the launched process writes its standard output there.

llvm-svn: 114102
2010-09-16 18:26:06 +00:00
Johnny Chen 1a9f4dd5a0 Provided a mechanism for the test class to cleanup after itself once it's done.
This will remove the confusion experienced when previous test runs left some
files (both intermediate or by-product as a result of the test).

lldbtest.TestBase defines a classmethod tearDownClass(cls) which invokes the
platform-specific cleanup() function as defined by the plugin; after that, it
invokes a subclass-specific function classCleanup(cls) if defined; and, finally,
it restores the old working directory.

An example of classCleanup(cls) is in settings/TestSettings.py:

    @classmethod
    def classCleanup(cls):
        system(["/bin/sh", "-c", "rm output.txt"])

where it deletes the by-product "output.txt" as a result of running a.out.

llvm-svn: 114058
2010-09-16 01:53:04 +00:00
Johnny Chen d5e111c2c1 Added two test cases to TestSettings.py which exercise the lldb's:
(lldb) settings set process.run-args A B C
(lldb) settings set process.env-vars ["MY_ENV_VAR"]=YES

commands.  The main.cpp checks whether A, B, C is passed to main and whether
the $MY_ENV_VAR env variable is defined and outputs the findings to a file.

llvm-svn: 114031
2010-09-15 22:27:29 +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 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