summaryrefslogtreecommitdiffstats
path: root/lldb/test/lldbtest.py
Commit message (Collapse)AuthorAgeFilesLines
...
* Change the environment variable name to be more descriptive from ↵Johnny Chen2010-10-191-3/+3
| | | | | | LLDB_TIME_WAIT to LLDB_TIME_WAIT_NEXT_LAUNCH. llvm-svn: 116809
* Modify the test driver and lldbtest.TestBase so that the dumping of session infoJohnny Chen2010-10-191-9/+26
| | | | | | | | | | | | | | | | | | | now goes into a timestamp-specific directory instead of the previous .session-* files. [17:24:34] johnny:/Volumes/data/lldb/svn/trunk $ ls -l test/2010-10-18-16:56:12.935342 total 48 -rw-r--r-- 1 johnny admin 1695 Oct 18 16:56 TestArrayTypes.ArrayTypesTestCase.test_with_dsym_and_run_command.log -rw-r--r-- 1 johnny admin 1652 Oct 18 16:56 TestArrayTypes.ArrayTypesTestCase.test_with_dwarf_and_run_command.log -rw-r--r-- 1 johnny admin 2967 Oct 18 16:56 TestBreakpointCommand.BreakpointCommandTestCase.test_with_dsym.log -rw-r--r-- 1 johnny admin 1648 Oct 18 16:56 TestClassTypes.ClassTypesTestCase.test_with_dwarf_and_run_command.log -rw-r--r-- 1 johnny admin 1665 Oct 18 16:56 TestClassTypesDisassembly.IterateFrameAndDisassembleTestCase.test_with_dsym_and_python_api.log -rw-r--r-- 1 johnny admin 3873 Oct 18 16:58 TestFloatTypesExpr.FloatTypesTestCase.test_float_types_with_dsym.log [17:24:37] johnny:/Volumes/data/lldb/svn/trunk $ Also, the dumping happens when a test errored in additioned to when it failed. llvm-svn: 116778
* Missed this spot where module.cleanup() can be passed a test instance toJohnny Chen2010-10-161-1/+1
| | | | | | | facilitate session recording. This happens inside an instance method where the test instance is well known. llvm-svn: 116649
* Some re-achitecturing of the plugins interface. The caller is now required toJohnny Chen2010-10-151-65/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pass in a 'sender' arg to the buildDefault(), buildDsym(), buildDwarf(), and cleanup() functions. The sender arg will be the test instance itself (i.e., an instance of TestBase). This is so that the relevant command execution can be recorded in the TestBase.session object if sender is available. The lldbtest.system() command has been modified to pop the 'sender' arg out of the keyword arguments dictionary and use it as the test instance to facilitate seesion recordings. An example is in test/types/AbstractBase.py: def generic_type_tester(self, atoms, quotedDisplay=False): """Test that variables with basic types are displayed correctly.""" # First, capture the golden output emitted by the oracle, i.e., the # series of printf statements. go = system("./a.out", sender=self) There are cases when sender is None. This is the case when the @classmethod is involved in the use of these APIs. When this happens, there is no recording into a session object, but printing on the sys.stderr is still honored if the trace flag is ON. An example is in test/settings/TestSettings.py: @classmethod def classCleanup(cls): system(["/bin/sh", "-c", "rm -f output.txt"]) system(["/bin/sh", "-c", "rm -f stdout.txt"]) llvm-svn: 116648
* Add a test case for exercising breakpoint conditions using the lldb command:Johnny Chen2010-10-151-1/+1
| | | | | | | | | | | | | breakpoint modify -c 'val == 3' 1 after: breakpoint set -n c which sets a breakpoint on function 'c'. The breakpoint should only stop if expression 'val == 3' evaluates to true. llvm-svn: 116607
* Add a const string for assert message. Remove extra printing of newlines fromJohnny Chen2010-10-151-5/+2
| | | | | | the session recordings. llvm-svn: 116596
* Add more comments.Johnny Chen2010-10-151-2/+5
| | | | llvm-svn: 116583
* Be more specific about cases whenthe runCmd() check flag is False, meaning thereJohnny Chen2010-10-151-0/+2
| | | | | | | is no need to check the return status of the command execution, and an error status is not deemed a failure in the test. llvm-svn: 116582
* Simply use the TestBase.markFailure() callback method to set the __failed__ ↵Johnny Chen2010-10-151-4/+8
| | | | | | flag. llvm-svn: 116559
* This is an initial version of test driver enhanceent to be able to dump theJohnny Chen2010-10-151-35/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | session info after a test case failure, allowing more direct inspection of debugger session which leads to the test failure. For a simple usage scenario: [18:06:26] johnny:/Volumes/data/lldb/svn/trunk/test $ ./dotest.py -v . 2> ~/Developer/Log/lldbtest.log ... [18:14:43] johnny:/Volumes/data/lldb/svn/trunk/test $ ls -l .session-* -rw-r--r-- 1 johnny admin 1359 Oct 14 18:06 .session-TestArrayTypes.ArrayTypesTestCase.test_with_dwarf_and_run_command -rw-r--r-- 1 johnny admin 2054 Oct 14 18:07 .session-TestClassTypes.ClassTypesTestCase.test_with_dsym_and_expr_parser -rw-r--r-- 1 johnny admin 2055 Oct 14 18:07 .session-TestClassTypes.ClassTypesTestCase.test_with_dwarf_and_expr_parser -rw-r--r-- 1 johnny admin 1351 Oct 14 17:57 .session-TestClassTypes.ClassTypesTestCase.test_with_dwarf_and_run_command [18:14:51] johnny:/Volumes/data/lldb/svn/trunk/test $ The test case which failed will have its recorded session info dumped to a .session-* file in the current working directory. For test suite using relocated directory, expect to find the .session-* files there. In this checkin, I also add @skip decorator to the two test methods in test/foundation/TestObjCMethods.py as it looks like the test suite is deadlocking when running the tests. More investigations are needed. llvm-svn: 116552
* Add an initial version of test that exercise the lldb commands: 'process signal'Johnny Chen2010-10-141-0/+2
| | | | | | | | | | | | and 'process handle'. The test suite would like to control the asynch/sync execution of the interpreter during the middle of the test method, so the CommandInterpreter::SetSynchronous(bool value) is modified to allow the mode to be changed more than once. In practice, it would be advisable to control the process and to set the async/sync mode from a single thread, too. llvm-svn: 116467
* Avoid using hardcoded line number to break on. Use the line_number() utilityJohnny Chen2010-10-121-1/+1
| | | | | | function to get the line number to break on during setUp(). llvm-svn: 116275
* Add a utility function to lldbtest.py to return the line number of a matched ↵Johnny Chen2010-10-111-0/+9
| | | | | | | | | | | | | | string within a file. This is to be used within the test case to avoid hardcoded line number. array_types/TestArrayTypes.py is modified first to use this pattern. Other test modules to follow. rdar://problem/8537816 Testsuite: don't set breakpoints by exact file & line number llvm-svn: 116270
* Added the capability for the test driver to relocate the tests and the ↵Johnny Chen2010-10-111-14/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | intermediate files to a different top level directory than those specified on the command line. When relocated, the test clanups normally performed afterwards after each test method and after each test class will not be exercised at all. This allows for an easier postmortem analysis of test failures. Example: ./dotest.py -v -t -r /tmp/lldbtest types will create a /tmp/lldbtest directory which houses the types directory and its supported files. Files modified: o dotest.py, lldbtest.py: Add logic to process '-r dir' option to support relocating the tests to a different top level directory instead of exected in place. o darwin.py, test/types/Makefile: The 'make clean' should only clean the minimum .o and .d files. llvm-svn: 116255
* o TestStdCXXDisassembly.py:Johnny Chen2010-10-081-0/+1
| | | | | | | | | | | | | | | | | | | | Update the expected match string. o lldbtest.py: Indicate when a command fails, even if there is nothing in the error stream. o TestHelp.py: Add a regression test case for 'help image dump symtab'. o CommandObjectHelp.cpp: Some of the logic branches with successful help command results were not tagged with a Success Status. They are fixed now. This is important for Python interaction. llvm-svn: 116062
* Move the enum to string utility functions from lldbtest.py to lldbuti.py andJohnny Chen2010-10-071-52/+0
| | | | | | update the affected API clients. llvm-svn: 115995
* Clean up the StateType and StopReason enums now that they reside in the lldb ↵Johnny Chen2010-10-071-71/+19
| | | | | | module. llvm-svn: 115922
* o SBtarget.cpp/.h:Johnny Chen2010-10-071-1/+64
| | | | | | | | | | | | | | | | | | Temporarily commenting out the deprecated LaunchProcess() method. SWIG is not able to handle the overloaded functions. o dotest.py/lldbtest.py: Add an '-w' option to insert some wait time between consecutive test cases. o TestClassTypes.py: Make the breakpoint_creation_by_filespec_python() test method more robust and more descriptive by printing out a more insightful assert message. o lldb.swig: Coaches swig to treat StateType as an int type, instead of a C++ class. llvm-svn: 115899
* Make the test module with unique name instead of just the generic name ↵Johnny Chen2010-10-051-0/+8
| | | | | | | | TestDisassembly. Add a utility function to lldbtest.py to get the native pointer size of the host os. llvm-svn: 115652
* o Added a new feature to the test framework to skip long running tests ↵Johnny Chen2010-10-011-1/+20
| | | | | | | | | | | | | | | | | | | | conditionally. To not skip long running tests, pass '-l' to the test driver (dotest.py). An example: @unittest2.skipIf(TestBase.skipLongRunningTest(), "Skip this long running test") def test_foundation_disasm(self): ... o Added a long running disassemble test to the foundation directory, which iterates the code symbols from Foundation.framework and kicks off a disassemble command for for the named function symbol. Found a crasher: rdar://problem/8504895. o Plus added/updated some comments for the TestBase class. llvm-svn: 115368
* These prints should go to stderr as well. Plus add a global assert string.Johnny Chen2010-09-301-4/+6
| | | | llvm-svn: 115166
* Added a generic_type_tester() to the TestBasicTypes class to be used forJohnny Chen2010-09-231-1/+1
| | | | | | | | | | | | | | | | testing various combinations of displaying variales of basic types. The generic_type_tester() works by first capturing the golden output produced by the printf stmts of ./a.out, creating a list of (var, value) pairs, and then running the a.out to a stop point, and comparing the 'frame variable var' output against the list of (var, value) pairs. Modified int_type() and added long_type() to use generic_type_tester(). Also modified TestBase.expect() such that substring matching also return ok if the substring starts at the 0-th position. llvm-svn: 114708
* Checked in an initial template for the types directory. Right now, it doesn'tJohnny Chen2010-09-221-6/+22
| | | | | | | | | | | actually test-and-compare anything yet. The lldbtest.TestBase has an added method setTearDownCleanup(dictionary=None) to facilitate running the cleanup right after each data type test is run. The test case can pass a dictionary object when registering the test case cleanup. There is currently only int_type test in the repository. llvm-svn: 114600
* Trivial change of a trace output string.Johnny Chen2010-09-211-1/+1
| | | | llvm-svn: 114505
* Added a subtest to exercise the capability of lldb Python objects to printJohnny Chen2010-09-211-13/+27
| | | | | | | | | | | themselves. Right now, it tests a breakpoint both before and after it has been resolved. Updated lldbtest.TestBase.expect() with an additional keyword argument 'exe' ( default to True), which if set to False, will treat the mandatory first argument as just the string to be matched/or not-matched against the golden input. llvm-svn: 114501
* Wrapped the subclass-specific cleanup call within a try:except: clause.Johnny Chen2010-09-211-2/+6
| | | | | | And removed the informational output from the conditional_break test case. llvm-svn: 114493
* Added a more complex test case of breakpoint commands, which executes a sequenceJohnny Chen2010-09-211-8/+39
| | | | | | | | | | | | | | | | | | | of 'breakpoint command add/list/remove' commands to set breakpoint callbacks, list them, and then remove one. Modified the lldbtest.TestBase.expect() method to add two additional keyword arguments: o matching (default to True), which, if set to False, reverses the semantics of 'expect' to 'expect not' o patterns (default to None), which specifies a list of regexp patterns to match against the output from running the command TestBreakpointCommand.py uses the matching=False and the patterns=[...] expect() API. llvm-svn: 114480
* Fixed a typo and supplied a more appropriate assert message.Johnny Chen2010-09-171-1/+3
| | | | llvm-svn: 114232
* Added test cases to FoundationTestCase to exercise lookup of objc data types andJohnny Chen2010-09-171-4/+15
| | | | | | | | | | | | to evaluate expressions. Marked with @expectedFailure decorators for the time being. Enhanced the lldbtest.TestBase.expect() API to allow an additional keyword arg named "error". If the client passes "error=True", it signifies that an error while running the command is expected. The golden input is then compared against the return object's error output. llvm-svn: 114228
* Added a test case for the settings command which sets process.output-path andJohnny Chen2010-09-161-1/+1
| | | | | | checks that the launched process writes its standard output there. llvm-svn: 114102
* Provided a mechanism for the test class to cleanup after itself once it's done.Johnny Chen2010-09-161-9/+33
| | | | | | | | | | | | | | | | | | | | This will remove the confusion experienced when previous test runs left some files (both intermediate or by-product as a result of the test). lldbtest.TestBase defines a classmethod tearDownClass(cls) which invokes the platform-specific cleanup() function as defined by the plugin; after that, it invokes a subclass-specific function classCleanup(cls) if defined; and, finally, it restores the old working directory. An example of classCleanup(cls) is in settings/TestSettings.py: @classmethod def classCleanup(cls): system(["/bin/sh", "-c", "rm output.txt"]) where it deletes the by-product "output.txt" as a result of running a.out. llvm-svn: 114058
* Changed to a more informative message.Johnny Chen2010-09-151-1/+1
| | | | llvm-svn: 113989
* We believed the intermittent process launch failure while running the test suiteJohnny Chen2010-09-151-0/+2
| | | | | | | has been fixed by r113947. But just in case it still fails, emits a prominent message always. llvm-svn: 113986
* Added two test cases to exercise 'expr this->m_c_int' with @expectedFailureJohnny Chen2010-09-151-2/+2
| | | | | | decorators for the time being. llvm-svn: 113905
* More appropriate headings for the traceoutput: stdout & stderr.Johnny Chen2010-09-141-3/+3
| | | | llvm-svn: 113879
* Removed the expectedFailure decorator from test_with_dwarf_and_run_command() ↵Johnny Chen2010-09-141-3/+4
| | | | | | | | | | | | | | | | test case as it now passes. Added some extra tests to breakpoint_creation_by_filespec_python(). More clarification for the "os command" output and error as defined in lldbtest.system() function. Cleaned up the option processing of the test driver (dotest.py) and fixed the comment about enabling gdb-remote logging. Example: $ GDB_REMOTE_LOG=/tmp/log.txt ./dotest.py -v -t enum_types llvm-svn: 113868
* Extend the build mechanism to allow for specifying the compiler used to buildJohnny Chen2010-09-131-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the binaries. If the build* function is passed the compiler argument, for example, 'llvm-gcc', it is passed as a make variable to the make command. Otherwise, we check the LLDB_CC environment variable; if it is defined, it is passed as a make variable to the make command. If neither the compiler keyword argument nor the LLDB_CC environment variable is specified, no CC make variable is passed to the make command. The Makefile gets to define the default CC being used. -------------------------------------------------------------------------------- Example usage follows: o Via the keyword argument: class ArrayTypesTestCase(TestBase): mydir = "array_types" @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") def test_with_dsym_and_run_command(self): """Test 'frame variable var_name' on some variables with array types.""" self.buildDsym(compiler='llvm-gcc') self.array_types() ... o Via LLDB_CC environment variable: $ LLDB_CC=llvm-gcc ./dotest.py -v -t array_types ---------------------------------------------------------------------- Collected 4 tests test_with_dsym_and_python_api (TestArrayTypes.ArrayTypesTestCase) Use Python APIs to inspect variables with array types. ... os command: [['/bin/sh', '-c', 'make clean; make MAKE_DSYM=YES CC=llvm-gcc']] output: rm -rf "a.out" "a.out.dSYM" main.o main.d llvm-gcc -arch x86_64 -gdwarf-2 -O0 -arch x86_64 -gdwarf-2 -O0 -c -o main.o main.c llvm-gcc -arch x86_64 -gdwarf-2 -O0 main.o -o "a.out" /usr/bin/dsymutil -o "a.out.dSYM" "a.out" ... llvm-svn: 113781
* The output for term-width setting has single quotes around the (int) value.Johnny Chen2010-09-071-0/+2
| | | | | | And added a trace output for the stop function name to breakAfterLaunch() method. llvm-svn: 113251
* Marked test_process_launch_for_universal() test case as requiring 'darwin' ↵Johnny Chen2010-09-031-0/+6
| | | | | | | | and 'i386' in order to be run. And added a default build phase at the beginning of the method. llvm-svn: 113037
* Fixed an lldb infrastructure bug, where the debugger should reaaly update itsJohnny Chen2010-09-031-4/+4
| | | | | | | | | | | execution context only when the process is still alive. When running the test suite, the debugger is launching and killing processes constantly. This might be the cause of the test hang as reported in rdar://problem/8377854, where the debugger was looping infinitely trying to update a supposedly stale thread list. llvm-svn: 113022
* Added comments regarding the two mechanisms of process cleanup to lldbtest.py.Johnny Chen2010-09-021-16/+12
| | | | | | | Also changed the expected strings to be matched since "thread list" changed its output format. llvm-svn: 112880
* Moved the process cleanup of Script-Bridge-based APIs into TestBase.tearDown()Johnny Chen2010-09-021-3/+18
| | | | | | | | | | method where they belong. Also fixed a logic error in maintaining the command interface flag (runStarted) indicating whether the lldb "run"/"process launch" command has been issued. It was erroneously cleared. Modified the test cases to take advantage of the refactoring. llvm-svn: 112863
* Put the little dances done after SBTarget.LaunchProcess() into the base class.Johnny Chen2010-09-011-2/+39
| | | | llvm-svn: 112749
* Avoid killing the inferior process twice by passing a setCookie=False keywordJohnny Chen2010-09-011-5/+6
| | | | | | | | argument when issuing a "run" lldb command within the test case meant to exercise the Python APIs, but is using the command interface due to certain reason (such as target.LaunchProcess() does not reliably bring up the inferior). llvm-svn: 112682
* Changed the buildDsym()/buildDwarf() TestBase methods to use a plugin frameworkJohnny Chen2010-08-311-66/+63
| | | | | | | | | | | to delegate the building of binaries to a sys.platform-sepcific plugin. Modified the dotest.py test driver to add the "plugins" directory to the PYTHONPATH as well. darwin.py is the Mac OS X plugin module. llvm-svn: 112606
* Added doc strings to the array_types test cases. And terminate the currentJohnny Chen2010-08-301-2/+2
| | | | | | | process being debugged in the TestBase.tearDown() instead of letting it continue and finish. llvm-svn: 112556
* Converted TestArrayTypes.py to Dsym/Dwarf combination, and added verbose outputJohnny Chen2010-08-301-0/+6
| | | | | | of os command to lldbtest.TestBase.system() method. llvm-svn: 112547
* Added buildDsym() and buildDwarf() methods to lldbtest.TestBase class, and callJohnny Chen2010-08-301-0/+14
| | | | | | them from test cases instead of issuing "make clean; make ..." os command. llvm-svn: 112542
* Added a system() method to the TestBase class of lldbtest.py, which is actuallyJohnny Chen2010-08-301-3/+42
| | | | | | | | | | | | | | | | | taken from Python 2.7's subprocess.check_output() convenience function. The purpose of this method is to run the os command with arguments and return its output as a byte string. Modified hello_world/TestHelloWorld.py to have two test cases: o test_with_dsym_and_run_command o test_with_dwarf_and_process_launch_api with the dsym case conditioned on sys.platform.startswith("darwin") being true. The two cases utilize the system() method to invoke "make clean; make MAKE_DYSM=YES/NO" to prepare for the appropriate debugging format before running the test logic. llvm-svn: 112530
* Added a test case test_breakpoint_creation_by_filespec_python() which creates aJohnny Chen2010-08-271-1/+3
| | | | | | | | breakpoint by FileSpec and line number and exercises some FileSpec APIs. Also, RUN_STOPPED is a bad assert name, RUN_SUCCEEDED is better. llvm-svn: 112327
OpenPOWER on IntegriCloud