tests: run some Python tests with CTF 1 and CTF 2 traces
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 24 Oct 2023 02:12:24 +0000 (22:12 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 4 Sep 2024 19:05:14 +0000 (15:05 -0400)
commitc5d4db7a5b271f013e93540e16998beb01fd677d
tree4342a9db789eae3130975cde11f097a94c897e54
parentbe3f10d5060954b231b3bfbc137f0cda1e8b4470
tests: run some Python tests with CTF 1 and CTF 2 traces

The goal of this patch is to run as many Python-based tests that use CTF
traces against both CTF 1 and CTF 2.  I would like to minimize the
amount of changes and boilerplate necessary in each individual test.

I've taken the approach to add a decorator named `test_all_ctf_versions`
to the test classes, inspired by the parameterized Python package [1].
Unlike the decorators, from parameterized, our decorator is hardcoded
for what we need.  When applied to a class, it makes two copies of all
`test_*` methods of that class, suffixed with `_ctf_1` and `_ctf_2`, and
removes the original method.  The two new methods are in fact wrapped in
a small wrapper that sets the `_ctf_version` attribute on the class
(with the value 1 or 2) for the duration of the method call.

The changes necessary in the test themselves are to make the test trace
paths dependent on `self._ctf_version`, instead of hard-coded.

[1] https://pypi.org/project/parameterized/

Change-Id: Idef27183db6287630e63260395d255e68da2a4c3
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8737
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12755
tests/data/ctf-traces/2/intersection/3eventsintersect/metadata [new file with mode: 0644]
tests/data/ctf-traces/2/intersection/3eventsintersect/test_stream_0 [new file with mode: 0644]
tests/data/ctf-traces/2/intersection/3eventsintersect/test_stream_1 [new file with mode: 0644]
tests/plugins/src.ctf.fs/query/test_query_support_info.py
tests/plugins/src.ctf.fs/query/test_query_trace_info.py
tests/utils/python/test_all_ctf_versions.py [new file with mode: 0644]
This page took 0.024751 seconds and 4 git commands to generate.