lib: add bt_{graph,query_executor}_add_interrupter()
[babeltrace.git] / CONTRIBUTING.adoc
index c5fb796862a5b799181c3402cff889cfb2bc52d3..d5d86e54a2a9e4daa19b21d22de1edbbc4ce28be 100644 (file)
@@ -631,59 +631,63 @@ The available format specifiers are:
 
 |`F`
 |Trace IR field class
-|`+struct bt_field_class *+`
+|`+const struct bt_field_class *+`
 
 |`f`
 |Trace IR field
-|`+struct bt_field *+`
+|`+const struct bt_field *+`
 
 |`P`
 |Trace IR field path
-|`+struct bt_field_path *+`
+|`+const struct bt_field_path *+`
 
 |`E`
 |Trace IR event class
-|`+struct bt_event_class *+`
+|`+const struct bt_event_class *+`
 
 |`e`
 |Trace IR event
-|`+struct bt_event *+`
+|`+const struct bt_event *+`
 
 |`S`
 |Trace IR stream class.
-|`+struct bt_stream_class *+`
+|`+const struct bt_stream_class *+`
 
 |`s`
 |Trace IR stream
-|`+struct bt_stream *+`
+|`+const struct bt_stream *+`
 
 |`a`
 |Trace IR packet
-|`+struct bt_packet *+`
+|`+const struct bt_packet *+`
 
 |`T`
 |Trace IR trace class
-|`+struct bt_trace_class *+`
+|`+const struct bt_trace_class *+`
 
 |`t`
 |Trace IR trace
-|`+struct bt_trace *+`
+|`+const struct bt_trace *+`
 
 |`K`
 |Trace IR clock class
-|`+struct bt_clock_class *+`
+|`+const struct bt_clock_class *+`
 
 |`k`
 |Trace IR clock snapshot
-|`+struct bt_clock_snapshot *+`
+|`+const struct bt_clock_snapshot *+`
 
 |`v`
 |Value object
-|`+struct bt_value *+`
+|`+const struct bt_value *+`
+
+|`R`
+|Integer range set
+|`const struct bt_integer_range_set *`
 
 |`n`
 |Message
-|`+struct bt_message *+`
+|`+const struct bt_message *+`
 
 |`i`
 |Message iterator
@@ -695,35 +699,39 @@ The available format specifiers are:
 
 |`c`
 |Component
-|`+struct bt_component *+`
+|`+const struct bt_component *+`
 
 |`p`
 |Port
-|`+struct bt_port *+`
+|`+const struct bt_port *+`
 
 |`x`
 |Connection
-|`+struct bt_connection *+`
+|`+const struct bt_connection *+`
 
 |`g`
 |Graph
-|`+struct bt_graph *+`
+|`+const struct bt_graph *+`
+
+|`z`
+|Interrupter
+|`+struct bt_interrupter *+`
 
 |`l`
 |Plugin
-|`const struct bt_plugin *`
+|`+const struct bt_plugin *+`
 
 |`r`
 |Error cause
-|`const struct bt_error_cause *`
+|`+const struct bt_error_cause *+`
 
 |`o`
 |Object pool
-|`+struct bt_object_pool *+`
+|`+const struct bt_object_pool *+`
 
 |`O`
 |Object
-|`+struct bt_object *+`
+|`+const struct bt_object *+`
 |===
 
 Conversion specifier examples:
@@ -1345,7 +1353,7 @@ an _INFO_ build.
 * Object copying (except fields and values).
 * Object freezing (whatever the type, as freezing only occurs in
   developer mode).
-* Object cancellation.
+* Object interruption.
 * Calling user methods and logging the result.
 * Setting object properties (except fields and values).
 |
@@ -1496,30 +1504,133 @@ backtrace when Valgrind shows errors.
 
 == Testing
 
-=== Python Bindings
+[[test-env]]
+=== Environment
+
+`tests/utils/utils.sh` sets the environment variables for any Babeltrace
+test script.
+
+`utils.sh` only needs to know the path to the `tests` directory within
+the source and the build directories. By default, `utils.sh` assumes the
+build is in tree, that is, you ran `./configure` from the source's root
+directory, and sets the `BT_TESTS_SRCDIR` and `BT_TESTS_BUILDDIR`
+environment variables accordingly. You can override those variables, for
+example if you build out of tree.
 
-To run all the `bt2` Python package tests use:
+All test scripts eventually do something like this to source `utils.sh`,
+according to where they are located relative to the `tests` directory:
 
+[source,bash]
 ----
-$ BT_TESTS_BUILDDIR=/path/to/build/babeltrace/tests \
-       ./tests/bindings/python/bt2/test_python_bt2
+if [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; then
+    UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh"
+else
+    UTILSSH="$(dirname "$0")/../utils/utils.sh"
+fi
 ----
 
-To run all the tests in a test module (e.g. `test_event.py`) use:
+==== Python
+
+You can use the `tests/utils/run_python_bt2` script to run any command
+within an environment making the build's `bt2` Python package available.
+
+`run_python_bt2` uses <<test-env,`utils.sh`>> which needs to know the
+build directory, so make sure you set the `BT_TESTS_BUILDDIR`
+environment variable correctly _if you build out of tree_, for example:
 
 ----
-$ BT_TESTS_BUILDDIR=/path/to/build/babeltrace/tests \
-       ./tests/utils/run_python_bt2 python3 ./tests/utils/python/testrunner.py \
-       -t test_event \
-       ./tests/bindings/python/bt2/
+$ export BT_TESTS_BUILDDIR=/path/to/build/babeltrace/tests
 ----
 
-To run a specific test (e.g. `EventTestCase.test_clock_value`) in a test module
-(e.g. `test_event.py`) use:
+You can run any command which needs the `bt2` Python package through
+`run_python_bt2`, for example:
+
+----
+$ ./tests/utils/run_python_bt2 ipython3
+----
+
+=== Report format
+
+All test scripts output the test results following the
+https://testanything.org/[Test Anything Protocol] (TAP) format.
+
+The TAP format has two mechanisms to print additional information about
+a test:
+
+* Print a line starting with `#` to the standard output.
++
+This is usually done with the `diag()` C function or the `diag` shell
+function.
+
+* Print to the standard error.
+
+
+=== Python bindings
+
+The `bt2` Python package tests are located in
+`tests/bindings/python/bt2`.
+
+
+==== Python test runner
+
+`tests/utils/python/testrunner.py` is Babeltrace's Python test runner
+which loads Python files containing unit tests, finds all the test
+cases, and runs the tests, producing a TAP report.
+
+You can see the test runner command's help with:
+
+----
+$ python3 ./tests/utils/python/testrunner.py --help
+----
 
+By default, the test runner reports failing tests (TAP's `not{nbsp}ok`
+line), but continues to run other tests. You can use the `--failfast`
+option to make the test runner fail as soon as a test fails.
+
+
+==== Guides
+
+To run all the `bt2` Python package tests:
+
+* Run:
++
+----
+$ ./tests/utils/run_python_bt2 ./tests/bindings/python/bt2/test_python_bt2
+----
++
+or:
++
+----
+$ ./tests/utils/run_python_bt2 python3 ./tests/utils/python/testrunner.py \
+  ./tests/bindings/python/bt2/ -p '*.py'
+----
+
+To run **all the tests** in a test module (for example,
+`test_value.py`):
+
+* Run:
++
+----
+$ ./tests/utils/run_python_bt2 python3 ./tests/utils/python/testrunner.py \
+  ./tests/bindings/python/bt2 -t test_value
+----
+
+To run a **specific test case** (for example, `RealValueTestCase` within
+`test_value.py`):
+
+* Run:
++
+----
+$ ./tests/utils/run_python_bt2 python3 ./tests/utils/python/testrunner.py \
+  ./tests/bindings/python/bt2/ -t test_value.RealValueTestCase
+----
+
+To run a **specific test** (for example,
+`RealValueTestCase.test_assign_pos_int` within `test_value.py`):
+
+* Run:
++
 ----
-$ BT_TESTS_BUILDDIR=/path/to/build/babeltrace/tests \
-       ./tests/utils/run_python_bt2 python3 ./tests/utils/python/testrunner.py \
-       -t test_event.EventTestCase.test_clock_value \
-       ./tests/bindings/python/bt2/
+$ ./tests/utils/run_python_bt2 python3 ./tests/utils/python/testrunner.py \
+  ./tests/bindings/python/bt2/ -t test_value.RealValueTestCase.test_assign_pos_int
 ----
This page took 0.028318 seconds and 4 git commands to generate.