tests: make test_intersection use bt_cli, test error cases
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 19 Sep 2019 19:45:53 +0000 (15:45 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 17 Oct 2019 16:13:27 +0000 (12:13 -0400)
commitc855b1ea85d664c6cbbb8d4d8d246a3afe7dab8a
treefcedf62b4dab0dfcea58f8754ba78e2bccfb6320
parent8a646afb27e079d7f9b556b9200a4a1808da98d8
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>
src/plugins/ctf/fs-src/query.c
tests/cli/test_intersection
This page took 0.024219 seconds and 4 git commands to generate.