blob: ea3926ceed2b647a0abdf320d35b9c22a874ca5d [file] [log] [blame]
Johnny Chen6be30df2010-08-03 22:12:11 +00001This README file describes the files and directories related to the Python test
2suite under the current 'test' directory.
3
4o dotest.py
5
6 Provides the test driver for the test suite. To invoke it, cd to the 'test'
7 directory and issue the './dotest.py' command or './dotest.py -v' for more
8 verbose output. '.dotest.py -h' prints out the help messge.
9
10 A specific naming pattern is followed by the .py script under the 'test'
11 directory in order to be recognized by 'dotest.py' test driver as a module
12 which implements a test case, namely, Test*.py.
13
Johnny Chen840d8e32010-08-17 23:00:13 +000014 Some example usages:
15
16 1. ./dotest.py -v . 2> ~/Developer/Log/lldbtest.log0
17 This runs the test suite and directs the run log to a file.
18
19 2. LLDB_LOG=/tmp/lldb.log GDB_REMOTE_LOG=/tmp/gdb-remote.log ./dotest.py -v . 2> ~/Developer/Log/lldbtest.log
20 This runs the test suite, with logging turned on for the lldb as well as
21 the process.gdb-remote channels and directs the run log to a file.
22
Johnny Chen6be30df2010-08-03 22:12:11 +000023o lldbtest.py
24
25 Provides an abstract base class of lldb test case named 'TestVase', which in
26 turn inherits from Python's unittest.TestCase. The concrete subclass can
27 override lldbtest.TestBase in order to inherit the common behavior for
28 unittest.TestCase.setUp/tearDown implemented in this file.
29
30 To provide a test case, the concrete subclass provides methods whose names
31 start with the letters test. For more details about the Python's unittest
32 framework, go to http://docs.python.org/library/unittest.html.
33
34 ./command_source/TestCommandSource.py provides a simple example of test case
35 which overrides lldbtest.TestBase to exercise the lldb's 'command source'
36 command. The subclass should override the attribute 'mydir' in order for the
37 runtime to locate the individual test cases when running as part of a large
38 test suite or when running each test case as a separate Python invocation.
39
40 The doc string provides more details about the setup required for running a
41 test case on its own. To run the whole test suite, 'dotest.py' is all you
42 need to do.
43
44o subdirectories of 'test'
45
46 Most of them predate the introduction of the python test suite and contain
47 example C/C++/ObjC source files which get compiled into executables which are
48 to be exercised by the debugger.
49
50 For such subdirectory which has an associated Test*.py file, it was added as
51 part of the Python-based test suite to test lldb functionality.
52
53 Some of the subdirectories, for example, the 'help' subdirectory, do not have
54 C/C++/ObjC source files; they were created to house the Python test case which
55 does not involve lldb reading in an executable file at all.
56
Johnny Chen8f24cd12010-08-23 23:56:08 +000057o make directory
58
59 Contains Makefile.rules, which can be utilized by test cases to write Makefile
60 based rules to build native binaries.
61
Johnny Chen433cc8d2010-08-31 17:51:08 +000062o plugins directory
63
64 Contains platform specific plugin to build binaries with dsym/dwarf debugging
65 info. Other platform specific functionalities may be added in the future.
66
Johnny Chen8f24cd12010-08-23 23:56:08 +000067o unittest2 directory
Johnny Chen16fc6942010-08-05 23:47:51 +000068
69 Many new features were added to unittest in Python 2.7, including test
70 discovery. unittest2 allows you to use these features with earlier versions of
71 Python.
72
73 It currently has unittest2 0.5.1 from http://pypi.python.org/pypi/unittest2.
Johnny Chen3acc73a2010-08-06 21:07:38 +000074 Version 0.5.1 of unittest2 has feature parity with unittest in Python 2.7
75 final. If you want to ensure that your tests run identically under unittest2
76 and unittest in Python 2.7 you should use unittest2 0.5.1.
77
78 Later versions of unittest2 include changes in unittest made in Python 3.2 and
79 onwards after the release of Python 2.7.
Johnny Chen16fc6942010-08-05 23:47:51 +000080
Johnny Chen6be30df2010-08-03 22:12:11 +000081o dotest.pl
82
83 In case you wonder, there is also a 'dotest.pl' perl script file. It was
84 created to visit each Python test case under the specified directory and
85 invoke Python's builtin unittest.main() on each test case.
86
87 It does not take advantage of the test runner and test suite functionality
88 provided by Python's unitest framework. Its existence is because we want a
89 different way of running the whole test suite. As lldb and the Python test
90 suite become more reliable, we don't expect to be using 'dotest.pl' anymore.
91
Johnny Chen0cae7e22010-10-05 00:08:08 +000092 Note: dotest.pl has been moved to the attic directory.