Commit Graph

286 Commits

Author SHA1 Message Date
Tamas Berghammer 6698d84286 Limit the lenght of the file name of the log file for tests
If a test have very long name and the compiler specified with (a long)
full path then the name of the log file name can exceed 255 characters.
This change replace the full compiler path with just the compiler name
if the prior would cause a too long file name.

Differential revision: http://reviews.llvm.org/D8252

llvm-svn: 232024
2015-03-12 10:24:11 +00:00
Ilia K d9953052e3 Skip AsanTestCase and AsanTestReportDataCase on Darwin
Summary:
This patch skips tests which cause the following error:
```
1: test_with_dsym (TestMemoryHistory.AsanTestCase) ... 
os command: make clean ; make MAKE_DSYM=YES ARCH=x86_64 CC="/Users/IliaK/p/llvm/build_ninja/bin/clang" 
with pid: 9475
stdout: rm -f "a.out"  main.o main.d main.d.tmp  
rm -f -r "a.out.dSYM"
/Users/IliaK/p/llvm/build_ninja/bin/clang  -fsanitize=address -fsanitize-address-field-padding=1 -g -arch x86_64   -I/Users/IliaK/p/llvm/tools/lldb/test/make/../../include   -c -o main.o main.c
/Users/IliaK/p/llvm/build_ninja/bin/clang  main.o  -fsanitize=address -fsanitize-address-field-padding=1 -g -arch x86_64   -I/Users/IliaK/p/llvm/tools/lldb/test/make/../../include   -o "a.out"

stderr: clang: error: unknown argument: '-fsanitize-address-field-padding=1'
clang: error: unsupported argument 'address' to option 'fsanitize='
ld: file not found: /Users/IliaK/p/llvm/build_ninja/bin/../lib/clang/3.7.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
clang-3.7: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [a.out] Error 1

retcode: 2


ERROR

os command: make clean 
with pid: 9521
stdout: rm -f "a.out"  main.o main.d main.d.tmp  
rm -f -r "a.out.dSYM"

stderr: 
retcode: 0


Restore dir to: /Users/IliaK/p/llvm/tools/lldb

======================================================================
ERROR: test_with_dsym (TestMemoryHistory.AsanTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/IliaK/p/llvm/tools/lldb/test/lldbtest.py", line 612, in wrapper
    func(*args, **kwargs)
  File "/Users/IliaK/p/llvm/tools/lldb/test/lldbtest.py", line 456, in wrapper
    return func(self, *args, **kwargs)
  File "/Users/IliaK/p/llvm/tools/lldb/test/functionalities/asan/TestMemoryHistory.py", line 24, in test_with_dsym
    self.buildDsym (None, compiler)
  File "/Users/IliaK/p/llvm/tools/lldb/test/lldbtest.py", line 1496, in buildDsym
    if not module.buildDsym(self, architecture, compiler, dictionary, clean):
  File "/Users/IliaK/p/llvm/tools/lldb/test/plugins/builder_darwin.py", line 16, in buildDsym
    lldbtest.system(commands, sender=sender)
  File "/Users/IliaK/p/llvm/tools/lldb/test/lldbtest.py", line 370, in system
    raise CalledProcessError(retcode, cmd)
CalledProcessError: Command 'make clean ; make MAKE_DSYM=YES ARCH=x86_64 CC="/Users/IliaK/p/llvm/build_ninja/bin/clang" ' returned non-zero exit status 2
Config=x86_64-clang
----------------------------------------------------------------------
```

Also this patch fixes findBuiltClang() by looking a clang in the build folder.

BTW, another patch was made in October 2014, but it wasn't committed: http://reviews.llvm.org/D6272.

Reviewers: abidh, zturner, emaste, jingham, jasonmolenda, granata.enrico, DougSnyder, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits, DougSnyder, granata.enrico, jasonmolenda, jingham, emaste, zturner, abidh, clayborg

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

llvm-svn: 232016
2015-03-12 07:19:41 +00:00
Tamas Berghammer 04f51d1413 Refactor GdbRemote test cases to support remote platforms
Previously these test cases execute lldb-server on the host and run the
tests against it even if a remote platform was specified. With this CL
these tests always test the communication with an lldb-server instance
running on the target.

Differential revision: http://reviews.llvm.org/D8202

llvm-svn: 231922
2015-03-11 13:51:07 +00:00
Robert Flack 8cc4cf178c Rename test/tools/lldb-gdbserver to test/tools/lldb-server
As requested in http://reviews.llvm.org/D7545 this change moves test/tools/lldb-gdbserver to test/tools/lldb-server ot match the name of the target being tested.

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

llvm-svn: 231479
2015-03-06 14:36:33 +00:00
Vince Harron bc477ddee0 Linux - debugging of local processes via lldb-gdbserver
Instead of lldb calling the ptrace APIs directly, it launches an llgs
instance and communicates with it via the remote debug protocol.

This has two advantages.

There is more code shared between the remote debugging code path
and the local debugging code path. If a feature works in remote, it
probably works locally and vice-versa.

It makes us more architecturally similar to OSX (which also does
local debugging via a connection to debugserver).

This path is called LLGS local. We think that this configuration is
now at parity with (or better than) local linux debugging.

It is currently invoked if you have an environment variable defined
"PLATFORM_LINUX_FORCE_LLGS_LOCAL"

We would like to switch to LLGS local as the default path and only
use the non-LLGS path if someone has an environment variable defined
"PLATFORM_LINUX_DISABLE_LLGS_LOCAL"

Later, if all goes well, we would like to remove non-LLGS local
debugging support to simplify the codebase and avoid confusion.

llvm-svn: 230919
2015-03-01 23:21:29 +00:00
Tamas Berghammer 765b5e5bfe Remove use_pthread option from getBuildFlags in the test environment
Removing the option to require the usage of pthread based on an argument
of the getBuildFlags method in lldbtest.py because it can be specified
by a variable in the makefile for the given test case. Using the
variable in the makefile works in all supported platforms.

Differential revision: http://reviews.llvm.org/D7861

llvm-svn: 230493
2015-02-25 13:26:28 +00:00
Ilia K 47448c2162 Except only EIO errors of OSError exception in Base.deletePexpectChild() in lldbtest.py after r227086
llvm-svn: 228877
2015-02-11 21:41:58 +00:00
Oleksiy Vyalov 1ef7b2c897 Extend SBPlatform with capability to launch/terminate a process remotely. Integrate this change into test framework in order to spawn processes on a remote target.
http://reviews.llvm.org/D7263

llvm-svn: 228230
2015-02-04 23:19:15 +00:00
Chaoren Lin 72b8f05878 Mark several tests as XFAIL with new expectedFailureLLGS decorator since they are failing in Darwin for the same reason.
llvm-svn: 227925
2015-02-03 01:51:18 +00:00
Hafiz Abid Qadeer a73d1ce74f Also except OSError when terminating a child.
Ilia K <ki.stfu@gmail.com> sent this patch. He noted that it was possible for
child to be terminated after isAlive call and before we send it quit command.
In this case, sending command to it causes OSError. This patch just adds this
exception to the except list.

llvm-svn: 227086
2015-01-26 12:03:05 +00:00
Oleksiy Vyalov 49b71c609c Make OSX test run firewall friendly.
http://reviews.llvm.org/D7115

llvm-svn: 226856
2015-01-22 20:03:21 +00:00
Greg Clayton 7099558499 Fix inlined test cases so they print out the correct command to run when they fail instead of printing out incorrect information.
To fix this I added a new method to TestBase:

    def getRerunArgs(self):
        return " -f %s.%s" % (self.__class__.__name__, self._testMethodName)
        
The InlineTest which inherits from TestBase then overrides this function with a custom version which does the right thing.

llvm-svn: 225407
2015-01-07 22:25:50 +00:00
Zachary Turner 80c2c60f36 XFAIL all of TestInferiorAssert.py tests on Windows.
Getting this working correctly is a significant amount of work.
Assertions on Windows show up as error code 0xC0000409, which is
STATUS_STACK_BUFFER_OVERRUN.  In order to accurately determine
that this is not just any stack buffer overrun, but one triggered
by a call to abort, we would need to analyze the call stack.  This
in turn requires better symbol support for Windows executables,
and work on LLDB to make stack frames better on Windows.

For now, these are XFAIL'ed and tracked in http://llvm.org/pr21793.

llvm-svn: 223816
2014-12-09 19:28:00 +00:00
Zachary Turner be40b2f1b2 Fix broken test suite on Windows after r223091.
Differential Revision: http://reviews.llvm.org/D6484
Reviewed by: Oleksiy Vyalov

llvm-svn: 223155
2014-12-02 21:32:44 +00:00
Oleksiy Vyalov a3ff6af484 Fix several test failures on Linux/FreeBSD caused by compiler configuration and invalid environment - make lldbtest.registerSharedLibrariesWithTarget to support multiple platforms.
http://reviews.llvm.org/D6392

llvm-svn: 223091
2014-12-01 23:21:18 +00:00
Oleksiy Vyalov dc4067c852 Fix several test failures on Linux/FreeBSD caused by compiler configuration and invalid environment.
http://reviews.llvm.org/D6392

llvm-svn: 222845
2014-11-26 18:30:04 +00:00
Hafiz Abid Qadeer 1cbac4e94f Add initial lldb-mi tests.
Test 'test_lldbmi_interrupt' is only enabled for Darwin as
it seems to cause a timeout error on Linux.
Patch from dawn@burble.org.

llvm-svn: 222750
2014-11-25 10:41:57 +00:00
Enrico Granata 6e0566c6d9 Not all things callable have an im_self, so harden the test logic against that. getattr(,,None) is the closest to ?. we have in Python, so use that
llvm-svn: 222160
2014-11-17 19:00:20 +00:00
Greg Clayton 35c91347e6 Fixes for remote test suite execution of the "lldb/test/lang" directory.
Fixes include:
- Add a new lldbtest.TestBase function named registerSharedLibrariesWithTarget. This function can be called using the shared libraries for your test suite either as shared library basename ("foo"), path basename ("libfoo.dylib") or full path ("/tmp/lldb/test/lang/c/carp/libfoo.dylib"). These shared libraries are then registered with the target so they will be downloaded when the test is run remotely. 
- Changed a lot of tests over to use SBDebugger::CreateTarget(...) calls instead of using "file a.out" commands.
- Cleaned up some tests to add new locations for breakpoints that all compilers should be able to abide by. Some tests and constants being loaded into values of structs and some compilers like arm64 will often combine two constant data loads into a single source line so some breakpoint locations were not being set correctly. Adding lines like 'puts("")' allow us to lock onto a source line that will have code.

llvm-svn: 222156
2014-11-17 18:40:27 +00:00
Enrico Granata 4c67655b45 Fix a problem reported by Ed Maste where the test harness was failing to call bound methods as cleanup hooks
llvm-svn: 221624
2014-11-10 19:51:57 +00:00
Shawn Best 181b09b7c3 fix for unit tests finding path to LLDB.h http://reviews.llvm.org/D6177
llvm-svn: 221566
2014-11-08 00:04:04 +00:00
Shawn Best eb3e905027 fixed minor code indenting http://reviews.llvm.org/D6127
llvm-svn: 221467
2014-11-06 17:52:15 +00:00
Enrico Granata ab0e831485 Allow inline test case to register actually useful teardown hooks by allowing a hook to be passed back the test instance, were it not to be already bound to self. Use this ability to make the reversal of escape-non-printables a teardown hook for added reliability of the testing logic
llvm-svn: 221402
2014-11-05 21:31:57 +00:00
Enrico Granata e9afaf71f7 This looks like the actual path under which the builder looks for LLDB headers, so use this path instead
llvm-svn: 220718
2014-10-27 20:31:12 +00:00
Jim Ingham 65b3f547cd Patch from ovyalov@google.com:
Handle pexpect exceptions correctly so that processes spawned with 
pexpect are always reaped.

llvm-svn: 220583
2014-10-24 18:51:57 +00:00
Matthew Gardiner c928de3e8e Added functions to the C++ API, for the benefit of non-8-bit byte architectures.
New functions to give client applications to tools to discover target byte sizes
for addresses prior to ReadMemory. Also added GetPlatform and ReadMemory to the
SBTarget class, since they seemed to be useful utilities to have.

Each new API has had a test case added.

http://reviews.llvm.org/D5867

llvm-svn: 220372
2014-10-22 07:22:56 +00:00
Enrico Granata cf3ab58e47 Making all @expectedFailure markers take an explicit bugnumber annotation. This used to be optional, but that makes it harder to track what tests are failing for what reason. So, make it mandatory, in the form of refusing to run the test suite if annotations are missing
llvm-svn: 220012
2014-10-17 01:11:29 +00:00
Jim Ingham da3a386622 Add a test for the -b (batch mode) option to the lldb driver.
llvm-svn: 219979
2014-10-16 23:02:14 +00:00
Zachary Turner 756acbaa0e Fix a path concatenation issue related to windows paths.
llvm-svn: 219730
2014-10-14 21:54:14 +00:00
Ed Maste 59cca5dc29 Fix exception text to match function name
llvm-svn: 219181
2014-10-07 01:57:52 +00:00
Enrico Granata b633e43d2b In some cases, the LLDB test suite will be run on a built framework with no sources coming along. In those cases, we want to skip the SB API test case. Add a marker for that, and apply it
llvm-svn: 219146
2014-10-06 21:37:06 +00:00
Kuba Brecka beed821ffb ASan malloc/free history threads
Reviewed at http://reviews.llvm.org/D4596

llvm-svn: 217116
2014-09-04 01:03:18 +00:00
Zachary Turner c7826524ac Get test executables compiling on Windows.
Many of the test executables use pthreads directly.  This isn't
portable on Windows, so this patch converts these test to use
C++11 threads and mutexes.  Since Windows' implementation of
std::thread classes throw and catch from header files, this patch
also disables exceptions when compiling with clang on Windows.

Reviewed by: Todd Fiala, Ed Maste

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

llvm-svn: 215562
2014-08-13 17:44:53 +00:00
Ed Maste 6e496338e6 Force trace on system() failure on FreeBSD while tracking down buildbot issues
llvm-svn: 214922
2014-08-05 20:33:17 +00:00
Zachary Turner 9ef307bfc1 Make the test runner understand Windows command shell execution.
Currently, the test runner makes the assumption that it will run
commands through /bin/sh.  This is obviously not true on Windows,
so this patch abstracts this logic out somewhat.  Instead of
having the caller build the command string himself, the caller
will now pass in argument list of the form [[a, b], [c, d], ...]
which will get converted into a string of the form a b; c d or
a b && c d, depending on the platform.

Reviewed by: Todd Fiala

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

llvm-svn: 213669
2014-07-22 16:19:29 +00:00
Todd Fiala a41d48cac8 Added two new test types: @debugserver_test and @llgs_test.
TestLldbGdbServer now supports both lldb-gdbserver (llgs) and
debugserver tests.  Similar to the dsym/dwarf tests, they allow
running the same underlying gdb remote protocol tests against
lldb-gdbserver and debugserver.  This will help make sure the
protocol-level tests for lldb-gdbserver faithfully represent
what debugserver does on OS X.

Switched back gdb remote protocol test logging to warning
and above (accidentally submitted it at debug level in a
recent commit).

llvm-svn: 207395
2014-04-28 04:49:40 +00:00
Ed Maste 433790a69c Remove duplication in expectedFailure* decorators
Differential Revision: http://reviews.llvm.org/D3452

llvm-svn: 206976
2014-04-23 12:55:41 +00:00
Ed Maste c97323ea8b Use libc++ on FreeBSD as on Darwin
llvm-svn: 205345
2014-04-01 18:47:58 +00:00
Ed Maste dbd5950b63 Use libc++ on FreeBSD as on Darwin
This could use some refinement still, but the previous behaviour of adding
-stdlib=libstc++ on FreeBSD w/ Clang is the least likely case to work.

llvm.org/pr17910

llvm-svn: 200646
2014-02-02 19:24:15 +00:00
Greg Clayton c694751a06 Correctly set the working directory when launching processes for both local and remote targets.
llvm-svn: 197266
2013-12-13 19:18:59 +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
Greg Clayton 1251456028 Added two new test case decorator functions: @skipIfRemote and @skipIfRemoteDueToDeadlock.
@skipIfRemote is used to decorate test cases that don't make sense to run remotely.

@skipIfRemoteDueToDeadlock indicates these tests need to be looked at and currently deadlock the running of the test suite when run on remote systems. These issues should be fixed soon.

llvm-svn: 196543
2013-12-05 22:22:32 +00:00
Greg Clayton aec167d79e Remove print statement when successfully setting the platform's working directory.
llvm-svn: 196308
2013-12-03 19:22:45 +00:00
Greg Clayton 5fb8f79738 Fixed internal code to not link against and code from "lldb/API/*".
lldb_private::Debugger was #including some "lldb/API" header files which causes tools (lldb-platform and lldb-gdbserver) that link against the internals only (no API layer) to fail to link depending on which calls were being used.

Also fixed the current working directory so that it gets set correctly for remote test suite runs. Now the remote working directory is set to: "ARCH/TESTNUM/..." where ARCH is the current architecture name and "TESTNUM" is the current test number. 

Fixed the "lldb-platform" and "lldb-gdbserver" to not warn about mismatched visibility settings by having each have their own exports file which contains nothing. This forces all symbols to not be exported, and also quiets the linker warnings.

llvm-svn: 196141
2013-12-02 19:35:49 +00:00
Greg Clayton fb90931b60 Improved platform support.
Improved the detection of a valid GDB server where we actually can connect to a socket, but then it doesn't read or write anything (which happens with some USB mux software).

Host::MakeDirectory() now can make as many intermediate directories as needed.

The testsuite now has very initial support for remote test suite running. When running on a remote platform, the setUp function for the test will make a new directory and select it as the working directory on the remote host. 

Added a common function that can be used to create the short option string for getopt_long calls.

llvm-svn: 195541
2013-11-23 01:58:15 +00:00
Matt Kopec ee969f9f27 Mark 32/64-bit tests as expected fail after root causing and referencing bugzilla.
Fix TestFrames.py error to check against a None pc value.

llvm-svn: 191470
2013-09-26 23:30:59 +00:00
Matt Kopec 7663b3a9d0 Add support for TestPluginComands on Linux. Also, rework makefile dsym target.
llvm-svn: 191383
2013-09-25 17:44:00 +00:00
Ed Maste 437f8f665a test: Handle libc++ shared lib name on FreeBSD
(I didn't take a guess at the Linux names, as these tests are currently
skipped with the comment "No standard locations for libc++ on Linux.")

llvm-svn: 190307
2013-09-09 14:04:04 +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 adaaec9aea Centralizing Intel compiler detection logic in lldbtest.py to avoid duplication in the future.
- Addresses review comments from Stefanus!

llvm-svn: 187816
2013-08-06 20:51:41 +00:00