X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=CONTRIBUTING.adoc;h=32f5363432f613ab34f000aef8acebd8afb15a25;hp=b9f26eb11bb5c626cbb40e5b3dfe380156fad028;hb=dba8555979d55f701c773da6d07e9039df5fd19c;hpb=fb7ff115d1c09334777a2cca347555765f3ce172 diff --git a/CONTRIBUTING.adoc b/CONTRIBUTING.adoc index b9f26eb1..32f53634 100644 --- a/CONTRIBUTING.adoc +++ b/CONTRIBUTING.adoc @@ -1490,26 +1490,23 @@ backtrace when Valgrind shows errors. [[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 +---- + +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 ---- ==== Python @@ -1683,13 +1680,19 @@ https://clang.llvm.org/docs/ClangFormatStyleOptions.html[style] of the 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}13 to use the project's `.clang-format` file. To automatically format all the project's {cpp} files, run: ---- -$ find -iname '*.cpp' -o -iname '*.hpp' -exec clang-format -i '{}' ';' +$ ./tools/format-cpp +---- + +Use the `FORMATTER` environment variable to override the default +formatter (`clang-format{nbsp}-i`): + +---- +$ FORMATTER='clang-format-10 -i' ./tools/format-cpp ---- ==== Naming