+
[source,c]
----
-BT_HIDDEN
char *bt_common_get_home_plugin_path(int log_level);
----
+
Library error logging statement, and unconditional error cause
appending.
-`+BT_LIB_LOGF_APPEND_CAUSE("format string", ...)+`::
- Library fatal logging statement, and unconditional error cause
- appending.
-
The macros above accept the typical `printf()` conversion specifiers
with the following limitations:
/* ... */
};
-BT_HIDDEN
bt_self_component_status my_comp_init(
bt_self_component_source *self_comp_src,
bt_value *params, void *init_method_data)
[[test-env]]
=== Environment
-`tests/utils/utils.sh` sets the environment variables for any {bt2}
-test script.
+Running `make check` in the build directory (regardless of whether the build is
+in-tree or out-of-tree) automatically sets up the appropriate environment for
+tests to run in, so nothing more is needed.
-`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.
+If building in-tree, you can run single tests from the tree directly:
-All test scripts eventually do something like this to source `utils.sh`,
-according to where they are located relative to the `tests` directory:
+----
+$ ./tests/plugins/sink.text.pretty/test-enum.sh
+----
+
+If building out-of-tree, you can get the appropriate environment by sourcing
+the `tests/utils/env.sh` file residing in the build directory against which you
+want to run tests.
-[source,bash]
----
-if [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; then
- UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh"
-else
- UTILSSH="$(dirname "$0")/../utils/utils.sh"
-fi
+$ source /path/to/my/build/tests/utils/env.sh
+$ ./tests/plugins/sink.text.pretty/test-enum.sh
----
==== 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.
+You can use the `tests/utils/run-python-bt2.sh` 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
+`run-python-bt2.sh` 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:
----
You can run any command which needs the `bt2` Python package through
-`run_python_bt2`, for example:
+`run-python-bt2.sh`, for example:
----
-$ ./tests/utils/run_python_bt2 ipython3
+$ ./tests/utils/run-python-bt2.sh ipython3
----
=== Report format
* Run:
+
----
-$ ./tests/utils/run_python_bt2 ./tests/bindings/python/bt2/test_python_bt2
+$ ./tests/utils/run-python-bt2.sh ./tests/bindings/python/bt2/test-python-bt2.sh
----
+
or:
+
----
-$ ./tests/utils/run_python_bt2 python3 ./tests/utils/python/testrunner.py \
+$ ./tests/utils/run-python-bt2.sh python3 ./tests/utils/python/testrunner.py \
./tests/bindings/python/bt2/ -p '*.py'
----
* Run:
+
----
-$ ./tests/utils/run_python_bt2 python3 ./tests/utils/python/testrunner.py \
+$ ./tests/utils/run-python-bt2.sh python3 ./tests/utils/python/testrunner.py \
./tests/bindings/python/bt2 -t test_value
----
* Run:
+
----
-$ ./tests/utils/run_python_bt2 python3 ./tests/utils/python/testrunner.py \
+$ ./tests/utils/run-python-bt2.sh python3 ./tests/utils/python/testrunner.py \
./tests/bindings/python/bt2/ -t test_value.RealValueTestCase
----
* Run:
+
----
-$ ./tests/utils/run_python_bt2 python3 ./tests/utils/python/testrunner.py \
+$ ./tests/utils/run-python-bt2.sh python3 ./tests/utils/python/testrunner.py \
./tests/bindings/python/bt2/ -t test_value.RealValueTestCase.test_assign_pos_int
----
You _must_ format modified and new {cpp} files with clang-format before
you create a contribution patch.
-You need clang-format{nbsp}≥{nbsp}10 to use the project's `.clang-format`
-file.
+You need clang-format{nbsp}15 to use the project's `.clang-format` file.
To automatically format all the project's {cpp} files, run:
$ ./tools/format-cpp
----
+Pass a directory path to only format the {cpp} files it contains:
+
+----
+$ ./tools/format-cpp ./src/cli
+----
+
Use the `FORMATTER` environment variable to override the default
formatter (`clang-format{nbsp}-i`):
----
-$ FORMATTER='clang-format-10 -i' ./tools/format-cpp
+$ FORMATTER='my-clang-format-15 -i' ./tools/format-cpp
----
==== Naming
#endif // BABELTRACE_BABY_HPP
----
====
+
+== Python Usage
+
+=== Formatting
+
+All Python code must be formatted using the version of
+https://github.com/psf/black[Black] specified in `dev-requirements.txt`.
+
+All Python imports must be sorted using the version of
+https://pycqa.github.io/isort/[isort] indicated in `dev-requirements.txt`.