Philippe Proulx [Sat, 15 Jun 2019 04:44:52 +0000 (00:44 -0400)]
tests: bt2: add query log level tests
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I725d3b7d64b4a820da1f3762c3217af9a88a0ca3
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1462
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Philippe Proulx [Sat, 15 Jun 2019 04:42:10 +0000 (00:42 -0400)]
lib: pass log level to bt_query_executor_query()
This new parameter indicates the log level to use during the query
execution.
The project's component classes are changed to receive this log level,
but they do not use it. This work is reserved for a future patch.
The CLI passes its default log level (main `--log-level` option) to
bt_query_executor_query().
Python bindings are adapted accordingly.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I929d545a1df2f4d6d083f6c536f6fcf26aa972bd
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1461
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Philippe Proulx [Sat, 15 Jun 2019 03:59:04 +0000 (23:59 -0400)]
Logging: pass dynamic log level to common functions and subsystems
This patch makes the project's common functions and subsystems get a
dynamic log level instead of using a global one set from an environment
variable. The goal is to achieve per-component log levels, so the common
functions and subsystems must receive, eventually, the component's
specific log level.
"Naked" functions (without a context object of some sort) simply get
their log level from a new parameter. In that case `BT_LOG_OUTPUT_LEVEL`
is simply defined to `log_level`, so a local `log_level` variable must
exist when using logging statements. Subsystems, such as an FD cache or
a CTF serializer, get their log level from a new parameter in their
initialization function and then use it for their other operations.
It was somehow hard to do this for `src/common` alone without also doing
it for the rest so I'm doing all of them at once here.
For those subsystems, the local `logging.c` and `logging.h` disappear.
`tests/plugins/flt.lttng-utils.debug-info/test_bin_info.c` needs to pass
a log level to the FD cache subsystem; I used the WARN level instead of
setting the log level from an environment variable for this test alone.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I35979a8fe4c74afe5921c3b6651015cd7ee2760a
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1460
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Philippe Proulx [Sat, 15 Jun 2019 03:29:46 +0000 (23:29 -0400)]
src/logging/log.h: add BT_LOG_WRITE_CUR_LVL(), BT_LOG_WRITE_ERRNO_CUR_LVL()
BT_LOG_WRITE_CUR_LVL() is like BT_LOG_WRITE(), but it compares the
given log level to a current log level parameter instead of
`_BT_LOG_OUTPUT_LEVEL`.
BT_LOG_WRITE_ERRNO_CUR_LVL() is the same thing, but for
BT_LOG_WRITE_ERRNO().
The goal of this is to be able to control which variable contains the
current log level at the call site to achieve per-component log levels.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I670664a7cb465954c2f0f8b3551ea49fd1465e32
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1459
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Philippe Proulx [Sat, 15 Jun 2019 02:52:27 +0000 (22:52 -0400)]
cli: add component-specific `--log-level` option (run/convert commands)
This new option makes it possible to specify a log level for a specific
component instance. The main program's `--log-level` option becomes the
default log level which the specific `--log-level` options override.
For example:
babeltrace2 -c src.mein.source --log-level=I \
-c sink.ctf.fs --log-level=D
makes the log level of the source be INFO and the log level of the
sink be DEBUG. The log level of the other components (implicit muxer),
of the CLI, and of the library is the default WARN.
babeltrace2 --log-level=E -c src.mein.source --log-level=I \
-c sink.ctf.fs
makes the log level of the source be INFO and the log level of the sink,
of the other components (implicit muxer), of the CLI, and of the library
be ERROR.
The CLI still sets the known log level environment variables until
subsequent patches make each component honor its initial log level, that
is, until each component uses the log level for its logging statements
as returned by bt_component_get_logging_level().
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I8a3b05b7147fdb0149ecff670c542c9a229beddb
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1458
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Philippe Proulx [Sat, 15 Jun 2019 01:52:15 +0000 (21:52 -0400)]
sink.text.pretty: remove logging (not used)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I5449d5a3aa89466764bea8ba7523c580ac695e29
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1457
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Philippe Proulx [Sat, 15 Jun 2019 01:48:50 +0000 (21:48 -0400)]
test_graph.py: add bt2.Graph.add_component() logging level parameter tests
GraphTestCase.test_add_component_logging_level() is pretty much the same
test as GenericComponentTestCase.test_logging_level(), but the former's
purpose is to test the bt2.Graph.add_component() part of this, while the
latter tests the component's public `logging_level` property.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I9c82e8a7ab6a733810eabfee5ccef66cd619a610
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1456
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Philippe Proulx [Sat, 15 Jun 2019 01:44:11 +0000 (21:44 -0400)]
test_component.py: add `logging_level` property tests
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ibc7dbbbb3d497efe8b8c237488fd0733c094f242
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1455
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Philippe Proulx [Sat, 15 Jun 2019 01:16:07 +0000 (21:16 -0400)]
lib: set component's initial log level when adding it to the graph
This patch changes the bt_graph_add_*_component*() functions so that
they accept a log level parameter. This is now considered the
component's initial log level, so that we can achieve per-component log
levels.
The component initialization method types are not changed: because the
log level is part of a component's state, a component initialization
method can retrieve its own, current log level with the new
bt_component_get_logging_level() function. When you call
bt_graph_add_*_component*(), the function creates an initial component
object, sets its initial log level, and then calls its initialization
method.
Eventually, we can add a new, optional "logging level changed" component
method to notify it that its log level changed (caused by a call to
bt_component_set_logging_level(), for example).
The project's components do not honor their initial log level within the
scope of this patch: this is postponed to another patch. In other words,
they still use shared object constructors and environment variables to
set their log level at the component class level.
The CLI passes the configured log level (`--log-level`, `-v`, or `-d`
options) when it calls the bt_graph_add_*_component() functions. As of
this patch, it also still sets the known log level environment
variables.
Python bindings are adjusted accordingly. Their tests are not changed
because the log level parameter is optional (defaults to
`bt2.LoggingLevel.NONE`) and it's the last one of
bt2.Graph.add_component(). The constructor of `bt2.ComponentSpec` also
accepts a new, optional log level parameter to configure the component
specifier as such. You can access the log level of a component with the
new `logging_level` property.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: If258335f46ffabb587dd777b5109fc66d8a59f54
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1454
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Philippe Proulx [Sat, 15 Jun 2019 01:14:06 +0000 (21:14 -0400)]
Add internal bt_common_logging_level_string()
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I6fd26a0657d93efc8a30d6055d755c5e2b852f2e
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1453
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Philippe Proulx [Sat, 15 Jun 2019 01:09:51 +0000 (21:09 -0400)]
cli: use log level integer instead of letter in configuration
This patch makes `struct bt_config` have an integer log level (to be set
to one of the `BT_LOG_*` values) instead of a letter. The
bt_log_get_letter_from_level() and bt_log_get_level_from_letter() can be
used to translate from/to a log level letter/integer, so we use that.
This is just cleaner and makes more sense than carrying a letter in the
configuration which is just one encoding of a log level value.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I5cbc3f2cb9ac868bc99e9458468a09c58e716884
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1452
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Philippe Proulx [Sat, 15 Jun 2019 01:06:03 +0000 (21:06 -0400)]
src/logging/log.h: add utility functions for log level to/from string
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I389b5da1a574523a986d2884126b8f862765d914
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1451
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Philippe Proulx [Fri, 14 Jun 2019 21:29:56 +0000 (17:29 -0400)]
Logging: standardize logging tags
Use `/` to show the subsystem to source file hierarchy, and use typical
component class identifier, but in uppercase (for example,
`SRC.CTF.FS`).
See the changes in `CONTRIBUTING.adoc` for more details.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I94aaf431e6a93e607496267c54419b012564daaf
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1449
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
Philippe Proulx [Fri, 14 Jun 2019 21:15:27 +0000 (17:15 -0400)]
configure.ac: change default minimal log level from VERBOSE to DEBUG
The goal here is that Babeltrace users have enough logging by default
without impacting the performance too much. From what I measured once
this patch is applied, the performance is very similar to an INFO build.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I20346f0f3eecf725e730a3e5add94804637c7193
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1445
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Philippe Proulx [Fri, 14 Jun 2019 21:13:59 +0000 (17:13 -0400)]
sink.text.pretty: remove message iterator inactivity message logging
This is not the role of this component class. A detailed component
class, `sink.text.details`, shows all the messages.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ic01b766a81fd622fc768d71f70aec4b4a136c3d0
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1444
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Philippe Proulx [Fri, 14 Jun 2019 21:12:36 +0000 (17:12 -0400)]
lib: plugin.h: force header user to include "lib/logging.h"
This pattern is found in other headers where, instead of including the
logging header for the user, we ask her to set up the logging and then
include the header.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I922b09f63eff41b9c3ba30df7ace0b8b30b5b5b2
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1443
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Philippe Proulx [Fri, 14 Jun 2019 21:11:40 +0000 (17:11 -0400)]
Logging: check `BT_DEBUG_MODE` instead of `NDEBUG`
This project does not rely on `NDEBUG`.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I35b282711f373998ea8361b343e9abf32fb6390c
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1442
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Philippe Proulx [Fri, 14 Jun 2019 21:10:26 +0000 (17:10 -0400)]
lib: `component-class-sink-colander.c`: remove useless `void *` cast
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Iddd16093dbdd9236151d948f09afe084c5685a6f
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1441
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Philippe Proulx [Fri, 14 Jun 2019 21:08:08 +0000 (17:08 -0400)]
Rename: <some/internal-header.h> -> "some/internal-header.h"
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Icad3fb88de3c5c2e6658c44dc00ece97cb1096b8
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1440
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Philippe Proulx [Fri, 14 Jun 2019 20:58:49 +0000 (16:58 -0400)]
Standardize log levels used by logging statements across the project
Let's use this approach now:
INFO level:
Any useful information which a non-developer user would possibly
understand.
Anything logged with this level must _not_ happen repetitively on
the fast path, that is, nothing related to each message, for
example. This level is used for sporadic and one-shot events.
* CLI or component configuration report.
* Successful plugin, component, or message iterator initialization.
* In the library: anything related to plugins, graphs, component
classes, components, message iterators, connections, and ports
which is not on the fast path.
* Successful connection to or disconnection from another system.
* An _optional_ subsystem cannot be loaded.
* An _optional_ field/datum cannot be found.
DEBUG level:
Something that only Babeltrace developers would be interested into,
which can occur on the fast path, but not more often than once per
message.
* Object construction and destruction.
* Object recycling (except fields).
* Object copying (except fields and values).
* Object freezing (whatever the type, as freezing only occurs in
developer mode).
* Object cancellation.
* Calling user methods and logging the result.
* Setting object properties (except fields and values).
VERBOSE level:
Low-level debugging context information (anything that does not fit
the other log levels). More appropriate for tracing in general.
* Reference count change.
* Fast path, low level state machine's state change.
* Get or set an object's property.
* Object comparison's intermediate results.
This will also be written in `CONTRIBUTING.adoc` by another patch.
The goal here is to make the DEBUG level the default minimal, build-time
log level, so that Babeltrace users have enough logging by default
without impacting the performance too much. From what I measured once
this patch is applied, the performance is very similar to an INFO build.
Many DEBUG logging statements are upgraded to the INFO level because
they only occur once, or very rarely, and consist of interesting
information for someone who does not have deep knowledge of the
Babeltrace source code.
Many VERBOSE logging statements are upgraded to the DEBUG level so that,
by default, we have more information in the log file of someone who
needs support. Those statements are executed seldom enough (at most once
per message) to be promoted as such.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Icdd1ec8f1f54396eea5588968d85e446030f282d
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1439
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Philippe Proulx [Mon, 17 Jun 2019 20:48:53 +0000 (16:48 -0400)]
bt2: message_iterator.py: packet beginning/end messages have a single CS
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ia650a2e33483a999216aaf15dccecc5196bb4876
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1483
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Philippe Proulx [Fri, 14 Jun 2019 02:22:26 +0000 (22:22 -0400)]
bt2: stream activity messages: create with unknown/infinite default CS
This patch makes it possible to create stream activity beginning and end
messages with unknown or infinite default clock snapshots. It was
already possible to create them with known default clock snapshots, that
is, with a value.
With this patch, you pass either `self._unknown_clock_snapshot` or
`self._infinite_clock_snapshot`, when implementing a
`bt2._UserMessageIterator`, as the default clock snapshot when you call
self._create_stream_activity_beginning_message() or
self._create_stream_activity_end_message(). They are instances of
internal types which are only used for this. The creation methods use
`_unknown_clock_snapshot` by default. This is similar to how
bt_message_stream_activity_beginning_create() and
bt_message_stream_activity_end_create() create messages with unknown
default clock snapshots.
`test_message.py` tests the new feature.
Also in this patch: `_BaseClockSnapshot` does not inherit
`object._UniqueObject` anymore so that `_UnknownClockSnapshot` and
`_InfiniteClockSnapshot` do not either. This is so that the default
clock snapshot properties of the stream activity beginning/end messages
can return instances of those types without having actual native
pointers, because there are none.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I56d5cd9fffb77d505f61522073aaf80ccd58eb8e
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1430
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Philippe Proulx [Thu, 13 Jun 2019 15:22:26 +0000 (11:22 -0400)]
Put `flt.lttng-utils.debug-info` tests into their own directory
The goal is to have each component class tests in their own directory
under `tests/plugins`.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I3f68d2af9087690c6a34d238197c9bb9e96b021c
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1423
Tested-by: jenkins
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
Philippe Proulx [Thu, 13 Jun 2019 15:13:13 +0000 (11:13 -0400)]
Remove unused `tests/plugins/test_utils_muxer_complete.in`
This script was the runner for the `flt.utils.muxer` test running in C,
which does not exist anymore. We'll write `flt.utils.muxer` tests either
in Python or with `sink.text.details` and expectation files.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I28df6d20c3bd3ee0b056790046d041787e702430
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1422
Tested-by: jenkins
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
Philippe Proulx [Tue, 11 Jun 2019 23:08:46 +0000 (19:08 -0400)]
Add facilities to test CLI and plugin regressions with expectation files
This patch adds `tests/utils/diff.sh.in` (which becomes
`tests/utils/diff.sh`) which contains shell functions to use the CLI and
a `sink.text.details` component to easily test the CLI itself and
plugins for regressions with expectation files.
There are three functions in `tests/utils/diff.sh.in`:
bt_diff_cli():
Compares the output of the CLI with specific arguments to the
content of a file.
bt_diff_details_ctf_single():
Compares the output of the CLI using an `src.ctf.fs` component to
open a specific CTF trace and a `sink.text.details` component to the
content of a file.
bt_diff_details_ctf_gen_single():
Like bt_diff_details_ctf_single(), but runs a given CTF trace
generating program instead of using an existing CTF trace.
When there's any difference, the functions write the full diff to the
standard error. This makes it possible to look at what's wrong in the
CI.
`tests/plugins/ctf` is moved to `tests/plugins/src.ctf.fs` to indicate
that we're testing this specific component class. The specific query
tests are moved to `tests/plugins/src.ctf.fs/query`.
`tests/plugins/src.ctf.fs/diff/test_diff.in` uses `tests/utils/diff.sh`
to show how to use bt_diff_details_ctf_single() and
bt_diff_details_ctf_gen_single().
The functions test_ctf_single() and test_ctf_gen_single() use resp.
bt_diff_details_ctf_single() and bt_diff_details_ctf_gen_single() to
compare the given CTF traces using a `sink.text.details` component to
expectation files ending with `.expect` in the same directory.
In both test_ctf_single() and test_ctf_gen_single(), we make the
`sink.text.details` component hide the trace and stream names because
`src.ctf.fs` puts absolute paths in them. For test_ctf_gen_single(), we
also make the `sink.text.details` component hide UUIDs because CTF
writer creates random ones by default.
More specifically, this line:
test_ctf_gen_single simple
means:
1. Run the program `gen-trace-simple` in the same directory to generate
a CTF trace.
2. Get the output of:
babeltrace2 /path/to/trace -c sink.text.details \
-p with-uuid=no,with-trace-name=no,with-stream-name=no
3. Compare the content of 2. to the file `trace-simple.expect` in the
same directory.
This line:
test_ctf_single smalltrace
means:
1. Get the output of:
babeltrace2 "$BTDIR/tests/ctf-traces/succeed/smalltrace" \
-c sink.text.details \
-p with-trace-name=no,with-stream-name=no
2. Compare the content of 1. to the file `trace-smalltrace.expect` in
the same directory.
Eventually, we can move the test_ctf_gen_single() and test_ctf_single()
functions outside the `src.ctf.fs` tests to make them available to test
other plugins and parts of the project. They are placed there for the
moment because only the `src.ctf.fs` tests need them.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I53660111c23117926e3ee114b5d0cd060fff87d3
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1414
Tested-by: jenkins
Philippe Proulx [Sat, 8 Jun 2019 00:26:34 +0000 (20:26 -0400)]
Add `sink.text.details`, a testing textual sink which prints details
This patch adds a new sink component class, `sink.text.details`. Such
a sink component prints all the messages and their details, including
the full metadata objects, in a deterministic way.
You can test it easily like this:
babeltrace2 /path/to/trace -c sink.text.details
The purpose of this sink is to use it for regression testing using the
following approach:
1. Run the `babeltrace2` program with a `sink.text.details` component,
providing a known input trace to the graph, for example a CTF trace
with `src.ctf.fs`. The graph can include one or more filters with
specific parameters to test them specifically.
2. Inspect the output with your human eyes and brain. Verify that
everything is as expected. It is possible that, for a given test,
some elements of the output are less important (for example, the
metadata objects or the message times): there are component
parameters to remove parts of the output to reduce the noise.
3. Save the output of 2. to a file.
4. Create a test which runs 1. with the same input and compares its
output to the file saved in 3. Any regression will show up as a
difference between both inputs.
Step 2. is particularly important because this is where you validate
that the output shows what you expect from the graph. To make this
easier, I tried to make the output format of `sink.text.details` as
human-readable as possible:
* The component optionally colorizes the output. This is the default
when the terminal supports it. There's no color codes by default when
you redirect the output.
* The component honors the preferred display base of integer fields and
prepends the typical `0x` and `0` prefixes.
* The component inserts digit separators to make it easier to read large
numbers, for example `102,354,895,784,619` and `0x7f4d:d04f:c636`.
* The component does not print the metadata objects interlaced with the
data and message objects. I found that this was noisy, for example
showing all the integer field class details for each integer field
when what you really want is to inspect the event payloads from one
message to the other.
Instead, I chose to print trace classes, stream classes, and event
classes only once, and before the message which is associated to them.
This typically occurs before a stream beginning message, but for event
classes, it can also occur before an event message, as a source can
add event classes to an existing stream class.
* The component assigns a unique ID to each trace object to follow the
messages associated to a specific stream more easily, as many streams
can share the same ID, across difference traces or even with the same
trace, when they have different stream classes.
The component prints this unique trace ID, as well as the stream
class and stream IDs, before each message type as such
(`{Trace 1, Stream class ID 0, Stream ID 2}` in the following
example):
[102,354,895,784,619 cycles, 1,441,852,773,172,610,636 ns from origin]
{Trace 1, Stream class ID 0, Stream ID 2}
Event `lttng_ust_statedump:build_id` (Class ID 56):
Common context:
vpid: 17,868
ip: 0x7f4d:d04f:c636
Payload:
baddr: 0x7f4d:d02d:1000
...
A unique trace ID is never reused for two different traces within the
lifetime of a `sink.text.details` component.
You can track all the messages of a given stream with this unique
tuple. For example, you can find the last packet beginning message for
the packet of a given event message having unique trace ID 0, stream
class ID 2, and stream ID 5 by finding the last
{Trace 0, Stream class ID 2, Stream ID 5}
Packet beginning
string.
This makes it possible to avoid redundancy and reduce textual noise in
the printed messages. For example, the component does not print the
packet context field for each event message, but only for the packet
beginning message.
In order to make step 4. continue to work in the future and really test
regressions, the output of step 1. must always be the same
(deterministic). For `sink.text.details`, this means:
* The component does not print run-time addresses.
* The component sorts mappings of enumeration field classes (by label),
and ranges within such mappings, before it prints them.
* The component sorts event classes of stream classes (by ID) before
it prints them.
* The component sorts stream classes of trace classes (by ID) before
it prints them.
* The component sorts streams of traces (by ID and class ID) before
it prints them.
* The component sorts environment entries of trace classes (by name)
before it prints them.
To make step 3. easier, the component does not print trailing spaces
or trailing empty lines.
A `sink.text.details` component can also be used for support if we want
all the details of a given graph's output.
The available component parameters are:
`color`:
`never`, `auto`, or `always` (just like `sink.text.pretty`).
Default: `auto`
`with-metadata`:
True to print metadata objects (only the first time they are
encountered).
Default: true
`with-time`:
True to print message times.
Default: true
`with-trace-class-name`:
True to print trace class names.
Default: true
`with-trace-name`:
True to print trace names.
Default: true
`with-stream-class-name`:
True to print stream class names.
Default: true
`with-stream-name`:
True to print stream names.
Default: true
`with-uuid`:
True to print UUIDs.
Default: true
`compact`:
True to make the output compact (one message per line, no property
names).
Default: false
This patch does not add the facilities to create tests easily using the
CLI and a `sink.text.details` component: this is reserved for a future
patch.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I9cc39cdfe44436974600388342029a2e4e2acb76
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1412
Tested-by: jenkins
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Philippe Proulx [Tue, 11 Jun 2019 14:59:56 +0000 (10:59 -0400)]
Add bt_common_sep_digits()
This new utility function adds digit separators to a string representing
a number. For example, `
1983291832` can become `1,983,291,832`.
See the function's comment for more details.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I39dedc69fbc76b31252a64c68261a35d8ac7c7a8
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1411
Tested-by: jenkins
Michael Jeanson [Fri, 14 Jun 2019 21:15:23 +0000 (17:15 -0400)]
fix: Add missing glib include on MINGW
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I4b8486406270314f610e6001eba854ddd189983c
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1437
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Michael Jeanson [Thu, 13 Jun 2019 18:23:20 +0000 (14:23 -0400)]
tests: Move ctf-writer to it's own directory
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I4033b31392867c468419aa43f31675af3842c6f1
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1427
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Michael Jeanson [Thu, 13 Jun 2019 18:10:51 +0000 (14:10 -0400)]
tests: Move libtestcommon to utils
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I4efe6edae5d70921cbfb106f5184c58f7e2e5abb
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1426
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Michael Jeanson [Thu, 13 Jun 2019 15:09:29 +0000 (11:09 -0400)]
Cleanup: remove plugin-common.h
It was only used to define 'UNUSED_VAR' which we can use literally.
Change-Id: Idf84f6ecee711e2caf4b7d68f5e6f598b0aca22e
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1425
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Michael Jeanson [Wed, 12 Jun 2019 22:09:37 +0000 (18:09 -0400)]
Cleanup: remove private babeltrace.h
* Remove unused macros
* Replace duplicated macros with their glib equivalent
* Move the *safe* static inlines to their own header
* Namespace the remaining macros and move them to macros.h
* Explicitly include 'common/macros.h' in all private headers that use
'BT_HIDDEN'.
* Remove BT_UNUSED, the attribute is a hard requirement anyway
* Remove zmalloc and replace the only callsite with calloc
Change-Id: I1bd765ad27c808c8bbe5ef232062267cb4a230d9
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1424
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Michael Jeanson [Thu, 13 Jun 2019 14:50:42 +0000 (10:50 -0400)]
fix: Static build fails with ctfser missing symbols
Spliting the ctf-writer from the main library had the side effect of not
including the ctfser convience library in the main lib anymore. Thus it
should now be linked with the binairies to satisfy the dependencies when
we statically link the plugins in.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I4626dcabce1914f0af2287afe8c3fcf7b7db9946
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1421
CI-Build: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Michael Jeanson [Mon, 10 Jun 2019 21:44:09 +0000 (17:44 -0400)]
Re-organize sources
* Create a top-level 'src' directory.
* Move all private headers from the public include directory to the
'src' directory.
* Rename all those private headers to remove the 'internal' notation.
* Use double quotes in `#include` directives when including a private
header so that we can easily know.
Change-Id: I05fbb81d969b3735aaf303ec2c222be7142c19ab
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1413
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Michael Jeanson [Wed, 12 Jun 2019 14:50:30 +0000 (10:50 -0400)]
tap-driver.sh: flush stdout after each test result
This is useful in a CI system where stdout is fully buffered and you
look at the console output to see which test is hanging.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I998b83347ca2445f46c3e195b797ce75b0096adb
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1415
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Mon, 10 Jun 2019 16:30:10 +0000 (12:30 -0400)]
Fix: src.ctf.fs: increment packet offset before init of index entry
Issue
=====
The `current_packet_offset_bytes` variable is incremented before the
initialization of the current `index_entry` by `init_index_entry()`.
This lead to each entry having the offset of the next entry and the last
entry having a erroneous offset.
Solution
========
Increment the `current_packet_offset_bytes` variable after the
initialization of each entry.
Drawbacks
=========
None.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I7592b2d70f402aa413de97a687bfe4fe1bf1b825
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1409
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Michael Jeanson [Fri, 7 Jun 2019 16:25:10 +0000 (12:25 -0400)]
ctf-writer: externalize libbabeltrace2-ctf-writer
Completely split the ctf writer part from the main babeltrace2 library.
* Remove the obsolete libbabeltrace2-ctf library
* Add a new libbabeltrace2-ctf-writer library
* Remove the ctf writer includes from the main include file
* Fork an internal copy of assert-pre.h that doesn't use the library
structures.
* Add a logging context specific to ctf writer
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: Iff9ab62ee9eeb8abd290fb1d758a73050e21c99b
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1410
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Michael Jeanson [Thu, 30 May 2019 15:35:17 +0000 (11:35 -0400)]
Cleanup: Move build logic to python-plugin-provider Makefile
Simplify the root Makefile, group the python provider build logic in a
single Makefile.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I580a3577e0a84f5b6e624ed2ed74a56a0b6b3960
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1353
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Michael Jeanson [Thu, 30 May 2019 15:36:26 +0000 (11:36 -0400)]
Cleanup: remove useless Makefiles from extras
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I8eaf99fab641f264699c16b2069b81c16e27bda5
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1354
CI-Build: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Sat, 8 Jun 2019 00:31:02 +0000 (20:31 -0400)]
Fix: use `babeltrace2` instead of `babeltrace` in plugin paths
This was overlooked when renaming some parts of the project from
`babeltrace` to `babeltrace2` recently.
Basically it made the project not work when installed.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ie1079cee61d6cb6b9bc3787332e4635ee738542f
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1408
Philippe Proulx [Fri, 7 Jun 2019 15:13:35 +0000 (11:13 -0400)]
Fix: doc/bindings/python/Makefile.am: run the `sphinx` Python 3 package
In `sphinx-build.py` (removed), importing `main` and `make_main` from
the `sphinx` package is not considered stable: it used to work for me,
but now it doesn't (cannot import). Instead, run the `sphinx` package
directly with the Python interpreter's `-m` option.
We do this instead of running `sphinx-build` directly because we want to
pick Sphinx for Python 3 (because we're importing the `bt2` package for
autodoc), not for Python 2, and the installed `sphinx-build` program can
be the one for Python 2 on some distributions.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I158dbb96a8b3a26db67dd6e16254a64ac9d24446
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1401
Philippe Proulx [Thu, 6 Jun 2019 23:06:11 +0000 (19:06 -0400)]
bt2: add `_Trace.cls` property
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I0669de442d91da7b188a02d633e1fad15fc5814c
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1395
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Philippe Proulx [Thu, 6 Jun 2019 22:57:59 +0000 (18:57 -0400)]
bt2: rename object's own BT class property to `cls`
Having `mein_event.event_class` is redundant; what we really want is
`mein_event.class`, but `class` is a reserved word, so use `cls`.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ib1f0c91ca37e91b7704ca61fb7380bb79cb48927
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1394
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Philippe Proulx [Thu, 6 Jun 2019 22:32:03 +0000 (18:32 -0400)]
bt2: prepend `_` prefix to names of classes that the user cannot create
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Icf47793836daede471372be16fb278884eb54f38
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1393
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Philippe Proulx [Thu, 6 Jun 2019 22:17:14 +0000 (18:17 -0400)]
Remove everything related to the `bt2.ctf_writer` Python module
This module wraps CTF writer, but is currently incomplete and would
require much work to finish, as CTF writer is completely decoupled from
the Babeltrace library.
Since we plan to make Babeltrace 1 and Babeltrace 2 coinstallable, and
that CTF writer 2 does not add many important features to CTF writer 1,
we decided to postpone the development of its Python bindings to when it
supports CTF 2.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ie8ceeac8bfcce86dec3cb426d7030ad445274cd2
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1392
Philippe Proulx [Fri, 7 Jun 2019 02:47:32 +0000 (22:47 -0400)]
Remove everything related to the `babeltrace` Python package
This package is the Babeltrace 1 package, and since we plan to make
Babeltrace 1 and Babeltrace 2 coinstallable, we decided to drop the
support for this one.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I37f2de0129df00ae5d78fc3f81ad6c57763809cb
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1391
Tested-by: jenkins
Simon Marchi [Fri, 7 Jun 2019 18:28:53 +0000 (14:28 -0400)]
tests: clean up test_trimmer
This patch changes test_trimmer to reduce duplication of the
boilerplate. I intend to add some test cases to this test in a
following patch, so this change allows me to understand better what the
test does currently and will help adding test cases.
Note that there are pairs of tests that are pretty much redundant, such
as:
- "Read a trace with the trimmer enabled (GMT relative timestamps)"
- "Ran successfully with --begin and --end (GMT relative timestamps)"
So I have only kept the second test of such pairs.
Change-Id: I075df21ed9c03495ab516d3870ccf7b63276d3ce
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1407
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 6 Jun 2019 21:39:37 +0000 (17:39 -0400)]
lib: make precondition failure messages more clear on message creation
Suggested-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: If1486d9bbb3fad02235ce14f53a974e57283fc1b
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1390
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Francis Deslauriers [Thu, 6 Jun 2019 04:05:53 +0000 (00:05 -0400)]
src.ctf.fs: trace-info: omit stream `range-ns` field when no TS
Don't print -1 timestamps when packet contexts don't have
`timestamp_begin` and `timestamp_end` fields. Simply omit this part of
the query reply.
Remove FIXME comment as the only user of the index now handles absent
timestamps.
Tests
=====
Adapt `test_ctf_plugin` stream sorting function to fall back on using
the `paths` field if `range-ns` field is absent and rename it to
abstract implementation details.
Add test case to test that `range-ns` fields are absent on traces
without `timestamp_begin` and `timestamp_end` fields in their packet
context.
Example
=======
Here is an example of the output of the `trace-info` query on a trace
without packet contexts before this commit:
-
streams:
-
range-ns:
begin: -1
end: -1
paths:
- /home/frdeso/projets/babeltrace/tests/ctf-traces/succeed/no-packet-context/stream
class-id: 0
port-name: /home/frdeso/projets/babeltrace/tests/ctf-traces/succeed/no-packet-context | 0 | /home/frdeso/projets/babeltrace/tests/ctf-traces/succeed/no-packet-context/stream
range-ns:
begin: -1
end: 0
name: no-packet-context
path: /home/frdeso/projets/babeltrace/tests/ctf-traces/succeed/no-packet-context
Here is an example of the output of the `trace-info` query on a trace
without packet contexts after this commit:
-
streams:
-
class-id: 0
port-name: /home/frdeso/projets/babeltrace/tests/ctf-traces/succeed/no-packet-context | 0 | /home/frdeso/projets/babeltrace/tests/ctf-traces/succeed/no-packet-context/stream
paths:
- /home/frdeso/projets/babeltrace/tests/ctf-traces/succeed/no-packet-context/stream
name: no-packet-context
path: /home/frdeso/projets/babeltrace/tests/ctf-traces/succeed/no-packet-context
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I419f57960a52d8ed2823fdb06982e5c20710b6da
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1387
CI-Build: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Michael Jeanson [Tue, 4 Jun 2019 21:08:46 +0000 (17:08 -0400)]
doc: Rename to babeltrace2
Adjust the documentation and manpages following the rename of the
executables and library.
Change-Id: I42cc662a94be6ece489af85d0415440bf1c1f36e
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1406
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Michael Jeanson [Tue, 4 Jun 2019 19:39:50 +0000 (15:39 -0400)]
lib: rename include dir to babeltrace2
Rename the include dir to be co-installable with bt1.
Change-Id: Icb9a048988544eaca7054648b9c7a9e76d70b9db
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1405
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Michael Jeanson [Mon, 3 Jun 2019 21:07:05 +0000 (17:07 -0400)]
lib: Reset libbabeltrace2 to SONANE 0
Following the rename of the library, reset the SONAME to zero and
decouple this from the project versioning which is not tied directly to
the library ABI.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: If3a3c890674d6236cfe33b5f3f1e3fe4229c5691
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1404
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Michael Jeanson [Tue, 4 Jun 2019 19:16:19 +0000 (15:16 -0400)]
lib: Rename to libbabeltrace2
We decided to make babeltrace2 co-installable with babeltrace1 since it
offers backward compatibility but is not a full drop in replacement.
Change-Id: I6da0230858601dd35ae35424540c73ba7b143858
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1403
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Michael Jeanson [Tue, 4 Jun 2019 18:22:42 +0000 (14:22 -0400)]
cli: Rename to babeltrace2
We decided to make babeltrace2 co-installable with babeltrace1 since it
offers backward compatibility but is not a full drop in replacement.
This first change renames the command line executables.
Change-Id: I52db05629b6349a5221f6b684cb15b289db8c6b3
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1402
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Thu, 6 Jun 2019 18:57:13 +0000 (14:57 -0400)]
Fix: lib: expose bt_lib_log_level symbol
The Python plugin provider does not work. It fails to be loaded:
$ ./cli/babeltrace -v list-plugins --plugin-path /tmp/python
...
06-06 15:03:51.883 13378 13378 I PLUGIN init_python_plugin_provider@plugin.c:80 Cannot open `libbabeltrace-python-plugin-provider.so`: /home/smarchi/build/babeltrace/python-plugin-provider/.libs/libbabeltrace-python-plugin-provider.so: undefined symbol: bt_lib_log_level: continuing without Python plugin support.
...
The Python plugin provider is built as a .so separate from the main
libbabeltrace.so lib. However, it uses the logging system of the lib,
including the bt_lib_log_level symbol. This symbol is currently not
exposed to other shared objects because it is marked as BT_HIDDEN.
Remove BT_HIDDEN to make the symbol visible to the python plugin
provider shared object.
Now that the Python bindings are merged, re-enable the Python plugin
provider test, which exposes the problem.
Note that the Python plugin provider is built as a separate .so for
packaging purposes (so it can be distributed separately), but is still
considered part of the lib. This is why it is allowed to include and
use internal lib things.
Reported-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Change-Id: I716ae2eb6e2457c7a4f130a394f97391d56454e4
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1388
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Michael Jeanson [Wed, 5 Jun 2019 19:07:20 +0000 (15:07 -0400)]
Add missing test_output_ctf_metadata to gitignore
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: Ia73e2a4510e2085c54794caa179a13cbac89fa77
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1384
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Michael Jeanson [Thu, 30 May 2019 15:10:15 +0000 (11:10 -0400)]
Cleanup: use detected asciidoc to build CONTRIBUTING.html
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I3ed041bf02711fe5f3267865410756b8df8bfb3f
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1352
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Thu, 6 Jun 2019 03:54:47 +0000 (23:54 -0400)]
Fix: src.ctf.fs: trace-info: fields no appended if range not set
Issue
=====
If the stream range is not set, the entire `if` clause is skipped and
the `paths`, `stream-id`, and `port-name` are not returned by the query
for that stream.
Solution
========
Append the value of this file group info even if the stream range is not
set.
Drawbacks
=========
None.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I7e185bcf3b640a684fc7944423eeb8d337764b19
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1386
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins
Francis Deslauriers [Wed, 15 May 2019 18:59:10 +0000 (14:59 -0400)]
src.ctf.fs: merge all indexes to the fs_ds_group level
Background
==========
The index contains information on the packets of the underlying CTF
trace (e.g. timestamp begin and end). It is currently used to compute
the time boundaries of the all streams during the `trace-info` query. It
will probably be used for seeking in the future. Currently, each
datastream file has its own index.
To find the time boundaries of a given stream, we need to get the first
entry of the first datastream file and the last entry of the last
datastream file.
Why merge all the indexes ?
===========================
There are two reasons why we want to merge the file indexes into a
single stream index:
* It's slightly simpler to extract the time boundaries of the stream.
* Changes to overcome various packet timestamps tracer bugs are about to
be introduced and will need to iterate over all sorted index entries of
each stream.
Approach
========
Move the index from `struct ctf_fs_ds_file_info` to
`struct ctf_fs_ds_file_group` and merge the indexes of a given stream
when merging the different chunks of the same trace.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Iabee86c7c76c69b56cbf86449f8930e6d35969e2
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1362
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Tue, 4 Jun 2019 16:30:17 +0000 (12:30 -0400)]
src.ctf.fs: bubble up `ctf_fs_ds_file_group_create()` error
This will be used by a future commit to bubble up other allocation
errors.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I3a847d8e2e2db15f661360305b4818afba1666ab
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1372
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Tue, 4 Jun 2019 20:58:26 +0000 (16:58 -0400)]
sink.ctf.fs: add more comments in code where it's not straightforward
This patch adds a few comments in the code of `sink.ctf.fs` to help
future contributors without deep knowledge of CTF.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ibaa9ae27adb42f76329d0eab5a321368f452fc56
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1376
Tested-by: jenkins
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Philippe Proulx [Mon, 3 Jun 2019 20:23:07 +0000 (16:23 -0400)]
Rename "default beginning/end CS" -> "beginning/end default CS"
Because the target is the "default clock", it makes more sense to keep
those words together and have the beginning/end adjective outside.
Suggested-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I9fdd32c6acefc51b63b322dc41470c50b9226dfa
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1369
Tested-by: jenkins
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Philippe Proulx [Mon, 3 Jun 2019 19:48:06 +0000 (15:48 -0400)]
src.ctf.fs: support no packet beg/end CS and no discarded events/packets
This patch makes `src.ctf.fs` support CTF traces where a packet context
field class has or does not have the `timestamp_begin`, `timestamp_end`,
`events_discarded`, and `packet_seq_num` members. The corresponding
trace IR stream class's properties are set accordingly.
This fixes a bug having those base conditions:
1. Stream class has a default clock class.
2. Packet context's `timestamp_begin` and `timestamp_end` members
are missing.
Then:
a) Because of 1., it was mandatory to set the default clock snapshot of
packet beginning and end messages. It was also mandatory to set the
default clock snapshots of discarded events/packets messages.
b) Because we didn't have the packet beginning and end times (because of
2.), we used 0 for the first packet's beginning default clock
snapshot.
c) Because CTF uses the packet beginning/end times to set the discarded
events ranges, and because of b), we also used 0 as a discarded
events message's beginning default clock snapshot if the events were
discarded during the first packet.
0 is wrong for both b) and c): it's not 0, we just don't know the value.
It is wrong to tell a downstream component that events were possibly
discarded from 0 to another time because we just don't know those times.
I'm adding two test traces to make this code covered:
`no-packet-context`:
No packet context at all, which means no packet beginning/end times,
no discarded events, and no discarded packets.
`ev-disc-no-ts-begin-end`:
A packet context with an `events_discarded` member, but without the
`timestamp_begin` and `timestamp_end` members.
In this case, when there's a discarded events message, events are
known to have been discarded contextually, between two other
messages with a default clock snapshot, but not at a specific time.
`sink.text.pretty` prints:
WARNING: Tracer discarded 17 events (unknown time range) in
trace "ev-disc-no-ts-begin-end" (no UUID) within stream
"/path/to/babeltrace/tests/ctf-traces/succeed/ev-disc-no-ts-begin-end/stream"
(stream class ID: 0, stream ID: 0).
while Babeltrace 1.5 prints:
[warning] Tracer discarded 17 events between
[19:00:00.
000000000] and [19:00:00.
000000000] in trace UUID
0000000000000000, at path:
"tests/ctf-traces/succeed/ev-disc-no-ts-begin-end", within
stream id 0, at relative path: "stream". You should consider
recording a new trace with larger buffers or with fewer events
enabled.
which is not exact.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ieebf679a67bd0089e48708372caf934cc27573dc
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1368
Tested-by: jenkins
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Philippe Proulx [Mon, 3 Jun 2019 19:48:16 +0000 (15:48 -0400)]
Fix: sink.text.pretty: print_discarded_elements_msg(): add missing space
Before:
WARNING: Tracer discarded 17 events(unknown time range) in trace
"ev-disc-no-ts-begin-end" (no UUID) within stream
"/path/to/ev-disc-no-ts-begin-end/stream" (stream class ID: 0,
stream ID: 0).
After:
WARNING: Tracer discarded 17 events (unknown time range) in trace
"ev-disc-no-ts-begin-end" (no UUID) within stream
"/path/to/ev-disc-no-ts-begin-end/stream" (stream class ID: 0,
stream ID: 0).
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I3f93f96479b2249c3e16f68e53533c48cf02a679
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1367
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins
Philippe Proulx [Mon, 3 Jun 2019 18:25:12 +0000 (14:25 -0400)]
sink.ctf.fs: support packets, DE, and DP w/o beginning/end clock snapshots
This patch makes `sink.ctf.fs` support more stream class configurations.
The table below shows the valid configurations, where:
DE:
Discarded events.
DP:
Discarded packets.
CS:
Clock snapshot.
Each table cell indicates whether or not the given message has a default
clock snapshot (or two default clock snapshots for discarded events
packets messages). Each row is a configuration supported by
`sink.ctf.fs`.
+------------+------------+-------+-------+
| Pkt beg CS | Pkt end CS | DE CS | DP CS |
+------------+------------+-------+-------+
| No | No | No | No |
| No | Yes | No | No |
| Yes | No | No | No |
| Yes | Yes | No | No |
| Yes | Yes | No | Yes |
| Yes | Yes | Yes | No |
| Yes | Yes | Yes | Yes |
+------------+------------+-------+-------+
All other configurations are not supported (the component logs an error
and fails).
As shown by the table above, discarded events and packets messages
without default clock snapshots are always supported:
* Any discarded events message occuring between two packet end messages
increments the discarded event counter for the packet targeted by the
second packet end message.
* Any discarded packets message occuring between a packet end message
and a packet beginning message increments the packet sequence number
for the packet targeted by the packet beginning message.
When discarded events/packets messages have default clock snapshots,
however, packet beginning and end messages must also have default clock
snapshots. This is to ensure that the discarded item time range matches
what is specified by CTF, which relies on the packet time ranges.
`src.ctf.fs` never produces (and will never produce) such a
configuration, so the CTF-to-CTF use case remains completely compatible.
When packet beginning messages have no default clock snapshot, the
generated packet context has no `timestamp_begin` member.
When packet end messages have no default clock snapshot, the generated
packet context has no `timestamp_end` member.
When a stream class does not support discarded event messages, the
generated packet context has no `events_discarded` member.
NOTE: As of this patch, `src.ctf.fs` cannot produce all the
configurations above. This work is reserved for a future patch.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I4e4fcb5c6f4e363d5c467427fb151c725d100cfb
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1366
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins
Philippe Proulx [Mon, 3 Jun 2019 16:16:11 +0000 (12:16 -0400)]
lib: make discarded events/packets support and clock snapshots optional
This patch adds functions to the stream class API to make it explicit
that discarded events and/or discarded packets are supported for stream
instances. The same functions are used to specify whether or not
discarded events and discarded packets have time ranges, that is,
default beginning and end clock snapshots.
The basic use cases to support are:
1. CTF 1.8: packet context has `timestamp_begin`, `timestamp_end` packet
context members, as well as `events_discarded` and/or
`packet_seq_num` members. This is legit: LTTng produces this.
2. CTF 1.8: packet context has `events_discarded` and/or
`packet_seq_num` packet context members, but no `timestamp_begin` and
`timestamp_end` members. This is possible (barectf, other tracers).
3. Source has no concept of discarded events and/or packets.
My initial approach was to have only the "discarded events have default
clock snapshots" and "discarded packets have default clock snapshots"
stream class properties, but they would need to be false by default
(because there's no default clock class by default), and then
`sink.ctf.fs` would, at least temporarily, require those default clock
snapshots to exist for those messages when there's a default clock
class, so simple sources without the discarded events/packets concept
would always need to set both stream class properties. I found this
weird, so the default is:
* No discarded events support.
* No discarded packets support.
When you set that the streams of a given stream class support discarded
events and packets, you specify at the same time if they have default
clock snapshots:
void bt_stream_class_set_supports_discarded_events(
bt_stream_class *stream_class,
bt_bool supports_discarded_events,
bt_bool with_default_clock_snapshots);
void bt_stream_class_set_supports_discarded_packets(
bt_stream_class *stream_class,
bt_bool supports_discarded_packets,
bt_bool with_default_clock_snapshots);
This means that a simple source can keep the default properties as is
and not create any discarded events/packets messages; `sink.ctf.fs` will
work fine.
It is a precondition that the stream class has a default clock class
when you call bt_stream_class_set_supports_discarded_events() or
bt_stream_class_set_supports_discarded_packets() with the
`with_default_clock_snapshots` parameter set.
This patch satisfies the three use cases above with those
configurations:
1. Discarded events and/or packets supported with default clock
snapshots.
2. Discarded events and/or packets supported without default clock
snapshots.
3. Discarded events and/or packets are not supported.
The component classes are not modified to support custom configurations
yet:
* `src.ctf.fs` always supports discarded events/packets, and always with
default clock snapshots when the stream class has a default clock
class.
* `sink.ctf.fs` and `flt.utils.trimmer` expect that, if discarded
events/packets are supported (and those messages are not intentionally
ignored for `sink.ctf.fs`) and the stream class has a default clock
class, discarded events/packets have default clock snapshots.
Support for other configurations will be added in future patches.
This change will also make it possible for `sink.ctf.fs` to not write
any `events_discarded` packet context member when discarded events are
known to be not supported.
Python bindings are updated to support this feature. The four new flags
are added as parameters to the TraceClass.create_stream_class(). The
corresponding (private) property setters in `StreamClass` check that you
cannot make the stream class _not_ support discarded events/packets, but
have discarded events/packets have default clock snapshots. The new
tests in `test_stream_class.py` verify this too.
In `message.py`, I changed how we check, for each type of message, if
the message object has a default clock snapshot or not. It used to rely
on its stream class having a default clock class or not, but it's not
the only condition for packet beginning, packet end, and now discarded
events and discarded packets messages. Now, in any default clock
snapshot property, the function checks its own, custom condition.
Because having the stream class have a default clock class is still a
typical condition, there's the helper
_Message._check_has_default_clock_class(). I renamed
`NoDefaultClockClass` to `NonexistentClockSnapshot` to make the
exception more generic, considering what's written in this paragraph.
I also removed the `_DiscardedMessage.default_clock_class` property
because it could not be found in other types of messages, which is weird,
and you can always access it with
mein_msg.stream.stream_class.default_clock_class
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I18b0bc65ef61e8bbd01521fb20c223d401d2adc9
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1365
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins
Philippe Proulx [Mon, 3 Jun 2019 15:33:49 +0000 (11:33 -0400)]
lib: create_packet_message(): make assertion message less convoluted
Instead of having a message which enumerated the possible precondition
breaks, have it say that the stream class has an unexpected configuration,
and add the "packets have default beginning clock snapshot" and
"packets have default end clock snapshot" properties to the extended
logging of a stream class object in `lib-logging.c`.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ic7b706b9d6ef3afb799072a8891a0ba24370f317
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1364
Tested-by: jenkins
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Philippe Proulx [Mon, 3 Jun 2019 15:28:34 +0000 (11:28 -0400)]
lib: create_packet_message(): use pool to determine beginning or end msg
The `is_beginning` parameter in create_packet_message() is redundant as
the function can use `pool` and `msg_iter` to determine if it's creating
a packet beginning or end message.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I7f9b4183d004947895fba16b2e8396b8cb5be33a
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1363
Tested-by: jenkins
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Michael Jeanson [Wed, 29 May 2019 20:48:44 +0000 (16:48 -0400)]
tests: build system spring cleanup
* Remove AC_CONFIG_FILES generated files from check_SCRIPTS and
EXTRA_DIST since they are already included.
* Remove useless conditionnals on AC_CONFIG_FILES generated files
since they are always included.
* Reduce the number of mostly unused Makefiles
* Remove execute permission on data files
Change-Id: I4e82bac01bf2033409c67508a4d60127a0e77f14
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1350
CI-Build: Francis Deslauriers <francis.deslauriers@efficios.com>
Tested-by: jenkins
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Michael Jeanson [Wed, 5 Jun 2019 15:36:19 +0000 (11:36 -0400)]
tests: replace BT_ASSERT with exit in test_bin_info
Since this is a test executable and not a library, it's cleaner to exit
with an error code than use an assertion which could be disabled.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I1684a21d510ea444106b84f5e06ece4a7ff96ef4
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1382
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Michael Jeanson [Wed, 29 May 2019 19:17:31 +0000 (15:17 -0400)]
tests: Add expected failure test to test_dwarf
Add a test to make sure we fail when opening an ELF file with no DWARF
information.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I59419a94fa0bca5589600e7b0691d291531cfa51
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1349
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Michael Jeanson [Tue, 28 May 2019 18:15:44 +0000 (18:15 +0000)]
tests: Add powerpc64le-linux-gnu debug-info artifacts
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: Ic86e49344dccf3d547bc441c4a16a4dca8553e1f
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1348
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Michael Jeanson [Tue, 28 May 2019 16:11:29 +0000 (12:11 -0400)]
tests: Add powerpc-linux-gnu debug-info artifacts
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I2b470db8427e20685a744edd6c9cec29fc70c54d
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1347
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Michael Jeanson [Wed, 8 May 2019 18:56:24 +0000 (18:56 +0000)]
tests: Add i386-linux-gnu debug-info artifacts
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: Ia8455b987cc2d4c82b1e119c8d12c2708d3d0ded
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1346
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Michael Jeanson [Thu, 9 May 2019 18:07:09 +0000 (18:07 +0000)]
tests: Parametrize test_bin_info to handle multiarch artifacts
The values that change on each build of the test artifacts were
hardcoded in the test source. Parametrize them so the test can be used
on differents artifacts.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I003733f54bdf1f6cee0aca134f31dec79d75b35d
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1345
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Michael Jeanson [Thu, 9 May 2019 15:09:08 +0000 (11:09 -0400)]
tests: Build new x86_64-linux-gnu debug-info artifacts
Build new debug info tests artifacts using the Makefile and namespace
them and the related tests with 'x86_64-linux-gnu'. This will allow
adding artifacts from different architectures to improve the test
coverage.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I97bd5052e9c3537f625581d21723e848c2a373b7
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1344
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Michael Jeanson [Thu, 9 May 2019 19:32:26 +0000 (19:32 +0000)]
tests: Add Makefile to build debug-info test artifacts
The current documentation on building the debug info test artifacts is
missing some important details, add a Makefile to make the process more
repoducible.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I188ce56bbe4d446e8959e18d2f4c50b8a82a4cb0
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1343
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Mathieu Desnoyers [Thu, 30 May 2019 20:15:22 +0000 (16:15 -0400)]
Cleanup: test_bitfield: nr_bits should be unsigned
Should not have any effect on the code behavior, but removes
useless type conversions between unsigned and signed types.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I39096ab89936875009a68d3ab8a4546c7f1eb8ae
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1375
CI-Build: Michael Jeanson <mjeanson@efficios.com>
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Wed, 5 Jun 2019 20:38:08 +0000 (16:38 -0400)]
Fix: lib: set iterator state even in non-dev mode
The following test fails currently when building with
BABELTRACE_DEV_MODE off:
FAIL: test_finalize (test_message_iterator.UserMessageIteratorTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File ".../babeltrace/tests/bindings/python/bt2/test_message_iterator.py", line 67, in test_finalize
self.assertTrue(finalized)
AssertionError: False is not true
The test verifies that the _finalize method (in Python) of an input port
message iterator is called when the iterator is destroyed. The failure
shows that the method is not getting called.
The issue is that
bt_self_component_port_input_message_iterator_try_finalize doesn't call
the finalize method if the iterator state is
BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_NON_INITIALIZED.
However, the iterator state is only set when in dev mode. In non-dev
mode, the state is left to its initial value of
BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_NON_INITIALIZED.
Fix this by setting the state of the iterator regardless of whether we
are in dev mode or not.
Change-Id: I158c9d913777eba117ed0d32e82db5a1b29f50ab
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1385
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins
Simon Marchi [Wed, 5 Jun 2019 18:11:37 +0000 (14:11 -0400)]
bt2: change some bt2.CreationError usages to ValueError
The bt2.CreationError exception type is reserved for cases where the
creation functions return None/NULL, which is usually because of
exhausted memory. Other exception types should be used for other
errors.
This patch fixes a few instances where bt2.CreationError is wrongly
used. Change them for ValueError, since they are cases of wrong
parameter value passed by the user. We have already used ValueError for
cases like these, for example in
_UserMessageIterator._create_packet_beginning_message.
Change-Id: Ib66943f8dc1200f7b589764c171bf4764741a6bd
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1383
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Wed, 5 Jun 2019 14:36:07 +0000 (10:36 -0400)]
bt2: remove unused exception types
There are several exception types defined in __init__.py.in that are not
used anywhere, remove them.
Change-Id: I6ba2c62689a4dc72f4b5325715962a7721169e07
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1381
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Tue, 28 May 2019 16:01:36 +0000 (12:01 -0400)]
src.ctf.fs: add stream port name to trace-info query, use it for stream intersection
For creating stream intersection trimmers, we currently rely on the fact
that the CLI and the Python bindings know that src.ctf.fs component port
names are the path to the data stream files (or the first data stream
file for the corresponding stream, if there are multiple files). Using
this information, they can deduce which trace (from the trace-info
query) this port is from, by checking for a trace whose path is a prefix
of the port name.
This patch changes how this works to avoid the CLI and Python bindings
having internal knowledge of how the src.ctf.fs component class names
the ports. The trace-info query now include a "port-name" property for
each stream. This property contains the name that a src.ctf.fs
component would give the port associated to this stream. This allows
the CLI and the Python bindings to match a port with a trace (and
therefore an intersection range) just by comparing the port name in the
actual component instance with the port name in the trace-info query
result.
Here's an excerpt (just two streams) from a trace-info result with this patch
applied:
-
range-ns:
begin:
1556911621056878212
end:
1556911631077588247
class-id: 0
paths:
- /home/smarchi/src/lttng-envs/augmented-metadata/home/lttng-traces/perpid-
20190503-152658/archives/20190503T152700-0400-20190503T152703-0400-1/ust/pid/hello-ust-2335-
20190503-152701/chan_2
- /home/smarchi/src/lttng-envs/augmented-metadata/home/lttng-traces/perpid-
20190503-152658/20190503T152705-0400-3/ust/pid/hello-ust-2335-
20190503-152701/chan_2
port-name:
1838b922-0089-497c-96e7-
2c7ad63e901e | 0 | 2
id: 2
-
range-ns:
begin:
1556911621053751789
end:
1556911631077569864
class-id: 0
paths:
- /home/smarchi/src/lttng-envs/augmented-metadata/home/lttng-traces/perpid-
20190503-152658/archives/20190503T152700-0400-20190503T152703-0400-1/ust/pid/hello-ust-2335-
20190503-152701/chan_1
- /home/smarchi/src/lttng-envs/augmented-metadata/home/lttng-traces/perpid-
20190503-152658/20190503T152705-0400-3/ust/pid/hello-ust-2335-
20190503-152701/chan_1
port-name:
1838b922-0089-497c-96e7-
2c7ad63e901e | 0 | 1
id: 1
I added some simple tests, although they don't cover all the cases. We
currently don't have a trace without uuid, or a trace with
stream_instance_id fields, to test the remaining possibilities. I plan
on adding some soon, when adding tests for the trace merging feature, at
which point we can also enhance
test_query_trace_info.QueryTraceInfoPortNameTestCase.
Change-Id: Ib3afc19f2c0e09a7235475b53f8023c8a2f40ebf
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1339
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Mon, 27 May 2019 18:50:19 +0000 (14:50 -0400)]
Fix: sink.text.pretty: comma in enum fields
The condition for printing commas that separate labels of enum fields is
reversed. It causes a comma tu be spuriously printed before the first
label:
enumfield = ( , "zero" : container = 0 )
instead of:
enumfield = ( "zero" : container = 0 )
With multiple matching labels, before:
enumfield = ( , "zero""one" : container = 0 )
and after:
enumfield = ( "zero", "one" : container = 0
Change-Id: I03452b8ece4f97bf0c819f6885ef512f7ddc31e6
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1334
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Thu, 23 May 2019 22:16:21 +0000 (18:16 -0400)]
cli: Fix exit code of ctf-metadata output
When the command
babeltrace -o ctf-metadata <trace>
is successful, it exits with exit code 1. On success, we would expect
it to return 0.
The issue is that when cmd_print_ctf_metadata exits, ret is filled with
the number of bytes returned with fprintf, which is non-zero. This is then translated to a 1 in main.
If the fprintf is successful, we should set ret to 0 to indicate that
the function has completed successfully.
If the fprintf fails, we should go the the end and avoid setting ret to
0 (the fprintf return value will be passed to the caller).
Add a test to verify the exit code and output of babeltrace when using
-o ctf-metadata.
Change-Id: I64372bce66822ba570a85cd69a32d582ebd3c727
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1332
CI-Build: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Thu, 23 May 2019 15:59:39 +0000 (11:59 -0400)]
bt2: Adapt test_trace_collection_message_iterator.py and make it pass
Update test_trace_collection_message_iterator.py and
trace_collection_message_iterator.py to work with the current Babeltrace
API.
It is no longer possible to pass a "message type" filter to a message
iterator. This means that the TraceCollectionMessageIterator objects in
the test now return all messages, where we previously filtered to only
have those of type EventMessage. The new count_msg_by_type function
helps to get around this problem.
In trace_collection_message_iterator.py, there are just a few changes to
account for the API changes. The src.ctf.fs component now takes a
"paths" parameter instead of "path". It is no longer possible to get a
component from a port, instead we use the component passed as a
parameter in the callbacks.
The change in the way we handle the timestamps in _create_trimmer is due
to the fact that if we pass a single integer, it is interpreted as
seconds. Since we have a number of nanoseconds, it is misinterpreted.
Instead, pass a string in the seconds.nanoseconds form.
Change-Id: Iddd1666008d06e49843932dc74ee51ac772d001b
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1328
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Fri, 31 May 2019 12:59:04 +0000 (08:59 -0400)]
bt2: let components attach "user data" to ports
The C API allows components to attach "user data" to ports when creating
them:
extern bt_self_component_status
bt_self_component_source_add_output_port(
bt_self_component_source *self_component,
const char *name, void *user_data,
bt_self_component_port_output **self_component_port);
This is useful to identify the purpose of a given port. This data can later be
fetched when an iterator is created for that port.
This patch makes the Python API offer a similar facility. When adding a port,
the user can optionally pass an arbitrary Python object as user data:
self_port = self._add_output_port('port name', user_data={'foo': 23})
which they can then access using the user_data property of
_UserComponentPort:
print(self_port.user_data) # {'foo': 23}
We confine the user data under the user_data property to avoid
clashes with future methods and properties that we might add to
_UserComponentPort or its subclasses.
A new "in" typemap is created for the "add port" functions to pass the
PyObject* representing the user data Python object to the creation
function. Without the typemap, SWIG complains that the passed value (a
PyObject *) is not of the right type (it expects a void *):
TypeError: in method 'self_component_source_add_output_port', argument 3 of type 'void *'
If the port is created successfully, it now owns a reference to this
Python object. We must reflect that in the Python object's refcount,
this is done through an "argout" typemap. In this typemap, we need to
check the return value of the function we called.
When fetching the user data of a port, we use an "out" typemap to
increment the refcount of the returned value. This is because a Python
method that returns an object must return a new reference that is
transferred to the caller.
Change-Id: I0b83454a81e71bd7c2fe9449c7fc65c09f18fcf4
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1359
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Mon, 3 Jun 2019 20:48:45 +0000 (16:48 -0400)]
bt2: Adapt test_message_iterator.py and make it pass
Update test_message_iterator.py to work with the current Babeltrace API.
Most changes are related to the fact that it is not possible anymore to
create most objects in isolation, everything is derived from a trace
class. Message iterators are created in the _graph_is_configured
callback rather than _port_connected. Because of this, we now need to
call graph.run() in the tests to get _graph_is_configured called.
I noticed that the component method of _SelfPortInputMessageIterator was
a bit problematic, as we don't know the type of the component at that
point. Returning the right type of component (the right Python class,
wrapping the right type of Swig pointer) would require a bit of dirty
work. I am not sure this is even useful, so I've just removed it and
marked the tests as skipped / commented them out (they can be removed if
we rule this is indeed unnecessary).
An important change is the addition the self_output_port parameter in
the constructor of _UserMessageIterator (which the user is expected to
override). This parameter is how the iterator is supposed to know what
it's supposed to iterate on (if the component has multiple ports).
There are no other changes in message_iterator.py, since everything had
to be done already for test_message.py to pass.
Change-Id: I574d812ed81d9628a8e4a2a2dd5c593c4d730c95
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1326
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Mon, 3 Jun 2019 22:28:10 +0000 (18:28 -0400)]
bt2: Adapt test_message.py and make it pass
Update test_message.py to match the current Babeltrace API. Update
message.py to also match the current API and make the test pass.
message_iterator.py is also updated, as it is required by the test, but
just the essential changes are done.
The test changes substantially, since it is no longer possible to create
a message by itself, they are created from a component message iterator,
which requires quite a bit of setup. Also, it would be invalid to emit
an "event message" without having first emitted a "stream beginning
message", "packet beginning message", and so on. So testing the message
types in isolation would required quite a lot of boilerplate. This is
why all messages types are now tested in the same test. We have a
source that emits all message types at least once. The sink on the
other side verifies that what it receives from the source is what we
expect.
Everything related to equality, copy and deep copy is removed.
Change-Id: Ibe6146049cc1065df82dde821a42f10d4e5bba27
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1324
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins
Simon Marchi [Tue, 21 May 2019 21:01:59 +0000 (17:01 -0400)]
bt2: Adapt test_field.py and make it pass
Update test_field.py and field.py to match the current API of
Babeltrace.
In the test, most changes are related to the fact that field classes and
fields are created ultimately from a trace class. A bunch of helpers
are added at the top, which allow to easily create a field of a certain
type without repeating the boilerplate.
Anything related to copy and deepcopy is removed. However, the test
_TestNumericField._test_binop_lhs_value_same relies on copy support, so
I am not too sure what to do with it. I have currently marked it as
skipped, but we should either adapt it or remove it.
A concept that disappeared (or rather, is not exposed by the public API)
is whether a field is set or not, and the ability to reset a field's
value. All tests and code related to that are removed.
Change-Id: I27f1ee6a3a2152232556d9d9c301de8411189a2c
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1323
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Wed, 29 May 2019 16:08:29 +0000 (12:08 -0400)]
bt2: Adapt test_field_class.py and make it pass
Update the test_field_class.py test to match the current API of
Babeltrace. Update field_class.py and some others to make that test
pass.
The main change in test_field_class.py is that field classes are now
created from an existing trace class (tc.create_foo_field_class())
rather than by constructor (FooFieldClass()). Everything related to
copy, deep copy and equality is removed. Everything related to
structure alignment, byte order and encoding is removed, as those were
ctf concepts that were removed from Babeltrace's trace-ir API.
All specific field class tests try to follow the same pattern. The
test_create_default test method verifies the properties of a specific
field class create with passing as few parameters as possible. Then,
for each possible creation parameter, we verify a case that works and
some problematic cases such as invalid value or invalid type. More
tests are done for specific field classes that support additional
features, such as container field classes.
The support for modifying field class properties after they have been
created is removed. All characteristics of a field class must passed
during construction (this doesn't apply to fields of composite field
classes).
A new concept of "field path" was introduced in the library, which is
useful in the context of dynamically-sized arrays and variants. Support
is therefore added to obtain the "field path" to a variant's selector
field or dynamic array length field.
Change-Id: Ia998119fcf7c61ef5904fbe72baa36a2838d5780
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1319
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Mon, 3 Jun 2019 20:45:56 +0000 (16:45 -0400)]
bt2: Adapt test_graph.py and make it pass
This patch updates test_graph.py and graph.py to work with the current
BT API.
An important change is that now, the port added and ports connected
listeners can report their failures up the stack. Therefore, if a
Python listener raises an exception, we now report it as an error. Some
tests are added for this.
The tests:
- test_connect_ports_canceled
- test_connect_ports_cannot_consume_accept
- test_connect_ports_cannot_consume_connected
were removed, since the library no longer returns an error in these
situations (they are just verified by precondition check). However, a
test was added to check that when the graph gets cancelled during
execution, a bt2.GraphCanceled gets raised.
Some changes in message.py, message_iterator.py and port.py are
necessary to support the test. They are not complete, but they are
representative of what will come after.
Any reference to ports being removed or disconnected were removed, since
it's not longer possible to remove or disconnect a port.
Change-Id: Ie8f11553f34208bb58242d9108efc361acba3c18
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1317
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins
Simon Marchi [Thu, 16 May 2019 16:10:18 +0000 (12:10 -0400)]
lib: Make graph listeners return an error status
Currently, if a graph listener fails for some reason (for example, an
uncaught exception in Python), no error is reported to the initial
caller, so it has no way to handle the failure properly. If a listener
fails, we can't really trust that the execution will proceed as
intended, so it is likely that the caller wants to exit with an error
too.
All the listener typedefs are updated to return a new type,
bt_graph_listener_status. If any listener fails, the graph is put in
"faulty" state and we return an error up the stack.
If a listener fails, the action is not rolled back. This means that if
a port added listener fails, the port that was added is not removed. If
a ports connected listener fails, the connection is not undone.
A few call sites needed to be updated. An interesting one is in
cli/babeltrace.c. Where we previously aborted, we can now return an
error and exit cleanly.
The Python bindings is another user of the listener API. I have
modified the functions in native_bt_graph.i to keep the code building,
but the errors are currently not propagated from the Python callback.
This will be done in a subsequent patch.
Change-Id: I115773c405162f7b1c617cf4a8302b980315e14d
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1316
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins
Francis Deslauriers [Thu, 11 Apr 2019 21:09:32 +0000 (17:09 -0400)]
lib: remove unused _NO_SINK graph status
Also:
- Add an assert to verify that there is at least a sink component in
the graph when it's configured.
- Remove the equivalent in the Python bindings, including the test in
test_graph.py, even though test_graph.py is not functional at the
moment.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I8d6ce79a2c77527908f500017bb346b2c2d94c63
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1315
CI-Build: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Tue, 14 May 2019 19:38:58 +0000 (15:38 -0400)]
bt2: Adapt test_packet.py and make it pass
This patch updates test_packet.py and packet.py to work with the current
API.
In both files, everything about equality, copy, deep copy and header
fields is removed. The setter for context_field is also removed.
One side-effect change (required for the test) is in the
Field.field_class property. Previously, when creating a Field object
wrapping a bt_field pointer, we would create the corresponding
FieldClass object and store it in Field._field_class. Instead, we can
compute it as needed in the Field.field_class property, I don't really
see any problem with that.
Change-Id: I509b3bd272fb323ed6df7de47d21c31b8aedc72f
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1301
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Mon, 3 Jun 2019 22:41:45 +0000 (18:41 -0400)]
bt2: Adapt test_clock_class.py and make it pass
This patch adapts test_clock_class to the current BT API and changes
what's needed to make it pass.
One change in test_clock_class is that clock classes need to be created
from self components now, so it requires a bit more boilerplate.
Everthing related to equality, copy and deepcopy is removed from
ClockClass. However, it remains possible to test a _ClockSnapshot for
equality against an integer. I thoough it would be useful to support
other relational operations (<, <=, >, >=) for clock snapshots, so I
added support for them using functools.total_ordering.
The constructors for both _ClockSnapshot and ClockClass are removed, as
the user never directly creates those objects anymore. Clock snapshots
are obtained from messages, while clock classes are created using the
_create_clock_class method of a component.
As in previous patches, the public setters are removed, as we only
support setting properies when creating an object.
Change-Id: I7228b32530f98811cb512243469ae7d0d61a9da1
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1299
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins
Simon Marchi [Mon, 13 May 2019 17:43:38 +0000 (13:43 -0400)]
bt2: Adapt test_event.py and make it pass
This patch changes test_event.py to work with the current BT API and
adapts event.py accordingly to make it pass. Since this is a central
piece of the API (it has many related concepts), a few other files are
modified as well, just enough to support the test. For example, events
are no longer created directly, instead we need to instantiate an
EventMessage. This requires to get the foundation for messages
working. Even though the changes in message_iterator (the "create"
methods to create various messages) are not complete, it gives an idea
of what is to come, so it would be good to get some comments on it right
now.
In event.py, things related to clock snapshots, header fields, equality,
copy and deep copy are removed.
In test_event.py, we now need a bigger setup, since events are created
from event messages, which are created from output iterators, which are
created from components.
In object.py, UniqueObject now needs to record its _owner_get_ref
callback, so that if we get a second UniqueObject from an existing
UniqueObject (such as a sub-field from a struct field), the callback can
be passed to the new object.
Change-Id: I72309826a61245b0fe4fdd9a638ddee3689c5921
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1298
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins
Simon Marchi [Mon, 13 May 2019 18:01:22 +0000 (14:01 -0400)]
Fix: lib: usage of output port message iterator
Fix some issues relate to output port message iterator usage.
The first encountered issue when trying to create one such iterator is:
05-13 13:51:20.845 14995 14995 F MSG-ITER bt_self_component_port_input_message_iterator_create@iterator.c:444 Graph is not configured: addr=0x612000000640, is-canceled=0, can-consume=0, config-state=BT_GRAPH_CONFIGURATION_STATE_CONFIGURING, comp-count=2, conn-count=1, en-pool-size=0, en-pool-cap=0, pbn-pool-size=0, pbn-pool-cap=0, pen-pool-size=0, pen-pool-cap=0
The problem is that the colander is trying to create an input iterator on its
input port in the "port connected" callback, which is before the graph is
configured. This is not a valid thing to do anymore, so change it to create
the input iterator during the "graph is configured" step.
The next issue we face is then:
05-13 14:00:01.903 21344 21344 W COLANDER colander_consume@component-class-sink-colander.c:142 Trying to consume without an upstream message iterator: comp-addr=0x60c0000028c0, c
omp-name="colander-
36ac3409-b1a8-4d60-ab1f-
4fdf341a8fb1", comp-class-type=BT_COMPONENT_CLASS_TYPE_SINK, comp-class-name="colander", comp-class-partial-descr="", comp-class-is-frozen=1, comp-input-port-count=1, comp-output-port-count=0
This is because the "graph is configured" callback is never invoked,
the reason being that bt_port_output_message_iterator_create just sets
the graph's config state field directly, rather than calling
bt_graph_configure.
Change-Id: Idbf873912ea5d116f0b011639177e57aa78e6759
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1297
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Mon, 13 May 2019 17:10:40 +0000 (13:10 -0400)]
bt2: Adapt test_event_class.py and make it pass
This patch updates event_class.py to be more in line with the current
API and updates test_event_class.py accordingly.
Everything related to equality, copy and deepcopy is removed. An event
class is always created from an existing stream class, so it is not
longer possible to create an event class out of thin air. We only
support passing parameters to the event class when creating it, not
assigning them afterwards.
Change-Id: I2f1ad9f98f25e3e2dfdea511a1410529d014745b
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1296
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Fri, 31 May 2019 14:31:35 +0000 (10:31 -0400)]
bt2: Adapt test_stream.py and make it pass
This patch updates test_stream.py and stream.py. It remove everything
related to equality, copy and deepcopy, as in the previous patches.
Since we don't want to share code between the CTF writer and the
trace-ir objects, the _StreamBase class is removed, and ctf_writer.py is
updated just so import still works.
Change-Id: I72e80694e0c8b401a86ce23d94b6e064afb08ac2
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1292
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Wed, 29 May 2019 14:28:55 +0000 (10:28 -0400)]
bt2: Adapt test_stream_class.py and make it pass
This patch updates test_stream_class.py quite a bit. In particular, it
removes everything related to equality, copy and deep copy. Since we
don't support (at least, for the moment) assigning stream class
properties after it has been created, most "assign" tests have become
"create" tests.
Stream class objects in Python are created using
TraceClass.create_stream_class. This method has been introduced
previously to support TraceClass tests, but this patch now adds the
missing options. Some field class creation methods are added to
TraceClass, just enough to support test_stream_class.
Changes in stream_class.py are mostly to adjust to past API changes.
The assigns_automatic_event_class_id property is new, everything related
to "header" field classes is removed. Everything related to equality,
copy and deep copy is also removed. The __call__ function is removed,
as it's not how create streams anymore (we use Trace.create_stream).
A new concept in the lib is that packet beginning/end messages may or
may not have a default clock snapshot, even if the stream has a default
clock class. An option to TraceClass.create_stream_class is added for
this.
Changes to other files are there to support the tests, and not meant to
be complete.
Change-Id: Idd182d3f512f4f5772816fee0c04e2b39fd163f2
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1291
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
This page took 0.055112 seconds and 4 git commands to generate.