deliverable/babeltrace.git
5 years agodoc/man/common-footer.txt: refer to `#lttng` IRC channel only
Philippe Proulx [Tue, 15 Oct 2019 21:33:31 +0000 (17:33 -0400)] 
doc/man/common-footer.txt: refer to `#lttng` IRC channel only

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I4c3246024184dbc024b56c98ec1162e984894cbc

5 years agodoc/man/common-footer.txt: update bug tracker resource
Philippe Proulx [Tue, 15 Oct 2019 20:08:16 +0000 (16:08 -0400)] 
doc/man/common-footer.txt: update bug tracker resource

Jérémie Galarneau, the current Babeltrace maintainer, decided that we
officially use the LTTng bug tracker instead of the LF one.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: If7df7bae7b99dac80257f1fc45672f424569b68b
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2202

5 years agolib, plugins: use bt_field_class_type_is() where suitable
Philippe Proulx [Thu, 10 Oct 2019 21:35:13 +0000 (17:35 -0400)] 
lib, plugins: use bt_field_class_type_is() where suitable

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I0cf5c50ab1a0a526678a50a34b2401ac16094eb0
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2172
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
5 years agolib: use powers of two for object type enumerators
Philippe Proulx [Thu, 10 Oct 2019 16:03:36 +0000 (12:03 -0400)] 
lib: use powers of two for object type enumerators

For all object type enumerators, that is, enumerators containing
`_TYPE`, use powers of two instead of sequential values.

This makes it possible to test that a given object has one or more
given types with a single bitwise operation, for example:

    bt_field_class_type fc_type = bt_field_class_get_type(my_fc);

    if (fc_type &
            (BT_FIELD_CLASS_TYPE_STATIC_ARRAY |
             BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITHOUT_LENGTH_FIELD |
             BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITH_LENGTH_FIELD)) {
        /* `my_fc` is an array */
    }

To make things easier, I'm also introducing one type enumerator per
"abstract" field class type. For example:

* `BT_FIELD_CLASS_TYPE_SIGNED_INTEGER`
* `BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION`
* `BT_FIELD_CLASS_TYPE_REAL`
* `BT_FIELD_CLASS_TYPE_ARRAY`
* `BT_FIELD_CLASS_TYPE_OPTION_WITH_SELECTOR_FIELD`

No field class object has those exact types, but their type can have
those bits set. For example, all the integer field class types have
bit 2 set. Then, if you need to know if a given type is conceptually
a given type, use bt_field_class_type_is(), which
returns:

    (type & type_to_check) == type_to_check

Each `BT_FIELD_CLASS_TYPE_*` enumerator conceptually matches, more or
less, a field class `bt2` Python class. For example:

* `BT_FIELD_CLASS_TYPE_ARRAY` → `bt2._ArrayFieldClass`
* `BT_FIELD_CLASS_TYPE_REAL` → `bt2._RealFieldClass`

The C to Python equivalent expressions are:

Object has a specific type:
    C:

        bt_field_class_get_type(fc) == BT_FIELD_CLASS_TYPE_X

    Python:

        type(fc) is bt2._XFieldClassConst

Object is an instance of a conceptual type:
    C:

        bt_field_class_type_is(bt_field_class_get_type(obj),
                               BT_FIELD_CLASS_TYPE_ABC)

    Python:

        isinstance(fc, bt2._AbcFieldClassConst)

Of course it's more natural in Python, but Python was not developed in
1972.

All `BT_FIELD_CLASS_TYPE_*` enumerators are `unsigned long long` values
and the non-API `__BT_FIELD_CLASS_TYPE_BIG_VALUE` is `1ULL << 62`
because we could have more than 32 enumerators eventually so I want to
make sure the `bt_field_class_type` type is a 64-bit integer for ABI
compatibility reasons.

Because the enumerators are not sequential anymore, we can't use them
directly as the indexes of lookup tables. This is why bt_field_create()
and bt_field_destroy() now check the FC type explicitly instead of using
lookup tables. Those functions are not called often anyway as field
objects are always created and destroyed from object pools.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I1b5110f691e1eabc0ce9291c0281755a3c6a755b
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2171
CI-Build: Simon Marchi <simon.marchi@efficios.com>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
5 years agolib: rename option/var. "selector" to "selector field"
Philippe Proulx [Thu, 10 Oct 2019 15:47:06 +0000 (11:47 -0400)] 
lib: rename option/var. "selector" to "selector field"

This is to be parallel with the "length field" API of dynamic array FCs.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I41d53ca7aa110cd6db5c827020af3c8d67b2392c
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2170
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
5 years agolib: have dedicated "dynamic array FC with/without length field" types
Philippe Proulx [Thu, 10 Oct 2019 15:35:29 +0000 (11:35 -0400)] 
lib: have dedicated "dynamic array FC with/without length field" types

This is to match what is already done for option and variant field
classes: you can know with their type enumerator whether or not they
have a selector and which type it is.

Now, when you pass `NULL` as the length FC to
bt_field_class_array_dynamic_create(), you get a FC with the type
`BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITHOUT_LENGTH_FIELD`. Otherwise
it is `BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITH_LENGTH_FIELD`.

Now you can only call
bt_field_class_array_dynamic_with_length_field_borrow_length_field_path_const()
with a FC having the type
`BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITH_LENGTH_FIELD`. The way to know
whether or not the dynamic array FC has a length field path is to check
its type.

In the Python bindings, there are dedicated
`_DynamicArrayWithLengthFieldFieldClass` and
`_DynamicArrayWithLengthFieldFieldClassConst` classes to match the
library changes. The `length_field_path` property is only available in
those.

A `sink.text.details` component now writes

    Dynamic array (no length field)

and

    Dynamic array (with length field)

depending on the dynamic array FC's type.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ibdc0ef1110bf05d517b241ba4f6a9a631ade8a0c
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2169
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
5 years agoFix: destroy_pretty_data: move NULL check earlier
Simon Marchi [Tue, 15 Oct 2019 18:32:00 +0000 (14:32 -0400)] 
Fix: destroy_pretty_data: move NULL check earlier

Move the NULL check for pretty before we dereference it.

Reported-by: Coverity
Change-Id: I2e598e734d4503ec17754dabf915d8264edcf4a7
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2179
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
5 years agotests: make test_intersection use bt_cli, test error cases
Simon Marchi [Thu, 19 Sep 2019 19:45:53 +0000 (15:45 -0400)] 
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>
5 years agoFix: check for NULL in destroy_pretty_data
Simon Marchi [Sun, 13 Oct 2019 03:11:57 +0000 (23:11 -0400)] 
Fix: check for NULL in destroy_pretty_data

In pretty_init, if create_pretty fails, we go to the `error` label and
call destroy_pretty_data.  However, destroy_pretty_data does not accept
a NULL pointer.

My understanding is that our "destroy" functions generally check for a
NULL pointer, and return early in that case.

Change destroy_pretty_data to do just that.

Fixes Coverity:

    *** CID 1405908:  Null pointer dereferences  (FORWARD_NULL)
    /src/plugins/text/pretty/pretty.c: 588 in pretty_init()
    582      bt_self_component_set_data(self_comp, pretty);
    583
    584      status = BT_COMPONENT_CLASS_INITIALIZE_METHOD_STATUS_OK;
    585      goto end;
    586
    587     error:
    >>>     CID 1405908:  Null pointer dereferences  (FORWARD_NULL)
    >>>     Passing null pointer "pretty" to "destroy_pretty_data", which dereferences it.
    588      destroy_pretty_data(pretty);
    589
    590     end:
    591      return status;

Reported-by: Coverity
Change-Id: I65ec6f8b2781c0a3a1166a1e68da1f47dc2da452
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2178
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
5 years agoCleanup: src.ctf.lttng-live: coding style
Francis Deslauriers [Thu, 10 Oct 2019 19:23:49 +0000 (15:23 -0400)] 
Cleanup: src.ctf.lttng-live: coding style

This commit fixes a few annoying coding style violations. Mainly number
of tabs when breaking line.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: If09f57c6f864c3446fc9f9d36c7fce7eb21990ae
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2168
Tested-by: jenkins <jenkins@lttng.org>
5 years agoCleanup: flt.lttng-utils.debug-info: coding style fixes
Francis Deslauriers [Fri, 11 Oct 2019 14:00:50 +0000 (10:00 -0400)] 
Cleanup: flt.lttng-utils.debug-info: coding style fixes

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I184e9beb2be0f8205a3ba604d8a1bac5fa4fc42c
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2173
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
5 years agoFix: avoid -Wmaybe-uninitialized warning in validate_map_value_entry
Simon Marchi [Fri, 11 Oct 2019 19:12:33 +0000 (15:12 -0400)] 
Fix: avoid -Wmaybe-uninitialized warning in validate_map_value_entry

We get this warning when building with gcc at -Og:

    /home/smarchi/src/babeltrace/src/plugins/common/param-validation/param-validation.c: In function ‘validate_map_value_entry’:
    /home/smarchi/src/babeltrace/src/plugins/common/param-validation/param-validation.c:182:18: error: ‘candidate’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
       data->status = validate_value(value, &candidate->value_descr,
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        data->ctx);
        ~~~~~~~~~~

Even though the code looks safe, we can modify it a little bit to avoid
that warning, and maybe even be a bit more readable.

Change-Id: I7a87d8125732744c4ff45fc0c0863c6dc9c26173
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2176
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
5 years agoFix: actually run the param validation test
Simon Marchi [Fri, 11 Oct 2019 16:23:56 +0000 (12:23 -0400)] 
Fix: actually run the param validation test

And fix the number of expected tests.

Change-Id: I4cd5cad27b3ae142d0c9a35b04c46241408677d3
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2175
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
5 years agoFix: don't use BT_VALUE_MAP_FOREACH_ENTRY_CONST_STATUS_MEMORY_ERROR
Simon Marchi [Fri, 11 Oct 2019 14:56:39 +0000 (10:56 -0400)] 
Fix: don't use BT_VALUE_MAP_FOREACH_ENTRY_CONST_STATUS_MEMORY_ERROR

BT_VALUE_MAP_FOREACH_ENTRY_CONST_STATUS_MEMORY_ERROR has been removed,
so don't use it in validate_map_value.

Fixes the following compilation error:

    /home/smarchi/src/babeltrace/src/plugins/common/param-validation/param-validation.c: In function ‘validate_map_value’:
    /home/smarchi/src/babeltrace/src/plugins/common/param-validation/param-validation.c:226:30: error: ‘BT_VALUE_MAP_FOREACH_ENTRY_CONST_STATUS_MEMORY_ERROR’ undeclared (first use in this function); did you mean ‘BT_VALUE_MAP_FOREACH_ENTRY_CONST_STATUS_INTERRUPTED’?
      if (foreach_entry_status == BT_VALUE_MAP_FOREACH_ENTRY_CONST_STATUS_MEMORY_ERROR) {
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                  BT_VALUE_MAP_FOREACH_ENTRY_CONST_STATUS_INTERRUPTED

Change-Id: Idc4ed1b198bfa40c9b3ba9d9532d69795f893c90
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2174
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
5 years agofilter.utils.trimmer: validate parameters using param-validation
Simon Marchi [Tue, 8 Oct 2019 20:59:14 +0000 (16:59 -0400)] 
filter.utils.trimmer: validate parameters using param-validation

This patch makes filter.utils.trimmer validate its parameters using the
param-validation utility.

Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: Ie127b424fed046cf6c4c6d043c84297982270fea
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2157
Tested-by: jenkins <jenkins@lttng.org>
5 years agofilter.utils.muxer: validate parameters using param-validation
Simon Marchi [Tue, 8 Oct 2019 20:59:03 +0000 (16:59 -0400)] 
filter.utils.muxer: validate parameters using param-validation

This patch makes filter.utils.muxer validate its parameters using the
param-validation utility.  The muxer component doesn't accept any
parameters, but at least this makes it verify that it doesn't receive
any unexpected parameter.

Change-Id: Ia89313c9b9b1fddd244b757a235be201ff5eb230
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2156

5 years agosink.utils.dummy: validate parameters using param-validation
Simon Marchi [Tue, 8 Oct 2019 19:27:43 +0000 (15:27 -0400)] 
sink.utils.dummy: validate parameters using param-validation

This patch makes sink.utils.counter validate its parameters using the
param-validation utility.  The dummy component doesn't accept any
parameters, but at least this makes it verify that it doesn't receive
any unexpected parameter.

Change-Id: I58493af30b04015d53c367487d294ded981539d2
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2155
Tested-by: jenkins <jenkins@lttng.org>
5 years agosink.utils.counter: validate parameters using param-validation
Simon Marchi [Tue, 8 Oct 2019 19:21:55 +0000 (15:21 -0400)] 
sink.utils.counter: validate parameters using param-validation

This patch makes sink.utils.counter validate its parameters using the
param-validation utility, instead of doing it by hand.

Change-Id: I0355eef4f1d7ecdfe4b943ff5f71af429b9419fa
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2154
CI-Build: Francis Deslauriers <francis.deslauriers@efficios.com>

5 years agosink.text.pretty: validate parameters using param-validation
Simon Marchi [Mon, 7 Oct 2019 20:26:53 +0000 (16:26 -0400)] 
sink.text.pretty: validate parameters using param-validation

This patch makes sink.text.pretty validate its parameters using the
param-validation utility, instead of doing it by hand.

Change-Id: I38235df6c7582928e96c06512a2630763cd2759f
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2148
Tested-by: jenkins <jenkins@lttng.org>
5 years agosrc.text.dmesg: validate parameters using param-validation
Simon Marchi [Mon, 7 Oct 2019 19:52:33 +0000 (15:52 -0400)] 
src.text.dmesg: validate parameters using param-validation

This patch makes src.text.dmesg validate its parameters using the
param-validation utility, instead of doing it by hand.

The

   Cannot specify both `read-from-stdin` and `path` parameters.

error seems unreachable, as there's no way that read_from_stdin can be
true when we read the path parameter.  I presume that there used to be a
read-from-stdin parameter, making this situation possible, but that it
was eventually removed.

Change-Id: Ie4c82968ba0aae24fc479a0f4442c92d50c489e4
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2147

5 years agosink.text.details: validate parameters using param-validation
Simon Marchi [Mon, 7 Oct 2019 19:21:14 +0000 (15:21 -0400)] 
sink.text.details: validate parameters using param-validation

This patch makes sink.text.details validate its parameters using the
param-validation utility, instead of doing it by hand.

To be able to re-use the parameter names in the statically defined
array, I had to change them to macros, to avoid this warning:

/home/smarchi/src/babeltrace/src/plugins/text/details/details.c:244:4: error: initializer element is not constant
  { color_param_name, BT_PARAM_VALIDATION_MAP_VALUE_ENTRY_OPTIONAL, { BT_VALUE_TYPE_STRING, .string = {
    ^~~~~~~~~~~~~~~~

Change-Id: I4279348e8441c22afe1ae47a6650d0a118cfa42a
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2146
Tested-by: jenkins <jenkins@lttng.org>
5 years agoflt.lttng-utils.debug-info: validate parameters using param-validation
Simon Marchi [Sat, 5 Oct 2019 05:14:21 +0000 (01:14 -0400)] 
flt.lttng-utils.debug-info: validate parameters using param-validation

This patch makes sink.ctf.fs validate its parameters using the
param-validation utility, instead of doing it by hand.

Change-Id: Iaa8cc02bd82ad7e1af2d18e1f1f7b73c5c5c8f19
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2142
CI-Build: Francis Deslauriers <francis.deslauriers@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
5 years agoflt.lttng-utils.debug-info: tidy up component initialization
Simon Marchi [Sat, 5 Oct 2019 05:01:34 +0000 (01:01 -0400)] 
flt.lttng-utils.debug-info: tidy up component initialization

Assign add_port_status to status directly, as has been the accepted
pattern in the rest of the project for a while.  This is less verbose
than using a switch-case.

Make init_from_params return a
bt_component_class_initialize_method_status, since it's only used in the
context of component initialization.  The alert reader will notice that
this function can't fail, making it pointless to have it return a
status.  However, it will be able to fail in the next patch, so I chose
to leave a non-void return type.

Change-Id: I41c1f6dc9dea5cbda4ef33f336d4b2cff216a568
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2141
Tested-by: jenkins <jenkins@lttng.org>
5 years agosrc.ctf.lttng-live: validate parameters using param-validation
Simon Marchi [Sat, 5 Oct 2019 03:17:29 +0000 (23:17 -0400)] 
src.ctf.lttng-live: validate parameters using param-validation

This patch makes src.ctf.lttng-live validate its parameters using the
param-validation utility, instead of doing it by hand.

Change-Id: I4abbf7a9e44bd04c1ecc620ab19b5084af2c68ef
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2140
Tested-by: jenkins <jenkins@lttng.org>
5 years agosink.ctf.fs: validate parameters using param-validation
Simon Marchi [Fri, 4 Oct 2019 21:19:35 +0000 (17:19 -0400)] 
sink.ctf.fs: validate parameters using param-validation

This patch makes sink.ctf.fs validate its parameters using the
param-validation utility, instead of doing it by hand.

Change-Id: I2d5433793a695f33935f7d2c3942c917145687db
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2137
Tested-by: jenkins <jenkins@lttng.org>
5 years agosrc.ctf.fs: validate parameters using param-validation
Simon Marchi [Fri, 4 Oct 2019 20:17:00 +0000 (16:17 -0400)] 
src.ctf.fs: validate parameters using param-validation

This patch makes src.ctf.fs validate its parameters using the
param-validation utility, instead of doing it by hand.

Change-Id: I3da43ba86417cc5bffb4b58e3052c38a1d08c602
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2136
Tested-by: jenkins <jenkins@lttng.org>
5 years agoAdd parameter validation utility
Simon Marchi [Fri, 4 Oct 2019 20:16:47 +0000 (16:16 -0400)] 
Add parameter validation utility

This patch adds a utility to help component classes validate the
parameters they receive (either for component initialization or query).

The definition of what constitutes valid parameters for a component
class is done by filling C structures describing each expected value
(see included test for examples).

Since this is made for parameter validation, and not general-purpose
value validation, the entry point bt_param_validation_validate assumes
that the root value is a map (and is therefore validated as a map, as
described below).

For parameters that have simple validation rules, it is enough to fill
the `type` field of bt_param_validation_value_descr, and perhaps the
additional fields associated to the type.

For array values, the description includes the minimum and maximum sizes
the array can have (use BT_PARAM_VALIDATION_INFINITE if there's no max).
It also includes a pointer to the description of its element values.

For map values, the description includes a list of possible map entries.
For each entry, we have the key, whether the entry is mandatory and the
description of the value.

For string values, the description may include a list of choices.  If it
does, the string value must be in this list.

For parameters that have more complex validation rules, for example
parameters whose value can be of different types, it is possible to set
the `validation_func` field.  If it is set, this function will be called
and is responsible for validating the value.

If the validation fails, an error message is produced, which includes
the full scope where the error occured (again, see the test for an
example).

Change-Id: If729415fdd8ce97fa94b79e8bf79461e46ebf2bc
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2119
Tested-by: jenkins <jenkins@lttng.org>
5 years agocli: ensure queries always receive a map
Francis Deslauriers [Thu, 10 Oct 2019 14:50:57 +0000 (10:50 -0400)] 
cli: ensure queries always receive a map

Note that with this commit it's possible to have multiple `--params`
options for the same query object. Before, that the last `--params`
would overwrite any previous ones.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Id63354024a4464cc65ddab2e2e0a168c36dc377d
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2164
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
5 years agoCleanup: ctf: logically dead code
Francis Deslauriers [Thu, 10 Oct 2019 15:11:06 +0000 (11:11 -0400)] 
Cleanup: ctf: logically dead code

The `iter_status` variable is guaranteed to be equal to
`BT_MSG_ITER_STATUS_OK` when breaking from the `do-while` loop above.

Coverity report:
  CID 1401337 (#1 of 1): Logically dead code (DEADCODE) dead_error_line:
  Execution cannot reach this statement: goto error;

Reported-by: Coverity (1401337) - Logically dead code
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I51448d800b8ed37e80ce64b77df3905c8042b1bf
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2166
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
5 years agotests: rename PRINT_FORMAT to TAP_PRINTF_FORMAT
Simon Marchi [Thu, 10 Oct 2019 15:14:36 +0000 (11:14 -0400)] 
tests: rename PRINT_FORMAT to TAP_PRINTF_FORMAT

Use a namespace, so we can define our own for the rest of babeltrace
(will be called BT_PRINTF_FORMAT) without colliding.

Change-Id: I03f5d4cf050f94de294bb179450876b300d53b91
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2165
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
5 years agovalues: make `bt_value_map_extend()` extend the provided base map
Francis Deslauriers [Wed, 9 Oct 2019 19:36:22 +0000 (15:36 -0400)] 
values: make `bt_value_map_extend()` extend the provided base map

The current behavior of this function is to create a new extended map
leaving the two provided maps untouched. I can see cases where that
would be useful, but I believe the user is going to expect the
`_extend()` function to extend an existing map.

If a user want to get a new map, she could still copy the base map using
`bt_value_copy()` before extending it.

So this commit changes the behavior of `bt_value_map_extend()` so that
it takes two arguments: the base map, and the extension map. The entries
of the extension map are added to the base map, overwriting any existing
keys.

Also, remove the `_MEMORY_ERROR` status from the
`bt_value_map_foreach_entry_status` and
`bt_value_map_foreach_entry_const_status` enums since those two are not
used at the moment.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I8fa7d4591da90dae50316d6db86af5ab1b76203c
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2162
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
5 years agotests: make test names in plugins/flt.utils.trimmer/test_trimming unique
Simon Marchi [Wed, 9 Oct 2019 19:45:51 +0000 (15:45 -0400)] 
tests: make test names in plugins/flt.utils.trimmer/test_trimming unique

Change-Id: I1f1e4ef2a8eaa79704848a765f0bc209e7ee4b92
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2163
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
5 years agoFix: format string warnings on mingw
Simon Marchi [Wed, 9 Oct 2019 19:10:00 +0000 (15:10 -0400)] 
Fix: format string warnings on mingw

Since we have added format string attributes in the tap.h file, we get
these diagnostics on Windows:

      CC       test_bitfield.o
    test_bitfield.c: In function 'run_test_unsigned_write':
    test_bitfield.c:51:36: error: unknown conversion type character 'l' in format [-Werror=format=]
       51 | #define DIAG_FMT_STR(val_type_fmt) "Failed reading value written \"%s\"-wise, with start=%i" \
          |                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    test_bitfield.c:51:36: note: in definition of macro 'DIAG_FMT_STR'
       51 | #define DIAG_FMT_STR(val_type_fmt) "Failed reading value written \"%s\"-wise, with start=%i" \
          |                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    test_bitfield.c:173:8: note: in expansion of macro 'check_result'
      173 |    if (check_result(src_ui, readval, target.c, unsigned char,
          |        ^~~~~~~~~~~~
    test_bitfield.c:175:9: note: format string is defined here
      175 |      "%llX")) {
          |         ^

By default, printf on Windows doesn't know about the `ll` format string
length modifier (as in %llx).  However, we build Babeltrace with the
__USE_MINGW_ANSI_STDIO macro defined, which makes mingw use a
replacement printf implementation that knows about `ll`.

When we define our own functions with a format attribute, we must then
use __MINGW_PRINTF_FORMAT instead of `printf`.  __MINGW_PRINTF_FORMAT
will take the right value, depending on __USE_MINGW_ANSI_STDIO, so it
will validate the format string according to the selected printf
implementation.

Change-Id: I89b194e915250a0e0a617817a1cd10fedb156639
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2161
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
5 years agoFix: lib: field-class.c: memory leak on error
Francis Deslauriers [Wed, 9 Oct 2019 14:05:18 +0000 (10:05 -0400)] 
Fix: lib: field-class.c: memory leak on error

scan-build report:
  Potential leak of memory pointed to by 'var_with_sel_fc'
  File: src/lib/trace-ir/field-class.c Line: 1524

Reported-by: scan-build
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I6f52562c8549810ffb82c6ae4b34707ad6a32576
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2158
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
5 years agoCleanup: lib: field-class.c: fix logging message for variant FC
Francis Deslauriers [Wed, 9 Oct 2019 15:19:33 +0000 (11:19 -0400)] 
Cleanup: lib: field-class.c: fix logging message for variant FC

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I5b23f843493d7c68121c262e5cbd795503996ad9
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2159
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
5 years agoRequire automake >= 1.12
Michael Jeanson [Tue, 8 Oct 2019 18:25:36 +0000 (14:25 -0400)] 
Require automake >= 1.12

The test suite LOG_DRIVER statement requires that automake >= 1.12 be used
during bootstrap.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I848324bfabcf158f53bed5ed4c1045546e9a8ce5
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2152
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
5 years agoFix: fix wint_t warning on MSYS2/mingw
Simon Marchi [Wed, 9 Oct 2019 16:12:38 +0000 (12:12 -0400)] 
Fix: fix wint_t warning on MSYS2/mingw

We get the following warning when compiling on Windows:

    common.c: In function 'handle_conversion_specifier_std':
    common.c:1419:30: warning: 'wint_t' {aka 'short unsigned int'} is promoted to 'int' when passed through '...'
     1419 |    BUF_STD_APPEND_SINGLE_ARG(wint_t);
          |                              ^
    common.c:1419:4: note: in expansion of macro 'BUF_STD_APPEND_SINGLE_ARG'
     1419 |    BUF_STD_APPEND_SINGLE_ARG(wint_t);
          |    ^~~~~~~~~~~~~~~~~~~~~~~~~
    common.c:1419:30: note: (so you should pass 'int' not 'wint_t' {aka 'short unsigned int'} to 'va_arg')
     1419 |    BUF_STD_APPEND_SINGLE_ARG(wint_t);
          |                              ^

When expanded, this problematic macro usage contains:

    wint_t _arg = va_arg(*args, wint_t);

I think the suggestion of passing `int`, not `wint_t` makes sense.  This
is because any integral argument smaller than an int would have already
been promoted to int when passed to the variable arguments function
that eventually called handle_conversion_specifier_std.  So it makes
sense to fetch this variable as an int.

We don't see this warning on x86-64 Linux because there, sizeof(wint_t)
is 4, the same as an int.

Change-Id: Ia1519b15a56a58022254be98597c1f3e020db9b9
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2160
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
5 years agosrc.ctf.lttng-live: make lttng_live_component_create static
Simon Marchi [Sat, 5 Oct 2019 02:46:17 +0000 (22:46 -0400)] 
src.ctf.lttng-live: make lttng_live_component_create static

This function is not used outside this file, so make it static.

Change-Id: If2836f7eea7c8243d26088b4e026b31a4ed8c82d
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2139
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
5 years agoCleanup: flt.lttng-utils.debug-info: coding style
Francis Deslauriers [Fri, 4 Oct 2019 18:58:26 +0000 (14:58 -0400)] 
Cleanup: flt.lttng-utils.debug-info: coding style

When I first wrote this component class, I was using the wrong coding
style standard. More specifically, the main problem is that the number
of tabs on breaking lines is wrong at bunch places in the debug-info
files.

I am currently working on this code and it annoyed me. So I fixed most
of it.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I41b3d6b3a35546e5ce4f65470bed1303966523c4
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2134
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
5 years agoport: fix link order of babeltrace2.exe
Michael Jeanson [Tue, 8 Oct 2019 19:20:39 +0000 (15:20 -0400)] 
port: fix link order of babeltrace2.exe

On both Cygwin and MINGW, the link order of static libraries in an exe
requires the dependent libraries to come first. In this case
'libbabeltrace2-param-parse.la' depends on 'libbabeltrace2.la' for the
'bt_value_bool_create_init' symbol and thus has to be listed before.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I64df3dddcc65233c63f61af3fe7a6a093990c203
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2153
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
5 years agoFix: lib: field.c: calling _PUT_REF() on unique objects on error
Francis Deslauriers [Tue, 8 Oct 2019 13:50:47 +0000 (09:50 -0400)] 
Fix: lib: field.c: calling _PUT_REF() on unique objects on error

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I91b22cc4afa492f56cf2a1f460bb29dd61c96c08
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2150
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
5 years agolib: rename `bt_*_compare()` to `bt_*_is_equal()`
Francis Deslauriers [Mon, 7 Oct 2019 19:22:58 +0000 (15:22 -0400)] 
lib: rename `bt_*_compare()` to `bt_*_is_equal()`

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I7782ad5c7b5374e88d5f0e31c4fe3fec4e4bea6c
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2145
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
5 years agoCleanup: lib: graph.c: dead assignment
Francis Deslauriers [Tue, 8 Oct 2019 01:54:21 +0000 (21:54 -0400)] 
Cleanup: lib: graph.c: dead assignment

Reported-by: Scan-build - Dead assignment
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I512551f8ca951eeb004c0a819e7123c363eb5036
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2149
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
5 years agoFix: fix some warnings shown with -Wextra on gcc 9.1.0
Simon Marchi [Sat, 5 Oct 2019 04:02:59 +0000 (00:02 -0400)] 
Fix: fix some warnings shown with -Wextra on gcc 9.1.0

Fix this:

    /home/simark/src/babeltrace/src/ctf-writer/event.c: In function ‘bt_ctf_event_create’:
    /home/simark/src/babeltrace/src/ctf-writer/event.c:626:3: error: cast between incompatible function types from ‘void (*)(struct bt_ctf_field_wrapper *)’ to ‘void (*)(void *, void *)’ [-Werror=cast-function-type]
      626 |   (release_header_field_func) destroy_event_header_field);
          |   ^

by adding a second parameter, stream_class, to destroy_event_header_field, to
match the release_header_field_func type (which takes two pointers).

Fix this:

    /home/simark/src/babeltrace/src/lib/trace-ir/clock-class.c: In function ‘bt_clock_class_create’:
    /home/simark/src/babeltrace/src/lib/trace-ir/clock-class.c:125:3: error: cast between incompatible function types from ‘void (*)(struct bt_clock_snapshot *, struct bt_clock_class *)’ to ‘void * (*)(void *, void *)’ [-Werror=cast-function-type]
      125 |   (bt_object_pool_destroy_object_func)
          |   ^

by making bt_object_pool_destroy_object_func return `void` instead of `void *`
(none of the implementations actually return anything, it seems like a copy
paste error from the typedef above).

Change-Id: I8707a4a3b3eb34d84604f9b8117a20eaa5f50c83
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2138
Tested-by: jenkins <jenkins@lttng.org>
5 years agotests: test_output_path_ctf_non_lttng_trace_output small improvements
Simon Marchi [Sat, 5 Oct 2019 05:37:25 +0000 (01:37 -0400)] 
tests: test_output_path_ctf_non_lttng_trace_output small improvements

- Give a name to temporary directories
- Use bt_cli, so the executed command lines are printed

Change-Id: Ife9cadbabeca86a58ac976dc61b7c4c8d25c6efb
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2143
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
5 years agoMove CLI params parsing to its own lib
Simon Marchi [Fri, 4 Oct 2019 19:00:01 +0000 (15:00 -0400)] 
Move CLI params parsing to its own lib

This will allow using it for parameter parsing in a test, for
convenience.

The sharp-eyed reader will have noticed that this patch also removes
unused structures from src/cli/babeltrace2-cfg-cli-args.c.  These were
likely forgotten there when the parameter parsing code was moved to its
own file.

Change-Id: Ibc7ecb238905051492718f1d176c0fb5f0c172a8
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2135
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
5 years agoCleanup: flt.lttng-utils.debug-info: remove leftover comments
Francis Deslauriers [Thu, 3 Oct 2019 20:48:00 +0000 (16:48 -0400)] 
Cleanup: flt.lttng-utils.debug-info: remove leftover comments

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I98412f2f27d8b3c7611f26021b1e8dca12062b87
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2131
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
5 years agoFix: tests: remove unused imports
Simon Marchi [Mon, 7 Oct 2019 18:48:54 +0000 (14:48 -0400)] 
Fix: tests: remove unused imports

Change-Id: I5969e33915073d9638dbdcc0ec6c49afec81d5e7
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2144

5 years agocli: update error message in set_stream_intersections
Simon Marchi [Wed, 2 Oct 2019 15:33:03 +0000 (11:33 -0400)] 
cli: update error message in set_stream_intersections

The error message printed when the `babeltrace.trace-infos` query fails,
regardless of the reason, is "Component class does not support the
`babeltrace.trace-infos` query".  I think it's misleading, because this
is just one particular error case.  It could be that the component class
supports the query, but failed because it didn't like the parameters we
passed.

Update the message to be a bit more generic.  The fail_reason printed
just after gives a bit more precision about the error.

Change-Id: If556129b612cb6aa9c480b3f863368e48e8a6d4a
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2115
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
5 years agotests: get rid of missing-field-initializers warning in test_bin_info.c
Simon Marchi [Fri, 4 Oct 2019 18:39:09 +0000 (14:39 -0400)] 
tests: get rid of missing-field-initializers warning in test_bin_info.c

This is not super important, and the current code looks correct, but
clang produces this warning:

    /home/smarchi/src/babeltrace/tests/plugins/flt.lttng-utils.debug-info/test_bin_info.c:93:7:
    error: missing field 'short_name' initializer
    [-Werror,-Wmissing-field-initializers]
            {NULL}};

I'd like to have this warning enabled, since it can catch some
legitimate mistakes, so I thought it would be useful to change the code
to avoid having a warning.

Change-Id: Icb5d3227b87ba1bbf405cd320f13886bf313492f
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2133
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
5 years agotests: constify format strings in tap.h
Simon Marchi [Fri, 4 Oct 2019 16:44:05 +0000 (12:44 -0400)] 
tests: constify format strings in tap.h

Format strings are typically read-only data (literal strings), and they
are not modified by the functions receiving them, so it makes no sense
for them not to be const.

This helps avoid some "passing value to function foo discards const
qualifier" kind of warnings.

Change-Id: Ibaaaf5690bed21e1d541f1b676627dfd70541219
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2130
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
5 years agotests: add format attributes to functions receiving format strings in tap.h
Simon Marchi [Fri, 4 Oct 2019 16:27:04 +0000 (12:27 -0400)] 
tests: add format attributes to functions receiving format strings in tap.h

This makes the compiler validate the format strings against the types of
the passed arguments.  It found a few (minor) issues, which are also
fixed by this patch.

Note that in test_bitfield.c, the format string now includes "0x" before
printing the number in hexadecimal, to avoid any confusion when the user
reads it.

Change-Id: I07cac88aa3cdd445d79f2c12bc0f9333f6a768a9
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2129
Tested-by: jenkins <jenkins@lttng.org>
5 years agotrace{-class}.c: BT_ASSERT_PRE() -> BT_ASSERT_POST() (ref. count check)
Philippe Proulx [Fri, 4 Oct 2019 10:54:29 +0000 (06:54 -0400)] 
trace{-class}.c: BT_ASSERT_PRE() -> BT_ASSERT_POST() (ref. count check)

Those are postcondition assertions because they check some state after a
user function returns.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I3705ee451ff8ae024a2eb17fbe6ae9cc2b11d05e
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2127
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
5 years agolib: rename `bt_object_{get,put}_no` -> `bt_object_{get,put}_ref_no`
Philippe Proulx [Thu, 3 Oct 2019 21:14:10 +0000 (17:14 -0400)] 
lib: rename `bt_object_{get,put}_no` -> `bt_object_{get,put}_ref_no`

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I5747bdb748d585b25e0ffbe4701b9aef5434728e
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2126
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
5 years agotest_package.py: use list of public names instead of dedicated methods
Philippe Proulx [Thu, 3 Oct 2019 21:10:06 +0000 (17:10 -0400)] 
test_package.py: use list of public names instead of dedicated methods

This patch changes `test_package.py` so that the public names to verify
are listed in the `_public_names` list. The code creates the
corresponding test methods.

This makes it less cumbersome to add public name tests in the future.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I0d370d4b5fd4564000e1e0f273d3b1b36a8acc43
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2125
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
5 years agofield_class.py: normalize field class names (`_NAME`)
Philippe Proulx [Thu, 3 Oct 2019 21:06:30 +0000 (17:06 -0400)] 
field_class.py: normalize field class names (`_NAME`)

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ib51e612dc3c6b2610bf9dc0c987ce4816e3bdd9f
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2124
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
5 years agolib, bt2: rename "signed/unsigned sel." -> "integer signed/unsigned sel."
Philippe Proulx [Thu, 3 Oct 2019 20:59:06 +0000 (16:59 -0400)] 
lib, bt2: rename "signed/unsigned sel." -> "integer signed/unsigned sel."

This matches the option field class terminology and makes it possible to
add other types of variant selectors in the future.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I8b1d5b10ffb9062b09ac5ce2ef6607045cdfb5cb
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2123
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
5 years agolib: add option field classes with integer selectors
Philippe Proulx [Wed, 2 Oct 2019 18:30:17 +0000 (14:30 -0400)] 
lib: add option field classes with integer selectors

This patch adds two new option field classes which have unsigned and
signed integer field classes as selectors. The purpose of this patch is
to be able to use the same selector for an option field class and a
contained, optional variant field class so that you can save space. For
example (pseudo-TSDL):

    enum : integer { size = 8; } {
        NONE,
        BANANA,
        APPLE,
    } tag;

    option <tag> {
        variant <tag> {
            string BANANA <1>;
            int APPLE <2>;
        } <1...0xff>;
    } opt_var;

Above, the optional variant field does not exist when the `tag` field is
0. If `tag` is anything else, then the variant field exists, and the
selected variant field's option also depends on this same value (1 and 2
select existing options).

Library changes
===============
There are now four option field classes:

Option without selector:
    Create with:

        bt_field_class *bt_field_class_option_without_selector_create(
            bt_trace_class *trace_class,
            bt_field_class *content_field_class);

Option with boolean selector:
    Create with:

        bt_field_class *bt_field_class_option_with_selector_bool_create(
            bt_trace_class *trace_class,
            bt_field_class *content_field_class,
            bt_field_class *selector_field_class);

    `selector_field_class` must be a boolean field class.

    By default, the selector is not reversed, in that when the selector
    boolean field is true, the option's field exists.

    You can reverse this logic with:

        void bt_field_class_option_with_selector_bool_set_selector_is_reversed(
            bt_field_class *field_class, bt_bool selector_is_reversed);

    You can get this property with:

        bt_bool
        bt_field_class_option_with_selector_bool_selector_is_reversed(
            const bt_field_class *field_class);

Option with unsigned integer selector:
Option with signed integer selector:
    Create with one of:

        bt_field_class *
        bt_field_class_option_with_selector_integer_unsigned_create(
            bt_trace_class *trace_class,
            bt_field_class *content_field_class,
            bt_field_class *selector_field_class,
            const bt_integer_range_set_unsigned *range_set);

        bt_field_class *
        bt_field_class_option_with_selector_integer_signed_create(
            bt_trace_class *trace_class,
            bt_field_class *content_field_class,
            bt_field_class *selector_field_class,
            const bt_integer_range_set_signed *range_set);

    For both versions:

    * `selector_field_class` must be an integer field class.

    * `range_set` tells, for such an option field, which values of the
      selector field make it contain the optional field.

    * `range_set` must contain at least one integer range.

    * On success, the function freezes `range_set`.

    You can borrow the integer range sets with:

        const bt_integer_range_set_unsigned *
        bt_field_class_option_with_selector_integer_unsigned_borrow_ranges_const(
            const bt_field_class *field_class);

        const bt_integer_range_set_signed *
        bt_field_class_option_with_selector_integer_signed_borrow_ranges_const(
            const bt_field_class *field_class);

Python bindings changes
=======================
There are new Python classes in `field_class.py` to wrap the new field
classes.

To create the new field classes, use:

* _TraceClass.create_option_without_selector_field_class()
* _TraceClass.create_option_with_bool_selector_field_class()
* _TraceClass.create_option_with_integer_selector_field_class()

_TraceClass.create_option_with_integer_selector_field_class() relies on
the type of `selector_fc` to create either an option with unsigned
integer selector field class or an option with signed integer selector
field class.

Notable component class changes
===============================
`flt.lttng-utils.debug-info`:
    Copies all option field classes and their properties.

`sink.text.details`:
    Writes all the option field class properties:

    * Whether or not the selector is reversed for an option with boolean
      selector field class.

      It looks like this:

          opt: Option (boolean selector) (Selector field path [Event payload: 2]):
            Selector is reversed: Yes
            Content: Unsigned integer (64-bit, Base 10)

    * The sorted integer ranges for an option with integer selector
      field class.

      It looks like this:

          opt: Option (signed integer selector) (Selector field path [Event payload: 1]):
            Selector ranges: [1, 1548] [1634] [2960, 3505]
            Content: Unsigned integer (64-bit, Base 10)

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I31e1deba974bf30274d567a73a00ea80d028f7ae
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2122
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
5 years agofs-sink-trace.c: lttng_validate_datetime(): ignore deprecated decl.
Philippe Proulx [Wed, 2 Oct 2019 18:25:49 +0000 (14:25 -0400)] 
fs-sink-trace.c: lttng_validate_datetime(): ignore deprecated decl.

Disable `deprecated-declarations` compiler warnings for
lttng_validate_datetime() because we're using `GTimeVal` and
g_time_val_from_iso8601() which are deprecated since GLib 2.56
(Babeltrace supports older versions too).

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I4da3bda550b3fd7d7ede13ff3b78ec78ad6f7839
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2121
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
5 years agoFix: iterator.c: initialize `status` (may be used uninitialized)
Philippe Proulx [Tue, 1 Oct 2019 18:17:44 +0000 (14:17 -0400)] 
Fix: iterator.c: initialize `status` (may be used uninitialized)

From this GCC warning:

    iterator.c: In function ‘find_message_ge_ns_from_origin’:
    iterator.c:1611:9: error: ‘status’ may be used uninitialized in this
                              function [-Werror=maybe-uninitialized]
     1611 |  return status;
          |

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: If6f5f8a63d5a530284a08b9c6dd7f67ecfc9a818
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2120
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
5 years agom4: sync ax_pthread.m4 with autoconf archive
Simon Marchi [Fri, 4 Oct 2019 16:18:05 +0000 (12:18 -0400)] 
m4: sync ax_pthread.m4 with autoconf archive

Sync with [1].

In particular, this lets us configure with -Wunused-but-set-parameter.

[1] https://raw.githubusercontent.com/autoconf-archive/autoconf-archive/62e8491dbc174113a04fe910cad1e92e8a9e2164/m4/ax_pthread.m4

Change-Id: I496e3d9a8e896b04bf3cc87ddd41b1b144d23ee5
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2128
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
5 years agobt2: add `IntegerRangeSet` const classes
Francis Deslauriers [Thu, 3 Oct 2019 12:30:05 +0000 (08:30 -0400)] 
bt2: add `IntegerRangeSet` const classes

Outside of simple rename and splitting, this commit changes the `__eq__`
methods so that it's possible to compare const and non-const objects
together.

I also renamed the `_range_type` to `_range_pycls` to follow what is
done in other files and `_borrow_range_by_index_ptr` to
`_borrow_range_ptr_by_index` to increase readability.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I04b4027d297d088c6531be04681598653601579d
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2118
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
5 years agoTests: bt2: move `_create_const_field()` to utils.py
Francis Deslauriers [Thu, 3 Oct 2019 12:27:58 +0000 (08:27 -0400)] 
Tests: bt2: move `_create_const_field()` to utils.py

So it can be used by other test cases. It will be used by the
`test_integer_range_set.py` file in a following commit.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ic64a60e9d1a7bca11292c824531949602d567a6f
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2117
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
5 years agoCleanup: bt2: typo "nsigned" -> "unsigned"
Francis Deslauriers [Thu, 3 Oct 2019 11:40:43 +0000 (07:40 -0400)] 
Cleanup: bt2: typo "nsigned" -> "unsigned"

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Id349adc7d4b1dfedadad2a1c014141b5e408b9bb
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2116
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
5 years agolib: make it mandatory to have seek_X if can_seek_X is defined
Simon Marchi [Thu, 26 Sep 2019 18:26:29 +0000 (14:26 -0400)] 
lib: make it mandatory to have seek_X if can_seek_X is defined

It's currently possible for a component class to provide can_seek_X
(can_seek_beginning or can_seek_ns_from_origin) without the
corresponding seek_X.  This doesn't make much sense, as if can_seek_X
returns true, Babeltrace assumes that seek_X can be called (which is
inconvenient if it's not provided).  That only leaves room for the case
where can_seek_X always returns false, which is not useful.

This patch makes it only possible to provide a can_seek_X if the
corresponding seek_X is provided, for both C and Python user component
classes.  It's still possible, however, to provide seek_X without
can_seek_X, in which case Babeltrace assumes that it's always possible
to call seek_X.

In the C API, component class method setters for seek_X and can_seek_X
are merged in a single function that sets both.  Since we assert that
seek_X is not NULL, this ensures that can_seek_X can only provided along
with a seek_X.

In the Python API, this verification is done dynamically when a user
message iterator class is assigned to a source or filter component
class.

Change-Id: If596d35dc3327bfd6e3f1e59f74c43dce3a722e1
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2100
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
5 years agolib: make can_seek_ns_from_origin logic use `can_seek_forward` property of iterator
Simon Marchi [Wed, 18 Sep 2019 20:22:16 +0000 (16:22 -0400)] 
lib: make can_seek_ns_from_origin logic use `can_seek_forward` property of iterator

This patch changes the behavior of
bt_self_component_port_input_message_iterator_can_seek_ns_from_origin to
make use of the new `can_seek_forward` property of iterators.

The current iterator "can seek ns from origin" logic works like this:

- If the iterator provides a `can_seek_ns_from_origin` method, call it
  and return that result.
- Otherwise, check if we can autoseek: if the iterator can seek
  beginning return true, else return false.

An issue with this is that if:

- an iterator doesn't provide the can_seek_ns_from_origin and
  seek_ns_from_origin methods
- the streams (and thus event messages) produced by this iterator don't
  have a timestamp
- the iterator can seek beginning

then
bt_self_component_port_input_message_iterator_can_seek_ns_from_origin
will report that this iterator can seek ns from origin, presumably
because it can use autoseek.  However, since the event messages don't
have a timestamp, we'll be able to seek beginning, but fast forwarding
to the desired point won't work.

To solve this, we need an additional property on message iterators,
whether the messages it produces have a timestamp, and therefore if the
"fast-forward" portion of autoseek will work.

This patch also brings another behavior change.  Previously, if the
can_seek_ns_from_origin method of the iterator was provided and returned
false, that was it.  With this patch, if that happens, we fall back to
checking if autoseek is supported.  That change is primarily in
bt_self_component_port_input_message_iterator_can_seek_ns_from_origin.
However,
bt_self_component_port_input_message_iterator_seek_ns_from_origin is
also updated accordingly, because we need to query the iterator to know
if it can seek ns from origin by itself, or if we should fall back on
autoseek.

Change-Id: I1848c87acf8ed75d4020a51e3be41dec2f144843
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2066
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
5 years agotests: remove CR characters from expected file in test_live
Simon Marchi [Tue, 1 Oct 2019 22:21:54 +0000 (18:21 -0400)] 
tests: remove CR characters from expected file in test_live

Tests done by test_compare_to_ctf_fs in test_live don't work on Windows.
When comparing the expected and actual files, the expected file has CRLF
end of lines while the actual file has LF end of lines.  This can be
unexpected, as both are produced by sink.text.details.

The reason is that bt_diff strips CR characters from the actual file.
This is done so actual files match the expect files, which typically are
static (not generated) and don't contain CR characters.

This patch makes test_live also strip CR characters from the expected
files it generates.

One might wonder, why not just make bt_diff strip both files of their CR
characters.  I prefer not to do that, because most files passed as
"expect" files to that function are files from the source tree.  These
files should not be modified by building and testing.  In other words,
it should be possible to run a make check while the source tree is on a
read-only filesystem.

Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: Ie5fac78260e5bb8102d3c7f9cc3b4a1b21cf773d
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2114
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
5 years agotests: use os.rename instead of os.replace in lttng_live_server.py
Simon Marchi [Tue, 1 Oct 2019 22:22:10 +0000 (18:22 -0400)] 
tests: use os.rename instead of os.replace in lttng_live_server.py

On Windows, os.rename fails if the destination file exists, which is the
case for the port file in lttng_live_server.py.  The file is created by
the bash test script.

This results in the following error:

    # Starting LTTng live server mockup
    Traceback (most recent call last):
      File "C:/Users/smarchi/babeltrace/tests/data/plugins/src.ctf.lttng-live/lttng_live_server.py", line 1449, in <module>
        args.port_filename, args.sessions, args.max_query_data_response_size
      File "C:/Users/smarchi/babeltrace/tests/data/plugins/src.ctf.lttng-live/lttng_live_server.py", line 1229, in __init__
        self._write_port_to_file(port_filename)
      File "C:/Users/smarchi/babeltrace/tests/data/plugins/src.ctf.lttng-live/lttng_live_server.py", line 1342, in _write_port_to_file
        os.rename(tmp_port_file.name, port_filename)
    FileExistsError: [WinError 183] Cannot create a file when that file already exists: 'C:/Users/smarchi/AppData/Local/Temp/tmpi8ihb0ck' -> 'test_live_list_sessions_server_port.5iod4m'

Use os.replace instead.

Change-Id: I8d7a28da66f11975bb0e2d355084a8a336500cc0
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2113
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
5 years agotests: convert paths passed to lttng_live_server.py
Simon Marchi [Tue, 1 Oct 2019 22:16:25 +0000 (18:16 -0400)] 
tests: convert paths passed to lttng_live_server.py

On Windows, the MSYS2 bash tries to convert paths in the Unix form
(/c/foo/bar) to the Windows form (C:\foo\bar).  However, some paths are
embedded in some complex arguments we pass to lttng_live_server.py, and
bash does not convert them.  This causes the file open in Python to
fail, because it doesn't find that file.  We therefore need to convert
them by hand using cygpath before passing them to the Python script.

Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I108e6dc2a690042bf727335fc5af5294bf928590
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2112
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
5 years agotests: name temporary files in test_live
Simon Marchi [Tue, 1 Oct 2019 22:16:13 +0000 (18:16 -0400)] 
tests: name temporary files in test_live

I find it nice for debugging to have file names that have a little bit
of meaning.

Change-Id: I2505d5b363c2ea5f0c62255585e8898592d5ead0
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2111
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
5 years agoFix: ctf: open metadata file using mode "rb"
Simon Marchi [Tue, 1 Oct 2019 20:04:03 +0000 (16:04 -0400)] 
Fix: ctf: open metadata file using mode "rb"

In the handling of the support info query, we open the metadata file
using the "r" mode.  On Windows, this is a problem when opening
packetized metadata files, which may contain bytes that Windows will
treat as end of lines and transorm.  Use "rb" instead.

This makes the test_trace_copy test pass on Windows.  It currently fails
with the "session-rotation" trace.

Change-Id: Iaa7a3b8def1c07335c5e7e094d82121df56de268
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2110
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
5 years agocli: print map value in ASCII-betical order of keys
Simon Marchi [Mon, 30 Sep 2019 19:13:25 +0000 (15:13 -0400)] 
cli: print map value in ASCII-betical order of keys

The test plugins/src.ctf.fs/query/test_query_metadata_info (and maybe
others that I don't know about) relies on the CLI outputting query
results in a constant way.  However, it isn't currently the case, as the
map entries are printed in the order that
bt_value_map_foreach_entry_const, therefore g_hash_table_iter_next,
provides them.  This test currently fails on the CI Windows machine for
this reason.

This patch makes the CLI print map values in a sorted order (defined by
comparing keys with strcmp).  This makes the tests stable, but it is
also convenient for the user, as the results will be sorted and in a
stable order.

Change-Id: I034b295bc238e146337844ac5d2c43a305fb90e0
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2109
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
5 years agotests: use bt_cli in test_trace_copy
Simon Marchi [Mon, 30 Sep 2019 18:19:56 +0000 (14:19 -0400)] 
tests: use bt_cli in test_trace_copy

This helps, by printing the executed babeltrace2 command lines.

Change-Id: Idaedfb212bd6cdb80a6498cec0e7020626ae0695
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2108
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
5 years agoport: mmap offset alignment on Windows
Michael Jeanson [Tue, 17 Sep 2019 18:31:37 +0000 (14:31 -0400)] 
port: mmap offset alignment on Windows

On Windows the mmap offset is not aligned to the page size but to the
allocator granularity which is usually bigger than the page size. Add a new
internal function to the mmap compat code to get the proper offset alignment
size for each platform.

See the "dwFileOffsetLow" section for more details :
https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-mapviewoffile

Change-Id: Ic26dc53862719892738a88b3dcea6a15901a0c94
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2107
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
5 years agotests: delete temporary files in cli/test_help
Simon Marchi [Mon, 30 Sep 2019 15:28:45 +0000 (11:28 -0400)] 
tests: delete temporary files in cli/test_help

Also, use `-t` option of mktemp so that temporary files are created in
the system's tmp directory (/tmp) instead of the current working
directory.

Change-Id: If27b7cc420a70033abc81f8f901521ea58a830bc
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2106
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
5 years agoCleanup: tests: remove debugging `diag` leftover
Francis Deslauriers [Fri, 27 Sep 2019 18:50:33 +0000 (14:50 -0400)] 
Cleanup: tests: remove debugging `diag` leftover

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I6f537025ba758a06e730b752fc1298ff724352a9
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2105
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
5 years agoRename `BT_PLUGIN_EXIT` to `BT_PLUGIN_FINALIZE`
Francis Deslauriers [Fri, 27 Sep 2019 17:21:16 +0000 (13:21 -0400)] 
Rename `BT_PLUGIN_EXIT` to `BT_PLUGIN_FINALIZE`

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I5ac769f400d27688d97235db15d89a6c1c6e1ecb
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2104
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
5 years agoRename `init` methods to `initialize`
Francis Deslauriers [Thu, 26 Sep 2019 15:39:35 +0000 (11:39 -0400)] 
Rename `init` methods to `initialize`

We use the full word 'finalize' so why not use the full word
'initialize'.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I741e2406bf53a8da4b74a5335afcd7ec359727ea
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2098
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
5 years agolib: split real FC/field into single and double prec FC/field
Francis Deslauriers [Thu, 26 Sep 2019 20:13:22 +0000 (16:13 -0400)] 
lib: split real FC/field into single and double prec FC/field

This commit removes the BT_FIELD_CLASS_TYPE_REAL field class and the
corresponding fields and adds BT_FIELD_CLASS_TYPE_SINGLE_PRECISION_REAL
and BT_FIELD_CLASS_TYPE_DOUBLE_PRECISION_REAL field classes and their
fields.

This seems like cleaner way to express the different types of floating
point representations and while keeping the door open for other
(smaller and/or larger) representations.

The test_field.py testcases for `_SinglePrecisionRealField` are
implemented using a default value of 52.0 which can be converted from
Python float(double precision) to C float(single precision) without loss
of precision. It's the best way I found to support the
`_TestNumericField` test cases without scattering specific conditions
for `_SinglePrecisionRealField`

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I6057e1626b71fee5dce1c374bda3faf3451b5fef
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2099
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
5 years agoFix: cli: don't log error when using help command with a plugin name
Simon Marchi [Thu, 26 Sep 2019 15:28:51 +0000 (11:28 -0400)] 
Fix: cli: don't log error when using help command with a plugin name

When using the help command with a plugin name, it works, but Babeltrace
logs an error:

    09-26 16:37:03.782 10054 10054 E CLI/CFG-CLI-ARGS plugin_comp_cls_names@babeltrace2-cfg-cli-args.c:189 Missing component class type (`source`, `filter`, or `sink`).

This is problematic, because this is a valid use of the command.
Logging an error is unnecessarily alarming.

The current code takes the argument (in our case, a plugin name such as
"ctf") and passes it through plugin_comp_cls_names.  The function can't
parse the string as a component class name, so logs the error mentioned
above.  The caller, bt_config_help_from_args, sees that the function has
failed, so falls back to assuming the string is a plugin name, which
then works correctly.

To avoid this, the sophisticated solution I chose was to look for an
unescaped dot in the argument.  If there's one, we treat it as a
component class name, if there isn't, we treat is as a plugin name.

Change-Id: I76b791e5d44436fdc5b10a3c10e3579a0783b04d
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2101
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
5 years agoFix: bt2: duplicate test name in test_field.py
Simon Marchi [Tue, 24 Sep 2019 19:20:06 +0000 (15:20 -0400)] 
Fix: bt2: duplicate test name in test_field.py

Flake8 reports:

    ./tests/bindings/python/bt2/test_field.py:2170:5: F811 redefinition of unused 'test_has_field_prop_true' from line 2166
    ./tests/bindings/python/bt2/test_field.py:2178:5: F811 redefinition of unused 'test_bool_op_true' from line 2174

I think that in both cases, the second instance was meant to be renamed
to `_false`.

Reported-by: flake8
Change-Id: I8b3143bb3f86982e220a6b516f028fca9e6e24ab
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2093

5 years agobt2: remove unused variable in UserMessageIteratorSeekNsFromOriginTestCase.test_seek_...
Simon Marchi [Tue, 24 Sep 2019 19:17:29 +0000 (15:17 -0400)] 
bt2: remove unused variable in UserMessageIteratorSeekNsFromOriginTestCase.test_seek_ns_from_origin

Flake8 reports:

    ./tests/bindings/python/bt2/test_message_iterator.py:790:9: F841 local variable 'msg' is assigned to but never used

Reported-by: flake8
Change-Id: I4be9bf2d1a86e4c5d538fd1d1461f6e2bbf2b763
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2092
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
5 years agoFix: bt2: duplicate test name in _IntegerRangeTestCase
Simon Marchi [Tue, 24 Sep 2019 19:16:05 +0000 (15:16 -0400)] 
Fix: bt2: duplicate test name in _IntegerRangeTestCase

Flake8 reports:

    ./tests/bindings/python/bt2/test_integer_range_set.py:45:5: F811 redefinition of unused 'test_create_wrong_type_lower' from line 41

I think the issue is simply that the second instance should have `upper`
instead of `lower`.

Reported-by: flake8
Change-Id: Id03b801951b9ce64eb0264debdd8ed4c4e3a577e
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2091

5 years agoFix: bt2: use of undefined variable in _VariantFieldClassWithSelectorTestCase.test_co...
Simon Marchi [Tue, 24 Sep 2019 19:04:07 +0000 (15:04 -0400)] 
Fix: bt2: use of undefined variable in _VariantFieldClassWithSelectorTestCase.test_const_append

Flake8 reports:

    ./tests/bindings/python/bt2/test_field_class.py:875:43: F821 undefined name 'str_field_class'

Fix it by defining the str_field_class variable (even though it won't
actually be used).

Reported-by: flake8
Change-Id: If17cef30ed24b6ec9d1ee25d3f6c94d491ffd8fd
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2090

5 years agoFix: bt2: unused assignments in test_field_class.py
Simon Marchi [Tue, 24 Sep 2019 18:33:16 +0000 (14:33 -0400)] 
Fix: bt2: unused assignments in test_field_class.py

Fix these:

    ./tests/bindings/python/bt2/test_field_class.py:101:9: F841 local variable 'field' is assigned to but never used
    ./tests/bindings/python/bt2/test_field_class.py:124:9: F841 local variable 'field' is assigned to but never used
    ./tests/bindings/python/bt2/test_field_class.py:215:9: F841 local variable 'field' is assigned to but never used
    ./tests/bindings/python/bt2/test_field_class.py:234:9: F841 local variable 'field' is assigned to but never used
    ./tests/bindings/python/bt2/test_field_class.py:251:9: F841 local variable 'field' is assigned to but never used
    ./tests/bindings/python/bt2/test_field_class.py:402:9: F841 local variable 'field' is assigned to but never used
    ./tests/bindings/python/bt2/test_field_class.py:428:9: F841 local variable 'field' is assigned to but never used
    ./tests/bindings/python/bt2/test_field_class.py:445:9: F841 local variable 'field' is assigned to but never used
    ./tests/bindings/python/bt2/test_field_class.py:1183:9: F841 local variable 'field' is assigned to but never used
    ./tests/bindings/python/bt2/test_field_class.py:1222:9: F841 local variable 'field' is assigned to but never used

In all these cases, the assignment has no effect.  The original intent
was probably to do `field.value = ...`, so use that everywhere.

Reported-by: flake8
Change-Id: If28fab3d1a8facb0123ab3a2dc0b83062ebed38e
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2089

5 years agobt2: print actual and expected lengths in _StaticArrayField._set_value error message
Simon Marchi [Tue, 24 Sep 2019 18:38:51 +0000 (14:38 -0400)] 
bt2: print actual and expected lengths in _StaticArrayField._set_value error message

I think it can help the user figure out what's wrong if we give the
lengths of the field and the passed value in the error message.

Change-Id: I94fb7ca04724d5d7af701df88aaedc195b1736fd
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2088
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
5 years agobt2: ignore comparison to None flake8 warnings in test_value.py
Simon Marchi [Tue, 24 Sep 2019 18:17:38 +0000 (14:17 -0400)] 
bt2: ignore comparison to None flake8 warnings in test_value.py

Fix these:

    ./tests/bindings/python/bt2/test_value.py:485:36: E711 comparison to None should be 'if cond is None:'
    ./tests/bindings/python/bt2/test_value.py:488:35: E711 comparison to None should be 'if cond is not None:'
    ./tests/bindings/python/bt2/test_value.py:1177:36: E711 comparison to None should be 'if cond is None:'
    ./tests/bindings/python/bt2/test_value.py:1180:35: E711 comparison to None should be 'if cond is not None:'

In these tests, we specifically want to test that comparing (equal/not
equal) to None yields the expected result.

Reported-by: flake8
Change-Id: I47d96598a158b10116fc6a948d42ef61f608fb07
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2087

5 years agobt2: remove duplicate test test_create_from_vint in RealValueTestCase
Simon Marchi [Tue, 24 Sep 2019 16:34:51 +0000 (12:34 -0400)] 
bt2: remove duplicate test test_create_from_vint in RealValueTestCase

There are two tests named like this in RealValueTestCase.  The second
one looks right (it creates a Value from an int, then creates a
RealValue from that).  The first one looks like it should be called
"test_create_from_vfloat", as it tests creating a RealValue from another
RealValue, but we already have such a test case a bit lower.  So I think
it's fine to delete it.

Reported-by: flake8
Change-Id: I274b922c653675913f2346cbc67cbcd03cd5208f
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2086
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
5 years agobt2: remove duplicated test test_setitem_none in ArrayValueTestCase
Simon Marchi [Tue, 24 Sep 2019 16:18:29 +0000 (12:18 -0400)] 
bt2: remove duplicated test test_setitem_none in ArrayValueTestCase

The two tests with that name are identical, so remove one.

Reported-by: flake8
Change-Id: Ibb63b6f548bceb81d6173dcc9619978e62d8828e
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2085
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
5 years agobt2: rename test with conflicting name in test_trace.py
Simon Marchi [Tue, 24 Sep 2019 16:03:18 +0000 (12:03 -0400)] 
bt2: rename test with conflicting name in test_trace.py

The second test named `test_env_iter` seems to be testing iteration of a
const environment object, so rename it to `test_const_env_iter`.

Reported-by: flake8
Change-Id: I614756daa511b9c66b031328f11ad77053ab9fc5
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2084
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
5 years agoAdd setup.cfg with sensible flake8 configuration
Simon Marchi [Tue, 24 Sep 2019 16:01:28 +0000 (12:01 -0400)] 
Add setup.cfg with sensible flake8 configuration

This is a sensible config which allows to run "flake8 ." without having
too many useless warnings.

Note that the `per-file-ignores` config requires flake8 >= 3.7.

Ignore:

- E501, line too long, because we don't really care about that (black
  decides how it's formatted anyway).
- W503, line break before bbinary operator, because we don't really care
  about that (black decides how it's formatted anyway).

__init__.py contains some expectedly unused imports, so it seems cleaner
to disable that warning for the whole file, rather than putting a "noqa"
comment on each line.  Of course, we risk having a really unused import
in that file, but it doesn't contain much, so the risk is low.

Finally, exclude the Python tap directory, as it's not our code.

Change-Id: Iebdf274b91907fb31d4ebfa6ae4c8157de46467c
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2083
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
5 years agolib: pass config object to message iterator init method, add can seek forward property
Simon Marchi [Wed, 18 Sep 2019 20:12:00 +0000 (16:12 -0400)] 
lib: pass config object to message iterator init method, add can seek forward property

This patch introduces a new bt_self_message_iterator_configuration
object that is passed to message iterator init methods.  The purpose of
this object is to hold options the message iterator can set at init time
but not later.

To verify that the user does not save a pointer to this object and try
to use it later, the object is frozen right after the init method
returns.

The object contains one option that we know we'll need,
`can_seek_forward`.  The corresponding functions to set it (on the
config object) and read it (from the self component port input message
iterator object) are also provided.  But because this patch already
contains a lot of boilerplate, the code that actually uses that option
will come in a following patch.

The Python bindings provide a simple wrapper around this new object.

Change-Id: Ibcd0df842fd154d3bafe3869b56f70aa3a72ceab
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2064
Tested-by: jenkins <jenkins@lttng.org>
5 years agoFix: tests: live: listen on python < 3.5 needs backlog parameter
Jonathan Rajotte [Wed, 25 Sep 2019 21:13:39 +0000 (17:13 -0400)] 
Fix: tests: live: listen on python < 3.5 needs backlog parameter

The backlog parameter is required on python version smaller then 3.5.

On sles12sp2:

 Traceback (most recent call last):
   File "/home/jenkins/workspace/babeltrace_master_slesbuild/arch/sles12sp2/build/std/conf/prod/src/babeltrace/tests/data/plugins/src.ctf.lttng-live/lttng_live_server.py", line 1447, in <module>
     args.port_filename, args.sessions, args.max_query_data_response_size
   File "/home/jenkins/workspace/babeltrace_master_slesbuild/arch/sles12sp2/build/std/conf/prod/src/babeltrace/tests/data/plugins/src.ctf.lttng-live/lttng_live_server.py", line 1232, in __init__
     self._listen()
   File "/home/jenkins/workspace/babeltrace_master_slesbuild/arch/sles12sp2/build/std/conf/prod/src/babeltrace/tests/data/plugins/src.ctf.lttng-live/lttng_live_server.py", line 1323, in _listen
     self._sock.listen()
 TypeError: listen() takes exactly one argument (0 given)

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Change-Id: Ib923beb9eadf929714b3270aaa7a57ff6c52407e
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2096
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
5 years agolib: pass config objects to component init methods
Simon Marchi [Tue, 17 Sep 2019 16:44:36 +0000 (12:44 -0400)] 
lib: pass config objects to component init methods

This patch introduces configuration objects that are passed to init
methods of components.  The goal is to make it possible to have
parameters that can be set during the component's init phase, and not
after.

At the moment, they are not used for anything, they are only there for
future use.  For that reason, we currently just pass the value NULL as
the config objects to the components.  This should be fine, since the
components should not do anything with the config objects for now.

Similarly, we have configuration Python objects passed to __init__
methods of _UserMessageIterator objects.  These configuration objects
are empty, but we can connect them with the corresponding SWIG pointer
once we actually add a method in them.

I added tests to verify that the config objects the components receive
have the right types.

Change-Id: If7568160e225c1eb8343eb212f8b4961f5472836
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2063
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
5 years agobt2: make it possible to remove a trace class or trace destruction listener
Simon Marchi [Fri, 20 Sep 2019 19:50:59 +0000 (15:50 -0400)] 
bt2: make it possible to remove a trace class or trace destruction listener

This patch adds the possibility to remove a previously added trace or
trace class destruction listener.  Calling
{_TraceClass,_Trace}.add_destruction_listener returns a
_ListenerHandle.  To remove the listener, the user must pass this handle
back to {_TraceClass,_Trace}.remove_destruction_listener.

Change-Id: I6020135c1e056658d941d2e022b171466c5df7b3
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2077
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
5 years agobt2: make it work for Python 3.4
Simon Marchi [Mon, 23 Sep 2019 19:21:41 +0000 (15:21 -0400)] 
bt2: make it work for Python 3.4

The import system from Python 3.4 has some significant differences
compared to the one from Python 3.5 and later.  Notably, support for
circular references (which we use) was added in the later versions.

For example, trace.py and stream.py both import each other.  Trace
objects need Stream objects when listing streams in a trace, and Stream
objects need Trace objects when getting the containing trace of a
stream.

To make it work on Python 3.4, I think we need to break any circular
import chain that happen when "import bt2" is done.  It is fine to
import things later, once all the modules have been initialized.

To achieve this, I changed some

  from bt2 import foo as bt2_foo

to

  def _get_bt2_foo():
      from bt2 import foo as bt2_foo
      return bt2_foo

The users of bt2_foo in that file now need to use _get_bt2_foo() instead
of bt2_foo.  it is important that _get_bt2_foo doesn't get called during
the import of the module, otherwise, we come back to the initial
problem.  So in some cases, I have wrapped some calls to _get_bt2_foo in
properties, as was already done to break circular dependencies between
classes.

This is not enough though, as there is another behavior difference
between 3.4 and 3.5+, which I believe is also a consequence of the
circular import changes [1].  It is also related to the fact that we
delete submodule attributes from the bt2 module in our __init__.py.

With 3.5, it is still possible to do:

    from bt2 import value

after we've deleted the `value` attribute from bt2.  With Python 3.4, it
doesn't work.  I believe it is related to [1] in that Python 3.5+, when
processing a "from" import, searches in sys.modules if a simple getattr
on the module failed.

This is problematic for us, since we need the 'from bt2 import "foo"'
lines to work after the bt2 attributes have been deleted (to support the
changes described above).  The solution I've found is to not delete the
bt2 submodule attributes when using Python 3.4.

We delete those attributes simply to clean up the bt2 namespace and to
avoid exposing the internal organisation of the code.  I think it's
an acceptable trade-off to not do it when using Python 3.4, if it means
that it will actually work.

[1] https://bugs.python.org/issue17636

Change-Id: Ia6810972492a058f60c21e6f22afd43962f4f7a2
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2082
Tested-by: jenkins <jenkins@lttng.org>
5 years agoUpdate project plugins's properties
Philippe Proulx [Mon, 16 Sep 2019 05:18:24 +0000 (01:18 -0400)] 
Update project plugins's properties

This patch updates various properties of the project's plugins. Those
properties are publicly visible through the API or with the CLI's `help`
command.

The updated properties are:

Descriptions:
    Updated to add details or normalize them.

Authors:
    All changed to `EfficiOS <https://www.efficios.com/>`. Keeping a
    specific up-to-date list of authors will be challenging in the
    future, especially with many contributors.

Help texts:
    Added to refer to specific manual pages.

    Maybe we can find a way to set a manual page's plain text as a
    component class's help text in the future, but in the meantime at
    least the user knows where to look for help.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I44d13a89039e433c06e1c527eb2be577fd471454
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2047
CI-Build: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
5 years agoutils.sh: expand `${extra_details_args[@]}` conditionally
Philippe Proulx [Sat, 21 Sep 2019 16:07:58 +0000 (12:07 -0400)] 
utils.sh: expand `${extra_details_args[@]}` conditionally

When you call bt_diff_details_ctf_single() or
bt_diff_details_ctf_gen_single(), it is possible that you don't provide
any extra `sink.text.details` arguments. This makes
`${extra_details_args[@]}` empty.

`utils.sh` does

    set -u

to make Bash throw an error when a variable is undefined/unbound.

Starting from Bash 4.4 [1]:

> Using ${a[@]} or ${a[*]} with an array without any assigned elements
> when the nounset option is enabled no longer throws an unbound
> variable error.

In bt_diff_details_ctf_single() and bt_diff_details_ctf_gen_single(), we
use `"${extra_details_args[@]}"` directly: Bash < 4.4 throws an error if
the array is empty.

We don't get this error on CI nodes having Bash < 4.4 currently because
all the usages of bt_diff_details_ctf_single() and
bt_diff_details_ctf_gen_single() pass extra `sink.text.details`
arguments. However it is my understanding that they are optional.

This patch replaces

    "${extra_details_args[@]}"

with

    ${extra_details_args[@]+"${extra_details_args[@]}"}

so that `"${extra_details_args[@]}"` is only used when
`${extra_details_args[@]}` is defined. This works with any Bash version.

[1]: https://git.savannah.gnu.org/cgit/bash.git/tree/CHANGES?id=3ba697465bc74fab513a26dea700cc82e9f4724e#n878

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ic74117607ac616f3e27968a6f8fb09d07fe7eb12
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2080
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
CI-Build: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
5 years agosink.text.details: add `with-data` initialization parameter
Philippe Proulx [Fri, 20 Sep 2019 09:52:33 +0000 (05:52 -0400)] 
sink.text.details: add `with-data` initialization parameter

This patch makes a `sink.text.details` component handle a new
`with-data` initialization parameter. This new parameter controls
whether or not the component writes data lines, as opposed to metadata
lines: anything that's not metadata is considered data, except for
message iterator inactivity messages.

This can be useful to inspect the metadata blocks of the received
messages without having all the message lines.

The new `default-without-data-without-metadata.expect` expectation file
is empty because, without data and without metadata, there's effectively
nothing to write.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I844073b2080df373501a9216d8041f4d6b799c08
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2076
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
5 years agoAdd basic `sink.text.details` tests
Philippe Proulx [Fri, 20 Sep 2019 09:18:36 +0000 (05:18 -0400)] 
Add basic `sink.text.details` tests

This patch adds very basic `sink.text.details` tests to at least keep
track of the generated text's format. The tests test each initialization
parameter individually, and some combined with `compact=yes`.

As of this patch, all tests pass `with-stream-name=no` to initialize the
`sink.text.details` component because the `src.ctf.fs` component uses
absolute paths to set stream names and this is not compatible with
static expectation files.

Future tests should use a custom source to check how `sink.text.details`
writes the stream name property.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I79c4956e5d67dd922130443992de9daef2974f4e
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2075
CI-Build: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
This page took 0.053329 seconds and 5 git commands to generate.