From: Simon Marchi Date: Mon, 22 Nov 2021 21:52:47 +0000 (-0500) Subject: Update CONTRIBUTING.adoc to mention tests/utils/env.sh X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=8aed890cabf4bf9b2366adacf00e4a237e585649 Update CONTRIBUTING.adoc to mention tests/utils/env.sh We can simplify the explanations of how to set up the appropriate environment for running tests to just mention sourcing env.sh. Change-Id: I905f8ef94b6b5d904ad62d367f04a29ede687213 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/6725 Reviewed-by: Michael Jeanson --- diff --git a/CONTRIBUTING.adoc b/CONTRIBUTING.adoc index 7052f2e8..945f3984 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. - -`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. - -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] ----- -if [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; then - UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh" -else - UTILSSH="$(dirname "$0")/../utils/utils.sh" -fi +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. + +If building in-tree, you can run single tests from the tree directly: + +---- +$ ./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 /path/to/my/build/tests/utils/env.sh +$ ./tests/plugins/sink.text.pretty/test_enum ---- ==== Python