babeltrace.git
6 years agoAdd `bt2.TraceCollectionNotificationIterator` tests
Philippe Proulx [Fri, 15 Sep 2017 23:24:38 +0000 (19:24 -0400)] 
Add `bt2.TraceCollectionNotificationIterator` tests

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agobt2: __init__.py: remove unused NoSuchPlugin
Philippe Proulx [Fri, 15 Sep 2017 23:23:48 +0000 (19:23 -0400)] 
bt2: __init__.py: remove unused NoSuchPlugin

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agobt2: add trace collection notification iterator
Philippe Proulx [Fri, 15 Sep 2017 23:18:24 +0000 (19:18 -0400)] 
bt2: add trace collection notification iterator

A trace collection notification iterator is a special notification
iterator which iterates on the multiplexed notifications of all the
output ports of one or more traces. The new notification iterator
supports a stream intersection mode and trimming the whole multiplexed
stream.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoflt.utils.trimmer: allow `begin`/`end` params. to be integers
Philippe Proulx [Fri, 15 Sep 2017 23:12:46 +0000 (19:12 -0400)] 
flt.utils.trimmer: allow `begin`/`end` params. to be integers

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agobt2: values: remove public `value` getter
Philippe Proulx [Wed, 13 Sep 2017 23:05:29 +0000 (19:05 -0400)] 
bt2: values: remove public `value` getter

The public `value` getter (e.g., `my_int_value.value`) is redundant here
since the `bt2.values` object already act like their Python equivalent.
If you need an `int` value out of a `bt2.IntegerValue` object, for
example, you can just use `int(bt_value)` instead of `bt_value.value`.

We keep the `value` setter because this is used to set the underlying
raw value.

Internally, we keep the private `_value` getter to access the object's
raw value.

In the tests, we copy the value to modify instead of using the `value`
property with this pattern:

    orig_value = copy.copy(value)
    # modify value
    self.assertEqual(value, orig_value)

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPython bt2 fix: erroneous imports following split of clock class and value
Jérémie Galarneau [Sat, 16 Sep 2017 02:49:01 +0000 (22:49 -0400)] 
Python bt2 fix: erroneous imports following split of clock class and value

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoOmit 'value' from is_set and reset field functions
Jérémie Galarneau [Sat, 16 Sep 2017 02:12:32 +0000 (22:12 -0400)] 
Omit 'value' from is_set and reset field functions

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPython bt2: remove type restriction on structure __setitem__
Jérémie Galarneau [Fri, 15 Sep 2017 04:07:45 +0000 (00:07 -0400)] 
Python bt2: remove type restriction on structure __setitem__

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoCleanup: line exceeds 80 chars
Jérémie Galarneau [Thu, 14 Sep 2017 19:03:55 +0000 (15:03 -0400)] 
Cleanup: line exceeds 80 chars

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: ensure sequence length field value is set and freeze it
Jérémie Galarneau [Thu, 14 Sep 2017 16:13:33 +0000 (12:13 -0400)] 
Fix: ensure sequence length field value is set and freeze it

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoCleanup: coding style mandates space after cast operator
Jérémie Galarneau [Thu, 14 Sep 2017 16:12:48 +0000 (12:12 -0400)] 
Cleanup: coding style mandates space after cast operator

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix Python bt2: sequence length field may be NULL
Jérémie Galarneau [Thu, 14 Sep 2017 16:09:16 +0000 (12:09 -0400)] 
Fix Python bt2: sequence length field may be NULL

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPython bt2: value is a write-only property
Jérémie Galarneau [Thu, 14 Sep 2017 15:47:36 +0000 (11:47 -0400)] 
Python bt2: value is a write-only property

This commit turns 'value' into a write-only property. The
value property is needed to distinguish between:

my_var = bt2.IntegerFieldType(32)(123456)
my_var = 123

my_var = bt2.IntegerFieldType(32)(123456)
my_var.value = 123

The value 'getter' is not necessary since the various field types
implement the interfaces needed to act as native Python types
(collections.abc.Sequence, collections.abc.Mapping, numbers.Integral,
etc.)

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPython bt2: add reset and is_set to fields
Jérémie Galarneau [Thu, 14 Sep 2017 15:44:51 +0000 (11:44 -0400)] 
Python bt2: add reset and is_set to fields

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoDocs: structure_set_field_by_name doesn't garantee field replacement
Jérémie Galarneau [Wed, 13 Sep 2017 20:52:16 +0000 (16:52 -0400)] 
Docs: structure_set_field_by_name doesn't garantee field replacement

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoAdd field value is_set and reset functions to the public API
Jérémie Galarneau [Wed, 13 Sep 2017 20:51:38 +0000 (16:51 -0400)] 
Add field value is_set and reset functions to the public API

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoAllocate structure fields on creation
Jérémie Galarneau [Wed, 13 Sep 2017 19:19:02 +0000 (15:19 -0400)] 
Allocate structure fields on creation

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPython test: remove useless test
Jérémie Galarneau [Wed, 13 Sep 2017 16:06:07 +0000 (12:06 -0400)] 
Python test: remove useless test

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPython bt2: value properties for sequence and struct
Jérémie Galarneau [Wed, 13 Sep 2017 16:05:36 +0000 (12:05 -0400)] 
Python bt2: value properties for sequence and struct

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoUse boolean for frozen and set field states
Jérémie Galarneau [Wed, 13 Sep 2017 15:47:05 +0000 (11:47 -0400)] 
Use boolean for frozen and set field states

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoUpdate .gitignore exclusions
Jérémie Galarneau [Tue, 5 Sep 2017 22:40:34 +0000 (18:40 -0400)] 
Update .gitignore exclusions

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoTests: use of non-existant API in bt2 python package test
Jérémie Galarneau [Tue, 5 Sep 2017 22:39:04 +0000 (18:39 -0400)] 
Tests: use of non-existant API in bt2 python package test

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPython bt2 fix: _ClockValue is no longer part of bt2.clock_class
Jérémie Galarneau [Sat, 16 Sep 2017 01:48:54 +0000 (21:48 -0400)] 
Python bt2 fix: _ClockValue is no longer part of bt2.clock_class

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoEnumeration mapping iterator's initial position is inconsistent
Jérémie Galarneau [Sat, 16 Sep 2017 01:47:49 +0000 (21:47 -0400)] 
Enumeration mapping iterator's initial position is inconsistent

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoCONTRIBUTING.adoc: add step to add env. var. name to cli/babeltrace.c
Philippe Proulx [Wed, 6 Sep 2017 19:29:10 +0000 (15:29 -0400)] 
CONTRIBUTING.adoc: add step to add env. var. name to cli/babeltrace.c

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoCONTRIBUTING.adoc: MY_MODULE_LOGGING_H -> BABELTRACE_MY_MODULE_LOGGING_H
Philippe Proulx [Wed, 6 Sep 2017 19:28:55 +0000 (15:28 -0400)] 
CONTRIBUTING.adoc: MY_MODULE_LOGGING_H -> BABELTRACE_MY_MODULE_LOGGING_H

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoCONTRIBUTING.adoc: document BT_LOG*_ERRNO() macros
Philippe Proulx [Wed, 6 Sep 2017 19:28:36 +0000 (15:28 -0400)] 
CONTRIBUTING.adoc: document BT_LOG*_ERRNO() macros

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoAdd CONTRIBUTING.adoc
Philippe Proulx [Wed, 6 Sep 2017 19:15:16 +0000 (15:15 -0400)] 
Add CONTRIBUTING.adoc

This new Babeltrace contributor's guide documents the internals of the
Babeltrace project for its developers and contributors. It overrides
doc/logging-guide.adoc, doc/ref-counting.md, and doc/development.txt,
which is why those files are removed.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agolib/ctf-ir/utils.c: lazy-initialize the hash table of reserved keywords
Philippe Proulx [Wed, 6 Sep 2017 01:09:13 +0000 (21:09 -0400)] 
lib/ctf-ir/utils.c: lazy-initialize the hash table of reserved keywords

This fixes bugs in static build context on platforms where the calling
order of library constructors is undefined: this constructor could be
called before GLib's constructor, in which case you cannot call
g_hash_table_new() because GLib's slice allocator is not initialized.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoImplement bt_private_connection_notification_iterator_from_private()
Philippe Proulx [Wed, 6 Sep 2017 00:30:00 +0000 (20:30 -0400)] 
Implement bt_private_connection_notification_iterator_from_private()

The function waas declared but not implemented yet.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoRename bt_X_from_private_X() -> bt_X_from_private()
Philippe Proulx [Wed, 6 Sep 2017 00:27:30 +0000 (20:27 -0400)] 
Rename bt_X_from_private_X() -> bt_X_from_private()

The second object's name is redundant in this context and only makes the
function name longer (sometimes much longer).

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoAvoid unnecessary inclusions in public headers
Philippe Proulx [Tue, 5 Sep 2017 23:58:22 +0000 (19:58 -0400)] 
Avoid unnecessary inclusions in public headers

Featured in this patch:

* In public headers, only include what is really needed by the
  declarations of the header itself. Copy forward declarations when
  possible instead of including just for the included file's forward
  declaration. Also indicate above each included header why it is
  included to justify it.

  This should prevent future bugs where we could, for example, remove an
  included header to replace it by a forward declaration, breaking some
  builds which relied on indirect inclusion (e.g. my project does not
  need to include <babeltrace/values.h> because it includes
  <babeltrace/ctf-ir/event-class.h>).

* Make all the plugin C source/header files include
  <babeltrace/babeltrace.h> instead of a bunch of public headers. This
  does not significantly increase the build time while making the source
  file much cleaner.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agobt2: split clock value module from clock class module
Philippe Proulx [Tue, 5 Sep 2017 23:01:03 +0000 (19:01 -0400)] 
bt2: split clock value module from clock class module

This doesn't change anything from the package's user's perspective, but
it's more in line with the C API.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoSplit clock value API from clock class API
Philippe Proulx [Tue, 5 Sep 2017 22:09:49 +0000 (18:09 -0400)] 
Split clock value API from clock class API

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agotests: remove `check` targets in subdirectories
Philippe Proulx [Sat, 2 Sep 2017 02:59:01 +0000 (22:59 -0400)] 
tests: remove `check` targets in subdirectories

Use a single `check` target at the `tests/` level like the project did
before to avoid stopping when a subdirectory fails and run all the
tests anyway. Use custom targets to run the tests of specific
directories (this only works from `tests/`) , for example:

    make check-cli check-plugins

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoTest bt2._OutputPort.create_notification_iterator()
Philippe Proulx [Sat, 2 Sep 2017 02:03:57 +0000 (22:03 -0400)] 
Test bt2._OutputPort.create_notification_iterator()

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agobt2: add bt2._OutputPort.create_notification_iterator()
Philippe Proulx [Sat, 2 Sep 2017 02:03:14 +0000 (22:03 -0400)] 
bt2: add bt2._OutputPort.create_notification_iterator()

This is the interface to create an output port notification iterator
from a given (public) output port.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoTest output port notification iterator
Philippe Proulx [Sat, 2 Sep 2017 02:00:11 +0000 (22:00 -0400)] 
Test output port notification iterator

Added tests are:

* You can create an output port notification iterator and the
  notifications it consumes and returns are the expected ones.

* You cannot run a graph once you have created a notification iterator
  on the output port of one of its components.

* You can create an output port notification iterator, subscribe to
  specific types of notifications, and the notifications it consumes and
  returns are the expected ones.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agolib: add output port notification iterator
Philippe Proulx [Sat, 2 Sep 2017 01:38:26 +0000 (21:38 -0400)] 
lib: add output port notification iterator

As of this patch, you can create an output port notification iterator
with a component's output port with
bt_output_port_notification_iterator_create(). This function, on
success:

1. Creates a notification iterator object, which contains a
   notification pointer.

2. Adds (creates) a colander sink component, passing this notification
   pointer's address to its initialization method data, along with
   a list of notification types to subscribe to received as a
   parameter.

3. Connects the passed output port to the colander component's input
   port.

4. Makes the targeted graph nonconsumable. This means, at this point,
   only bt_notification_iterator_next() can consume the graph, not the
   user.

5. Returns the created notification iterator.

When you call bt_notification_iterator_next() with this new notification
iterator, it puts its current notification and consumes its specific
colander sink within the graph to make it store the next notification,
forwarding any exceptional graph status as a notification iterator
status.

More than one output port notification iterators on a single graph are
supported: multiple colander sinks are added to the graph and each one
makes its own colander sink consume.

To avoid immediate or eventual component name clashes,
bt_output_port_notification_iterator_create() accepts an optional
colander name parameter. If you use NULL, then `colander` is used.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoSplit notification iterator API into base and specialized functions
Philippe Proulx [Thu, 24 Aug 2017 20:52:12 +0000 (16:52 -0400)] 
Split notification iterator API into base and specialized functions

This patch splits the notification iterator API into base functions
(<babeltrace/graph/notification-iterator.h>) shared by all notification
iterators:

* bt_notification_iterator_next()
* bt_notification_iterator_get_notification()

and specialized functions
(<babeltrace/graph/private-connection-notification-iterator.h>):

* bt_private_connection_notification_iterator_get_component()

This allows the future creation of specialized notification iterators
which can use the common API for basic operations. A "private connection
notification iterator", the only type of notification iterator as of
this patch, is a notification iterator created from a private connection
with bt_private_connection_create_notification_iterator().

The bt2 Python package is updated accordingly.
_GenericNotificationIterator has only the __next__() method, while
_PrivateConnectionNotificationIterator extends
_GenericNotificationIterator with the `component` property.

The name "private connection" is excluded from component class type
definitions and functions, and also from plugin development macros,
because this is the only type of notification iterator which a user can
provide anyway, for example:

* bt_component_class_notification_iterator_init_method
* bt_component_class_source_set_notification_iterator_init_method()

`bt_notification_iterator_next_return` is renamed to
`bt_notification_iterator_next_method_return` to indicate that this is
the user notification iterator's "next" method return type.
`bt_component_class_query_return` is renamed to
`bt_component_class_query_method_return` to match this convention.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoRemove notification iterator seeking API until it's supported
Philippe Proulx [Thu, 24 Aug 2017 20:40:55 +0000 (16:40 -0400)] 
Remove notification iterator seeking API until it's supported

Remove everything related to seeking a notification iterator until the
actual seeking operation is supported by the library. This ensures that
Babeltrace 2.0 plugins (including third-party ones) do not have seeking
methods until we are sure about the correct API.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agolib: graph: disallow recursive consuming
Philippe Proulx [Fri, 18 Aug 2017 20:43:18 +0000 (16:43 -0400)] 
lib: graph: disallow recursive consuming

Do not allow a user component to consume or run its parent graph if the
graph is in one of the following states (operations):

* Consuming (running)
* Connection ports
* Adding (creating) a component

test_graph.py tests this feature through the Python bindings.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agolib: graph.c: call bt_graph_consume_no_check() in bt_graph_run()
Philippe Proulx [Fri, 18 Aug 2017 20:03:17 +0000 (16:03 -0400)] 
lib: graph.c: call bt_graph_consume_no_check() in bt_graph_run()

This is why bt_graph_consume_no_check() exists in the first place, to
avoid checking arguments and the cancel state every time considering
that it's already checked.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoir: stream.c: do not truncate file at each packet flush
Philippe Proulx [Thu, 17 Aug 2017 22:00:27 +0000 (18:00 -0400)] 
ir: stream.c: do not truncate file at each packet flush

The whole stream file is truncated in bt_ctf_stream_destroy() anyway so
truncating at each packet flush is redundant.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: bindings/python/bt2: use appropriate log level variable names
Philippe Proulx [Thu, 17 Aug 2017 00:57:36 +0000 (20:57 -0400)] 
Fix: bindings/python/bt2: use appropriate log level variable names

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPython plugin provider: only finalize interpreter if we initialized it
Philippe Proulx [Thu, 17 Aug 2017 00:54:30 +0000 (20:54 -0400)] 
Python plugin provider: only finalize interpreter if we initialized it

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: common: improve color support handling
Philippe Proulx [Wed, 16 Aug 2017 19:06:55 +0000 (15:06 -0400)] 
Fix: common: improve color support handling

With this patch, terminal color codes are emitted by Babeltrace modules
if the `BABELTRACE_TERM_COLOR` environment variable is set to `ALWAYS`
or if all the following conditions are satisfied:

1. The `BABELTRACE_TERM_COLOR` environement variable is not set to
   `NEVER`.
2. The `TERM` environment variable starts with `xterm`, `rxvt`,
   `konsole`, `gnome`, `screen`, `tmux`, or `putty`.
3. For both the standard output and error streams: its file descriptor
   is a TTY.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: component.py: pass `other_port`, not `other_port_ptr` to user
Philippe Proulx [Tue, 15 Aug 2017 23:20:12 +0000 (19:20 -0400)] 
Fix: component.py: pass `other_port`, not `other_port_ptr` to user

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoAdd query executor
Philippe Proulx [Mon, 14 Aug 2017 21:55:53 +0000 (17:55 -0400)] 
Add query executor

Use a new object, a query executor, to query a component class:

    struct bt_query_executor *query_exec = bt_query_executor_create();
    enum bt_query_status status = bt_query_executor_query(query_exec,
        comp_cls, "object", params, &result);

The user's query method receives this query executor as a parameter so
that some state can be shared between the user who queries (calls
bt_query_executor_query()) and the user's method. Currently, only a
cancellation flag is part of the query executor's state, so that, if you
wish to cancel a query during a signal handler, you can call
bt_query_executor_cancel(): then, when the user's method's current
system call sets the EINTR error (or the equivalent on other supported
platforms), it can check the state of the query executor with
bt_query_executor_is_canceled() to know whether to retry the system call
(debugging mode, query executor is not canceled) or to return an error
(application mode, query executor is canceled).

This is the same mechanism that is used with the graph object and
component objects: bt_graph_cancel() and bt_graph_is_canceled().

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoTests: erroneous usage of if preprocessor directive
Jérémie Galarneau [Thu, 31 Aug 2017 20:59:48 +0000 (16:59 -0400)] 
Tests: erroneous usage of if preprocessor directive

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: remove g_spawn_check_exit_status to support glib 2.22
Michael Jeanson [Wed, 30 Aug 2017 18:54:23 +0000 (14:54 -0400)] 
Fix: remove g_spawn_check_exit_status to support glib 2.22

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPort: don't quote wc output in test scripts
Michael Jeanson [Wed, 30 Aug 2017 18:29:26 +0000 (14:29 -0400)] 
Port: don't quote wc output in test scripts

The 'wc' command on macOS prefixes the count it returns with spaces, if
we quote the output it won't be properly converted to integer for the
comparison.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoMissing stamp file in .gitignore
Jérémie Galarneau [Wed, 30 Aug 2017 18:16:00 +0000 (14:16 -0400)] 
Missing stamp file in .gitignore

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: import of ctf_writer in bt2.stream
Michael Jeanson [Tue, 29 Aug 2017 22:04:45 +0000 (18:04 -0400)] 
Fix: import of ctf_writer in bt2.stream

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: typo in ctf_writer error msg
Michael Jeanson [Tue, 29 Aug 2017 22:04:08 +0000 (18:04 -0400)] 
Fix: typo in ctf_writer error msg

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agofilter.lttng-utils.debug-info fix: wrong type used as function parameter
Jérémie Galarneau [Tue, 29 Aug 2017 22:36:32 +0000 (18:36 -0400)] 
filter.lttng-utils.debug-info fix: wrong type used as function parameter

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agosrc.ctf.fs fix: wrong type specifier used in logging statement
Jérémie Galarneau [Tue, 29 Aug 2017 21:59:11 +0000 (17:59 -0400)] 
src.ctf.fs fix: wrong type specifier used in logging statement

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoTest fix: python plugin provider with new bindings
Michael Jeanson [Tue, 29 Aug 2017 18:04:01 +0000 (14:04 -0400)] 
Test fix: python plugin provider with new bindings

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: silence unused warning in native_bt
Michael Jeanson [Tue, 29 Aug 2017 16:17:36 +0000 (12:17 -0400)] 
Fix: silence unused warning in native_bt

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: python bindings OOT build
Michael Jeanson [Mon, 28 Aug 2017 21:00:41 +0000 (17:00 -0400)] 
Fix: python bindings OOT build

All the source files required to build the python bindings with
distutils must be in the same directory, since some of them are
generated by the build system, copy the static ones to the build
directory when it is different from the source directory.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoRemove the python bindinds tests switch from configure
Michael Jeanson [Wed, 23 Aug 2017 21:23:17 +0000 (17:23 -0400)] 
Remove the python bindinds tests switch from configure

The bindings tests are automatically enabled when the bindings are.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoAdd python tap runner to the tree
Michael Jeanson [Wed, 23 Aug 2017 21:19:41 +0000 (17:19 -0400)] 
Add python tap runner to the tree

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoBuild Python bindings with distutils for consistent installs
Michael Jeanson [Wed, 23 Aug 2017 15:43:05 +0000 (11:43 -0400)] 
Build Python bindings with distutils for consistent installs

This patch changes the build system used to compile and install the
Python Bindings. Distutils is used to find the right install directory.
When the install directory generated from the install prefix is not in
the Python search path (PYTHONPATH), we print a warning explaining what
can be done to include it.
It uses Distutils which is part of the Python standard library.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: add missing void param to bt_clock_class_priority_map_create
Michael Jeanson [Tue, 29 Aug 2017 16:16:39 +0000 (12:16 -0400)] 
Fix: add missing void param to bt_clock_class_priority_map_create

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: build lib before python-plugin-provider
Michael Jeanson [Mon, 28 Aug 2017 21:08:28 +0000 (17:08 -0400)] 
Fix: build lib before python-plugin-provider

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoTest: run debug-info even with built-in plugins
Michael Jeanson [Mon, 28 Aug 2017 19:04:28 +0000 (15:04 -0400)] 
Test: run debug-info even with built-in plugins

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix test: don't link tests directly with plugins
Michael Jeanson [Mon, 28 Aug 2017 18:48:58 +0000 (14:48 -0400)] 
Fix test: don't link tests directly with plugins

Move the debug-info code to a convenience library that is then used by
both the plugin and the test code. This fixes build with static
libraries disabled where it's not possible to link directly the plugin
shared object which is a module.

Reviewed-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix test: OOT build of test_trace_copy and test_trimmer
Michael Jeanson [Mon, 28 Aug 2017 16:12:08 +0000 (12:12 -0400)] 
Fix test: OOT build of test_trace_copy and test_trimmer

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: support older pkg-config autoconf macros
Michael Jeanson [Mon, 21 Aug 2017 20:56:05 +0000 (16:56 -0400)] 
Fix: support older pkg-config autoconf macros

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPort: don't quote wc output in test scripts
Michael Jeanson [Mon, 21 Aug 2017 19:24:36 +0000 (15:24 -0400)] 
Port: don't quote wc output in test scripts

The 'wc' command on macOS prefixes the count it returns with spaces, if
we quote the output it won't be properly converted to integer for the
comparison.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoReport plugins without a path as "built-in"
Michael Jeanson [Tue, 18 Jul 2017 15:21:02 +0000 (11:21 -0400)] 
Report plugins without a path as "built-in"

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPort: replace literal '/' with G_DIR_SEPARATOR
Michael Jeanson [Tue, 6 Jun 2017 18:56:30 +0000 (14:56 -0400)] 
Port: replace literal '/' with G_DIR_SEPARATOR

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPort: normalize windows path on Mingw
Michael Jeanson [Tue, 6 Jun 2017 15:24:21 +0000 (11:24 -0400)] 
Port: normalize windows path on Mingw

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPort: handle ctrl+c on Mingw
Michael Jeanson [Wed, 31 May 2017 19:13:41 +0000 (15:13 -0400)] 
Port: handle ctrl+c on Mingw

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agosrc.ctf.fs: implement stream indexing
Jérémie Galarneau [Sun, 27 Aug 2017 19:57:30 +0000 (15:57 -0400)] 
src.ctf.fs: implement stream indexing

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agosrc.ctf.fs: move internal util to ctf/common/utils
Jérémie Galarneau [Tue, 22 Aug 2017 21:33:41 +0000 (17:33 -0400)] 
src.ctf.fs: move internal util to ctf/common/utils

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agosrc.ctf.fs cleanup: unused page size variable
Jérémie Galarneau [Wed, 23 Aug 2017 20:46:25 +0000 (16:46 -0400)] 
src.ctf.fs cleanup: unused page size variable

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: global logging symbols defined multiple times
Jérémie Galarneau [Wed, 23 Aug 2017 20:41:53 +0000 (16:41 -0400)] 
Fix: global logging symbols defined multiple times

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPort fix: don't round mmap offset to next page
Jérémie Galarneau [Tue, 22 Aug 2017 19:04:45 +0000 (15:04 -0400)] 
Port fix: don't round mmap offset to next page

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPort fix: Windows does not allow read-only mappings > file's size
Jérémie Galarneau [Tue, 22 Aug 2017 18:35:13 +0000 (14:35 -0400)] 
Port fix: Windows does not allow read-only mappings > file's size

Reported-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoTest fix: handle debug info disabled in test_convert_args
Michael Jeanson [Fri, 18 Aug 2017 21:51:00 +0000 (17:51 -0400)] 
Test fix: handle debug info disabled in test_convert_args

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoTest fix: use portable path code in test_plugin
Michael Jeanson [Fri, 18 Aug 2017 18:28:58 +0000 (14:28 -0400)] 
Test fix: use portable path code in test_plugin

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoTest fix: handle timestamps order in test_trace_copy
Michael Jeanson [Thu, 17 Aug 2017 16:09:53 +0000 (12:09 -0400)] 
Test fix: handle timestamps order in test_trace_copy

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoTest: rework shell test scripts
Michael Jeanson [Wed, 16 Aug 2017 19:06:19 +0000 (15:06 -0400)] 
Test: rework shell test scripts

Moved common code to common.sh and lots of shellcheck syntax fixes and
cleanup.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPort: use SIZE_MAX as max size_t value
Michael Jeanson [Fri, 21 Jul 2017 15:44:07 +0000 (11:44 -0400)] 
Port: use SIZE_MAX as max size_t value

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPort: fix logging with C99 format specifiers on Mingw
Michael Jeanson [Mon, 14 Aug 2017 20:10:20 +0000 (16:10 -0400)] 
Port: fix logging with C99 format specifiers on Mingw

On Mingw when __USE_MINGW_ANSI_STDIO is defined, the printf family of
functions expects C99 format specifiers instead of the MSVC specific
ones. This should be reflected in the logging code to get proper display
of C99 types.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoTest fix: free() of uninitialized pointer on error path
Jérémie Galarneau [Mon, 21 Aug 2017 18:41:39 +0000 (14:41 -0400)] 
Test fix: free() of uninitialized pointer on error path

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPort: Replace fork() in test_ctf_writer
Michael Jeanson [Tue, 15 Aug 2017 22:05:31 +0000 (18:05 -0400)] 
Port: Replace fork() in test_ctf_writer

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agotests: add diag_multiline() helper to escape multi-line diagnostic info
Jérémie Galarneau [Fri, 18 Aug 2017 23:43:11 +0000 (19:43 -0400)] 
tests: add diag_multiline() helper to escape multi-line diagnostic info

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoTest: use static data in test_ctf_writer
Michael Jeanson [Wed, 9 Aug 2017 22:35:56 +0000 (18:35 -0400)] 
Test: use static data in test_ctf_writer

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix test: remove hardcoded /tmp path
Michael Jeanson [Wed, 9 Aug 2017 20:01:22 +0000 (16:01 -0400)] 
Fix test: remove hardcoded /tmp path

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoAdd Python plugin provider tests
Philippe Proulx [Wed, 9 Aug 2017 22:24:53 +0000 (18:24 -0400)] 
Add Python plugin provider tests

This is a simple test for Python plugins. I'm using Python to load
the Python plugin for simplicity, but the C API could load it as well.

This tests both python-plugin-provider/python-plugin-provider.c and
bindings/python/bt2/py_plugin.py.

What happens is this:

1. test.sh executes Python which executes the test
   (test_python_plugin_provider.py).
2. test_python_plugin_provider.py imports the bt2 Python package.
3. The bt2 Python package imports _native_bt.so.
4. _native_bt.so is linked with libbabeltrace.so.
5. libbabeltrace.so, on construction, loads
   libbabeltrace-python-plugin-provider.so.
5. test_python_plugin_provider.py tries to load the Python plugin
   with `bt2.find_plugins()`.
6. `bt2.find_plugins()` calls plugin_create_all_from_file(), which,
   since the path points to a Python file, makes the Python plugin
   provider try to initialize the Python interpreter (already
   initialized by Python in step 1), import the `bt2.py_plugin` module,
   and load the Python file to create a bt_plugin object.

Then the test makes sure that the returned Python plugin object has the
expected properties and component classes.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoPython plugin provider: log if Python interpreter is already initialized
Philippe Proulx [Wed, 9 Aug 2017 22:13:03 +0000 (18:13 -0400)] 
Python plugin provider: log if Python interpreter is already initialized

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agolib/plugin/plugin.c: log more details when g_module_open() fails
Philippe Proulx [Wed, 9 Aug 2017 22:12:34 +0000 (18:12 -0400)] 
lib/plugin/plugin.c: log more details when g_module_open() fails

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agopython-plugin-provider/Makefile.am: link to libbabeltrace
Philippe Proulx [Wed, 9 Aug 2017 22:13:33 +0000 (18:13 -0400)] 
python-plugin-provider/Makefile.am: link to libbabeltrace

Make the Python plugin provider dependent on libbabeltrace because
it needs symbols from the library.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix sink.ctf.fs: NULL dereference in logging statement
Jérémie Galarneau [Wed, 16 Aug 2017 19:40:02 +0000 (15:40 -0400)] 
Fix sink.ctf.fs: NULL dereference in logging statement

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix filter.utils.muxer: NULL dereference in logging statement
Jérémie Galarneau [Wed, 16 Aug 2017 19:29:11 +0000 (15:29 -0400)] 
Fix filter.utils.muxer: NULL dereference in logging statement

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: overflowed return value
Mathieu Desnoyers [Tue, 15 Aug 2017 21:54:34 +0000 (17:54 -0400)] 
Fix: overflowed return value

Found by Coverity (attempt to fix, unsure it will convince Coverity of
the holiness of our code):

2. overflow: Subtract operation overflows on operands align and 1UL.

CID 1376162 (#1 of 1): Overflowed return value (INTEGER_OVERFLOW)3.
overflow_sink: Overflowed or truncated value (or a value computed from
an overflowed or truncated value) align != 0UL && !(align & align - 1UL)
used as return value.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: attempt to fix improper use of negative value
Mathieu Desnoyers [Tue, 15 Aug 2017 21:36:19 +0000 (17:36 -0400)] 
Fix: attempt to fix improper use of negative value

Found by Coverity, unsure that the fix will make it happy:

CID 1376189 (#1 of 1): Improper use of negative value
(NEGATIVE_RETURNS)negative_returns: Passing negative constant -1 to a
parameter that cannot be negative. [hide details]

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: add missing overflow check in bt_ctf_stream_pos_access_ok
Mathieu Desnoyers [Tue, 15 Aug 2017 21:30:03 +0000 (17:30 -0400)] 
Fix: add missing overflow check in bt_ctf_stream_pos_access_ok

Found by Coverity:

2. overflow: Subtract operation overflows on operands bit_offset and 1UL.

CID 1377278 (#1 of 1): Overflowed return value (INTEGER_OVERFLOW).
overflow_sink: Overflowed or truncated value (or a value computed from
an overflowed or truncated value) bt_ctf_stream_pos_move(pos, ({...}))
used as return value.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
This page took 0.041554 seconds and 4 git commands to generate.