|
| 1 | +.. _developer-testsuite: |
| 2 | + |
| 3 | +============================== |
| 4 | +Debugging the Numba Test Suite |
| 5 | +============================== |
| 6 | + |
| 7 | +.. note:: Features described here are only implemented for the parallel |
| 8 | + test runner (e.g. requires the ``-m`` flag). |
| 9 | + |
| 10 | +The Numba test suite provides some useful features for debugging test failures |
| 11 | +or crashes. |
| 12 | + |
| 13 | +Generating JUnit XML Output |
| 14 | +--------------------------- |
| 15 | + |
| 16 | +You can generate a JUnit-compatible XML report by running the tests with the |
| 17 | +``--junit`` flag: |
| 18 | + |
| 19 | +.. code-block:: bash |
| 20 | +
|
| 21 | + $ python -m numba.runtests <args> --junit |
| 22 | +
|
| 23 | +This will produce a ``junit_numba_<timestamp>.xml`` file containing the test results. |
| 24 | + |
| 25 | +The XML contains some extra metadata as ``testcase`` properties: |
| 26 | + |
| 27 | +- ``pid``: The ID of the worker process running each test case |
| 28 | +- ``start_time``: The start time for each test case relative to when the worker |
| 29 | + process started |
| 30 | + |
| 31 | + |
| 32 | +Example of the XML file: |
| 33 | + |
| 34 | +.. code-block:: xml |
| 35 | +
|
| 36 | + <?xml version='1.0' encoding='utf-8'?> |
| 37 | + <testsuites time="20.745398832"> |
| 38 | + <testsuite name="numba_testsuite"> |
| 39 | + <testcase name="TestUsecases.test_andor" classname="numba.tests.test_usecases" |
| 40 | + time="1.7033392500000002"> |
| 41 | + <properties> |
| 42 | + <property name="pid" value="73274" /> |
| 43 | + <property name="start_time" value="1.337771667" /> |
| 44 | + </properties> |
| 45 | + </testcase> |
| 46 | + <testcase name="TestUsecases.test_blackscholes_cnd" classname="numba.tests.test_usecases" |
| 47 | + time="1.723800292"> |
| 48 | + <properties> |
| 49 | + <property name="pid" value="73275" /> |
| 50 | + <property name="start_time" value="1.3350285" /> |
| 51 | + </properties> |
| 52 | + </testcase> |
| 53 | + ... |
| 54 | + </testsuite> |
| 55 | + </testsuites> |
| 56 | +
|
| 57 | +
|
| 58 | +Debugging Timeouts caused by Crashes |
| 59 | +------------------------------------ |
| 60 | + |
| 61 | +If the test suite times out, it may indicate a crashed worker process. |
| 62 | +In this case, the timeout error will show: |
| 63 | + |
| 64 | +- The active tests that didn't finish before the timeout |
| 65 | +- For each affected process ID, the list of tests that process was running |
| 66 | + |
| 67 | +For example: |
| 68 | + |
| 69 | +.. code-block:: none |
| 70 | +
|
| 71 | + TimeoutError: Active tests didn't finish before timeout: |
| 72 | + - test_foo [PID 1234] |
| 73 | +
|
| 74 | + Tests ran by each affected process: |
| 75 | + - [PID 1234]: test_bar test_baz test_foo |
| 76 | +
|
| 77 | +This information can help reproduce crashes that depend on the test execution |
| 78 | +order or state within a process. You can retry just the tests that were running |
| 79 | +in the crashed process. |
| 80 | + |
0 commit comments