summaryrefslogtreecommitdiffstats
path: root/lldb/test/python_api/lldbutil
Commit message (Collapse)AuthorAgeFilesLines
* Move lldb/test to lldb/packages/Python/lldbsuite/test.Zachary Turner2015-10-2810-666/+0
| | | | | | | | | | | 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
* Rename `lldb_shared` to `use_lldb_suite`.Zachary Turner2015-10-274-4/+4
| | | | llvm-svn: 251444
* Port the python api decorator to use test categoriesPavel Labath2015-10-264-6/+6
| | | | | | | | | | | | | | | | | | 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
* Add from __future__ import print_function everywhere.Zachary Turner2015-10-234-14/+22
| | | | | | | | | | | | | 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
* Update every test to import `lldb_shared`.Zachary Turner2015-10-224-31/+8
| | | | | | | | | | | | | | | | | | | | | 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
* Merge dwarf and dsym testsTamas Berghammer2015-09-304-32/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Last set of XFAILs for Windows.Zachary Turner2015-09-161-0/+1
| | | | llvm-svn: 247825
* XFAIL miscellaneous tests on windows.Zachary Turner2015-09-111-0/+1
| | | | | | llvm.org/pr24778 llvm-svn: 247460
* Exception registers aren't supported outside of DarwinEd Maste2015-09-081-1/+0
| | | | | | Apply test update from r234992 to FreeBSD llvm-svn: 247009
* Update TestPrintStackTraces XFAIL once morePavel Labath2015-06-251-1/+1
| | | | | | | it seems the failure happens also with clang. The main thing which triggers the failure is architecture. llvm-svn: 240652
* Make XFAIL on TestPrintStackTraces more specificPavel Labath2015-06-251-4/+1
| | | | | | the thread creation failure was fixed, but a backtracing problem remains in some situations. llvm-svn: 240635
* XFAILing TestPrintStackTraces on linux to stabilize the build botPavel Labath2015-04-171-6/+4
| | | | llvm-svn: 235169
* Exception registers aren't supported outside of DarwinVince Harron2015-04-151-9/+16
| | | | | | | | Updated test to match Differential Revision: http://reviews.llvm.org/D8812 llvm-svn: 234992
* TestPrintStackTraces - made XFAIL more preciseVince Harron2015-03-311-1/+7
| | | | | | | Works with x86_64 inferior, fails w/i386 inferior - updated test to reflect llvm-svn: 233717
* Don't clobber CFLAGS_EXTRAS in tests.Robert Flack2015-03-242-2/+2
| | | | | | | | | | | | | | | | | 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
* Get test executables compiling on Windows.Zachary Turner2014-08-134-41/+55
| | | | | | | | | | | | | | 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
* Correctly set the working directory when launching processes for both local ↵Greg Clayton2013-12-134-5/+5
| | | | | | and remote targets. llvm-svn: 197266
* Massive test suite cleanup to stop everyone from manually having to compute ↵Greg Clayton2013-12-104-4/+4
| | | | | | | | | | "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
* test: Update decorators for FreeBSD failures with threaded inferior supportEd Maste2013-12-091-1/+0
| | | | | | | llvm.org/pr18190 llvm.org/pr18191 llvm-svn: 196792
* Update Linux bug tracker link in TestPrintStackTracesDaniel Malea2013-09-171-1/+1
| | | | | | - now fails due to llvm.org/pr15415 (partial stack trace while stopped inside read() call) llvm-svn: 190867
* tests: Mark expected FreeBSD failures due to pr16696Ed Maste2013-07-241-0/+1
| | | | | | | Live debugging of threaded inferiors is currently unimplemented for FreeBSD. llvm-svn: 187077
* test_iter_registers is expected to fail on FreeBSDEd Maste2013-07-241-0/+1
| | | | | | | Added comment to llvm.org/pr14600 that it fails on FreeBSD in the same way as Linux. llvm-svn: 187070
* Clean up linux test decorators and add links to known bugsDaniel Malea2013-05-152-2/+2
| | | | | | | | | - s/skipOnLinux/skipIfLinux/ to match style of every other decorator - linkify bugizilla/PR numbers in comments No intended change in functionality. llvm-svn: 181913
* Update test scripts and Makefiles to allow testing with GCC:Daniel Malea2013-01-252-2/+2
| | | | | | | | | | | - 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
* Marking test cases with @expectedFailureLinux as per recently opened bugsDaniel Malea2013-01-242-1/+1
| | | | | | | | | - 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
* Marking test_lldb_iter_frame in TestLLDBIterator.py as expectedFailureLinux ↵Andrew Kaylor2012-12-131-0/+1
| | | | | | (due to lack of multi-threaded debugging support). llvm-svn: 170074
* Marking TestPrintStackTraces.py as expectedFailureLinux (due to lack of ↵Andrew Kaylor2012-12-121-0/+1
| | | | | | multi-threaded debugging support). llvm-svn: 170043
* Patch from Dan Malea daniel.malea@gmail.com to add some requiredJason Molenda2012-11-082-0/+4
| | | | | | flags to the Linux makefiles to get the tests to run. llvm-svn: 167600
* Added a new Host class: ReadWriteLockGreg Clayton2012-04-051-0/+3
| | | | | | | | | | | | 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
* Make the assignment of TestBase.mydir more portable.Johnny Chen2011-09-273-3/+3
| | | | llvm-svn: 140640
* Cleaned up the SBType.h file to not include internal headers and reorganizedGreg Clayton2011-08-031-3/+3
| | | | | | | | | | | | | | | | | | 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
* Add a @benchmarks_test decorator for test method we want to categorize as ↵Johnny Chen2011-07-304-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Minor change of variable name, from m to b (for breakpoint).Johnny Chen2011-07-141-2/+2
| | | | llvm-svn: 135214
* Passing in os.ctermid() as the arg for SBTarget.Launch(...) for stdin_path, ↵Johnny Chen2011-07-113-12/+8
| | | | | | | | | | | | 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
* o lldbutil.py:Johnny Chen2011-06-162-4/+5
| | | | | | | | | | | | | | | | 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
* The extra burden for the Python API test case to assign its process object ↵Johnny Chen2011-06-154-17/+17
| | | | | | | | | 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
* Simplify test setup; there's no need to pass a customized dictionary here.Johnny Chen2011-05-261-1/+1
| | | | llvm-svn: 132147
* Add truth value testing to those lldb Python objects with the IsValid() ↵Johnny Chen2011-05-174-23/+23
| | | | | | | | | | | 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
* Add implementation of built-in function len() for those lldb containers withJohnny Chen2011-05-161-11/+31
| | | | | | | | | | | | | | | 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
* Renamed the test cases more properly to test_lldb_iter_module/breakpoint/farme.Johnny Chen2011-05-161-9/+9
| | | | llvm-svn: 131412
* Add two utility functions:Johnny Chen2011-05-1210-4/+253
| | | | | | | | | | | 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
* Add a utility function get_registers(frame, kind) to get the registers of a ↵Johnny Chen2011-05-101-0/+72
| | | | | | | | | | | 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
* Add implementation of '==' and '!=' for SBFileSpec and SBModule. Modify a ↵Johnny Chen2011-05-021-2/+2
| | | | | | test case to take advantage of 'ths_module == that_module'. llvm-svn: 130709
* Add the Python rich comparison methods for SBBreakpoint, where GetID() returnsJohnny Chen2011-04-291-1/+1
| | | | | | | 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
* Modify the test suite and lldbutil.py to utilize the Python iteration ↵Johnny Chen2011-04-281-2/+1
| | | | | | | | pattern now that the lldb iteration protocol has been added to lldb.py module. llvm-svn: 130452
* Move the iteration protocol of lldb objects to the auto-generated lldb ↵Johnny Chen2011-04-281-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add a utility function smart_iter() which has knowledge of the getsize and ↵Johnny Chen2011-04-271-2/+37
| | | | | | | | | | | | | | | | | | | | | | 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
* Use new string formatting operations in assert messages to simplify things.Johnny Chen2011-04-271-2/+2
| | | | llvm-svn: 130325
* Add another test case for lldb_iter(), this time using SBTarget to get at ↵Johnny Chen2011-04-272-8/+43
| | | | | | its SBBreakpoint containees. llvm-svn: 130323
* Change the rest of lldbutil.py's function names to all lower case formats to ↵Johnny Chen2011-04-271-1/+1
| | | | | | | | be consistent. And modify the test cases accordingly. llvm-svn: 130314
OpenPOWER on IntegriCloud