Add developer docs about testing

This commit is contained in:
John Beard 2017-03-01 19:05:40 +08:00 committed by Maciej Suminski
parent d7e1152aa3
commit 9dff85f0dc
1 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,41 @@
# Testing KiCad #
# Unit tests #
KiCad has a limited number of unit tests, which can be used to
check that certain functionality works.
## Python modules ##
The Pcbnew Python modules have some test programs in the `qa` directory.
You must have the `KICAD_SCRIPTING_MODULES` option on in CMake to
build the modules and enable this target.
The main test script is `qa/test.py` and the test units are in
`qa/testcases`. All the test units can by run using `make qa`, which
runs `test.py`.
You can also run an individual case manually, by making sure the
modules are built, adding them to `PYTHONPATH` and running the test
from the source tree:
make pcbnew_python_module
export PYTHONPATH=/path/to/kicad/build/pcbnew
cd /path/to/kicad/source/qa
python2 testcase/test_001_pcb_load.py
### Diagnosing segfaults ###
Although the module is Python, it links against a C++ library
(the same one used by KiCad Pcbnew), so it can segfault if the library
has a defect.
You can run the tests in GDB to trace this:
$ gdb
(gdb) file python2
(gdb) run testcases/test_001_pcb_load.py
If the test segfaults, you will get a familiar backtrace, just like
if you were running pcbnew under GDB.