Simon Marchi [Wed, 6 Nov 2024 05:19:51 +0000 (00:19 -0500)]
bt2: some more .h -> .hpp
These files were forgotten in
df4b0828816d ("bt2: rename .i.h ->
.i.hpp").
Change-Id: I0a50fbfde8f5c0de66eb43240337f2fcf0f02fbe
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13506
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Wed, 6 Nov 2024 05:08:53 +0000 (00:08 -0500)]
bt2: fix comment formatting
Change-Id: I247297801ecfb8aa4e253f9c44893a60835cc875
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13505
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Wed, 6 Nov 2024 04:57:10 +0000 (23:57 -0500)]
py-common: remove unused include
Change-Id: If0fece55c5067ff4acf70761c5e00a24e36faee7
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13504
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Wed, 6 Nov 2024 04:54:05 +0000 (23:54 -0500)]
py-common: compile as C++
Keep the C interface (`py-common.h`), needed by
`python-plugin-provider.c`.
Change-Id: I84dc61cc18cf77ebaca4aefb0a15e64a32936798
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13503
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Wed, 6 Nov 2024 04:24:31 +0000 (23:24 -0500)]
bt2: remove some unnecessary checks
- getting the id from a stream class, stream or event class can't
return negative values
- getting the trace class from a trace can't return None
- getting the stream class from a stream can't return None
Change-Id: If797994f4a10072f662c122c15a5081419d9fa3d
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13502
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Fri, 1 Nov 2024 03:25:29 +0000 (23:25 -0400)]
bt2: rename .i.h -> .i.hpp
Change-Id: If6968e678727c79d11835473be81321367362f13
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13434
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Tue, 5 Nov 2024 17:17:52 +0000 (12:17 -0500)]
bt2: generate native extension as C++
Make SWIG generate the native code in C++ rather than C. The
differences in the generated file (`native_bt.cpp`, previously
`native_bt.c`) are not significant (use of C++-style casts instead of
C-style casts, use of new/delete instead malloc/free, etc), but it will
allow us to use C++ in the typemap code. It will help to integrate
better with other utils that are or will be written in C++.
Unfortunately, this requires more distutils hackery. It looks like
distutils (both the copies distributed with CPython < 3.12 and the copy
in setuptools < 72.2.0) doesn't have good support for building objects
from C++ files that will end up in shared objects. The `compiler_so`
executable gets used, defined here [1] as using the C compiler. If
using a recent enough compiler that defaults to C++11, it works (when
calling `gcc` or `clang`, rather than `g++` or `clang++` they understand
that you want to compile C++ based on the file suffix). But on an older
system (e.g. SLES12) with gcc 4.8, we get errors like:
In file included from bt2/native_bt.cpp:3296:0:
/babeltrace/src/bindings/python/bt2/bt2/native_bt_autodisc.i.h: In function 'bt_value* bt_bt2_auto_discover_source_components(const bt_value*, const bt_plugin_set*)':
/babeltrace/src/bindings/python/bt2/bt2/native_bt_autodisc.i.h:118:9: warning: 'auto' changes meaning in C++11; please remove it [-Wc++0x-compat]
const auto autodisc_result = static_cast<auto_source_discovery_result*>(
^
Things appear to have improved in setuptools 72.2.0 [2], where there's
now a `compiler_so_cxx` executable that uses the C++ compiler. This
release doesn't appear widely available in Linux distros right now (for
instance Arch is still at 69.5.1), and we need to support distutils all
the way back to Python 3.4 anyway.
The new distutils hackery is inspired by this blog post [3]. The idea
is to override the `build_extensions()` method of
`distutils.command.build_ext.build_ext` method to set the executables on
the `distutils.ccompiler.CCompiler` instance. Because this way of doing
things overrides the flags previously determined by distutils, we can
handle here the other hacks:
- the hack to force our CFLAGS over sysconfig's CFLAGS (which now
becomes CXXFLAGS because C++)
- the hack to manually convert the include paths form on MinGW
I add to the `compiler_so_cxx` command the result of
`sysconfig.get_config_var("CCSHARED")`, which is analogous to what is
done in [2]. On Linux, for instance, this contains `-fPIC`, which is
necessary to produce objects files intended to be used in shared
objects.
[1] https://github.com/pypa/setuptools/blob/v72.1.0/setuptools/_distutils/sysconfig.py#L355-L357
[2] https://github.com/pypa/setuptools/blob/v72.2.0/setuptools/_distutils/sysconfig.py#L360-L363
[3] https://shwina.github.io/custom-compiler-linker-extensions/
Change-Id: I5999292d3a14948ef5f675a924e2360bc4d73f13
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13431
Simon Marchi [Tue, 5 Nov 2024 17:48:10 +0000 (12:48 -0500)]
setup.cfg: make flake8 scan *.py.in files
... in order to scan `src/bindings/python/bt2/setup.py.in` (it is a
valid Python program despite the name, the replacement tokens are only
in strings).
Make the pre-commit hooks run on this file as well (the technique is
described somewhere here [1]).
Doing so finds a small flake8 issue, fix it.
[1] https://pre-commit.com/#filtering-files-with-types
Change-Id: I1427d0d987884b72851741d6bb36620c5609ddb9
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13492
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Tue, 5 Nov 2024 17:10:51 +0000 (12:10 -0500)]
bt2/setup.py.in: assume environment variables always exist
`setup.py` is always called from our Makefile, where we control which
environment variables are set. Remove the code paths that handle the
cases where environment variables CC, LDFLAGS, CFLAGS and CPPFLAGS may
not exist. This simplifies the number of cases to worry about, making
the code easier to reason about.
This requires passing the build flags to setup.py when using the install
command, but I don't think that's a problem.
Change-Id: I380d113824bddf6a423e34a681d904a844175100
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13491
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Wed, 23 Oct 2024 19:52:16 +0000 (15:52 -0400)]
bt2: first pass of type annotation
Do a quick pass of adding type annotations on almost everything public
in the API. It's not perfect, for instance:
- Because of the structure of const vs non-const objects, the typings
claim that the non-const versions reutrn const properties, when in
reality then return non-const properties. For instance,
`_StreamClass.trace_class` should return a `_TraceClass`, not a
`_TraceClassConst`. Some refactoring will be needed to get that
right.
- The typings could sometimes return a more precise type with the use
of generics. For instance,
`_OptionWithUnsignedIntegerSelectorFieldClassConst.ranges()` should
return an `_UnsignedIntegerRangeSetConst`, but it returns an
`_IntegerRangeSetConst` right now (because the `ranges()` method is
shared with the signed version).
- I left out some more complex things, like the type of params (which
is also the type of the parameter to `bt2.create_value()`). That's a
project for later.
Still, I think it's better than nothing, and we have to start somewhere.
Even when the return value could be inferred, I chose to specify it
explicitly. It acts as documentation for anyone reading the code
without an analysis tool that can display the inferred value, and it
acts as validation that the functions keep returning what we want them
to return (especially if we ever run pyright or similar in the CI one
day).
Change-Id: I25999b855626ca3efb619b8cb07d267b4d8ec3ed
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13403
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Mon, 16 Oct 2023 20:19:30 +0000 (16:19 -0400)]
bt2: add local copy of typing module
Add a local copy of the typing module [1], in order to be able to use
the typing module features with Python 3.4.
Add notes about the license in the top-level LICENSE file.
Add exclusions to avoid this file being reformatted by black and
analyzed by flake8.
Add an import in utils.py, such that other files will be able to use the
typing module using:
typing = utils._typing_mod
... and not care where the typing module comes from.
[1] https://github.com/python/typing/blob/3.10.0.2/src/typing.py
Change-Id: Id36fb65804ad8e00962b70f185c99325e314fee7
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/10300
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Simon Marchi [Wed, 23 Oct 2024 18:48:54 +0000 (14:48 -0400)]
bt2: factor out some code in field class creation
Remove `_TraceClass._check_field_class_create_status()` and
`_TraceClass._set_field_class_user_attrs()`. Add
`_TraceClass._check_and_wrap_field_class()` and use it. The new method
combines the behavior of the two removed ones, plus wrapping the SWIG
pointer with the correct Python type (found using
`bt2_field_class._obj_type_from_field_class_ptr()`).
Change-Id: Iaa4871acb7bad4d21baae537802c20353ed25f22
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13399
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Thu, 24 Oct 2024 03:36:08 +0000 (23:36 -0400)]
bt2: remove unused `_FieldClassConst._check_create_status()` method
Change-Id: Idd4ec7facdc0e812ccf7e9afbed33e28e55f6ef1
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13401
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Tue, 22 Oct 2024 20:22:53 +0000 (16:22 -0400)]
lib: fix typo in error message
Change-Id: I2049e364747977f36243e9d7d07280a2721e829f
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13398
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Tue, 22 Oct 2024 20:18:30 +0000 (16:18 -0400)]
lib: add missing MIP checks in bit array flag functions
Add some MIP checks, it seems like an oversight that these functions
don't have them.
I think that functions `bt_field_class_bit_array_flag_get_label()` and
`bt_field_class_bit_array_flag_borrow_index_ranges_const()` don't need
such checks, because it's not possible to get hold of a
`bt_field_class_bit_array_flag *` without going through function that
has the appropriate MIP check before.
Change-Id: I0848f414772aa7bf6c252d8e81ed60b20ccce14a
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13397
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Tue, 22 Oct 2024 20:15:40 +0000 (16:15 -0400)]
Fix: lib: initialize `bt_field_class_bit_array::label_buf`
This field is never assigned, so we crash when trying to use it.
Change-Id: Ib283031ac0f12ecfae53c7b1e77eb1b685d06791
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13396
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Tue, 22 Oct 2024 19:48:45 +0000 (15:48 -0400)]
lib: add bt_field_class_get_graph_mip_version()
Add bt_field_class_get_graph_mip_version, which returns the MIP version
for the graph the field class is in, for the same reason as explained in
fbc90342dade ("lib: add bt_trace_class_get_graph_mip_version") for trace
class.
Note to Phil: I don't know where to put the function declaration in the
header, perhaps a new section is needed.
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I97b4a440020cb006bee9a79a5dce9cbade565914
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13395
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Tue, 22 Oct 2024 19:48:45 +0000 (15:48 -0400)]
lib: add bt_clock_class_get_graph_mip_version()
Add bt_clock_class_get_graph_mip_version, which returns the MIP version
for the graph the clock class is in, for the same reason as explained in
fbc90342dade ("lib: add bt_trace_class_get_graph_mip_version") for trace
class.
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I6949c47e39b2c4dfc8e0d55ab701e6eef9fb0d45
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13394
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Mon, 12 Jun 2023 20:29:52 +0000 (16:29 -0400)]
bt2: replace internal property setters with standard methods
Pyright doesn't like this pattern:
def _user_attributes(self, user_attributes):
value = bt2_value.create_value(user_attributes)
native_bt.field_class_variant_option_set_user_attributes(
self._ptr, utils._check_type(value, bt2_value.MapValue)._ptr
)
_user_attributes = property(fset=_user_attributes)
The warning is:
/home/smarchi/src/babeltrace/src/bindings/python/bt2/bt2/field_class.py
/home/smarchi/src/babeltrace/src/bindings/python/bt2/bt2/field_class.py:102:24 - error: Expression of type "property" cannot be assigned to declared type "(self: Self@_FieldClass, user_attributes: Unknown) -> None"
Type "property" cannot be assigned to type "(self: Self@_FieldClass, user_attributes: Unknown) -> None" (reportGeneralTypeIssues)
What happens is that we first define a method with the
"_user_attributes", and at some later point it in the initialization,
the "_user_attributes" name in the class gets assigned a property whose
setter is the original method. The type checker doesn't like that the
type of "_user_attributes" changes like that.
Change all instances of this pattern to just use a "_set_*" method. I
don't think it's important for these internal APIs to be properties, in
fact I think it just makes the code hard to grep.
Change-Id: Iea3cee470f55b28ec2ec798c3a24d6e880913343
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/10250
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Mon, 21 Oct 2024 19:54:02 +0000 (15:54 -0400)]
bt2: rename `_MessageIteratorConfiguration.can_seek_forward()`
This method's name suggests that it's public and can be called by the
user, but that's not the case, since it is overwritten by the write-only
property just below. Example:
File
"/home/smarchi/build/babeltrace/src/bindings/python/bt2/build/build_lib/bt2/message_iterator.py",
line 142, in _bt_init_from_native
self.__init__(config, self_output_port)
File "/home/smarchi/src/babeltrace/test.py", line 11, in __init__
config.can_seek_forward(False)
^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: property 'can_seek_forward' of '_MessageIteratorConfiguration'
object has no getter
Rename it to something that's more obviously not intended for the user.
Change-Id: Ibef9cd8297569e2d4daea01ede00f3f0735abd90
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13387
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Mon, 21 Oct 2024 18:20:01 +0000 (14:20 -0400)]
Fix: bt2: correctly handle empty result of bt_field_enumeration_unsigned_get_mapping_labels
When calling `_EnumerationFieldClassConst.mappings_for_value()` and the
result is empty (no matching mappings), we get:
File "/home/smarchi/build/babeltrace/src/bindings/python/bt2/build/build_lib/bt2/field_class.py", line 240, in mappings_for_value
return [self[label] for label in labels]
^^^^^^
TypeError: 'NoneType' object is not iterable
Here's what happens:
- When the input value matches no mappings, the library sets the array
output parameter to `NULL`.
- The SWIG argout typemap checks the array output parameter value to
choose between returning a list or `None`. So in this case, we return
the tuple `(__BT_FUNC_STATUS_OK, None)`.
- Back in the Python side, we try to iterate over `None`.
Fix this by checking the status in the typemap to see if the call
succeeded.
Add a corresponding test.
Change-Id: If1c7de435c27b9c37b67b66a7b8384480ac654e1
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13385
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Mon, 21 Oct 2024 19:31:48 +0000 (15:31 -0400)]
Fix: bt2: "trace class" -> "trace" in error message
Change-Id: I2dfd4eb4daa5ca8dc9de4d8d3828b6f4e775dd93
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13386
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Mon, 16 Oct 2023 20:25:32 +0000 (16:25 -0400)]
python: factor out user_attributes getters and setters
To avoid repeating the `user_attributes()` methods everywhere, define
two mixin classes (_WithUserAttributesConst and _WithUserAttributes) and
use them throughout.
Note that this fixes a bug where _StreamClassConst.user_attributes would
return a (non-const) MapValue, since it used
bt2_value._create_from_ptr_and_get_ref, instead of
bt2_value._create_from_const_ptr_and_get_ref.
Improve tests to fill in some gaps we had in the testing of user
attributes. For all objects types that have user attributes, test
getting the user attributes from both the non-const and const versions
of the object, and verify that the return value of the
`user_attributes()` method is of the correct type.
Change-Id: I4a7542f015b5f3245395d64175761fe34aa1753f
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/10243
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Mon, 21 Oct 2024 19:16:41 +0000 (15:16 -0400)]
dev-requirements.txt: bump flake8 to 7.1.1
7.1.1 is almost the double of 3.8! There must be a lot of new features.
Change-Id: Ia9479f9f1e4efe0fa5cd7f96e5c198bfda409433
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13384
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Mon, 21 Oct 2024 19:15:50 +0000 (15:15 -0400)]
dev-requirements.txt: bump isort to 5.13
Let's get the latest and greatest bugs.
Change-Id: I76ee3c3e5fd7d85a2873bf093cc6a4e082ddae8d
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13383
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Mon, 21 Oct 2024 19:12:42 +0000 (15:12 -0400)]
dev-requirements.txt: bump Black to 23.12.1
We're unable to update to Black 24 for the moment, because our CI
workers use a Python too old for Black 24. But we should at least use
the latest Black 23.
Change-Id: I4e6f28e7d85868a85e41f15ddbc4c801d38540ba
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13382
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Mon, 21 Oct 2024 15:03:04 +0000 (11:03 -0400)]
CONTRIBUTING.adoc: document how to refer to a commit in commit messages
This is what I already do, I would like it to make it an official
procedure. What I want to avoid is having commits referred to just
using their hashes, which is meaningless for humans.
Change-Id: I47b5044d74d3d10e2b953fe7ad291b4468391da2
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13379
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Michael Jeanson [Wed, 24 Jul 2024 17:24:00 +0000 (13:24 -0400)]
Add SPDX copyright header to all Makefiles
Change-Id: I5c26c6a6cd899e71d3a97da3b3d18b99b96f8244
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13013
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
CI-Build: Simon Marchi <simon.marchi@efficios.com>
Simon Marchi [Mon, 12 Jun 2023 20:32:42 +0000 (16:32 -0400)]
python: define _BaseObject._ptr property
Define the property `_ptr` on _BaseObject, which returns the value of
the currently-named `_ptr` field. Rename the `_ptr` field to
`_ptr_internal`, for the lack of a better name.
The goal is for mixin classes to be able to declare that they require
such a property to exist, using `abc.abstractmethod`, and for
_BaseObject to fill in the implementation (and for static type checkers
to be happy). For instance:
class MyMixin(abc.ABC):
@property
@abc.abstractmethod
def _ptr(self):
raise NotImplementedError
def my_method(self):
... do something with self._ptr ...
class MyObject(object._SharedObject, MyMixin):
...
In this case, object._SharedObject provides the `_ptr` implementation
that `MyMixin` requires.
Change-Id: I696c04ed690ede7cd50bcb71890cc0b7b25f44e4
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/10326
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Simon Marchi [Wed, 22 Nov 2023 20:49:52 +0000 (15:49 -0500)]
tests: remove _def_new_value fields from test_value.py
These fields are only set, never read. Remove them.
Change-Id: Id476dc5811656079cd1c917c2f131831305b4a67
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/11412
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Simon Marchi [Wed, 22 Nov 2023 17:24:50 +0000 (12:24 -0500)]
tests: rename some fields in test_value.py
The very short names used in _TestIntegerValue and descendants were very
mysterious to me, it took me a while to figure out what each meant.
Rename them to slightly longer names for clarity.
Change-Id: I28dce959516d5bc91deadddb56e420e6b65d0277
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/11410
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Simon Marchi [Mon, 27 Nov 2023 20:17:43 +0000 (15:17 -0500)]
tests: assign to `value` property in test_assign_str/test_assign_vstr
These tests don't do what was initially intended. The intent is to
assign a string to the value in `self._def`. Instead, they overwrite
`self._def`. Fix that by assigning to the `value` property.
Change-Id: Ic5d0e797d5da7cc0fb17daa0b5e221db5c440bf9
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/11446
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Jitka Plesnikova [Mon, 14 Oct 2024 12:17:10 +0000 (12:17 +0000)]
bt2: use SWIG_AppendOutput (fix for SWIG 4.3.0)
From the SWIG release notes:
[Python] #2907 Fix returning null from functions with output
parameters. Ensures OUTPUT and INOUT typemaps are handled
consistently wrt return type.
New declaration of SWIG_Python_AppendOutput is now:
SWIG_Python_AppendOutput(PyObject* result, PyObject* obj, int is_void);
The 3rd parameter is new and the new $isvoid special variable
should be passed to it, indicating whether or not the wrapped
function returns void. If SWIG_Python_AppendOutput is currently being
used and a completely backwards compatible (but technically incorrect)
solution is required, then pass 1 for the is_void parameter.
Also consider replacing with:
SWIG_AppendOutput(PyObject* result, PyObject* obj);
which calls SWIG_Python_AppendOutput with same parameters but adding $isvoid
for final parameter.
Change-Id: I0944116fa40e024785d48e0b172ab30f359f505c
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13345
CI-Build: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Simon Marchi [Fri, 4 Oct 2024 16:41:59 +0000 (12:41 -0400)]
src.ctf.fs: report support for MIP 1
Implement the "get supported MIP versions" method for the `src.ctf.fs`
component class, with the following logic:
- Attempt to parse the metadata from the given input
- If the metadata is CTF 1, the supported range is [0, 1]
- If the metadata is CTF 2, the supported range is [1, 1]
MIP 1 is necessary to properly represent all the concepts found in CTF
2. It would be possible to implement a mode "CTF 2 with MIP 0" mode,
perhaps by restricting what can be found in the trace to concepts that can
be represented in MIP 0, but the decision was that it's not worth the
investment right now.
Modify `tests/plugins/src.ctf.fs/succeed/test-succeed.sh` to add a MIP
version axis.
Modify `tests/plugins/sink.text.details/succeed/test-succeed.sh` to add
CTF and MIP version axes.
Modify `tests/plugins/flt.lttng-utils.debug-info/test-succeed.sh` to
restrict the MIP version to 0. We'll remove that flag and add CTF/MIP
version axes once the debug info component class supports MIP 1.
Modify `tests/plugins/src.ctf.lttng-live/test-live.sh` to restrict the
MIP version to 0 in `test_compare_to_ctf_fs()`, which compares the
output of `src.ctf.lttng-live` to that of `src.ctf.fs`.
Change-Id: Icf8522281dd37c96011bed365b273960dc89a3f3
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12777
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Wed, 2 Oct 2024 05:12:41 +0000 (01:12 -0400)]
plugins/common/muxing: compare clock class identities (MIP 1)
Adjust for MIP 1, where clock classes may have identities (namespace,
name, UID), instead of UUIDs.
Change-Id: I23fe610ae7c85c7dfa2999d102c26ec9188dbeee
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13311
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Simon Marchi [Wed, 2 Oct 2024 04:44:13 +0000 (00:44 -0400)]
sink.text.pretty: print trace UIDs (MIP 1)
Adjust to MIP 1, where traces may have UIDs instead of UUIDS.
Change-Id: If57f2ad1857e0b03f91f4226e11ecb63abdaef17
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13310
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Simon Marchi [Sat, 5 Oct 2024 01:08:40 +0000 (21:08 -0400)]
tests: factor out discarded packet regex in test-packet-seq-num.sh
The regex used in `test_no_lost()` is outdated, which means that if
Babeltrace were to emit an unexpected discarded packets message, the
test would not catch it. Fix it by factoring the regex used to look for
discarded packets messages. At least now, we can have the confidence
that we're looking for the right thing, otherwise the `test_lost()`
tests wouldn't pass.
In general, it's fragile to check for the absence of something, since a
typo or change in what to look can easily make the test uneffective. I
initially re-wrote this test in Python (the test is in the `cli`
directory, but its intent is more to validate the source's behavior than
to validate the CLI's behavior), but this simple change seems good
enough for now.
Change-Id: I9f8c30a567fa6f5036cadcc4691c3bd6f953ca3d
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13309
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Tue, 1 Oct 2024 18:55:53 +0000 (14:55 -0400)]
tests: use bt_cli in cli/test-packet-seq-num.sh
Modify this test to use `bt_cli`, in order to get the `Running ...`
printout.
Use `isnt` to simplify one test while at it.
Change-Id: I1fe125b8cadfb8cffaf1b3502d5b730af26212ac
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13308
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Fri, 27 Sep 2024 21:02:41 +0000 (17:02 -0400)]
ctf: add explicit cast to CStringView in ternary
In this ternary, the true branch yields a reference to std::string. The
false branch, `nullptr` is therefore implicitly cast to an std::string.
It builds, since you can build an std::string from a pointer to a C
string, but it would crash at runtime, since constructing an std::string
from nullptr doesn't work.
Ultimately, we want to pass this to the ClockClass::origin() setter,
which takes a CStringView, so cast the true branch to CStringView. If
the condition is false, this constructs a CStringView from nullptr,
which is correct and what we want to do here.
This problem was reported by clang-tidy as a bugprone-string-constructor
[1] error ("Constructing string from nullptr is undefined behaviour").
[1] https://clang.llvm.org/extra/clang-tidy/checks/bugprone/string-constructor.html
Change-Id: Ib9c8dfa619cbd652c8284ef7c3a4ccebeb0e6fbd
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13299
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Fri, 4 Oct 2024 16:34:27 +0000 (12:34 -0400)]
ctf: filter out libbabeltrace user attributes
Some `babeltrace.org,2020` user attributes (`log-level` and `emf-uri`)
get translated to specific properties on event class IR objects. It is
therefore redundant to keep them as user attributes.
Change-Id: I9e558faea19662f9b9a07f500581cd2569f4df76
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13298
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Simon Marchi [Thu, 3 Oct 2024 01:56:50 +0000 (21:56 -0400)]
tests: make `bt_diff()` able to write expected files
Make `bt_diff()` copy the "actual" file over to the "expected" file, if:
- the comparison between "actual" and "expected" failed
- the "expected" file is a regular file
- the `BT_TESTS_DIFF_WRITE_EXPECTED` env var is set and not `0`
This makes it much easier to update `.expect` files than doing it by
hand.
Change-Id: Ia55b55035591d521c627b1022d6dcbde9ed541a7
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13313
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Fri, 27 Sep 2024 20:42:55 +0000 (16:42 -0400)]
cpp-common/bt2: add Value::copy()
Wrap bt_value_copy().
Change-Id: Ied4900db16064b44d84aac1773385d8be4cfbf80
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13297
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Simon Marchi [Fri, 27 Sep 2024 20:10:34 +0000 (16:10 -0400)]
ctf: make parseMetadataStream() output the metadata version
Add a `metadataVersion` field to `ParseRet`, allowing users of this
class to know the metadata version, after successfully parsing a
metadata file.
Change-Id: I5fdeab715d8146744b743c4be1dc9d44ac1a70e6
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13295
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Fri, 27 Sep 2024 20:01:20 +0000 (16:01 -0400)]
cpp-common/bt2c: Logger: add self component class constructor
Make it possible to build a `Logger` from a self component class only
(for instance, from the "get supported mip versions" method).
Change-Id: Ic1d0abe8832eb5af831d5fa2b66b3d9737bcdee7
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13294
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Fri, 4 Oct 2024 15:10:08 +0000 (11:10 -0400)]
ccv: adjust for MIP 1
Adjust the clock correlation validation code for MIP 1.
The high level conceptual changes to adapt to are:
- With MIP 0, the only way to have a known clock origin is for it to be
the Unix epoch. In MIP 1, it's possible to have known user-defined
clock origins.
- With MIP 0, clock classes are optionally identified with UUIDs. With
MIP 1, it's with a (namespace, name, UID) tuple.
The concrete changes are:
- Pass the MIP version down to
`ClockCorrelationValidator::validate()`and
`bt_clock_correlation_validator_validate_message()`.
- Rename enumerators
- Unix epoch -> Known origin
- UUID -> ID (which comprises both UUIDs and (namespace, name, UID)
tuples)
- Adjust ClockCorrelationValidator::_validate() where the logic differs
between MIP 0 and 1.
- Adjust the error messages given by clients of
`ClockCorrelationValidator` to reflect the differences between MIP 0
and 1.
- Make `MessageComparator` take a graph MIP version, change the way
`MessageComparator::compare()` compares trace identities based on the
MIP version.
- Adjust tests checking clock compatibility problems to run with MIP 0
and 1, using the right kind of identity depending on the MIP version.
Change-Id: I12a5b5bed27fe6185ab407465901d285cbb23778
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12785
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Simon Marchi [Tue, 8 Oct 2024 15:52:41 +0000 (11:52 -0400)]
tests: disable coredumps in `conds-trigger`
After adding some more tests in `conds-trigger`, some CI jobs would
start to fail randomly while running that test, with the Jenkins runner
process seemingly crashing. Digging a little bit revealed that many
processes (including `systemd-coredump`) would get OOM-killed.
What I think happens is that the many quickly crashing `conds-triggers`
processes cause many `systemd-coredump` processes to get started, which
causes too much memory to be consumed.
It's just wasteful to generate core dumps while running this test
anyway, so disable them. Use `setrlimit()` in the code path that we
know is going to lead to a crash.
I considered calling `ulimit -c 0` in the bash script that calls all
this, but I would prefer to disable core dumps in the narrowest scope
possible, so that we don't disable them for the code that's not supposed
to crash.
Change-Id: I69bf206cf0afed26f6db65e7fb7e70e9dbe7c053
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13325
Reviewed-by: Kienan Stewart <kstewart@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Simon Marchi [Tue, 10 Sep 2024 19:45:40 +0000 (15:45 -0400)]
iterator.c, muxer: tweak clock compatibility validation error messages
In general, make the prose part of the messages be a bit more in line
with the enumerator names, which usually ends up a bit more specific
than the current messages.
In muxer's msg-iter.cpp:
- Split the ExpectingOriginUnixGotNone,
ExpectingOriginUnknownWithUuidGotNone and
ExpectingOriginUnknownWithoutUuidGotNone, to provide slightly more
precise error messages about what kind of clock class is expected.
- Always include the stream class information, whenever there is a
stream class (message iterator inactivity messages don't have an
associated stream class). Factor this out in a `formatStreamCls`
lambda.
- Factor out the formatting of the clock class info, and print an
additional `clock-class-origin-is-unix-epoch` and `clock-class-uuid`
fields. This factorisation will be helpful when adding support for
MIP 1, since the fields to format will change. We will need to
update fewer places.
In iterator.c:
- Print the actual clock class info in a few more places.
- Change phrases like "has non Unix epoch origin" for "has unknown
origin", both in human-readable messages and conditions IDs.
- Tweak the "Expecting a clock class, got none." messages to be a bit
more specific, differentiating the three cases.
- Print the expected UUID whenever we expect a clock class with a
specific UUID.
Instead of cherry-picking the information we print for each case, we
could also print the entire reference clock class information (making it
clear that we don't necessarily expect this particular clock class
instance, perhaps with a `reference-` prefix). It would probably make
the implementation simpler, but it would print a bit more unnecessary
information. The user would have to infer from the error message what
is the relevant information in there. I don't have a strong preference
for either approach.
Change-Id: I0ce2ab5b146a79baa5aa0afbd9d5de4f79f283a1
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12784
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Simon Marchi [Fri, 3 May 2024 15:18:51 +0000 (11:18 -0400)]
ccv: rename error type enumerators
In the names of enumerators:
- Replace "other" with "unknown" when referring to origins in clock
correlation validator error types.
The origin of a clock class is either known or unknown. As of MIP 0,
the only way for a clock class origin to be known is for it to be the
Unix epoch, so it's really either Unix epoch or unknown.
With MIP 1, it will become possible to have known origins that are
not the Unix epoch. Using the term "unknown" here makes it clear
that we are not talking about that.
- Replace "origin uuid" with "origin unknown with uuid", "origin no
uuid" with "origin unknown without uuid". The formers make it sound
like the origins have UUIDs, which is not the case. The clock class
(which is implied in the name) has a UUID.
- Make the enumerators extra explicit to avoid any ambiguity.
Change-Id: I4e9f9e6caf4e09de2ff1a2d26fe10a1a5f343453
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12783
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Simon Marchi [Mon, 9 Sep 2024 19:44:08 +0000 (15:44 -0400)]
ccv: output reference clock class on error
On validation error, always output the clock class used as a reference.
In combination with the error type, the callers will be able to inspect
the reference clock class to obtain the details needed to generate the
appropriate error message.
The goal of this change is to avoid having to add many output parameters
when adding support for MIP 1, keeping things simpler.
Change-Id: I032cc706d586134a35aabd14d9fb00611b430ad0
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12782
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Simon Marchi [Mon, 9 Sep 2024 19:42:07 +0000 (15:42 -0400)]
flt.utils.muxer: rename local variable
Change-Id: If716499dd9e9f8bf0311fb314919341516823c53
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13255
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Thu, 2 May 2024 15:25:33 +0000 (11:25 -0400)]
tests/lib/conds: change `CreateClockCls` type to `std::function`
The `CreateClockCls` callable type is currently a raw function pointer.
An upcoming patch will want to pass lambdas with captures, so change
`CreateClockCls` to be `std::function` instead. Update the
`CreateClockCls` parameters to be non-const where we want to move the
value, and const-ref otherwise.
Remove the `noClockClass` function, and use an empty `CreateClockCls` to
mean "do not create a clock class". I couldn't find how to do the
equivalent of the `createClockCls == noClockClass` with an
`std::function`, but using an empty `std::function` is clear enough (we
could have done it with a nullptr before too).
Change-Id: Ie30e42b68b5ffad566458933869e78da8ca01614
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12781
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Simon Marchi [Wed, 1 May 2024 21:18:54 +0000 (17:18 -0400)]
tests: make `runIn()` accept a MIP version
Make `runIn()` and `RunInCondTrigger` accept a MIP version to use when
creating the graph, instead of using 0. Update existing users to pass a
hardcoded 0.
Add a `forEachMipVersion()` utility function, which calls a callback
once for each possible MIP version. This is intended to help code that
wants to try testing variations of the same thing for all possible MIP
version.
Change-Id: Ic1d42d20b4eef872106f216fea9d2e883cb33775
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12780
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Simon Marchi [Wed, 1 May 2024 21:29:20 +0000 (17:29 -0400)]
test/lib/conds: use `:` to concatenate trigger name suffix
For cosmetic (and obviously subjective reasons), use `:` when
appending a trigger name suffix.
Example:
-message-iterator-class-next-method:clock-class-is-expected-mii-mii
+message-iterator-class-next-method:clock-class-is-expected:mii-mii
I like it because it's now of the form:
<function name>:<cond id>:<suffix>
... where the suffix discriminates different triggers to reach the
pre/post condition identified by `<function name>:<cond id>`. When the
suffix is concatenated using `-`, it's not clear where the cond id ends.
Change-Id: I9e27524a589f19094eb90543d500d015a985a123
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12779
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Wed, 1 May 2024 20:51:43 +0000 (20:51 +0000)]
flt.utils.muxer: subjective re-format
Wrap arguments to `BT_CPPLOGE_APPEND_CAUSE_AND_THROW` so that we can
have slightly longer strings (still within 100 columns). Remove
unnecessary local variables.
Change-Id: If7412e6913d06d12142f01e09742d4d6a5dc5d0e
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12505
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Tue, 30 Apr 2024 17:31:39 +0000 (17:31 +0000)]
tests/lib/conds: run pre-cond test by name
Change `conds-trigger` to run triggers by name, instead of by index.
This makes it easier to run an arbitrary trigger by hand, when
developing.
Example:
$ tests/lib/conds/conds-triggers list | python3 -m json.tool
...
{
"cond-id": "pre:field-class-integer-set-field-value-range:valid-n",
"name": "field-class-integer-set-field-value-range:valid-n-gt-64"
},
...
$ tests/lib/conds/conds-triggers run field-class-integer-set-field-value-range:valid-n-gt-64
<abort message>
Update the `test.py` driver to match. Update it also to output the
trigger name in a TAP comment before each test, to make it easier for a
developer to run a failing test by hand.
Example:
$ tests/lib/conds/test-conds.sh
# Running trigger `field-class-integer-set-field-value-range:not-null:field-class`
# TAP results for LibPrePostCondsTestCase
ok 1 - test_field_class_integer_set_field_value_range_not_null_field_class (test.LibPrePostCondsTestCase.test_field_class_integer_set_field_value_range_not_null_field_class)
# Running trigger `field-class-integer-set-field-value-range:valid-n-0`
ok 2 - test_field_class_integer_set_field_value_range_valid_n_0 (test.LibPrePostCondsTestCase.test_field_class_integer_set_field_value_range_valid_n_0)
# Running trigger `field-class-integer-set-field-value-range:valid-n-gt-64`
ok 3 - test_field_class_integer_set_field_value_range_valid_n_gt_64 (test.LibPrePostCondsTestCase.test_field_class_integer_set_field_value_range_valid_n_gt_64)
Note the little quirk that the `Running trigger` comment is displayed
before the `TAP results for ...` comment. The latter is displayed when
the first result is recorded, so I'm not sure how to fix this, but I
don't think it's really a problem as it is.
Since the test name is now a used as a key, modify `condMain()` to check
that the test names passed in the `condTriggers` vectors are unique. If
there is a duplicate name, we get:
$ tests/lib/conds/conds-triggers list
Duplicate test name `field-class-integer-set-field-value-range:valid-n-0`
Ensuring unique names would have probably been useful anyway, since we
generate Python methods based on that name, so we don't want any
clashes.
Change-Id: Ie05ad4070d9ea859e0678ee1cf5ed1c4010f9829
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12503
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Simon Marchi [Thu, 9 May 2024 21:11:49 +0000 (17:11 -0400)]
plugins/common/muxing: C++ify
Change the code to be more idiomatic C++. I tried to keep the overall
logic identical.
The pattern where we look for the presence of both objects to compare
(when we compare things that are optional) comes back often, so factor
this out in a `_compareOptional` function.
Similarly, comparing strings that can be null comes back often, factor
this out in a `_compareStrings` function.
The existing code isn't consistent about how to order things, when
comparing one empty/null and one non-empty/non-null object. Sometimes,
the empty object goes first, sometimes the non-empty object goes first.
By factoring out these two functions, the message ordering changes
slightly in some cases. I found two test cases that needed to be updated:
- flt.utils.muxer/succeed/diff-stream-class-no-name.expect
- flt.utils.muxer/succeed/diff-stream-no-name.expect
It happens often that we want to compare and order scalar value. Factor
this out in a `_compareLt` templated function. The starship operator
from C++20 could probably replace this, in a distant future.
Otherwise the rest should be pretty straightforward it's the same logic
as before.
Change-Id: If372de51ff5584d17705a0aed5597cea750597fa
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12565
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Thu, 9 May 2024 17:02:43 +0000 (13:02 -0400)]
plugins/common/muxing: compile as C++
Rename the files, re-format, and adjust files including `muxing.h`.
Change-Id: Idf16a80e1950c44a9212d3f80e690446e614c662
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12564
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Mathieu Desnoyers [Wed, 10 Apr 2024 15:46:27 +0000 (11:46 -0400)]
cli: add `--allowed-mip-versions` option to restrict MIP version
Introduce a new "--allowed-mip-versions=VER" command line argument
to babeltrace2. By default, versions 0 and 1 are allowed (prior behavior
before this patch). It allows specifying that either version 0 or 1 are
to be allowed in the graph. Its main purpose is for testing
implementation of plugin components interactions for specific MIP
versions.
Philippe's changes to the original patch:
‣ Use `--allowed-mip-versions` instead of `--allowed-mip-version`: in
the future we might want to make it possible to specify more than one
version, for example `--allowed-mip-versions=0,1,5` or even
`--allowed-mip-versions=0-2,5`.
The current single-version format is to be considered an initial,
temporary limitation.
‣ Use the short option `-m` for `--allowed-mip-versions`.
‣ Sort options alphabetically by long name in the output of `--help`.
‣ Updated the manual pages.
Change-Id: I1c9f74176f6686ec560ede2494b89e28f35da6a6
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12792
Tested-by: jenkins <jenkins@lttng.org>
Simon Marchi [Wed, 2 Oct 2024 03:07:07 +0000 (23:07 -0400)]
pyproject.toml: pyright: ignore reportPrivateUsage
Our code does not follow the convention of treating identifiers starting
with an underscore as private. For instance, the `bt2` module exposes
types like `_EventMessageConst`. Even though the user is not expected
to create objects of that type, they can still use the type in a type
check like:
if type(msg) is bt2._EventMessageConst:
That produces a `reportPrivateUsage` in pyright / pylance. Disable that
check to get rid of a lot of false positives.
Change-Id: I78a19653aafb923d3e429b9b321cb1f87372c83e
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13307
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Simon Marchi [Fri, 30 Aug 2024 19:32:33 +0000 (15:32 -0400)]
Add .pre-commit-config.yaml
This can help catch problems a bit earlier than in the CI.
To use it, a developer would run `pre-commit` in the source repository.
This installs git commit hooks that will run the checks described by
`.pre-commit-config.yaml` on the modified files.
It is possible to run the checks on all files with:
$ pre-commit run --all-files
black....................................................................Passed
flake8...................................................................Passed
isort....................................................................Passed
Change-Id: I695f0b0f2fea3adadae132ceb708928db3217e0c
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13202
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Simon Marchi [Fri, 4 Oct 2024 15:14:10 +0000 (11:14 -0400)]
tools: do not distribute development files in tarball
Linters scripts are not useful to have in tarballs, as nobody is
expected to do development outside of a git tree.
Anyway, as of today, don't distribute `.clang-format`, so
`tools/format-cpp.sh` is useless in a tarball as it is.
Change-Id: I9f0aaebbe47390749c9be1085791ae09079519fe
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13318
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
Simon Marchi [Fri, 4 Oct 2024 15:06:11 +0000 (11:06 -0400)]
lib: rename bt_clock_class_origin_is_{unknown,known}
The "is unknown" getter leads to double negatives:
if (!bt_clock_class_origin_is_unknown(cls))
... which is not great for readability. Rename to
bt_clock_class_origin_is_known().
Change-Id: I27a9c9fec80b0e23851ee62fd2c897a1c695d2b1
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13317
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Simon Marchi [Thu, 3 Oct 2024 15:20:21 +0000 (11:20 -0400)]
tests/cli/test-intersection.sh: rewrite test to avoid shellcheck warning
Shellcheck 0.10.0 shows:
$ shellcheck -x test-intersection.sh
In test-intersection.sh line 36:
ok $? "$totalevents events in the whole trace"
^-- SC2319 (warning): This $? refers to a condition, not a command. Assign to a variable to avoid it being overwritten.
For more information:
https://www.shellcheck.net/wiki/SC2319 -- This $? refers to a condition, no...
I think that Shellcheck is confused with what we're trying to do and
that the code is actually correct. Nevertheless, change the code to
circumvent this by using `is`, which looks nicer anyway.
This is not seen on the CI, since it currently runs Shellcheck 0.9.0.
Change-Id: I7bb861b478046ab327c5950c9deefa52953bc854
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13316
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Fri, 13 Sep 2024 11:58:21 +0000 (07:58 -0400)]
.gitignore: add installed_files.txt
This file gets generated when you run `make install` in the Python
bindings directory.
Change-Id: I0967276dac7a6277b0b6642e4ab73c1fecdd000d
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13273
Tested-by: jenkins <jenkins@lttng.org>
Erica Bugden [Wed, 21 Aug 2024 18:25:25 +0000 (14:25 -0400)]
.gitignore: add some missing files
With this patch, doing:
./configure --enable-api-doc --enable-doxygen-doc --enable-man-pages --enable-python-bindings-doc --enable-python-bindings --enable-python-plugins
make
make dist
leaves a clean repo (no untracked files reported by `git status`).
Change-Id: Ifbe44eb0c93237dac933eeef3b39fabfa034601c
Signed-off-by: Erica Bugden <ebugden@efficios.com>
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13224
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Mon, 9 Sep 2024 17:59:50 +0000 (13:59 -0400)]
flt.utils.muxer: add IWYU pragma
clangd reports that the include of cpp-common/bt2c/fmt.hpp is unused,
but it is in fact used for the formatting of some types. Add a pragma.
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I43ebf7f7fc917f273ac6eaa88bf26790c83d9ead
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13254
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Sat, 31 Aug 2024 02:39:50 +0000 (22:39 -0400)]
Fix: src.ctf.lttng-live: manually clear sessions vector in ~lttng_live_msg_iter()
Starting with
751aaa6218f ("src.ctf.lttng-live: make
lttng_live_msg_iter::sessions an std::vector"), when live message
iterator gets destroyed while some stream iterators are still active, we
get this assertion:
(╯°□°)╯︵ ┻━┻ /home/simark/src/babeltrace/src/plugins/ctf/lttng-live/lttng-live.cpp:153: ~lttng_live_msg_iter(): Assertion `this->active_stream_iter == 0` failed.
When a live message iterator completes successfully, by consuming
everything the relay has to offer until all stream iterators are ended,
there are no more active stream iterators when reaching
~lttng_live_msg_iter() (they all get destroyed by
next_stream_iterator_for_trace() when they end). So the
`this->active_stream_iter == 0` assertion in the destructor holds.
But when an unexpected exit occurs, for instance because of an error or
a SIGINT interruption, the message iterator is destroyed while there are
still some stream iterators active.
Prior to
751aaa6218f, lttng_live_msg_iter_destroy() (which has since
been renamed to ~lttng_live_msg_iter()) had:
if (lttng_live_msg_iter->sessions) {
g_ptr_array_free(lttng_live_msg_iter->sessions, TRUE);
}
Clearing the `sessions` array caused the `lttng_live_session` objects to
be destroyed, which caused the `lttng_live_trace` objects to be
destroyed, which caused the stream iterators to be destroyed. When
reaching the assertion, the count of active stream iterators was
therefore 0.
With the refactor introduced by
751aaa6218f, we rely on the destruction
of the `sessions` vector for all this to happen, which occurs after the
user-specified destructor has run, therefore after the assertion. At
the time the assertion is checked, there are still some stream iterators
alive.
Fix this by manually clearing the sessions vector before the assertion,
to mimic the old behavior.
Add a test that purposefully sends metadata with a syntax error, which
triggers the bug.
The change adding the `kill_server_on_cli_failure` parameter to
get_cli_output_with_lttng_live_server() is useful to avoid the test
script trying to kill the Python live server, in the new test. Since
babeltrace successfully connects to the server and the disconnects, the
server exits on its own. This would print a "kill 1234 failed: no such
process" message. Not fatal, but not welcome either. It's not pretty,
but it works.
Change-Id: Id777e7ac0294d89ea236dd05651c8fbe708b2be4
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13204
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Mon, 9 Sep 2024 17:27:42 +0000 (13:27 -0400)]
ctf: use self component / message iterator C++ wrappers throughout
Use `bt2::SelfComponent`, `bt2::SelfSourceComponent`,
`bt2::SelfSinkComponent` and `bt2::SelfMessageIterator` for function
parameters and fields throughout `src/plugins/ctf` instead of raw
pointers.
Don't try to adapt the code too much to use the wrappers yet.
Change-Id: I2a3ae5849ef44fd639486185e5718919a152be93
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12416
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Simon Marchi [Mon, 9 Sep 2024 17:59:50 +0000 (13:59 -0400)]
src.ctf.lttng-live: add IWYU pragma
clangd reports that the include of cpp-common/bt2c/fmt.hpp is unused,
but it is in fact used for the formatting of some types. Add a pragma.
Change-Id: I850fb44383b61bd46880c4eb67bd9a2323c0d725
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13253
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Mon, 9 Sep 2024 16:30:03 +0000 (12:30 -0400)]
argpar: sync with upstream
Sync with upstream commit
a80b22c5f492 ("Add C++ bindings").
Change-Id: I65086a80325907d029a34fde437d52dba5a323c6
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13252
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Mathieu Desnoyers [Wed, 27 Mar 2024 23:09:06 +0000 (19:09 -0400)]
lib: add bt_get_greatest_operative_mip_version_with_restriction()
This new function works like bt_get_greatest_operative_mip_version(),
but has an additional optional MIP version restriction range set.
For example, if all the components would support MIP 0 and 1,
bt_get_greatest_operative_mip_version() would return 1, while
bt_get_greatest_operative_mip_version_with_restriction() with the
`mip_version_restriction` parameter only containing [0, 0] would
return 0.
This new function provides more control over the preferred MIP version
to use while avoiding the complexity of exposing a direct "get supported
MIP versions" method call.
Philippe updated the documentation.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic8bbdee6055a0816e398f0f27ac0ca8c45f0b85a
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12791
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
CI-Build: Simon Marchi <simon.marchi@efficios.com>
Philippe Proulx [Mon, 13 May 2024 09:00:43 +0000 (05:00 -0400)]
tests/utils/python/mctf.py: convert JSON array → JSON text seq.
This patch updates `mctf.py` so that it converts a JSON array found in
the part named `metadata` to a JSON text sequence.
This makes it possible to write a CTF 2 metadata part without the odd
RS characters, for example:
--- metadata
[
{
"type": "preamble",
"version": 2
},
{
"type": "trace-class"
},
{
"type": "data-stream-class"
},
{
"name": "test",
"payload-field-class": {
"member-classes": [
{
"field-class": {
"type": "variable-length-unsigned-integer"
},
"name": "vu1a"
},
{
"field-class": {
"type": "variable-length-unsigned-integer"
},
"name": "vu1b"
},
{
"field-class": {
"type": "variable-length-unsigned-integer"
},
"name": "vu2"
},
{
"field-class": {
"type": "variable-length-unsigned-integer"
},
"name": "vu3"
},
{
"field-class": {
"type": "variable-length-unsigned-integer"
},
"name": "vu4"
},
{
"field-class": {
"type": "variable-length-unsigned-integer"
},
"name": "vu5"
},
{
"field-class": {
"type": "variable-length-unsigned-integer"
},
"name": "vu6"
},
{
"field-class": {
"type": "variable-length-unsigned-integer"
},
"name": "vu7"
},
{
"field-class": {
"type": "variable-length-unsigned-integer"
},
"name": "vu8"
},
{
"field-class": {
"type": "variable-length-unsigned-integer"
},
"name": "vu9"
},
{
"field-class": {
"type": "variable-length-unsigned-integer"
},
"name": "vu10"
},
{
"field-class": {
"type": "variable-length-signed-integer"
},
"name": "vi1a"
},
{
"field-class": {
"type": "variable-length-signed-integer"
},
"name": "vi1b"
},
{
"field-class": {
"type": "variable-length-signed-integer"
},
"name": "vi1c"
},
{
"field-class": {
"type": "variable-length-signed-integer"
},
"name": "vi2"
},
{
"field-class": {
"type": "variable-length-signed-integer"
},
"name": "vi3"
},
{
"field-class": {
"type": "variable-length-signed-integer"
},
"name": "vi4"
},
{
"field-class": {
"type": "variable-length-signed-integer"
},
"name": "vi5"
},
{
"field-class": {
"type": "variable-length-signed-integer"
},
"name": "vi6"
},
{
"field-class": {
"type": "variable-length-signed-integer"
},
"name": "vi7"
},
{
"field-class": {
"type": "variable-length-signed-integer"
},
"name": "vi8"
},
{
"field-class": {
"type": "variable-length-signed-integer"
},
"name": "vi9"
},
{
"field-class": {
"type": "variable-length-signed-integer"
},
"name": "vi10a"
},
{
"field-class": {
"type": "variable-length-signed-integer"
},
"name": "vi10b"
},
{
"field-class": {
"type": "variable-length-signed-integer"
},
"name": "vi10c"
}
],
"type": "structure"
},
"type": "event-record-class"
}
]
--- my-stream
[0 : uleb128] # `vu1a`
[77 : uleb128] # `vu1b`
[177 : uleb128] # `vu2`
[43123 : uleb128] # `vu3`
[
21829382 : uleb128] # `vu4`
[
5121829382 : uleb128] # `vu5`
[
95121829382 : uleb128] # `vu6`
[
13895121829382 : uleb128] # `vu7`
[
913895121855555 : uleb128] # `vu8`
[
333333333333333333 : uleb128] # `vu9`
[
18446744073709551615 : uleb128] # `vu10`
[0 : sleb128] # `vi1a`
[-1 : sleb128] # `vi1b`
[23 : sleb128] # `vi1c`
[-156 : sleb128] # `vi2`
[8556 : sleb128] # `vi3`
[-
100101001 : sleb128] # `vi4`
[
8288491823 : sleb128] # `vi5`
[-
171717171717 : sleb128] # `vi6`
[
123456787654321 : sleb128] # `vi7`
[-
1121231234123450 : sleb128] # `vi8`
[
99999999999999999 : sleb128] # `vi9`
[
9223372036853775807 : sleb128] # `vi10a`
[
9223372036854775807 : sleb128] # `vi10b`
[-
9223372036854775808 : sleb128] # `vi10c`
Detecting `[` as the first character of the part is enough because a
CTF 1.8 TSDL metadata text never starts with `[`.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ic1d6fb1644870f3b951d26238f82c79d7f3cf25a
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12772
Philippe Proulx [Sun, 12 May 2024 11:42:00 +0000 (07:42 -0400)]
src.ctf.fs: always set the correct trace IR stream ID
In add_ds_file_to_ds_file_group(), we don't use the original CTF data
stream ID to set the trace IR stream ID whenever the beginning timestamp
is missing.
The comment says:
if (begin_ns == -1) {
/*
* No beginning timestamp to sort the stream files
* within a stream file group, so consider that this
* file must be the only one within its group.
*/
stream_instance_id.reset();
}
This might be true, but there's no need to reset the data stream ID.
Then during data stream decoding, the trace IR stream ID always matches
the CTF IR data stream ID (if any), which enables some further checks.
Furthermore, a trace which goes from `src.ctf.fs` to `sink.ctf.fs` will
keep its original data stream IDs.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I3c6ea0a3cbd913017cd00c1c07c6c6bf83b8a534
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12771
Philippe Proulx [Sun, 12 May 2024 11:31:45 +0000 (07:31 -0400)]
tests/.../data_from_mp.py: add CTF 2 support
This patch changes `tests/data/plugins/src.ctf.fs/field/data_from_mp.py`
to add CTF 2 support.
The script generates a CTF 2 trace when the stripped field class text
starts with `{` (full field class) or `"` (field class alias), which are
exclusive to the CTF 2 metadata syntax (any CTF 1.8 field class starts
with some keyword).
The same automatic field class aliases as the CTF 1.8 case
are available.
_make_ctf_2_metadata() doesn't need the `@` replacement trick of
_make_ctf_1_metadata() because CTF 2 array field classes aren't
different from any CTF 2 field class, for example:
{
"type": "static-length-array",
"length": 4,
"element-field-class": "u8"
}
vs.
u8 @[4]
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I6abe0776c64fde62633cfc7a89094c0aedf6b9be
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12770
Philippe Proulx [Fri, 10 May 2024 20:06:25 +0000 (16:06 -0400)]
src.ctf.*: make `ctf::src::ClkClsCfg` final
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Iaf0b5564cafdca5d7ce4ca17b03639de90f69cbf
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12769
Philippe Proulx [Fri, 10 May 2024 19:38:50 +0000 (15:38 -0400)]
cpp-common/bt2c/libc-up.hpp: make `FileCloserDeleter` final
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I50cb8185a1e929db9da8f7fc98967351e126b781
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12768
Philippe Proulx [Thu, 16 May 2024 15:37:58 +0000 (11:37 -0400)]
bt2c/logging.hpp: replace `Logger::MemData` with `ConstBytes`
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Iad923b8d42256fe02a9c3300045201776bfc0c4e
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12767
Simon Marchi [Wed, 29 May 2024 15:50:31 +0000 (11:50 -0400)]
cpp-common/bt2c/data-len.hpp: `static inline` → `inline`
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I8f6a6d49d24ad312c2fdead6667bc41494f1321d
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12766
Philippe Proulx [Fri, 10 May 2024 19:36:43 +0000 (15:36 -0400)]
cpp-common/bt2c/c-string-view.hpp: remove useless `bt2c::`
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I7dd42aef2cc547f6e18d575f0366f899bc43b1df
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12765
Philippe Proulx [Fri, 10 May 2024 19:30:40 +0000 (15:30 -0400)]
cpp-common/bt2c/read-fixed-len-int.hpp: remove useless `bt2c::`
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ieb06919f8a18f2cb31d542d2eeb20ff096c985a7
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12764
Philippe Proulx [Fri, 10 May 2024 19:30:27 +0000 (15:30 -0400)]
cpp-common/bt2c/read-fixed-len-int.hpp: fix comment style
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ibe59847e6db70e6361d57d259155c5489b0e1750
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12763
Philippe Proulx [Fri, 10 May 2024 19:26:11 +0000 (15:26 -0400)]
Add static bt2c::Uuid::isValidUuidStr()
The bt2c::Uuid(bt2s::string_view) constructor wants the conversion
to work.
This new static method calls bt_uuid_from_str() directly and uses its
return value to validate the UUID string.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I279ac6521b805b0085247c8fbeb16c9ed5018e51
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12762
Philippe Proulx [Fri, 10 May 2024 19:24:51 +0000 (15:24 -0400)]
cpp-common/bt2c/uuid.hpp: `static inline` → `inline`
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: If7a8ce9060c4618906e0ec3ac091cb7aca17e36b
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12761
Philippe Proulx [Fri, 10 May 2024 19:23:45 +0000 (15:23 -0400)]
bt2c::Uuid::Uuid(): accept `bt2s::string_view` instead of `CStringView`
The input string doesn't need to be null-terminated.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I1ae0be22ee44fc4b7969525224f0721689a12dd1
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12760
Philippe Proulx [Fri, 10 May 2024 19:13:32 +0000 (15:13 -0400)]
cpp-common/bt2c/uuid.hpp: remove useless `bt2c::`
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I381ee08c5d5eae70a987ca941629cd8d04e2eda5
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12759
Philippe Proulx [Fri, 10 May 2024 19:11:15 +0000 (15:11 -0400)]
Make bt_uuid_from_str() take begin/end pointers
Make bt_uuid_from_str() take begin/end pointers (null terminator not
required) to make it possible to call it with a string view.
What used to be bt_uuid_from_str() is now bt_uuid_from_c_str() to avoid
changing existing the logic of call sites.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I4d7c0c434b71c684a90fa696c6654e4b3a5c055c
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12758
Philippe Proulx [Tue, 20 Jun 2023 20:39:16 +0000 (16:39 -0400)]
sink.text.details: adapt to latest libbabeltrace2 API
This patch makes a `sink.text.details` component write the details of
the following MIP 1 features:
Clock class:
• Namespace
• UID
• Precision if unknown
• Accuracy
• Custom origin (namespace, name, and UID)
Stream class:
• UID
Event class:
• UID
Bit array field class:
• Flags (sorted, like enumeration field class mappings)
Trace:
• Namespace
• UID
The clock class term "offset from origin" is more accurate and modern
than "offset", therefore I'm changing this too and updating existing
expectation files accordingly.
Also, what used to be
Origin is Unix epoch: Yes
with MIP 0 is now the same for any MIP:
Origin: Unix epoch
When the origin is unknown, whatever the MIP version, there's no origin
line (like most missing/empty properties of `sink.text.details`).
Here's a hypothetical MIP-1 clock class output example:
Default clock class:
Namespace: lttng.org,2009
Name: monotonic
UID: boot-id:
7d19f00b-f1c7-49ea-a0a1-
5f1a6a062a29
User attributes:
lttng.org,2009:
tag: provigo
original-index: 4
Description: Monotonic Clock
Frequency (Hz): 1,000,000,000
Precision (cycles): 0
Accuracy (cycles): 1000
Offset from origin (s): 1,564,079,206
Offset from origin (cycles): 484,157,338
Origin:
Namespace: quebec.ca,2017
Name: referendum
UID: 1995
The component only writes UIDs when the `with-uid` parameter is true
(the default). This is analogous to the `with-uuid` parameter. You may
specify both `with-uuid` and `with-uid` parameters: the former only
applies under MIP 0 and the latter under MIP 1.
Also changing some tests which set `with-uuid` to false to also set
`with-uid` to false, should they work under MIP 1.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I2411acb49a878e2eb135af86bc9f618cfd284987
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12757
Simon Marchi [Tue, 24 Oct 2023 02:12:24 +0000 (22:12 -0400)]
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
Simon Marchi [Tue, 23 Aug 2022 12:41:49 +0000 (08:41 -0400)]
tests/src.ctf.fs: run test_force_origin_unix_epoch succeed test on CTF 1 and CTF 2 traces
Modify test_force_origin_unix_epoch such that it tests with both the CTF
1 and CTF 2 version of the trace.
Change-Id: I356a2c70c10cab2ab4f182649cbbb93debe86e7e
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8738
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12754
Simon Marchi [Mon, 15 Aug 2022 18:02:39 +0000 (14:02 -0400)]
tests: add test with incomplete packet header
During developement we hit a problem where src.ctf.fs's medium returned
less data than the `minSize` parameter, when reading a faulty trace.
The trace added in this patch reproduces the problem. It consists of a
full packet, followed by a single byte. When trying to read a second
packet, the ItemSeqIter instance would ask the medium for at least two
bytes, but the medium would return a buffer with a single byte (the data
available until the end of file). The fix was to make the medium
generate an error in this case.
Change-Id: I9a79360b18091f517846ca2be94fbf10fb9af349
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12753
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Mon, 15 Aug 2022 15:04:19 +0000 (11:04 -0400)]
tests: add clock-class before trace-class CTF2 test
Add a test with a CTF 2 metadata file where a clock-class fragment is
before the trace-class fragment. A bug triggered by this patch was hit
during development.
Change-Id: If9fd2497ca31ad73d9db1198f90e2404d9a7a8c1
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12752
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Sat, 4 Nov 2023 20:23:14 +0000 (20:23 +0000)]
tests/src.ctf.fs: add CTF 2 tests for no stream class, no trace class
During development, we hit some crashes when the trace metadata did not
specify any data stream class fragment (with and without an explicit
trace class fragment). Add tests for that.
Change-Id: Ic8ce4c7a2ae78b2f484a86e5b1306b7eae606528
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12751
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Fri, 10 Nov 2023 16:33:48 +0000 (16:33 +0000)]
tests/src.ctf.fs/test_fail: test with both autodiscovery and explicit component instantiation
Specifying a path to a failing trace like this:
babeltrace2 mytrace
vs
babeltrace2 -c src.ctf.fs -p 'inputs=["mytrace"]'
... exercises different code paths. If the failure is due to bad
metadata, the first one will error out during the support-info query
phrase, whereas the second one will error out in the component
initialization. I think it would be good to exercise both in the test
with failing traces.
Rename the test_fail function to test_fail_method, and add a parameter
indicating which method of passing the trace path to use (autodisc vs
component). Add a new test_fail function that tries with both methods.
Change-Id: Ieb65504a773b0915946f8ef543a7d0930ca0a7d7
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12750
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Thu, 2 Nov 2023 18:50:16 +0000 (18:50 +0000)]
tests/src.ctf.fs: add function to compute trace path in test-fail.sh
Add a function that returns a trace path given a trace name and a ctf
version. This is useful for subsequent patches that add tests with CTF
2 traces.
Change-Id: Ibc81d150152cd47e7113ebbc94bfe6995773655e
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12749
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Tue, 21 May 2024 17:59:51 +0000 (13:59 -0400)]
ctf: remove now unused files
Change-Id: Ib66be547edae247049f4d5b0a21233a7c68e0811
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8649
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12748
Simon Marchi [Fri, 24 May 2024 21:21:56 +0000 (17:21 -0400)]
src.ctf.lttng-live: use the new metadata stream parser and message iterator
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: Id2e11205bed54654942077c5336495b7bdd3f38d
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8617
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8648
Simon Marchi [Thu, 4 Aug 2022 20:32:56 +0000 (16:32 -0400)]
tests/cli/test_trace_read: use `bt_cli` and `isnt`
This makes the output more readable/analyzable on failure.
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I6bb7d76538c843a50e605756493de0755cc9ca11
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12747
Simon Marchi [Wed, 25 Oct 2023 02:11:44 +0000 (02:11 +0000)]
tests/cli/test_output_ctf_metadata: use `bt_cli` and `diff`
This makes the output more readable/analyzable on failure.
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I2466a032d7cfc2b8b6eb2de4b473dd1bb0c193df
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12746
Simon Marchi [Fri, 10 Nov 2023 16:32:38 +0000 (16:32 +0000)]
tests: adjust src.ctf.fs succeed tests to read CTF 2 traces
Change-Id: I3a78fb1641c3c1bae98be74b741ce2f4b8089ec0
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8509
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8646
Francis Deslauriers [Wed, 22 Jun 2022 19:52:05 +0000 (15:52 -0400)]
tests: Add CTF 2 version of succeed test traces
The following traces were left out:
succeed/warnings
succeed/succeed3
succeed/succeed4
Because they are testing CTF1 syntax.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I84504bd934958b6c04d8350610c397a8e851383e
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8465
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8645
This page took 0.055866 seconds and 4 git commands to generate.