Commit Graph

3636 Commits

Author SHA1 Message Date
Zachary Turner 21da1ed15b Fix ResourceWarning about unclosed file in use_lldb_suite_root.py.
llvm-svn: 257945
2016-01-15 22:22:35 +00:00
Enrico Granata b13293876c Add a symbolic link from the test directory to the actual - elsewhere located - path that contains the test cases - and teach the test suite driver to resolve paths that contain symbolic links to test cases
This is meant to reduce the typing that one needs to do to get from the test subdirectory to actual test cases. Now one can just do

$ ./dotest.py ./testcases/<yaddayaddayadda>

llvm-svn: 255741
2015-12-16 01:15:49 +00:00
Zachary Turner 4c152690be Remove `lldb.root` and just look for the file we care about.
llvm-svn: 253679
2015-11-20 17:40:57 +00:00
Ryan Brown f6660e24d7 Move go expression tests to the new location.
llvm-svn: 251835
2015-11-02 21:28:18 +00:00
Ryan Brown 998c8a1c1c Create an expression parser for Go.
The Go interpreter doesn't JIT or use LLVM, so this also
moves all the JIT related code from UserExpression to a new class LLVMUserExpression.

Differential Revision: http://reviews.llvm.org/D13073

Fix merge

llvm-svn: 251820
2015-11-02 19:30:40 +00:00
Adrian McCarthy 9e3bbb903d Add check for __main__ in dotest.py to ensure problems with multiprocessing on some Windows machines.
llvm-svn: 251549
2015-10-28 19:59:18 +00:00
Zachary Turner 06daa70385 Try to fix the linux buildbot.
It's complaining that it doesn't under the "import" command, so
I guess I need this hashbang at the beginning so that it knows
it's a Python script.

llvm-svn: 251544
2015-10-28 19:18:53 +00:00
Zachary Turner c432c8f856 Move lldb/test to lldb/packages/Python/lldbsuite/test.
This is the conclusion of an effort to get LLDB's Python code
structured into a bona-fide Python package.  This has a number
of benefits, but most notably the ability to more easily share
Python code between different but related pieces of LLDB's Python
infrastructure (for example, `scripts` can now share code with
`test`).

llvm-svn: 251532
2015-10-28 17:43:26 +00:00
Ravitheja Addepally f546b411d0 Changes for Bug 17384
Summary:
Virtual dynamic shared objects, or vdso files were 
not loaded for Linux OS.In Bug 17384 the call 
stack could not be unwinded from functions
residing in the vdso object.

This commit adds support for loading such files by
reading the Aux vectors since a vdso is invisibily 
mapped to the inferiors address space and the
 actual file is not present in the filesystem. The 
presence of the vdso is detected by inspecting 
the Aux vector for AT_SYSINFO_EHDR tag.

Reviewers: lldb-commits, ovyalov, tberghammer

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D14118

llvm-svn: 251505
2015-10-28 09:47:29 +00:00
Zachary Turner af383ff70c Preparation for turning lldbsuite into a Python package.
The idea behind this patch is to expose the meat of
LLDB's Python infrastructure (test suite, scripts, etc)
as a single package.  This makes reusability and code
sharing among sub-packages easy.

Differential Revision: http://reviews.llvm.org/D14131

llvm-svn: 251460
2015-10-27 22:33:47 +00:00
Zachary Turner 0a0490b152 Rename `lldb_shared` to `use_lldb_suite`.
llvm-svn: 251444
2015-10-27 20:12:05 +00:00
Pavel Labath e272b77120 Deprecate -m/+m dotest options in favor of test categories
Summary:
This change deprecates -m/+m dotest options (the options are still recognized but they print an
error message pointing to the new options) and adds a new lldb-mi test category instead. To just
run lldb-mi tests, use '-G lldb-mi'. To skip lldb-mi tests, use '--skip-category lldb-mi'. All
lldb-mi tests are marked as such using the getCategories method on the base MiTestCaseBase class
and the @lldbmi_test decorator is not needed. In case one still needs to annotate a specific test
function as an lldb-mi test, one can use the @add_test_categories(['lldb-mi']) decorator to
achieve that.

Reviewers: tfiala, dawn, ki.stfu, abidh

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D14060

llvm-svn: 251400
2015-10-27 09:34:34 +00:00
Pavel Labath 9e131f7fef Fix race condition in process resume
Summary:
Gdb-remote's async thread sent out the eBroadcastBitRunPacketSent message *before* actually
sending out the continue packet. Since it's this message the actually triggers the public state
transition, it could happen (and it did happen in TestAttachResume, which does an "process
interrupt" right after a continue) that we attempt to stop the inferior before it was actually
started (which obviously did not end well). This fixes the problem by moving the broadcast after
the packet was actually sent.

Reviewers: clayborg

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D14083

llvm-svn: 251399
2015-10-27 09:23:55 +00:00
Enrico Granata 6ed1d75a9f Change TestTypeCompletion to not rely on std::string
On some combination of platform and c++ library, this dependency was causing the test to fail for reasons tangential to its real objective

llvm-svn: 251368
2015-10-26 23:39:12 +00:00
Zachary Turner cd236b8cc6 Python 3: Convert uses of `callable(x)` to `six.callable(x)`.
llvm-svn: 251329
2015-10-26 18:48:24 +00:00
Zachary Turner 1411668b6a Remove use of octal literals.
Python 3 has a different syntax for octal literals than Python 2
and they are incompatible with each other.  Six doesn't provide
a transparent wrapper around this, so the most sane thing to do
is to not use octal literals.  If you need an octal literal,
use a decimal literal and if it's not obvious what the value is,
provide the value in octal as a comment.

llvm-svn: 251328
2015-10-26 18:48:14 +00:00
Greg Clayton 22fd3b1dee Fixed the test suite on MacOSX so that "test/api/multithreaded/TestMultithreaded.py" works without errors.
The problem was that the @skipIfNoSBHeaders on darwin was trying to use self.lib_dir when it hadn't been set yet.

I looked at the code and places were required to set "self.lib_dir" for no real reason as all places that used it just used the LLDB_LIB_DIR environment variable. So I removed all uses of self.lib_dir and replaced them to use 'os.environ["LLDB_LIB_DIR"]'. Did the same for self.implib_dir.

llvm-svn: 251315
2015-10-26 17:52:16 +00:00
Zachary Turner 598c661d40 Wrap call to zip() in list()
llvm-svn: 251307
2015-10-26 16:51:28 +00:00
Zachary Turner da3dea6122 Python3 - Change sys.maxint to sys.maxsize.
Python3 has no analogue to sys.maxint since ints in Python 3 have
arbitrary size.  However, the distinction was not actually important
in any of these cases, and in a few cases using maxint was already
a bug to begin with.

llvm-svn: 251306
2015-10-26 16:51:20 +00:00
Zachary Turner f67f7e31e7 Convert `long` to `int`, and portably detect all integral types.
llvm-svn: 251305
2015-10-26 16:51:09 +00:00
Zachary Turner 36b225913c Python3 - Change `dict.has_key(x)` to `x in dict`
llvm-svn: 251304
2015-10-26 16:50:51 +00:00
Zachary Turner 210eb970de Convert deprecated unittest method names.
Plural methods were long deprecated, and in Python 3 they are gone.
Convert to the actual supported method names.

llvm-svn: 251303
2015-10-26 16:50:39 +00:00
Zachary Turner 744cd5d8ed Fix usages of range() and xrange() for Python 3.
llvm-svn: 251302
2015-10-26 16:49:57 +00:00
Pavel Labath dc8b2d3d3a Port the python api decorator to use test categories
Summary:
Per discussions on the mailing list, I have implemented a decorator which annotates individual
test methods with categories. I have used this framework to replace the '-a' and '+a'
command-line switches (now '-G pyapi' and '--skip-category pyapi') and the @python_api_test
decorator (now @add_test_categories('pyapi')). The test suite now gives an error message
suggesting the new options if the user specifies the deprecated +/-a switches. If the general
direction is good, I will follow this up with other switches.

Reviewers: tberghammer, tfiala, granata.enrico, zturner

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D14020

llvm-svn: 251277
2015-10-26 09:28:32 +00:00
Dawn Perchik b5d425ecfb [lldb-mi] Fix expansion of anonymous structures and unions
A variable of type:
    struct S {
       union {
           int            i1;
           unsigned u1;
       };
       union {
           int            i2;
           unsigned u2;
       };
    };
had been impossible to evaluate in lldb-mi, because MI assigns '??' as the
variable name to each of the unnamed unions after "-var-list-children" command.
Also '??' incorrectly goes to 'exp' field which is treated by IDE as a
structure field name and is displayed in watch window.

The patch fixes this returning empty string as type name for unnamed union and
assigning $N to variable name, where N is the field number in the parent entity.

Patch from evgeny.leviant@gmail.com
Reviewed by: clayborg, abidh
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D13947

llvm-svn: 251176
2015-10-24 02:01:28 +00:00
Enrico Granata 79c4ee4d98 Lower the depth of the recursion in this test since it would on occasion timeout and add noise to test runs
llvm-svn: 251161
2015-10-24 00:15:57 +00:00
Siva Chandra 671dadd8f6 [TestBreakpointCommand] Fix after r251121
Summary:
"from __future__ import print_function" was added to the test file but
not to the embedded interpreter. This change uses file.write instead to
avoid all problems with print.

Reviewers: zturner

Subscribers: zturner, lldb-commits

Differential Revision: http://reviews.llvm.org/D14029

llvm-svn: 251150
2015-10-23 21:38:04 +00:00
Zachary Turner 58968ac83f Make uses of unicode literals portable.
Six provides six.u() which resolves to either u"" or "" depending on
Python version, and and six.unichr() which resolves to either unichr()
or chr() depending on Python version.  Use these functions anywhere
where we were relying on u"" or unichr().

llvm-svn: 251139
2015-10-23 19:52:36 +00:00
Zachary Turner 606e1e33ef Python3 - Wrap more statements in calls to list()
llvm-svn: 251129
2015-10-23 17:53:51 +00:00
Zachary Turner 3ad38749fd Remove argparse_compat.
We don't support versions of Python less than 2.7

llvm-svn: 251128
2015-10-23 17:53:30 +00:00
Zachary Turner 35d017f0fc Add from __future__ import print_function everywhere.
Apparently there were tons of instances I missed last time, I
guess I accidentally ran 2to3 non-recursively.  This should be
every occurrence of a print statement fixed to use a print function
as well as from __future__ import print_function being added to
every file.

After this patch print statements will stop working everywhere in
the test suite, and the print function should be used instead.

llvm-svn: 251121
2015-10-23 17:04:29 +00:00
Pavel Labath 69e8f5cf4e Enable the libc++ tests on linux
Summary:
The list of loaded modules which skip_if_library_missing is depending on is not available on
linux until after we run the target. This causes the tests to be wrongfully skipped. This commit
moves the skip call after the run command.

Reviewers: granata.enrico, tfiala

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D13985

llvm-svn: 251102
2015-10-23 09:17:30 +00:00
Dawn Perchik b91779eb28 [lldb-mi] display summary for simple types + refactor (use lldb formatting for all cases)
Previously, lldb did not use type summaries for simple types with no children
(like function pointers).  This patch enables MI to use lldb type summaries for
evaluation of all types of objects, so MI own formatters are no longer needed.

Patch from evgeny.leviant@gmail.com
Reviewed by: abidh
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D13799

llvm-svn: 251082
2015-10-23 00:23:53 +00:00
Zachary Turner 1c4059a0c4 Python 3 porting - Wrap returns from map() in list()
Under Python 2 this has no effect, since map() returns a list.
In Python 3 map() returns an iterable, so wrapping in a list is
necessary to keep the same semantics.

llvm-svn: 251060
2015-10-22 20:39:59 +00:00
Zachary Turner 77db4a8552 Update every test to import `lldb_shared`.
This is necessary in order to allow third party modules to be
located under lldb/third_party rather than under the test
folder directly.

Since we're already touching every test file anyway, we also
go ahead and delete the unittest2 import and main block wherever
possible.  The ability to run a test as a standalone file has
already been broken for some time, and if we decide we want this
back, we should use unittest instead of unittest2.

A few places could not have the import of unittest2 removed,because
they depend on the unittest2.expectedFailure or skip decorators.
Removing all those was orthogonal in spirit to the purpose of this
CL, so the import of unittest2 remains in those files that were
using it for its test decorators.  Those can be addressed
separately.

llvm-svn: 251055
2015-10-22 20:06:20 +00:00
Zachary Turner 7b24ff1509 Remove special case logic for finding 3rd party libs
llvm-svn: 251047
2015-10-22 19:55:18 +00:00
Zachary Turner 746bb5e457 Move third party libraries to lldb/third_party
llvm-svn: 251046
2015-10-22 19:55:01 +00:00
Todd Fiala 82ffb8e904 Fix libstdc++ data formatters on Ubuntu 15.10 x86_64
See http://reviews.llvm.org/D13964 for details.

llvm-svn: 250965
2015-10-22 00:23:38 +00:00
Greg Clayton 258c164bf7 Fix typo so that "./dotest.py --results-formatter=curses_results.Curses --results-file=/dev/stdout" works again.
llvm-svn: 250952
2015-10-21 21:55:16 +00:00
Siva Chandra 9ac7a6c51f [SBValue] Add a method GetNumChildren(uint32_t max)
Summary:
Along with this, support for an optional argument to the "num_children"
method of a Python synthetic child provider has also been added. These have
been added with the following use case in mind:

Synthetic child providers currently have a method "has_children" and
"num_children". While the former is good enough to know if there are
children, it does not give any insight into how many children there are.
Though the latter serves this purpose, calculating the number for children
of a data structure could be an O(N) operation if the data structure has N
children. The new method added in this change provide a middle ground.
One can call GetNumChildren(K) to know if a child exists at an index K
which can be as large as the callers tolerance can be. If the caller wants
to know about children beyond K, it can make an other call with 2K. If the
synthetic child provider maintains state about it counting till K
previosly, then the next call is only an O(K) operation. Infact, all
calls made progressively with steps of K will be O(K) operations.

Reviewers: vharron, clayborg, granata.enrico

Subscribers: labath, lldb-commits

Differential Revision: http://reviews.llvm.org/D13778

llvm-svn: 250930
2015-10-21 19:28:08 +00:00
Zachary Turner 814236d694 Use six to portably handle module renames in Python 2 and 3
llvm-svn: 250915
2015-10-21 17:48:52 +00:00
Adrian McCarthy da9b90ce11 Skip TestMultithreaded on Windows.
Differential Revision: http://reviews.llvm.org/D13923

llvm-svn: 250899
2015-10-21 14:42:10 +00:00
Pavel Labath baf54a8ad5 Clean up more .dwo files after the tests run
llvm-svn: 250896
2015-10-21 12:56:37 +00:00
Pavel Labath 65a16e56b9 [DataFormatters] Make libc++ list loop detection linear
Summary:
Loop detection code is being called before every element access. Although it tries to cache some
of the data by remembering the loop-free initial segment, every time it needs to increase this
segment, it will start from scratch. For the typical usage pattern, where one accesses the
elements in order, the loop detection will need to be run after every access, resulting in
quadratic behavior. This behavior is noticable even for the default 255 element limit.

In this commit, I rewrite the algorithm to be truly incremental -- it maintains the state of its
loop-detection runners between calls, and reuses them when it needs to check another segment.
This way, each part of the list is scanned only once, resulting in linear behavior.

Also note that I have changed the operator== of ListEntry to do the comparison based on the
value() function (instead of relying on ValueObjectSP equality). In my experiments, I kept
getting different ValueObjectSPs when going through the same element twice.

Reviewers: granata.enrico

Subscribers: lldb-commits, sivachandra

Differential Revision: http://reviews.llvm.org/D13902

llvm-svn: 250890
2015-10-21 10:17:21 +00:00
Zachary Turner 43a01e45f9 Use six to portably assign metaclasses in Python 2 and 3.
llvm-svn: 250859
2015-10-20 21:06:05 +00:00
Zachary Turner 8741e31876 Introduce a mechanism for reusing Python modules out of tree.
Right now our Python code does not all share a common root.  Tests and
scripts both contain python code that cannot take advantage of reusability
since they are unrelated siblings of each other.

In particular, this presents a problem for wanting to use third party
packages from both sides, since it does not make sense to copy the module
into both places.

This patch solves this by introducing a script lldb_shared.py which is a
very lightweight script that just searches up the tree until it finds a
root, and then imports a module from there.  That module knows how to
find all of the shared code that LLDB uses, and adjusts sys.path
accordingly to make them all visible.

llvm-svn: 250858
2015-10-20 21:05:57 +00:00
Pavel Labath f29914883d Increase default memory cache line size for android
Summary:
ADB packets have a maximum size of 4k. This means the size of memory reads does not affect speed
too much (as long as it fits in one packet). Therefore, I am increasing the default memory read
size for android to 2k. This value is used only if the user has not modified the default
memory-cache-line-size setting.

Reviewers: clayborg, tberghammer

Subscribers: tberghammer, danalbert, srhines, lldb-commits

Differential Revision: http://reviews.llvm.org/D13812

llvm-svn: 250814
2015-10-20 10:33:17 +00:00
Siva Chandra b1f4a50912 Adjust TestCompletion.py and TestDumpDynamic.py after recent changes.
Reviewers: zturner, spyffe

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D13882

llvm-svn: 250782
2015-10-20 01:03:18 +00:00
Zachary Turner ff890daf12 Convert print statements to print function calls.
This patch was generating by running `2to3` on the files in the
lldb/test directory.  This patch should be NFC, but it does
introduce the `from __future__ import print_function` line, which
will break future uses of the print statement.

llvm-svn: 250763
2015-10-19 23:45:41 +00:00
Enrico Granata a512103bdf Add a flakey category for flakey tests
llvm-svn: 250750
2015-10-19 22:53:34 +00:00