Commit Graph

1299 Commits

Author SHA1 Message Date
Zachary Turner e73a0601bd Python 3 - Port use of string.maketrans and don't use sets.Set.
`sets.Set` has been deprecated in favor of `set` since 2.6, and
`string.maketrans` has to be special cased.  In Python 3 there
is `str.maketrans`, `bytes.maketrans`, and `bytearray.maketrans`
and you have to choose the correct one.  So we need to introduce
a runtime version check at this site.

llvm-svn: 252348
2015-11-06 21:37:33 +00:00
Zachary Turner 5821f79714 Python 3 - Use the exec function, not the exec statement.
exec statement is gone in Python 3, this version works in both.

llvm-svn: 252347
2015-11-06 21:37:21 +00:00
Zachary Turner 5cb8e67b17 Don't use module internal implementation details in our decorators.
We tried implementing something akin to a conditionalExpectedFailure
decorator for unittest2.  We did this by making use of some
implementation details of the unittest2 module.  In an effort to make
this work with unittest, this patch removes the reliance on the
implementation details.  I have a hard time wrapping my head around
how this all works with the deeply nested decorators, but the spirit
of the patch here is to do do the following: If the condition function
is true, use the original unittest2.expectedFailure decorator.  Otherwise
don't use any decorator, just call the test function.

Differential Revision: http://reviews.llvm.org/D14406
Reviewed By: tberghammer, labath

llvm-svn: 252326
2015-11-06 18:14:42 +00:00
Zachary Turner f0c3f68e33 Make Windows always use multiprocessing-pool.
We still see "Too many file handles" errors on Windows even with
lower numbers of cores.  It's not clear what the right balance is,
and the bar seems to move as more tests get added.  So just use
the strategy that works until we can investigate more deeply.

llvm-svn: 252325
2015-11-06 18:14:31 +00:00
Chaoren Lin f2a37eeb8f Another import fix for OS X.
llvm-svn: 252230
2015-11-05 23:19:27 +00:00
Chaoren Lin 18da38edb3 Fix OS X tests.
llvm-svn: 252218
2015-11-05 22:00:47 +00:00
Zachary Turner c1b7cd72db Python 3 - Turn on absolute imports, and fix existing imports.
Absolute imports were introduced in Python 2.5 as a feature
(e.g. from __future__ import absolute_import), and made default
in Python 3.

When absolute imports are enabled, the import system changes in
a couple of ways:

1) The `import foo` syntax will *only* search sys.path.  If `foo`
   isn't in sys.path, it won't be found.  Period.  Without absolute
   imports, the import system will also search the same directory
   that the importing file resides in, so that you can easily
   import from the same folder.

2) From inside a package, you can use a dot syntax to refer to higher
   levels of the current package.  For example, if you are in the
   package lldbsuite.test.utility, then ..foo refers to
   lldbsuite.test.foo.  You can use this notation with the
   `from X import Y` syntax to write intra-package references.  For
   example, using the previous locationa s a starting point, writing
   `from ..support import seven` would import lldbsuite.support.seven

Since this is now the default behavior in Python 3, this means that
importing from the same directory with `import foo` *no longer works*.
As a result, the only way to have portable code is to force absolute
imports for all versions of Python.

See PEP 0328 [https://www.python.org/dev/peps/pep-0328/] for more
information about absolute and relative imports.

Differential Revision: http://reviews.llvm.org/D14342
Reviewed By: Todd Fiala

llvm-svn: 252191
2015-11-05 19:22:28 +00:00
Chaoren Lin fc5d9dd4b5 Fix TestGoFormatters.py.
llvm-svn: 252133
2015-11-05 02:17:21 +00:00
Zachary Turner e6ba053037 Python 3 - Don't use `os.path.walk`, it's removed in Py3.
It was deprecated even in 2.7, but not removed until 3.x.  os.walk
provides all of the same functionality and is the correct way to
do this now.

llvm-svn: 252127
2015-11-05 01:33:54 +00:00
Zachary Turner 5167115cf6 Python 3 - Use universal_newlines=True in subprocess.Popen.
This follows the spirit of a previous patch which did essentially
the same thing.  In Python 3, when you use Popen.communicate(),
you get back a bytes object which cannot normally be treated as
a string.  We could decode this manually, but universal_newlines=True
does this automatically, and there's no disadvantage to doing so
even on Python 2.  So just enable it always.

llvm-svn: 252126
2015-11-05 01:33:44 +00:00
Enrico Granata 5f92a130ff Teach LLDB how to directly launch processes on the iOS simulator
This allows for command-line debugging of iOS simulator binaries (as long as UI is not required, or a full UI simulator has previously been otherwise launched), as well as execution of the LLDB test suite on the iOS simulator

This is known to compile on OSX 10.11 GM - feedback from people on other platforms and/or older versions of OSX as to the buildability of this code is greatly appreciated

llvm-svn: 252112
2015-11-05 00:46:25 +00:00
Ryan Brown 2dd84882fc Add go data formatters.
Differential Revision: http://reviews.llvm.org/D13878

llvm-svn: 252109
2015-11-05 00:24:36 +00:00
Zachary Turner 88a12f5526 Handle keyword args on our patched Popen methods.
Python 3 introduces the `timeout` keyword argument on Popen.wait().
If our patched version doesn't support keyword arguments, then when
the internal Python implementation attempts to call wait() with the
keyword argument, things will explode.

Such as my head, after I finally figured out what was happening.

llvm-svn: 252092
2015-11-04 23:03:21 +00:00
Todd Fiala d8078ffcfc Fix test infrastructure when using xunit output.
Our test reporting infrastructure needed module names to change based on the python package layout.

llvm-svn: 252058
2015-11-04 17:10:40 +00:00
Zachary Turner bbc5b46a10 Python 3 - Use universal_newlines when calling subprocess.check_output
By default in Python 3, check_output() returns a program's output as
an encoded byte sequence.  This means it returns a Py3 `bytes` object,
which cannot be compared to a string since it's a different fundamental
type.

Although it might not be correct from a purist standpoint, from a
practical one we can assume that all output is encoded in the default
locale, in which case using universal_newlines=True will decode it
according to the current locale.  Anyway, universal_newlines also
has the nice behavior that it converts \r\n to \n on Windows platforms
so this makes parsing code easier, should we need that.  So it seems
like a win/win.

llvm-svn: 252025
2015-11-04 01:03:47 +00:00
Enrico Granata b766292951 Fix an issue where LLDB would truncate summaries for string types without producing any evidence thereof
llvm-svn: 252018
2015-11-04 00:02:08 +00:00
Zachary Turner bac6e4f75b Introduce seven.cmp_ and use it instead of cmp
llvm-svn: 251982
2015-11-03 21:37:27 +00:00
Zachary Turner 19474e1801 Remove `use_lldb_suite` from the package, and don't import it anymore.
This module was originally intended to be imported by top-level
scripts to be able to find the LLDB packages and third party
libraries.  Packages themselves shouldn't need to import it,
because by the time it gets into the package, the top-level
script should have already done this.  Indeed, it was just
adding the same values to sys.path multiple times, so this
patch is essentially no functional change.

To make sure it doesn't get re-introduced, we also delete the
`use_lldb_suite` module from `lldbsuite/test`, although the
original copy still remains in `lldb/test`

llvm-svn: 251963
2015-11-03 19:20:39 +00:00
Zachary Turner bb03a4660f Python 3 - Don't use `commands` module anymore.
The `commands` module was deprecated in 2.7 and removed in 3.x.
As a workaround, we introduce a new module `seven` in
lldbsuite.support, and write helper functions in there that delegate
to the commands module if it is available, and re-implement their
functionality for cases where it is not available.

llvm-svn: 251959
2015-11-03 18:55:22 +00:00
Pavel Labath 63103c9279 Fix flakyness in TestWatchLocationWithWatchSet
Two threads in the test can hit the watchpoint simultaneously. Fix the test to account for that.

llvm-svn: 251954
2015-11-03 18:17:21 +00:00
Tamas Berghammer 53feb8c10b Skip TestBacktraceAll on android-arm
The android compiler can't compile the inferior because of an issue
in the standard library.

llvm-svn: 251951
2015-11-03 18:03:47 +00:00
Pavel Labath daa51d4a96 Leave TestAttachResume as flakey on linux
there must be (at least) one more race hidden there...

llvm-svn: 251950
2015-11-03 17:33:31 +00:00
Pavel Labath 862432c90e Fix race during process detach
Summary:
The code which was preventing the usage of the OS plugin while detach is in
progress also prevented us to update the thread list correctly. This resulted
in an empty thread list, which confused the detaching logic. Change the
condition do only do what it says (disable the usage of the OS plugin).

Reviewers: clayborg, jingham

Subscribers: lldb-commits

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

llvm-svn: 251932
2015-11-03 16:05:18 +00:00
Ravitheja Addepally 46bcbaafb5 Changes for Bug 25251
Summary:
The solution to bug 24074,rL249673 needed
to parse the function information from the Dwarf in order
to set the SymbolContext. For that, GetFunction was called
for the parent in GetTypeForDIE, which parses the
ChildParameters and in the flow, GetTypeForDIE was called
for one of the sibling die and so an infinite
loop was triggered by calling GetFunction repeatedly for the
same function.

The changes in this revision modify the GetTypeForDIE to only
resolve the function context in the Type Lookup flow and so
prevent the infinite loop.

A testcase has also been added to check for regression in the
future and a test vector had been added to the testcase of
24074.

Reviewers: jingham, tberghammer, clayborg

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

llvm-svn: 251917
2015-11-03 14:24:24 +00:00
Zachary Turner 95c453a221 Tighten up sys.path, and use absolute imports everywhere.
For convenience, we had added the folder that dotest.py was in
to sys.path, so that we could easily write things like
`import lldbutil` from anywhere and any test.  This introduces
a subtle problem when using Python's package system, because when
unittest2 imports a particular test suite, the test suite is detached
from the package.  Thus, writing "import lldbutil" from dotest imports
it as part of the package, and writing the same line from a test
does a fresh import since the importing module was not part of
the same package.

The real way to fix this is to use absolute imports everywhere.  Instead
of writing "import lldbutil", we need to write "import
lldbsuite.test.util".  This patch fixes up that and all other similar
cases, and additionally removes the script directory from sys.path
to ensure that this can't happen again.

llvm-svn: 251886
2015-11-03 02:06:18 +00:00
Pavel Labath 2a3dc2526b Fix usage of removed decorator in TestExpressions
llvm-svn: 251880
2015-11-03 01:39:03 +00:00
Pavel Labath 23d59c5c0f Revert "Make new dotest.py executable"
This was a misunderstanding on my part. The new dotest.py is not meant to be executed directly.

llvm-svn: 251863
2015-11-02 23:41:44 +00:00
Pavel Labath 05e1f49478 Revert "Remove the __import__ hack of lldbtest_config."
The hack still seems to be necessary. Putting it back in until we figure out why.

llvm-svn: 251862
2015-11-02 23:39:09 +00:00
Enrico Granata adb4d36d76 This test case does not actually depend on Cocoa; Foundation is good enoguh
llvm-svn: 251861
2015-11-02 23:37:55 +00:00
Zachary Turner 9dbf62f927 Create lldbsuite.support package with `seven` file.
This file will be useful for filling in the gaps where `six` is
missing some things we need.

llvm-svn: 251847
2015-11-02 22:41:01 +00:00
Ryan Brown f6660e24d7 Move go expression tests to the new location.
llvm-svn: 251835
2015-11-02 21:28:18 +00:00
Pavel Labath 48c6b52f92 [dosep] Fix-up callers of process_dir, after it got its argument removed
llvm-svn: 251830
2015-11-02 20:54:25 +00:00
Zachary Turner 2264df40df Remove the __import__ hack of lldbtest_config.
I think the underlying problem was fixed by r251819, but I can't
reproduce the problem.  So this is to check whether it does in
fact fix the problem.

llvm-svn: 251822
2015-11-02 19:38:58 +00:00
Zachary Turner 7d564544eb Make dosep correctly invoke the top-level script when forking out
packages/Python/lldbsuite is now a Python package, and it relies
on its __init__.py being called to do package-level initialization.
If you exec packages/Python/lldbsuite/dotest.py directly, you won't
get this package level initialization, and things will fail.  But
without this patch, this is exactly what dosep itself does.  To
launch the multi-processing fork, it was hardcoding a path to
dotest.py and exec'ing it from inside the package.

The fix here is to get the path of the top-level script, and
then exec'ing that instead.  A more robust solution would involve
refactoring the code so that dosep execs some internal script that
imports lldbsuite, but that's a bit more involved.

Differential Revision: http://reviews.llvm.org/D14157
Reviewed by: Todd Fiala

llvm-svn: 251819
2015-11-02 19:19:49 +00:00
Hafiz Abid Qadeer c10e82087b Handle the options and parameters separator in every MI command
Summary:
As per the following link, the "--" separator can appear between the options
and parameters of any MI command. Previously this separator was only
handled by the `-data-disassemble` MI command. I have moved the relevant
code into `CMICmdBase` so that any MI command can handle the
aforementioned separator.

https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Input-Syntax.html#GDB_002fMI-Input-Syntax

Reviewers: ki.stfu

Subscribers: lldb-commits

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

llvm-svn: 251793
2015-11-02 11:43:40 +00:00
Enrico Granata 2ef8822951 Harden this test case to do the right thing in the face of compiler changes
llvm-svn: 251732
2015-10-31 01:19:27 +00:00
Pavel Labath fe1eb306fe Mark another TestEvents test as flaky on linux
I don't think anything has changed recently - the test was always flaky, but
only very rarely. Still, it is causing noise in the buildbots.

llvm-svn: 251699
2015-10-30 14:08:19 +00:00
Pavel Labath 4761f782e1 Make new dotest.py executable
llvm-svn: 251684
2015-10-30 03:52:27 +00:00
Enrico Granata 8627209b43 Some test cases that need the lldbExec path were failing because lldbExec was turning out to be None even though it was being validly set by dotest.py
It turns out that lldbtest_config was being imported locally to "lldbsuite.test" instead of globally, so when the test cases got individually brought by a global import via __import__ by unittest2, they did not see the lldbtest_config import, and ended up importing a new separate copy of it, with lldbExec unset

This is a simple hackaround that brings lldbtest_config to global visibility and makes sure the configuration data is correctly shared

llvm-svn: 251678
2015-10-30 01:09:54 +00:00
Enrico Granata 7a33621fa5 Add a --offset option to memory read that allows one to specify, given a type, how many sizeof(type) bytes to speak before starting to read memory
llvm-svn: 251668
2015-10-29 23:40:24 +00:00
Jim Ingham 72b5f9bb97 Give the test class it's own name (it was reusing the name from TestCompletions.py).
llvm-svn: 251657
2015-10-29 21:54:50 +00:00
Hafiz Abid Qadeer d122fd8d06 Better handle the arguments common to all MI commands.
Summary:
I observed that eclipse was passing --thread-group for many other commands
then we are currently handling. Looking at the MI documentation, the
following link states that each MI command accept the --thread and
--frame option. Looking at the GDB implementation, it seems that apart
from these 2, --thread-group is also handled the same way.

https://sourceware.org/gdb/onlinedocs/gdb/Context-management.html#Context-management

So instead of handling those arguments in every comamnds, I have moved
them into the base class and removed them from elsewhere. Now any command
can use these arguments. The patch seems big but most of the changes are
mechanical.

Reviewers: ki.stfu

Subscribers: lldb-commits

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

llvm-svn: 251636
2015-10-29 16:30:47 +00:00
Pavel Labath 7d557910c6 Fix flakyness in TestChangeProcessGroup
The test was verifying that the pid of the child is not equal to its process
group by searching for text substrings. This failed in the rare cases when the
pid actually *was* a substring of the process group (even though they were not
equal).

Change the test to use SB API and do proper numeric comparisons.

llvm-svn: 251626
2015-10-29 13:44:09 +00:00
Pavel Labath 5935dbdf29 Leave TestAttachResume as flakey on linux
there must be (at least) one more race hidden there...

llvm-svn: 251590
2015-10-29 01:18:45 +00:00
Enrico Granata 9685074fd3 Skip this test is the test suite is running in a mode where it has no WindowServer access
llvm-svn: 251559
2015-10-28 22:08:09 +00:00
Oleksiy Vyalov acd0a5cfba Mark TestHelloWorld and TestInferiorAssert.py as XFAIL due llvm.org/pr25338.
llvm-svn: 251542
2015-10-28 18:36:11 +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
Zachary Turner 9e84535351 Fix line endings to be LF instead of CRLF.
llvm-svn: 251462
2015-10-27 22:54:46 +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