aboutsummaryrefslogtreecommitdiff
path: root/test/lldbtest.py
AgeCommit message (Collapse)Author
2011-10-07If we spawn an lldb process for test (via pexpect), do not load the init ↵Johnny Chen
file unless told otherwise. Set up self.lldbOption to be "--no-lldbibit" unless env variable NO_LLDBIBIT is defined and equals "NO". Also add "-nx" to gdb spawned. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@141384 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-30o lldbtest.py:Johnny Chen
Add a keyword argument 'endstr' to TestBase.expect() method to assert that the output will end with 'endstr'. Add TestBase.switch_to_thread_with_stop_reason(stop_reason) to select the thread with the stop reason = 'stop_reason' as the current thread. o TestWatchLocation.py: Modified to switch to the stopped thread with stop reason = watchpoint and to evaluate an expression with expected output for stronger assertion. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140890 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-15Add a simple watchpoint test to exercise watchpoint creation followed by ↵Johnny Chen
watchpoint hit events. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@139847 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-26Add a new attribute self.lldbHere, representing the fullpath to the 'lldb' ↵Johnny Chen
executable built locally from the source tree. This is distinguished from self.lldbExec, which can be used by test/benchmarks to measure the performances against other debuggers. You can use environment variable LLDB_EXEC to specify self.lldbExec to the dotest.py test driver, otherwise it is going to be populated with self.lldbHere. Modify the regular tests under test dir, i.e., not test/benchmarks, to use self.lldbHere. Also modify the benchmarks tests to use self.lldbHere when it needs an 'lldb' executable with debug info to do the performance measurements. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@138608 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-24Pretty print the run options for dumpSessionInfo(self) client.Johnny Chen
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@138466 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-19Minor change for the @expectedFailureClang logic. For the non-clang test ↵Johnny Chen
failure, re-raise the exception to get more stack trace information. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@138021 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-19Add a decorator for marking clang only expectedFailure. Use it for the ↵Johnny Chen
test_step_over_3_times_with_dsym/dwarf() test cases in TestThreadAPI.py by decorating it with @expectedFailureClang. Example: @expectedFailureClang @python_api_test def test_step_over_3_times_with_dwarf(self): """Test Python SBThread.StepOver() API.""" # We build a different executable than the default buildDwarf() does. d = {'CXX_SOURCES': 'main2.cpp', 'EXE': self.exe_name} self.buildDwarf(dictionary=d) self.setTearDownCleanup(dictionary=d) self.step_over_3_times(self.exe_name) git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@138019 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-16Add comment about recent change.Johnny Chen
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137776 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-16Fix the test suite error of:Johnny Chen
... File "/Volumes/data/lldb/svn/trunk/test/lldbtest.py", line 243, in __init__ self.session = test.session if test else None AttributeError: 'StdCXXDisassembleTestCase' object has no attribute 'session' git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137724 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-16Forgot to initialize the self.__skipped__ attribute lldbtest.Base.Johnny Chen
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137696 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-15Test driver should also report skipped tests because there were cases when ↵Johnny Chen
tests were skipped due to incorrect skip-logic. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137678 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-12Add TestInferiorChanged.py to test that lldb reloads the inferior after it ↵Johnny Chen
was changed during the debug session. First, main.c causes a crash, the inferior then gets re-built with main2.c which is not crashing. Add Base.cleanup(self, dictionary=None) for platform specfic way to do cleanup after build. This plugin method is used by the above test case to cleanup the main.c build before rebuild for main2.c. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137500 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-11When a benchmarks test fails, the re-run command should include the '+b' ↵Johnny Chen
option instead of the '-t' option. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137285 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-05o modify-python-lldb.py:Johnny Chen
Add the rich comparison methods (__eq__, __ne__) to SBType, too. o lldbtest.py: Add debug utility method TestBase.DebugSBType(). o test/python_api/type: Add tests for exercising SBType/SBTypeList API, including the SBTarget.FindTypes(type_name) API which returns a SBTypeList matching the type_name. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@136975 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-02Add the real benchmarks comparing lldb against gdb for repeated expression ↵Johnny Chen
evaluations. Modify lldbbench.py so that lldbtest.line_number() utility function is available to BenchBase client as just line_number(), and modify lldbtest.py so that self.lldbExec (the full path for the 'lldb' executable) is available to BenchBase client as well. An example run of the test case on my MacBook Pro running Lion: 1: test_compare_lldb_to_gdb (TestRepeatedExprs.RepeatedExprsCase) Test repeated expressions with lldb vs. gdb. ... lldb_avg: 0.204339 gdb_avg: 0.205721 lldb_avg/gdb_avg: 0.993284 ok git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@136740 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-01Add an abstract base class called BenchBase to be inherited by benchmark tests.Johnny Chen
Modify the example TestRepeatedExprs.py to use BenchBase, instead. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@136649 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-01More refactorings to migrate logic from TestBase to its parent class.Johnny Chen
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@136641 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-01Start refactoring lldbtest.TestBase so that it inherits from a newly created ↵Johnny Chen
lldbtest.Base class, while its API clients remain unchanged. The new lldbtest.Base class is to capture common behaviors when working with the test driver to accomplish things. The clients of lldbtest.Base can be lldb command line and api tests as well as other generic tests like a benchmark test. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@136636 91177308-0d34-0410-b5e6-96231b3b80d8
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. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@136553 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15Add TestValueAPI.py to exercise the newly added/modified SBValue APIs:Johnny Chen
o GetChildAtIndex, and o GetValueForExpressionPath git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@135315 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-11Update the test scenario for find_global_variables() to now start the ↵Johnny Chen
inferior process before issuing API calls to find the global variable and to get its value. rdar://problem/9700873 has been updated to reflect the latest status. The dwarf case now does not seg fault if the inferior is not started; instead, for dwarf case, the value retrieved from the global variable is None. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@134909 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-27Add TestPrintObj.py to go with lang/objc/print-objc, which:Johnny Chen
Test "print object" where another thread blocks the print object from making progress. Set a breakpoint on the line in my_pthread_routine. Then switch threads to the main thread, and do print the lock_me object. Since that will try to get the lock already gotten by my_pthread_routime thread, it will have to switch to running all threads, and that should then succeed. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@133933 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-23o lldbtest.py:Johnny Chen
Assign the test method name to self.testMethodName. This can be useful for the test directory (see test/types for a good example) which houses a bunch of executables compiled from different source files. The default build action is to create a.out as the binary executable, which can confuse the module cacheing mechanism and result in the debugger getting a stale image as the target to be debugged, and chaos ensues. o AbstractBase.py, TestThreadAPI.py: Use self.testMethodName to our advantage. o TestLoadUnload.py: Add expected failure marker to test case test_modules_search_paths(). git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@133768 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-21For now, insert some delays between succesive test cases in the test/types ↵Johnny Chen
directory if not already specified by the test driver (via ./dotest -w). Remove the AbstractBase.setUp() method definition when/if we find out the cause of the failures if no delays are inserted between these test cases. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@133495 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-20Add a builder module for Linux (plus some refactoring)Peter Collingbourne
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@133457 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-15Simplify the base test class. Remove keyword argument setCookie from ↵Johnny Chen
TestBase.runCmd() and remove the self.runStarted attribute since the automatic shutdown of processes associated with the targets are now performed automatically. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@133092 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-15Add an API to SBDebugger class:Johnny Chen
bool SBDebugger::DeleteTarget(lldb::SBTarget &target); which is used in the test tearDown() phase to cleanup the debugger's target list so that it won't grow larger and larger as test cases are executed. This is also a good opportunity to get rid of the arcane requirement that test cases exercising the Python API must assign the process object to self.process so that it gets shutdown gracefully. Instead, the shutdown of the process associated with each target is now being now automatically. Also get rid of an API from SBTarget class: SBTarget::DeleteTargetFromList(lldb_private::TargetList *list); git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@133091 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-13Removed unneeded method breakAfterLaunch() from the TestBase class to ↵Johnny Chen
simplify our base class. It was introduced to work around some debugger infrastructure bug which has long since been fixed. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@132951 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-06Remove extra whitespace.Johnny Chen
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@132692 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-31Fix out-dated module docstring for lldbtest.py. Also wrap some lldb ↵Johnny Chen
attribute references inside a try-except block in case the test is not invoked through the dotest.py test driver. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@132372 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-31Move some comments to the docstrings.Johnny Chen
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@132367 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-27Fix some comments.Johnny Chen
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@132232 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-27Add comment headers describing some method groups of our TestBase class.Johnny Chen
Remove an unnecessary __import__() function call. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@132231 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-25Convert these two modules to use the compact truth value testing as well.Johnny Chen
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@132072 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-06Add an API test script file for SBCommandInterpreter.Johnny Chen
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131035 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-06For a test with unexpected success status, we also dump its session info ↵Johnny Chen
into a unique file. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131011 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-05Comment.Johnny Chen
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@130965 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-05Add comment for self.child_in_script_interpreter.Johnny Chen
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@130963 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-05Use standard lldb enum -- lldb.eStopReasonBreakpoint.Johnny Chen
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@130960 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-05Add a test script for verifying that the convenience variables:Johnny Chen
o lldb.debugger o lldb.target o lldb.process o lldb.thread o lldb.frame "just works" when we stop at a breakpoint. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@130904 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-03Use a more gentle way of shutting down the child process spawned during the ↵Johnny Chen
test execution using pexpect. Change some child.expect() to child.expect_exact() as they try to match the string, not a regular expression. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@130797 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-03A more robust pexpect-based test case for testing against the firing of stop ↵Johnny Chen
hooks. Change one test sequence to detect the '** End Stop Hooks **' marker emitted by the stop hooks mechanism and check for whether the 'expr ptr' stop-hook has been run. Also, change the TestBase.tearDown() to wait for 2 seocnds before forcefully kill the pexpect-spawned child lldb process. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@130767 91177308-0d34-0410-b5e6-96231b3b80d8
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. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@130314 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-21Add a HideStdout() method to our TestBase class and call it from ↵Johnny Chen
TestAbbreviations.py and TestAliases.py. Pass the keyword argument 'check=False' to: self.runCmd("script my.date()", check=False) since we want to restore sys.stdout no matter what the outcome of the runCmd is. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@129949 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-19Modify docstring.Johnny Chen
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@129786 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-19Add a TraceOn(self) method to the base test class, which returns True if we areJohnny Chen
currently in trace mode (-t to dotest.py), i.e., tracing the lldb command execution. Change TestInferiorCrashing.inferior_crashing_python(self) to check this flag in order to print the stack trace of the inferior thread. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@129785 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-18Add a test script for exercising the "taregt create", "target list", and ↵Johnny Chen
"target select" commands. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@129717 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15Forgot to check in this change with ↵Johnny Chen
http://llvm.org/viewvc/llvm-project?view=rev&revision=129542. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@129574 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-23Turns out that the test failure wrt:Johnny Chen
rdar://problem/9173060 lldb hangs while running unique-types disappears if running with clang version >= 3. Modify the TestUniqueTypes.py to detect if we are running with clang version < 3 and, if true, skip the test. Update the lldbtest.system() function to return a tuple of (stdoutdata, stderrdata) since we need the stderr data from "clang -v" command. Modify existing clients of lldbtest.system() to now use, for example: # First, capture the golden output emitted by the oracle, i.e., the # series of printf statements. - go = system("./a.out", sender=self) + go = system("./a.out", sender=self)[0] # This golden list contains a list of (variable, value) pairs extracted # from the golden output. gl = [] And add two utility functions to lldbutil.py. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@128162 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-12Add a test directory stop-hook to test the newly added "target stop-hook" ↵Johnny Chen
command. This uses pexpect module to spawn a 'lldb' program and uses pseudo-TTY to talk to the child application. The test cases test setting breakpoints, adding a stop-hook with line range, and verifies that when the inferior stops, the stop-hook will fire off when it is within range and will not fire off when it is out of range. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@127519 91177308-0d34-0410-b5e6-96231b3b80d8