summaryrefslogtreecommitdiff
path: root/lldb/test/python_api/lldbutil
AgeCommit message (Collapse)Author
2015-10-28Move lldb/test to lldb/packages/Python/lldbsuite/test.Zachary Turner
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-27Rename `lldb_shared` to `use_lldb_suite`.Zachary Turner
llvm-svn: 251444
2015-10-26Port the python api decorator to use test categoriesPavel Labath
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-23Add from __future__ import print_function everywhere.Zachary Turner
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-22Update every test to import `lldb_shared`.Zachary Turner
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-09-30Merge dwarf and dsym testsTamas Berghammer
Currently most of the test files have a separate dwarf and a separate dsym test with almost identical content (only the build step is different). With adding dwo symbol file handling to the test suit it would increase this to a 3-way duplication. The purpose of this change is to eliminate this redundancy with generating 2 test case (one dwarf and one dsym) for each test function specified (dwo handling will be added at a later commit). Main design goals: * There should be no boilerplate code in each test file to support the multiple debug info in most of the tests (custom scenarios are acceptable in special cases) so adding a new test case is easier and we can't miss one of the debug info type. * In case of a test failure, the debug symbols used during the test run have to be cleanly visible from the output of dotest.py to make debugging easier both from build bot logs and from local test runs * Each test case should have a unique, fully qualified name so we can run exactly 1 test with "-f <test-case>.<test-function>" syntax * Test output should be grouped based on test files the same way as it happens now (displaying dwarf/dsym results separately isn't preferable) Proposed solution (main logic in lldbtest.py, rest of them are test cases fixed up for the new style): * Have only 1 test fuction in the test files what will run for all debug info separately and this test function should call just "self.build(...)" to build an inferior with the right debug info * When a class is created by python (the class object, not the class instance), we will generate a new test method for each debug info format in the test class with the name "<test-function>_<debug-info>" and remove the original test method. This way unittest2 see multiple test methods (1 for each debug info, pretty much as of now) and will handle the test selection and the failure reporting correctly (the debug info will be visible from the end of the test name) * Add new annotation @no_debug_info_test to disable the generation of multiple tests for each debug info format when the test don't have an inferior Differential revision: http://reviews.llvm.org/D13028 llvm-svn: 248883
2015-09-16Last set of XFAILs for Windows.Zachary Turner
llvm-svn: 247825
2015-09-11XFAIL miscellaneous tests on windows.Zachary Turner
llvm.org/pr24778 llvm-svn: 247460
2015-09-08Exception registers aren't supported outside of DarwinEd Maste
Apply test update from r234992 to FreeBSD llvm-svn: 247009
2015-06-25Update TestPrintStackTraces XFAIL once morePavel Labath
it seems the failure happens also with clang. The main thing which triggers the failure is architecture. llvm-svn: 240652
2015-06-25Make XFAIL on TestPrintStackTraces more specificPavel Labath
the thread creation failure was fixed, but a backtracing problem remains in some situations. llvm-svn: 240635
2015-04-17XFAILing TestPrintStackTraces on linux to stabilize the build botPavel Labath
llvm-svn: 235169
2015-04-15Exception registers aren't supported outside of DarwinVince Harron
Updated test to match Differential Revision: http://reviews.llvm.org/D8812 llvm-svn: 234992
2015-03-31TestPrintStackTraces - made XFAIL more preciseVince Harron
Works with x86_64 inferior, fails w/i386 inferior - updated test to reflect llvm-svn: 233717
2015-03-24Don't clobber CFLAGS_EXTRAS in tests.Robert Flack
To run tests against a different target platform many extra compiler flags are needed to specify sysroot, include dirs, etc. The environment variable CFLAGS_EXTRAS seems suited for this purpose except that several Makefiles clobber the current flags. This change modifies all of these to add to CFLAGS_EXTRAS instead. Test Plan: Verify no regressions in ninja check-lldb. Run tests using CFLAGS_EXTRAS to specify cross compilation flags for a different target running lldb-server platform. Differential Revision: http://reviews.llvm.org/D8559 llvm-svn: 233066
2014-08-13Get test executables compiling on Windows.Zachary Turner
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
2013-12-13Correctly set the working directory when launching processes for both local ↵Greg Clayton
and remote targets. llvm-svn: 197266
2013-12-10Massive test suite cleanup to stop everyone from manually having to compute ↵Greg Clayton
"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-09test: Update decorators for FreeBSD failures with threaded inferior supportEd Maste
llvm.org/pr18190 llvm.org/pr18191 llvm-svn: 196792
2013-09-17Update Linux bug tracker link in TestPrintStackTracesDaniel Malea
- now fails due to llvm.org/pr15415 (partial stack trace while stopped inside read() call) llvm-svn: 190867
2013-07-24tests: Mark expected FreeBSD failures due to pr16696Ed Maste
Live debugging of threaded inferiors is currently unimplemented for FreeBSD. llvm-svn: 187077
2013-07-24test_iter_registers is expected to fail on FreeBSDEd Maste
Added comment to llvm.org/pr14600 that it fails on FreeBSD in the same way as Linux. llvm-svn: 187070
2013-05-15Clean up linux test decorators and add links to known bugsDaniel Malea
- s/skipOnLinux/skipIfLinux/ to match style of every other decorator - linkify bugizilla/PR numbers in comments No intended change in functionality. llvm-svn: 181913
2013-01-25Update test scripts and Makefiles to allow testing with GCC:Daniel Malea
- introduce new variable ARCHFLAG in make/Makefile.rules to switch between "-arch" on Mac and "-m" everywhere else - update testcase makefiles to use LD_EXTRAS instead of LDFLAGS (the former interacts with Makefile.rules badly) - special treatment for gcc 4.6: replace "-std=c++11" with "-std=c++0x" as the former is not handled correctly - remove hardcoded "-arch" from test Makefile This patch should not have any effect on lldb on Mac OS X. llvm-svn: 173402
2013-01-24Marking test cases with @expectedFailureLinux as per recently opened bugsDaniel Malea
- PR 15038: missing wide char support on Linux - PR 14600 - Exception state registers not supported on Linux - PR 15039: SBProcess.GetSTDOUT() returns an empty buffer - PR 15037: stop-hooks sometimes fail to fire on Linux llvm-svn: 173363
2012-12-13Marking test_lldb_iter_frame in TestLLDBIterator.py as expectedFailureLinux ↵Andrew Kaylor
(due to lack of multi-threaded debugging support). llvm-svn: 170074
2012-12-12Marking TestPrintStackTraces.py as expectedFailureLinux (due to lack of ↵Andrew Kaylor
multi-threaded debugging support). llvm-svn: 170043
2012-11-08Patch from Dan Malea daniel.malea@gmail.com to add some requiredJason Molenda
flags to the Linux makefiles to get the tests to run. llvm-svn: 167600
2012-04-05Added a new Host class: ReadWriteLockGreg Clayton
This abstracts read/write locks on the current host system. It is currently backed by pthread_rwlock_t objects so it should work on all unix systems. We also need a way to control multi-threaded access to the process through the public API when it is running. For example it isn't a good idea to try and get stack frames while the process is running. To implement this, the lldb_private::Process class now contains a ReadWriteLock member variable named m_run_lock which is used to control the public process state. The public process state represents the state of the process as the client knows it. The private is used to control the actual current process state. So the public state of the process can be stopped, yet the private state can be running when evaluating an expression for example. Adding the read/write lock where readers are clients that want the process to stay stopped, and writers are clients that run the process, allows us to accurately control multi-threaded access to the process. Switched the SBThread and SBFrame over to us shared pointers to the ExecutionContextRef class instead of making their own class to track this. This fixed an issue with assigning on SBFrame to another and will also centralize the code that tracks weak references to execution context objects into one location. llvm-svn: 154099
2011-09-27Make the assignment of TestBase.mydir more portable.Johnny Chen
llvm-svn: 140640
2011-08-03Cleaned up the SBType.h file to not include internal headers and reorganizedGreg Clayton
the SBType implementation classes. Fixed LLDB core and the test suite to not use deprecated SBValue APIs. Added a few new APIs to SBValue: int64_t SBValue::GetValueAsSigned(int64_t fail_value=0); uint64_t SBValue::GetValueAsUnsigned(uint64_t fail_value=0) llvm-svn: 136829
2011-07-30Add a @benchmarks_test decorator for test method we want to categorize as ↵Johnny Chen
benchmarks test. The test driver now takes an option "+b" which enables to run just the benchmarks tests. By default, tests decorated with the @benchmarks_test decorator do not get run. Add an example benchmarks test directory which contains nothing for the time being, just to demonstrate the @benchmarks_test concept. For example, $ ./dotest.py -v benchmarks ... ---------------------------------------------------------------------- Collected 2 tests 1: test_with_gdb (TestRepeatedExprs.RepeatedExprssCase) Test repeated expressions with gdb. ... skipped 'benchmarks tests' 2: test_with_lldb (TestRepeatedExprs.RepeatedExprssCase) Test repeated expressions with lldb. ... skipped 'benchmarks tests' ---------------------------------------------------------------------- Ran 2 tests in 0.047s OK (skipped=2) $ ./dotest.py -v +b benchmarks ... ---------------------------------------------------------------------- Collected 2 tests 1: test_with_gdb (TestRepeatedExprs.RepeatedExprssCase) Test repeated expressions with gdb. ... running test_with_gdb benchmarks result for test_with_gdb ok 2: test_with_lldb (TestRepeatedExprs.RepeatedExprssCase) Test repeated expressions with lldb. ... running test_with_lldb benchmarks result for test_with_lldb ok ---------------------------------------------------------------------- Ran 2 tests in 0.270s OK Also mark some Python API tests which are missing the @python_api_test decorator. llvm-svn: 136553
2011-07-14Minor change of variable name, from m to b (for breakpoint).Johnny Chen
llvm-svn: 135214
2011-07-11Passing in os.ctermid() as the arg for SBTarget.Launch(...) for stdin_path, ↵Johnny Chen
stdout_path, and stderr_path is just wrong and resulted in the inferior's output getting mixed into the GDB remote communication's log file. Change all test cases to not pass os.ctermid() and either use SBTarget.LaunchSimple() or SBTarget.Launch() and pass None as stdin_path/stdout_path/srderr_path to use a pseudo terminal. rdar://problem/9716499 program output is getting mixed into the GDB remote communications llvm-svn: 134940
2011-06-16o lldbutil.py:Johnny Chen
For the print_stacktrace(thread, string_buffer = False) function, if we have debug info for a frame function, let's also emit the args for the current function. o TestFrameUtils.py: Add stronger assertTrue for frame0's args. o TestPrintStackTraces.py: Launch the inferior with ["abc", "xyz"] and expect '(int)argc=3' in the stack traces, since by design the inferior is built with debug info. llvm-svn: 133204
2011-06-15The extra burden for the Python API test case to assign its process object ↵Johnny Chen
to self.process in order to have its process cleaned up (terminated) upon tearDown is gone for good. Let's simplify a bunch of Python API test cases. llvm-svn: 133097
2011-05-26Simplify test setup; there's no need to pass a customized dictionary here.Johnny Chen
llvm-svn: 132147
2011-05-17Add truth value testing to those lldb Python objects with the IsValid() ↵Johnny Chen
method definitions. object.__nonzero__(self) is called to implement truth value testing and the built-in operation bool(), via a simple delegation to self.IsValid(). Change tests under python_api/lldbutil to utilize this mechanism. llvm-svn: 131494
2011-05-16Add implementation of built-in function len() for those lldb containers withJohnny Chen
unambiguous iteration support. So that we could, for example: ... REGs = lldbutil.get_GPRs(frame) print "Number of general purpose registers: %d" % len(REGs) for reg in REGs: print "%s => %s" %(reg.GetName(), reg.GetValue()) ... llvm-svn: 131418
2011-05-16Renamed the test cases more properly to test_lldb_iter_module/breakpoint/farme.Johnny Chen
llvm-svn: 131412
2011-05-12Add two utility functions:Johnny Chen
o get_parent_frame(frame) o get_args_as_string(frame) to lldbutil.py and create TestFrameUtils.py to exercise the utils. Plus re-arrange the test/python_api/lldbutil to have three directories for testing iteration, process stack traces, and the just added frame utils. llvm-svn: 131213
2011-05-10Add a utility function get_registers(frame, kind) to get the registers of a ↵Johnny Chen
given frame and of a given kind. Also add three convenience functions get_GPRs(frame), get_FPRs(frame), and get_ESRs(frame) to get the general purpose registers, the floating point registers, and the exception state registers. Add TestRegistersIterator.py to test these added functions of lldbutil.py. llvm-svn: 131144
2011-05-02Add implementation of '==' and '!=' for SBFileSpec and SBModule. Modify a ↵Johnny Chen
test case to take advantage of 'ths_module == that_module'. llvm-svn: 130709
2011-04-29Add the Python rich comparison methods for SBBreakpoint, where GetID() returnsJohnny Chen
the breakpoint ID and provides the semantics needed for '==' and '!='. And modify LLDBIteratorTestCase.lldb_iter_2() to use '==' between two SBBreakpoint's. llvm-svn: 130531
2011-04-28Modify the test suite and lldbutil.py to utilize the Python iteration ↵Johnny Chen
pattern now that the lldb iteration protocol has been added to lldb.py module. llvm-svn: 130452
2011-04-28Move the iteration protocol of lldb objects to the auto-generated lldb ↵Johnny Chen
Python module. This is so that the objects which support the iteration protocol are immediately obvious from looking at the lldb.py file. SBTarget supports two types of iterations: module and breakpoint. For an SBTarget instance, you will need to issue either: for m in target.module_iter() or for b in target.breakpoint_iter() For other single iteration protocol objects, just use, for example: for thread in process: ID = thread.GetThreadID() for frame in thread: frame.Disassemble() .... llvm-svn: 130442
2011-04-27Add a utility function smart_iter() which has knowledge of the getsize and ↵Johnny Chen
the getelem method names of all the lldb container objects and returns an iterator object when passed an eligible lldb container object. Example: from lldb_util import smart_iter for thread in smart_iter(process): ID = thread.GetThreadID() if thread.GetStopReason() == lldb.eStopReasonBreakpoint: stopped_due_to_breakpoint = True for frame in smart_iter(thread): self.assertTrue(frame.GetThread().GetThreadID() == ID) ... Add a test case for lldb.smart_iter(). llvm-svn: 130332
2011-04-27Use new string formatting operations in assert messages to simplify things.Johnny Chen
llvm-svn: 130325
2011-04-27Add another test case for lldb_iter(), this time using SBTarget to get at ↵Johnny Chen
its SBBreakpoint containees. llvm-svn: 130323
2011-04-27Change the rest of lldbutil.py's function names to all lower case formats to ↵Johnny Chen
be consistent. And modify the test cases accordingly. llvm-svn: 130314