Commit Graph

309 Commits

Author SHA1 Message Date
Vince Harron c849267a69 Fixed skipIfLinuxClang to check the target architecture
Instead of the host architecture

This decorator isn't in use anywhere currently.
Add it to a test and run

llvm-svn: 236402
2015-05-04 02:59:19 +00:00
Vince Harron f2e3760ad8 Enabled libc++ formatter tests on Linux
Refactored TestInitializerList to not be an inline test.
Refactored Makefiles to use USE_LIBCPP instead of adding FLAGS directly
Fixed copy/paste error in TestDataFormatterUnordered class name

Differenttial Revision: http://reviews.llvm.org/D9426

llvm-svn: 236401
2015-05-04 02:56:32 +00:00
Vince Harron 026137628f TestMultithreaded improvements
These tests link against host lldb API. Compiler's target triple
must match liblldb triple. Instead of naively skipping i386, I added
a check of the liblldb arch against the compiler target arch.

This is useful for 32 bit API builds (planned for Windows)

Since remote is disabled, we can assume the os is the same.

Also, removed skipIfLinuxClang because it's passing

llvm-svn: 236396
2015-05-04 00:17:53 +00:00
Ying Chen 7091c2ca3f XFAIL tests that are failed on linux with gcc-4.9.2
Summary:
- add decorator functions to xfail and skip test on specific os, architecture and version of comipler
- xfail failing test with gcc-4.9.2 on linux
- add one usage of skipIf function

Test Plan:
Run tests with different archs, and version of compilers to verify decorator function working as expected
Run tests with gcc-4.9.2 and no failure reported

Reviewers: sivachandra, ovyalov, vharron, chaoren

Subscribers: lldb-commits

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

llvm-svn: 235368
2015-04-21 01:15:47 +00:00
Robert Flack fb2f6c60f2 Uses the target platform to determine the platform context.
Uses the target platform to determine the platform context to use. This fixes an
early failure in some tests when running on a different remote target.

Test Plan:
./dotest.py $DOTEST_OPTS -t -p TestGlobalVariables.py|TestSharedLib.py
Running on macosx -> linux, this fails at a later stage in the test - rather
than in registerSharedLibrariesWithTarget looking for a library without the
correct "lib" prefix and ".so" suffix.

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

llvm-svn: 235164
2015-04-17 08:02:18 +00:00
Ilia K 725abcb889 Bug 23051 - Fix zombie processes after lldb-server tests
Summary:
This patch fixes the following bug: https://llvm.org/bugs/show_bug.cgi?id=23181
For some reason some lldb-server tests should be kicked using SIGHUP and SIGINT before termination, otherwise it will leave a zombie process.
I think the reason is that the lldb-server will terminate a slave process if it gets the SIGHUP/SIGINT and if so it should be fixed in lldb-server.

The solution is to terminate process like it does the pexpect (including the delayafterterminate interval).

Also this patch reverts the following commits:
* r234549 - Skip lldb-server tests according to bug 23181
* r234765 - Skip a few tests on OS X according to the bug 23181
* r234803 - Skip the TestGdbRemoteRegisterState.test_grp_register_save_restore_works_no_suffix_debugserver_dsym test on OS X according to the bug 23181

Test Plan:
```
$ ps | grep Z | grep a.out | wc -l
447
$ ./dosep.py --options "-v --executable $INSTALLDIR/bin/lldb"
[...]
$ ps | grep Z | grep a.out | wc -l
447
```

Reviewers: jasonmolenda, clayborg, tberghammer

Reviewed By: clayborg

Subscribers: lldb-commits, dawn, tberghammer, clayborg, jasonmolenda

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

llvm-svn: 235008
2015-04-15 13:35:49 +00:00
Robert Flack 068898cb83 Fix @skipUnlessPlatform and @skipIfPlatform decorators to work on classes.
The decorators to skip if or unless certain platforms relied on calling
skipTest, which only worked if they were decorating individual test cases.
However for decorating entire classes it needs different behavior. This behavior
is already encapsulated in unittest2.skipIf and unittest2.skipUnless so this
modifies the platform decorators to use these unittest skip decorators.

Test Plan:
./dotest.py -t -p TestObjCMethods2.py
See skipped tests on linux, and see tests run on macosx.

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

llvm-svn: 234514
2015-04-09 18:07:58 +00:00
Robert Flack f4db5462e3 Fix expectedFailureLLGS to expect failure when host platform is not linux.
expectedFailureLLGS has an early return false if the platform is not linux
except it should be checking the target platform on which the server is
running for remote tests.

Test Plan:
Verify expected failure when running from mac to remote linux llgs:
TestBreakAfterJoin.py, TestCreateDuringStep.py, TestExitDuringBreak.py,
TestProcessLaunch.py, TestThreadStates.py

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

llvm-svn: 234492
2015-04-09 14:54:26 +00:00
Ed Maste 0f434e625b test: Move amd64 -> x86_64 translation to getArchitecture()
Rather than sprinkling this knowledge throughout the test suite, just
translate amd64 to x86_64 globally.

llvm-svn: 234166
2015-04-06 15:50:48 +00:00
Adrian McCarthy 1d57433c50 Fix LLDB test tracing to include the output (stdout and stderr) of each shell command.
llvm-svn: 234025
2015-04-03 17:10:30 +00:00
Vince Harron 20952ccf90 TestRecursiveInferior fixed on Linux
Summary:
Updated test to reflect that Linux and Darwin behave the same now.

Removed @expectedFailureLinux for passing tests.

Test Plan: run tests

Reviewers: clayborg, sivachandra

Subscribers: lldb-commits

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

llvm-svn: 233989
2015-04-03 01:00:06 +00:00
Greg Clayton e0d0a7652d Many many test failures after some recent changes. The problem is lldbtest.getPlatform() returns the "OS" of the selected platform's triple. This is "macosx" for desktop macosx and "ios" for iOS. It used to be "darwin".
There was a lot of code that was checking "if self.getPlatform() == 'darwin'" which is not correct. I fixed this by adding a:

lldbtest.platformIsDarwin()

which returns true if the current platform's OS is "macosx", "ios" or "darwin". These three valid darwin are now returned by a static function:

lldbtest.getDarwinOSTriples()

Fixed up all places that has 'if self.getPlatform() == "darwin":' with "if self.platformIsDarwin()" and all instances of 'if self.getPlatform() != "darwin":' with "if not self.platformIsDarwin()". I also fixed some darwin decorator functions to do the right thing as well.

llvm-svn: 233933
2015-04-02 18:24:03 +00:00
Ed Maste bf441f4ffa Fix FreeBSD test runs after r233311
On FreeBSD LLDB's triple ends up as e.g. "x86_64-unknown-freebsd10.1"
but getPlatform() consumers expect just the name with no version
number.

llvm-svn: 233705
2015-03-31 16:37:10 +00:00
Robert Flack 13c7ad9cd2 Replace sys.platform skips in tests with @skip decorators which check against remote platform.
Adds @skipIfPlatform and @skipUnlessPlatform decorators which will skip if /
unless the target platform is in the provided platform list.

Test Plan:
ninja check-lldb shows no regressions.
When running cross platform, tests which cannot run on the target platform are
skipped.

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

llvm-svn: 233547
2015-03-30 14:12:17 +00:00
Adrian McCarthy b016b3cfea Fix lld command on Windows for many tests.
llvm-svn: 233416
2015-03-27 20:47:35 +00:00
Ying Chen 464d1e1439 Allow ExpectedFailure* decorators to work with optional arguments
-if the decorator functions called with optional arguments, return decorator to orignal method

llvm-svn: 233338
2015-03-27 00:26:52 +00:00
Robert Flack efa49c2665 Change expectedFailureOS and skipIfPlatform checks to be based on target platform when running test suite remotely.
Most expected OS failures or skipped tests are about the target platform on
which the test binary is being run, not the host platform launching the tests.
This changes expectedFailureOS and skipIfPlatform to check against the remote
platform when running remote tests.

Test Plan:
Run ./do_sep.py test suite against a remote target on a different platform and
verify that tests which should be excluded on the remote platform are excluded.

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

llvm-svn: 233311
2015-03-26 19:34:26 +00:00
Zachary Turner 9581204ceb Fix test failures caused by order of initialization.
tear down hooks run as part of Base.tearDown().  Some of these
hooks rely on accessing the debugger instance.  So although it
looks awkward, we need to call "del self.dbg" after calling
Base.tearDown().

llvm-svn: 233306
2015-03-26 18:54:21 +00:00
Zachary Turner 65fe1eb5f8 Tear down tests in reverse order from setting them up.
Tests derive from TestBase, which derives from Base.  In the
test setUp() methods, we always call TestBase.setUp() first and
then call implementation-specific setup.  Tear down needs to do
the reverse.

This was causing over 20 failures on Windows, and was the culprit
behind about 80% of the files not being cleaned up after test run.
TestBase.tearDown() is responsible for deleting all targets created
during the test run and without this step, on Windows files will
be locked and cannot be deleted.  But TestBase.tearDown() was
calling Base.tearDown() before its own cleanup (i.e. deleting the
targets) and in some cases one of the teardown hooks would be to
call make clean.  So make clean would be run before the targets
had been deleted, and fail to remove the files, and subsequently
result in a failed test as well.

llvm-svn: 233284
2015-03-26 16:43:25 +00:00
Tamas Berghammer 3e0ecb202a Fix not_remote_testsuite_ready annotation in the test runner
Treat a test run as remote run also if lldb.remote_platform is set.

llvm-svn: 233190
2015-03-25 15:13:28 +00:00
Zachary Turner 794e6a60a8 Fix makefiles to build shared library tests on Windows.
Abstracted away some POSIX-isms that caused MAKE to issue invalid
commands on Windows.  Added a new force-include for the test
programs so that we can use platform-specific macros.

TestSharedLib now builds and cleans up on Windows, though the test
still fails some of the expectations.

Differential Revision: http://reviews.llvm.org/D8277
Patch by: Adrian McCarthy
Issue Tracker: http://llvm.org/pr21727

llvm-svn: 232220
2015-03-13 21:51:11 +00:00
Vince Harron 8974ce2735 Add support for XFAILing a test on specific clang versions
llvm-svn: 232205
2015-03-13 19:54:54 +00:00
Tamas Berghammer 1253a81096 Skip fdleak tests on android
Android have more file descriptor opened by the shell what are inherited
to the process (different ones on device and on emulator).

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

llvm-svn: 232150
2015-03-13 10:12:25 +00:00
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