tests: make test_intersection use bt_cli, test error cases
The way test_intersection is written doesn't make it check whether the
babeltrace2 binary exits with success or failure. In two cases
(nointersect and nostream), the babeltrace2 binary errors out, but it
isn't explicitly validated by the test, so it's unclear whether this is
the behavior we want. The test just validates that nothing is output on
stdout, but that could happen because the process prints nothing and
exits with success, or because it prints an error on stderr and exits
with a failure status code.
This patch improves the test by making it use bt_cli instead of running
the babeltrace2 binary directly. This helps when troubleshooting the
test, since bt_cli prints the full command line with which it invokes
babeltrace2.
Then, it makes the test check the exit status of babeltrace2. In the
cases nointersect and nostream, we validate that it exits with a
non-zero status code, and that it prints an expected error string on
stderr. It adds a relatively trivial call to
BT_COMP_CLASS_LOGE_APPEND_CAUSE in the src.ctf.fs query code to make the
error message clearer in the nostream case.
I don't know if the current behavior of babeltrace2 in these two cases
is the one we want, but the goal of this patch is merely to update the
test to better test the current behavior. If we'd like a different
behavior, we can always modify babeltrace2 and the test later.
Change-Id: I1d6e616005369e397c98bdb1e40407e4e3959cc9 Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2068 Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com> Tested-by: jenkins <jenkins@lttng.org>