summaryrefslogtreecommitdiff
path: root/src/ToolBox/SOS/tests/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'src/ToolBox/SOS/tests/README.md')
-rw-r--r--src/ToolBox/SOS/tests/README.md43
1 files changed, 27 insertions, 16 deletions
diff --git a/src/ToolBox/SOS/tests/README.md b/src/ToolBox/SOS/tests/README.md
index ed4c8d062c..1b9c1eac29 100644
--- a/src/ToolBox/SOS/tests/README.md
+++ b/src/ToolBox/SOS/tests/README.md
@@ -1,18 +1,28 @@
Testing libsosplugin
=====================================
-**Test assembly**
-The test asembly file must follow two rules:
-1. the test class must be named `Program` and
-2. it must have a static `Main` method.
-
-**Running tests**
-Make sure that python's lldb module is accessible. To run the tests, use the following command:
-`python test_libsosplugin.py --clr-args="/path/to/corerun [corerun_options] /path/to/test_assembly.exe"`
-`--clr-args` is a command that would normally be used to launch `corerun`
-This will run the test suite on the specified assembly.
-
-**Writing tests**
+**Test assembly**
+Compile test assembly file using any C# compiler you have, for example:
+- `gmcs test.cs`
+- `corerun csc.exe /nologo /r:System.Private.CoreLib.dll test.cs`
+
+
+**Running tests**
+Make sure that python's lldb module is accessible. To run the tests, use the following command:
+`python2 test_libsosplugin.py --corerun=corerun --sosplugin=sosplugin --assembly=assembly --timeout=timeout`
+- `lldb` is a path to `lldb` to run
+- `clrdir` is a directory with `corerun` and sosplugin
+- `assembly` is a compiled test assembly (e.g. Test.exe)
+- `timeout` is a deadline for a single test (in seconds)
+- `regex` is a regular expression matching tests to run
+- `repeat` is a number of passes for each test
+
+
+
+Log files for both failed and passed tests are `*.log` and `*.log.2` for standard output and error correspondingly.
+
+
+**Writing tests**
Tests start with the `TestSosCommands` class defined in `test_libsosplugin.py`. To add a test to the suite, start with implementing a new method inside this class whose name begins with `test_`. Most new commands will require only one line of code in this method: `self.do_test("scenarioname")`. This command will launch a new `lldb` instance, which in turn will call the `runScenario` method from `scenarioname` module. `scenarioname` is the name of the python module that will be running the scenario inside `lldb` (found in `tests` folder alongside with `test_libsosplugin.py` and named `scenarioname.py`).
An example of a scenario looks like this:
@@ -25,9 +35,10 @@ An example of a scenario looks like this:
process.Continue()
return True
- `runScenario` method does all the work related to running the scenario: setting breakpoints, running SOS commands and examining their output. It should return a boolean value indicating a success or a failure.
+ `runScenario` method does all the work related to running the scenario: setting breakpoints, running SOS commands and examining their output. It should return a boolean value indicating a success or a failure.
***Note:*** `testutils.py` defines some useful commands that can be reused in many scenarios.
-**Useful links**
-[Python scripting in LLDB](http://lldb.llvm.org/python-reference.html)
-[Python unittest framework](https://docs.python.org/2.7/library/unittest.html) \ No newline at end of file
+
+**Useful links**
+[Python scripting in LLDB](http://lldb.llvm.org/python-reference.html)
+[Python unittest framework](https://docs.python.org/2.7/library/unittest.html)