deliverable/barectf.git
3 years agoconfig_parse.py: fix PEP 8 errors, as reported by `flake8`
Philippe Proulx [Fri, 29 May 2020 19:57:17 +0000 (15:57 -0400)] 
config_parse.py: fix PEP 8 errors, as reported by `flake8`

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years agotox.ini: make `flake8` ignore `templates.py`
Philippe Proulx [Fri, 29 May 2020 19:56:33 +0000 (15:56 -0400)] 
tox.ini: make `flake8` ignore `templates.py`

`templates.py` is only a bunch of strings; no application code there.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years agotox.ini: run `flake8` for the `barectf` directory only
Philippe Proulx [Fri, 29 May 2020 19:56:11 +0000 (15:56 -0400)] 
tox.ini: run `flake8` for the `barectf` directory only

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years agoconfig_parse.py: comment `_ConfigParseErrorCtx` and `_ConfigParseError`
Philippe Proulx [Fri, 29 May 2020 19:47:55 +0000 (15:47 -0400)] 
config_parse.py: comment `_ConfigParseErrorCtx` and `_ConfigParseError`

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years ago_YamlConfigParser: rename field type creation methods (more explicit)
Philippe Proulx [Fri, 29 May 2020 19:35:31 +0000 (15:35 -0400)] 
_YamlConfigParser: rename field type creation methods (more explicit)

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years ago_YamlConfigParser: rename `_root_yaml_path` 👉 `_root_path`
Philippe Proulx [Fri, 29 May 2020 19:33:18 +0000 (15:33 -0400)] 
_YamlConfigParser: rename `_root_yaml_path` ðŸ‘‰ `_root_path`

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years agoconfig_parse.py: use a `_YamlConfigParser` object a single time
Philippe Proulx [Fri, 29 May 2020 19:30:52 +0000 (15:30 -0400)] 
config_parse.py: use a `_YamlConfigParser` object a single time

This patch changes `_YamlConfigParser` so that you can only use it once:
the object parses the file on construction, and then makes the
configuration object available through its `config` property.

Because you can't parse another file with the same parser, we don't need
to care about any stale state.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years agoconfig_parse.py: normalize exception contexts and messages
Philippe Proulx [Fri, 29 May 2020 19:21:49 +0000 (15:21 -0400)] 
config_parse.py: normalize exception contexts and messages

This patch also changes the terminology of the messages to use "type"
and "field type" as much as possible, for example "event type",
"stream type", and "integer field type".

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years agoconfig_parse.py: update/improve comments
Philippe Proulx [Fri, 29 May 2020 16:48:49 +0000 (12:48 -0400)] 
config_parse.py: update/improve comments

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years agobarectf: rename `ConfigParseError` 👉 `_ConfigParseError`
Philippe Proulx [Fri, 29 May 2020 15:29:03 +0000 (11:29 -0400)] 
barectf: rename `ConfigParseError` ðŸ‘‰ `_ConfigParseError`

This is not a class which the API user can instantiate.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years agobarectf: use JSON schema to validate special root field type fields
Philippe Proulx [Thu, 28 May 2020 20:32:52 +0000 (16:32 -0400)] 
barectf: use JSON schema to validate special root field type fields

This patch removes almost everything from the
`_MetadataSpecialFieldsValidator` class, moving those checks to the
`schemas/2/config/config.yaml` JSON schema instead.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years agobarectf: schemas: use conditionals intead of `oneOf` when possible
Philippe Proulx [Thu, 28 May 2020 18:18:48 +0000 (14:18 -0400)] 
barectf: schemas: use conditionals intead of `oneOf` when possible

Using `if`/`then`/`else` instead of `oneOf` makes the `jsonschema`
validator create much more readable errors.

For example:

Before:
    Error:
      Configuration: Cannot create configuration from YAML file
        `config.yaml`
      Configuration object:
      `metadata` property:
      `clocks` property:
      `some_clock` property:
      `offset` property:
      `seconds` property: -2 is not valid under any of the given
        schemas: -2 is less than the minimum of 0; -2 is not of type
        'null' (from schema `2/config/config`)

Now:
    Error:
      Configuration: Cannot create configuration from YAML file
        `config.yaml`
      Configuration object:
      `metadata` property:
      `clocks` property:
      `some_clock` property:
      `offset` property:
      `seconds` property: -2 is less than the minimum of 0
        (from schema `2/config/config`)

This is because, with conditionals, we assume that the user intended
something with some valid schema, and add more constraints. The example
above is for an integer having a minimum value of 0, or a null value. As
soon as we know that the value is an integer, then we know its minimum
must be 0; we decide to not care about the fact that the whole value
could also be null (which the old message indicated). In my opinion,
this is a better UX.

The example above is simple. For more complex schemas, the UX gain is
even more obvious.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years ago_SchemaValidator.validate(): use "element" prefix for array elements
Philippe Proulx [Thu, 28 May 2020 18:16:47 +0000 (14:16 -0400)] 
_SchemaValidator.validate(): use "element" prefix for array elements

Otherwise the context's object name would be:

    `2` property

instead of

    Element 2

for example.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years agoLICENSE: reflow licence header for 72 columns
Philippe Proulx [Wed, 27 May 2020 03:04:48 +0000 (23:04 -0400)] 
LICENSE: reflow licence header for 72 columns

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years agoLICENSE: update copyright years
Philippe Proulx [Wed, 27 May 2020 03:04:32 +0000 (23:04 -0400)] 
LICENSE: update copyright years

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years agobarectf: reflow licence headers for 72 columns
Philippe Proulx [Wed, 27 May 2020 03:02:30 +0000 (23:02 -0400)] 
barectf: reflow licence headers for 72 columns

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years agobarectf: update copyright years
Philippe Proulx [Wed, 27 May 2020 03:00:16 +0000 (23:00 -0400)] 
barectf: update copyright years

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years agogen.py, templates.py: replace double quotes with backticks (generated)
Philippe Proulx [Wed, 27 May 2020 02:58:10 +0000 (22:58 -0400)] 
gen.py, templates.py: replace double quotes with backticks (generated)

Style preference.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years agocli.py, config_parse.py: replace double quotes with backticks
Philippe Proulx [Wed, 27 May 2020 02:54:36 +0000 (22:54 -0400)] 
cli.py, config_parse.py: replace double quotes with backticks

Style preference.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years agoUse JSON schemas to validate the layout and types of the YAML config.
Philippe Proulx [Fri, 22 May 2020 15:06:31 +0000 (11:06 -0400)] 
Use JSON schemas to validate the layout and types of the YAML config.

This patch changes `config_parse.py` so as to use JSON schemas
(<https://json-schema.org/>) to validate many aspects of a barectf YAML
configuration file instead of having redundant, manual checks.

JSON schemas are found in the `barectf` package's `schemas` directory by
an instance of the new `_SchemaValidator` class. Such an object finds
all the YAML files in the `schemas` directory and, for each of them:

1. Loads it (YAML to Python dictionary).
2. Gets its ID (`$id` property).
3. Adds the schema (1.) to a local schema store using its ID (2.).

Then _SchemaValidator.validate() uses this schema store to build a JSON
schema reference resolver and validator from the `jsonschema` package
(<https://pypi.org/project/jsonschema/>).

The `jsonschema` dependency is added to `pyproject.toml` and
`poetry.lock`. We need a version which supports JSON Schema draft 7
because we need the conditional keywords (`if`/`then`).

Because the barectf YAML configuration file format supports features
which do not exist natively in YAML (inclusions, field type aliases,
field type inheritance, and log level aliases), we can't have a single
JSON schema for the "raw" configuration file. There are actually five
validation steps, each one having its JSON schema:

1. Make sure the configuration object is minimally valid, that is, it's
   an object and has a `version` property with a supported value.

   Schema: `config/config-min.yaml`.

2. Make sure the configuration object is valid for the inclusion phase.

   Those schemas only validate that the metadata/stream/event objects
   are objects and that any `$include` property is valid.

   Each time the YAML configuration parser loads a partial YAML file for
   inclusion, it validates the resulting object using the corresponding
   schema depending on what's being included.

   Knowing those objects are valid as such is enough to process
   inclusions without caring about the resulting configuration object's
   validity.

   Schemas:

   * `2/config/clock-pre-include.yaml`
   * `2/config/config-pre-include.yaml`
   * `2/config/event-pre-include.yaml`
   * `2/config/include-prop.yaml`
   * `2/config/metadata-pre-include.yaml`
   * `2/config/stream-pre-include.yaml`
   * `2/config/trace-pre-include.yaml`

3. Make sure the configuration object is valid for the field type
   expansion phase.

   This schema digs into compound field types recursively to make sure
   any field type is either a string (field type alias) or an object
   with either a `class` property or an `$inherit`/`inherit` (mutually
   exclusive) property.

   Knowing the configuration object is valid as such is enough to expand
   field types without caring about the resulting configuration object's
   validity. So, for example, a resulting, expanded field type could be:

       class: string
       size: 16
       value-type:
         class: array
       meow: mix

   We just don't care at this point, as long as field types are
   "complete".

   Schema: `2/config/config-pre-field-type-expansion.yaml`.

4. Make sure the configuration object is valid for the log level
   expansion phase.

   This schema validates the `$log-levels` property of the metadata
   object as well as the `log-level` property of any event object.

   Knowing the configuration object is valid as such is enough to expand
   log levels, that is, to replace log level strings with their numeric
   value, without caring about the resulting configuration object's
   validity.

   Schema: `2/config/config-pre-log-level-expansion.yaml`.

5. Make sure the configuration object is valid.

   This validates the final, effective configuration object which, at
   this point, do not contain any:

   * `$include` properties.
   * Strings as field types.
   * `$inherit`/`inherit` properties (field type objects).
   * `$log-levels` property (metadata object).
   * Strings for the `log-level` properties (event objects).

   Also, this is the configuration object which the `--dump-config`
   option prints now.

   * `2/config/byte-order-prop.yaml`
   * `2/config/config.yaml`
   * `2/config/field-type.yaml`
   * `2/config/uuid-prop.yaml`

After step 5., there's not much to validate in `config_parse.py` itself:

* Make sure referred clock type objects (in `property-mappings` properties
  of integer field type objects) exist.

* Make sure identifiers are valid (the schemas do not always validate
  that they exclude CTF keywords for technical reasons).

* Make sure alignment values are valid (powers of two).

* Make sure there's only one default stream type name and that it
  exists.

* Make sure the values of enumeration field type members are within the
  field type's range depending on the value (integer) field type's size.

* Everything that remains in `_BarectfMetadataValidator`.

* Everything in `_MetadataSpecialFieldsValidator`, which is untouched
  because that's not something we validate with JSON schemas, although
  we could possibly, but it might stretch the use case.

_SchemaValidator.validate() catches a `jsonschema` exception and
converts it to a barectf `ConfigParseError` exception to avoid leaking
`jsonschema` objects (implementation detail) from barectf calls. I made
an effort to make the error object as readable as possible, for example
converting the instance path to context object names, but there's room
for improvement here.

No functional change intended, except for the modified raised
`ConfigParseError` objects. Tests are not changed and pass.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years agoconfig_parse.py: add _append_error_ctx() to remove redundant code
Philippe Proulx [Wed, 20 May 2020 18:58:16 +0000 (14:58 -0400)] 
config_parse.py: add _append_error_ctx() to remove redundant code

_append_error_ctx() appends context to a given `ConfigParseError`
exception and then reraises it.

Using

    catch ConfigParseError as exc:
        _append_error_ctx(exc, 'My object', 'My message')

instead of

    catch ConfigParseError as exc:
        exc.append_ctx('My object', 'My message')
        raise

makes sure we don't forget to reraise.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years agoMake configuration and metadata objects immutable
Philippe Proulx [Fri, 15 May 2020 21:12:39 +0000 (17:12 -0400)] 
Make configuration and metadata objects immutable

This patch changes how configuration and metadata objects are built.

Before this patch, the YAML configuration parser in `config.py` created
default metadata objects and then set their properties as it parsed the
YAML node.

Having such mutable objects means they can change at anytime once they
exist.

This patch changes this so that all configuration and metadata objects
accept all they need at construction time and do not offer setters.

`config.py` now only contains the `Config` and `ConfigOptions` classes
as well as the from_file() function. All the YAML parsing and
configuration/metadata construction is in `config_parse.py`.

In `config_parse.py`, there are mutable "pseudo" classes which
correspond to the immutable versions. They are only used during the
parsing stage and, at the end, converted to their public, immutable
equivalents.

The configuration validation is done at the YAML/pseudo level, which
means the public configuration/metadata classes do not validate anything
(narrow contract). Their constructors _should_ at least assert that
everything looks okay, but this work is not part of this patch.

No functional changes intended by this patch at the CLI level, which is
why all tests still pass without modification.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years agoCapitalize exception messages and what the CLI prints
Philippe Proulx [Fri, 15 May 2020 19:55:14 +0000 (15:55 -0400)] 
Capitalize exception messages and what the CLI prints

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years agotest.bash: pass all `.bats` files to `bats`
Philippe Proulx [Fri, 15 May 2020 19:35:00 +0000 (15:35 -0400)] 
test.bash: pass all `.bats` files to `bats`

This makes `bats` accumulate tests and run all of them with a global
progress, which is much better.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years agobarectf_config_check_fail(): check that failure is caused by cfg. error
Philippe Proulx [Fri, 15 May 2020 19:31:59 +0000 (15:31 -0400)] 
barectf_config_check_fail(): check that failure is caused by cfg. error

This patch makes barectf_config_check_fail() in `config/common.bash`
check that the output of `barectf` contains the string

    configuration: cannot create configuration

so as to ensure that the failure is _at least_ caused by a configuration
error, even if we don't know if the real failure cause matches what the
test intends to verify.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years agotests/config/pass/everything/pass.bats: quote `$CC`
Philippe Proulx [Fri, 15 May 2020 19:31:33 +0000 (15:31 -0400)] 
tests/config/pass/everything/pass.bats: quote `$CC`

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years agotests/config/pass/everything/pass.bats: make test directory the CWD
Philippe Proulx [Fri, 15 May 2020 19:31:11 +0000 (15:31 -0400)] 
tests/config/pass/everything/pass.bats: make test directory the CWD

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years agotests/config/fail/yaml/invalid.yaml: fix invalid YAML (list/neg. value)
Philippe Proulx [Fri, 15 May 2020 19:30:34 +0000 (15:30 -0400)] 
tests/config/fail/yaml/invalid.yaml: fix invalid YAML (list/neg. value)

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years agocli: print traceback for unknown exceptions
Philippe Proulx [Fri, 15 May 2020 19:29:46 +0000 (15:29 -0400)] 
cli: print traceback for unknown exceptions

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years agoAppend context to a `ConfigError` instead of wrapping another exception
Philippe Proulx [Fri, 15 May 2020 19:28:59 +0000 (15:28 -0400)] 
Append context to a `ConfigError` instead of wrapping another exception

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years agoRemove everything related to CTF sequences and variants
Philippe Proulx [Fri, 15 May 2020 01:42:48 +0000 (21:42 -0400)] 
Remove everything related to CTF sequences and variants

Those CTF types are not supported by barectf currently, yet some code
was written to support them at the configuration level. This is some
rather complex (dead) code to resolve field paths and validate those
types, but without anything to test it. In fact, the code exists to
parse a variant type, for example, but barectf fails with an error (not
supported) when you do so.

The code is still in this repository's history; let's add it back when
we can really test it.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years agoConvert project to a Poetry project
Philippe Proulx [Thu, 14 May 2020 19:22:09 +0000 (15:22 -0400)] 
Convert project to a Poetry project

Poetry <https://python-poetry.org/> handles the build creation and
`setup.py` and `PKG-INFO` generation.

Poetry also handles dependencies and can create a corresponding virtual
environment having them installed.

Poetry can also publish.

`poetry.lock` was generated by `poetry install` and ensures this
specific version of barectf is tested with those specific versions of
the dependencies.

Setuptools is a run-time dependency for its `pkg_resources` package. I
use `*` for its version constraint because somehow Poetry needs
Setuptools itself so it skips this dependency (see
<https://github.com/python-poetry/poetry/issues/1584>). The `setuptools`
dependency still ends up in `setup.py`.

`tox.ini` is calibrated so that tox doesn't manage any dependency;
everything is done through Poetry (except `flake8` which doesn't need
barectf to be installed).

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
3 years agobarectf/__init__.py: build version string instead of parsing it
Philippe Proulx [Thu, 14 May 2020 16:47:24 +0000 (12:47 -0400)] 
barectf/__init__.py: build version string instead of parsing it

This is more natural and less complicated.

Leaving get_version_tuple() as some modules use it.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agoAdd git-review config
Michael Jeanson [Tue, 4 Jun 2019 15:52:19 +0000 (11:52 -0400)] 
Add git-review config

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I12ee3f57fc2e9cafb74cd489add4f8dbb89b2ca9

5 years agobarectf v2.3.1
Philippe Proulx [Mon, 25 Mar 2019 20:28:03 +0000 (16:28 -0400)] 
barectf v2.3.1

Signed-off-by: Philippe Proulx <pproulx@efficios.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
5 years agoFix: do not sample clock when closing/opening a packet for an event not fitting
Philippe Proulx [Mon, 25 Mar 2019 20:05:13 +0000 (16:05 -0400)] 
Fix: do not sample clock when closing/opening a packet for an event not fitting

This patch adds members to the generated barectf context to save the
current (becomes last) event's timestamp and use it when closing and
opening packets when the event does not fit the current packet instead
of sampling the clock again.

Without this patch, with this scenario:

1. Application calls a tracing function.
2. Tracing function samples the clock.
3. Event does not fit the current packet size: current packet is closed,
   sampling the clock, and new packet is opened, also sampling the
   clock.
4. Event is serialized to the new packet.

The new packet's timestamp is greater than its first event's timestamp,
because this event's timestamp is the result of sampling the clock
before sampling it to close the current packet and open a new one.

Babeltrace 1 accepts and reads the resulting stream, but Babeltrace 2's
muxer is more strict and refuses a message which is in the past.

Signed-off-by: Philippe Proulx <pproulx@efficios.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
5 years agoFix: use the same actions to compute event size and to serialize
Philippe Proulx [Fri, 11 Jan 2019 21:52:35 +0000 (16:52 -0500)] 
Fix: use the same actions to compute event size and to serialize

Issue
=====
In `gen.py`, the code to generate the event size computation C code and
the event serialization C code are not the same. There are optimizations
to avoid generating useless alignment statements in one which are
missing in the other, and those optimizations have a bug. This bug can
lead to the space reservation phase of a tracing function passing
(enough space for a given event to serialize), but the serialization
phase writing passed the end of the packet buffer.

Solution
========
Make barectf use the exact same actions to generate the event size
computation C code and the event serialization C code.

In `gen.py`, `_SerializationActions` is a new class of which you can
use an instance to append a root scope field type
(_SerializationActions.append_root_scope_type()) and to retrieve a list
of resulting serialization actions. The two types of serialization
actions are:

`_AlignSerializationAction`:
    Force the alignment of the current bit position within the packet.

`_SerializeSerializationAction`:
Serialize a field from a given type.

Each action object contains:

* An optional field type which is responsible for the action.
* An offset within the current byte when this action needs
  to be executed (to generate the appropriate bt_bitfield_write_*()
  calls).
* A list of names which identify this action (complete field name/path).

_SerializationActions.append_root_scope_type() performs the necessary
optimizations (does not align when specific conditions are met to avoid
a useless alignment statement). Then those optimizations apply to both
the event size computation and event serialization C code, the only
difference being that the event size computation code adds to a partial
sum variable instead of writing to the packet buffer.

The alignment optimization technique is straightforward at this point
and could be improved: if the alignment requirement did not change since
the last alignment, and if there's no padding between a field and the
previous field, then do not align for this field; otherwise, align.

Known drawbacks
===============
Because the alignment optimization technique is changed to be simpler,
some barectf configurations could make barectf generate more C code
(which means more compiled code and slower execution eventually).
However, the previously generated C code was incorrect anyway.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
6 years agobarectf v2.3.0
Philippe Proulx [Tue, 17 Oct 2017 21:40:57 +0000 (17:40 -0400)] 
barectf v2.3.0

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
6 years agotox.ini: no `pep8` env by default, fix testenv:pep8 env
Philippe Proulx [Tue, 17 Oct 2017 21:30:40 +0000 (17:30 -0400)] 
tox.ini: no `pep8` env by default, fix testenv:pep8 env

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
6 years agobarectf/config.py: fix whitespaces (PEP 8)
Philippe Proulx [Tue, 17 Oct 2017 21:30:18 +0000 (17:30 -0400)] 
barectf/config.py: fix whitespaces (PEP 8)

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
6 years agotox: Add usedevelop
Michael Jeanson [Tue, 17 Oct 2017 20:43:21 +0000 (16:43 -0400)] 
tox: Add usedevelop

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
6 years agoFix: fail tests succeed on env failure
Michael Jeanson [Tue, 17 Oct 2017 20:36:59 +0000 (16:36 -0400)] 
Fix: fail tests succeed on env failure

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
6 years agotests/common.bash: use $status, not $?, when using `run`
Philippe Proulx [Tue, 17 Oct 2017 19:25:25 +0000 (15:25 -0400)] 
tests/common.bash: use $status, not $?, when using `run`

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
6 years agoMerge branch 'tox' of https://github.com/mjeanson/barectf
Philippe Proulx [Tue, 17 Oct 2017 19:11:40 +0000 (15:11 -0400)] 
Merge branch 'tox' of https://github.com/mjeanson/barectf

6 years agoAdd tox support
Michael Jeanson [Tue, 17 Oct 2017 18:45:42 +0000 (14:45 -0400)] 
Add tox support

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
6 years agoMerge branch 'master' of https://github.com/mjeanson/barectf
Philippe Proulx [Tue, 17 Oct 2017 18:53:10 +0000 (14:53 -0400)] 
Merge branch 'master' of https://github.com/mjeanson/barectf

6 years agoFix: templates.py: call bt_piecewise_rshift() with _vtype (BE)
Philippe Proulx [Tue, 17 Oct 2017 18:52:16 +0000 (14:52 -0400)] 
Fix: templates.py: call bt_piecewise_rshift() with _vtype (BE)

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
6 years agoFix: return proper exit code on test failure
Michael Jeanson [Tue, 17 Oct 2017 18:50:48 +0000 (14:50 -0400)] 
Fix: return proper exit code on test failure

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
7 years agolinux-fs-simple example Makefile: make platform depend on barectf.h
Philippe Proulx [Sat, 19 Nov 2016 19:23:18 +0000 (14:23 -0500)] 
linux-fs-simple example Makefile: make platform depend on barectf.h

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
7 years agoAdd tracing activity and tracing section API
Philippe Proulx [Sat, 19 Nov 2016 19:00:14 +0000 (14:00 -0500)] 
Add tracing activity and tracing section API

The new barectf_is_tracing_enabled() function allows the instrumented
program to enable or disable tracing for a specific barectf context.
This is a thread-safe API, in that it only sets a member of the context
to 0 or 1. Disabling the tracing activity does not guarantee, however,
that the current packet or back-end is not currently being altered. See
the next paragraph about this.

The new barectf_is_in_tracing_section() function allows the instrumented
program to know if its tracing thread is currently in a barectf section
or not. barectf_is_in_tracing_section_ptr() returns a volatile pointer
to this same information.

Both functions can be used together to implement a snapshot action for a
given platform, something like:

1. The instrumented thread calls the barectf tracing functions during
   its execution. When a packet is closed, the platform appends it to a
   ring buffer, overwriting the oldest recorded one if there's no space
   left. This is called a flight recorder mode.
2. The controller (another thread of the instrumented program, or an
   external host) recognizes a trigger where we would only need the
   latest data to analyze the situation. Therefore tracing must be
   stopped, because we don't want the current ring buffer packets to be
   overwritten anymore.
3. The controller disables tracing. It is safe to call
   barectf_is_tracing_enabled(ctx, 0) from another thread.
4. When barectf_is_tracing_enabled(ctx, 0) is called, the barectf
   tracing function currently being executed still needs to finish. At
   this point it could still alter the current packet. Therefore the
   controller waits until barectf_is_in_tracing_section() is 0.
5. Once barectf_is_in_tracing_section() returns 0, it won't return 1
   until barectf_is_tracing_enabled(ctx, 1) is called again, so it is
   safe to read the ring buffer, and also to read the current packet.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
7 years agoREADME.md: fix links
Philippe Proulx [Tue, 15 Nov 2016 18:08:59 +0000 (13:08 -0500)] 
README.md: fix links

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
7 years agobarectf v2.2.1
Philippe Proulx [Tue, 15 Nov 2016 18:00:46 +0000 (13:00 -0500)] 
barectf v2.2.1

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
7 years agoREADME.md: update content
Philippe Proulx [Tue, 15 Nov 2016 17:55:48 +0000 (12:55 -0500)] 
README.md: update content

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
7 years agodoc/examples: use -ansi flag to ensure ANSI C compatibility
Philippe Proulx [Tue, 15 Nov 2016 17:13:32 +0000 (12:13 -0500)] 
doc/examples: use -ansi flag to ensure ANSI C compatibility

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
7 years agobarectf(1): write short option's argument too
Philippe Proulx [Thu, 10 Nov 2016 22:33:19 +0000 (17:33 -0500)] 
barectf(1): write short option's argument too

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
7 years agoClaim to generate ANSI C code
Philippe Proulx [Thu, 10 Nov 2016 22:19:43 +0000 (17:19 -0500)] 
Claim to generate ANSI C code

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
7 years agoRemove <stdint.h> include in generated bitfield.h
Philippe Proulx [Thu, 10 Nov 2016 22:17:52 +0000 (17:17 -0500)] 
Remove <stdint.h> include in generated bitfield.h

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
7 years agoRemove unused macros from generated bitfield header
Philippe Proulx [Thu, 10 Nov 2016 21:44:36 +0000 (16:44 -0500)] 
Remove unused macros from generated bitfield header

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
7 years agogen.py: put union variable at the top of a nested block
Philippe Proulx [Thu, 10 Nov 2016 21:43:39 +0000 (16:43 -0500)] 
gen.py: put union variable at the top of a nested block

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
7 years agoRemove dependency on GNU C extensions
Philippe Proulx [Thu, 10 Nov 2016 18:16:59 +0000 (13:16 -0500)] 
Remove dependency on GNU C extensions

__typeof__() dependency is removed by passing the type to the
macro explicitly.

Statement expression dependency is removed by using an in/out
macro parameter instead.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
7 years agoSupport C++ build of generated and linux-fs platform files
Philippe Proulx [Wed, 9 Nov 2016 22:53:22 +0000 (17:53 -0500)] 
Support C++ build of generated and linux-fs platform files

Mostly void * casting stuff.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
7 years agobarectf-platform-linux-fs.h: add __cplusplus check
Philippe Proulx [Wed, 9 Nov 2016 17:36:56 +0000 (12:36 -0500)] 
barectf-platform-linux-fs.h: add __cplusplus check

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
7 years agobarectf.c: remove unused _packet_is_full()
Philippe Proulx [Wed, 9 Nov 2016 17:32:12 +0000 (12:32 -0500)] 
barectf.c: remove unused _packet_is_full()

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
7 years agobarectf.h: add __cplusplus check
Philippe Proulx [Wed, 9 Nov 2016 17:29:06 +0000 (12:29 -0500)] 
barectf.h: add __cplusplus check

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
7 years agoMerge pull request #11 from mjeanson/master
Michael Jeanson [Thu, 8 Sep 2016 20:43:35 +0000 (16:43 -0400)] 
Merge pull request #11 from mjeanson/master

Update CI link in README.md

7 years agoUpdate CI link in README.md
Michael Jeanson [Mon, 29 Aug 2016 15:46:12 +0000 (11:46 -0400)] 
Update CI link in README.md

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
7 years agoRefer to official website barectf.org
Philippe Proulx [Wed, 13 Jul 2016 15:41:38 +0000 (11:41 -0400)] 
Refer to official website barectf.org

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
7 years agoAdd MIT license header to generated files
Philippe Proulx [Wed, 13 Jul 2016 15:35:03 +0000 (11:35 -0400)] 
Add MIT license header to generated files

Fixes: #8
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
7 years agoFix package name in Ubuntu install instructions
Philipp Wagner [Tue, 12 Jul 2016 15:47:44 +0000 (17:47 +0200)] 
Fix package name in Ubuntu install instructions

8 years agoMake sure all source files have a MIT license header
Philippe Proulx [Thu, 14 Apr 2016 00:52:47 +0000 (20:52 -0400)] 
Make sure all source files have a MIT license header

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agoexamples/barectf-tracepoint: fix comment
Philippe Proulx [Thu, 14 Apr 2016 00:18:09 +0000 (20:18 -0400)] 
examples/barectf-tracepoint: fix comment

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agodoc/man: update man page's date and version
Philippe Proulx [Thu, 14 Apr 2016 00:12:08 +0000 (20:12 -0400)] 
doc/man: update man page's date and version

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agobarectf v2.2.0
Philippe Proulx [Wed, 13 Apr 2016 21:00:09 +0000 (17:00 -0400)] 
barectf v2.2.0

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agodocs/examples/.gitignore: ignore "metadata"
Philippe Proulx [Wed, 13 Apr 2016 20:49:41 +0000 (16:49 -0400)] 
docs/examples/.gitignore: ignore "metadata"

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agobarectf-tracepoint: add QEMU ARM target example
Philippe Proulx [Wed, 13 Apr 2016 19:52:48 +0000 (15:52 -0400)] 
barectf-tracepoint: add QEMU ARM target example

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agobarectf-tracepoint ex: rename "barectf" -> "barectf-linux-fs"
Philippe Proulx [Tue, 12 Apr 2016 21:20:38 +0000 (17:20 -0400)] 
barectf-tracepoint ex: rename "barectf" -> "barectf-linux-fs"

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agobarectf-tracepoint ex: put platform-specific stuff in separate files
Philippe Proulx [Tue, 12 Apr 2016 21:02:19 +0000 (17:02 -0400)] 
barectf-tracepoint ex: put platform-specific stuff in separate files

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agodoc/examples/linux-fs-simple: use $(BARECTF), no view target
Philippe Proulx [Thu, 7 Apr 2016 04:05:50 +0000 (00:05 -0400)] 
doc/examples/linux-fs-simple: use $(BARECTF), no view target

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agoAdd doc/examples/barectf-tracepoint
Philippe Proulx [Thu, 7 Apr 2016 03:46:45 +0000 (23:46 -0400)] 
Add doc/examples/barectf-tracepoint

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agoAdd extra/barectf-tracepoint.h (tracepoint() macro wrapper)
Philippe Proulx [Thu, 7 Apr 2016 03:46:08 +0000 (23:46 -0400)] 
Add extra/barectf-tracepoint.h (tracepoint() macro wrapper)

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agotests/config/fail/stream: add tests for "$default" prop
Philippe Proulx [Thu, 7 Apr 2016 01:53:26 +0000 (21:53 -0400)] 
tests/config/fail/stream: add tests for "$default" prop

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agotests/config/fail/metadata: add tests for default stream name
Philippe Proulx [Thu, 7 Apr 2016 01:50:15 +0000 (21:50 -0400)] 
tests/config/fail/metadata: add tests for default stream name

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agotests/config/fail: remove .c/.h files
Philippe Proulx [Thu, 7 Apr 2016 01:49:32 +0000 (21:49 -0400)] 
tests/config/fail: remove .c/.h files

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agotests/config/pass/everything: fix gen-default-stream-def
Philippe Proulx [Thu, 7 Apr 2016 01:41:54 +0000 (21:41 -0400)] 
tests/config/pass/everything: fix gen-default-stream-def

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agodoc/examples/linux-fs-simple: generate prefix/def stream name defs
Philippe Proulx [Thu, 7 Apr 2016 01:40:52 +0000 (21:40 -0400)] 
doc/examples/linux-fs-simple: generate prefix/def stream name defs

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agotests/config/fail/config: remove options-gen-default-stream-def-unknown-stream-name
Philippe Proulx [Thu, 7 Apr 2016 01:39:54 +0000 (21:39 -0400)] 
tests/config/fail/config: remove options-gen-default-stream-def-unknown-stream-name

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agoMake config option "gen-default-stream-def" a boolean
Philippe Proulx [Thu, 7 Apr 2016 01:37:10 +0000 (21:37 -0400)] 
Make config option "gen-default-stream-def" a boolean

Now that there's a way to specify a default stream, we only
need to know if we want or not to generate this definition.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agodoc/examples/linux-fs-simple: use 2.2 config with default stream
Philippe Proulx [Wed, 6 Apr 2016 23:33:03 +0000 (19:33 -0400)] 
doc/examples/linux-fs-simple: use 2.2 config with default stream

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agogen, templates: generate default stream trace definitions
Philippe Proulx [Wed, 6 Apr 2016 23:32:43 +0000 (19:32 -0400)] 
gen, templates: generate default stream trace definitions

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agoconfig: specify default stream in metadata/stream objects
Philippe Proulx [Wed, 6 Apr 2016 23:17:34 +0000 (19:17 -0400)] 
config: specify default stream in metadata/stream objects

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agogen, templates: generate prefix/default stream definitions
Philippe Proulx [Wed, 6 Apr 2016 16:50:50 +0000 (12:50 -0400)] 
gen, templates: generate prefix/default stream definitions

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agotests/config/pass/everything: add config options to test
Philippe Proulx [Wed, 6 Apr 2016 16:41:26 +0000 (12:41 -0400)] 
tests/config/pass/everything: add config options to test

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agotests/config/fail/config: add config options tests
Philippe Proulx [Wed, 6 Apr 2016 16:39:55 +0000 (12:39 -0400)] 
tests/config/fail/config: add config options tests

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agoconfig: add configuration options
Philippe Proulx [Wed, 6 Apr 2016 16:30:02 +0000 (12:30 -0400)] 
config: add configuration options

Current options:

  * `gen-prefix-def`: generate a prefix definition in the
    header file
  * `gen-default-stream-def`: generate a default stream
    name definition in the header file

Those are intended to facilitate the use of a barectf-LTTng-UST
adapter.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agobarectf v2.2.0-dev
Philippe Proulx [Wed, 6 Apr 2016 16:20:24 +0000 (12:20 -0400)] 
barectf v2.2.0-dev

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agoREADME.md: specify Ubuntu versions
Philippe Proulx [Thu, 31 Mar 2016 19:43:33 +0000 (15:43 -0400)] 
README.md: specify Ubuntu versions

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agoREADME.md: add PPA instructions for Ubuntu
Philippe Proulx [Thu, 31 Mar 2016 19:38:01 +0000 (15:38 -0400)] 
README.md: add PPA instructions for Ubuntu

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agoREADME.md: add AUR package instructions for Arch Linux
Philippe Proulx [Wed, 30 Mar 2016 22:25:30 +0000 (18:25 -0400)] 
README.md: add AUR package instructions for Arch Linux

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agoREADME.md: "philosphy" -> "philosophy"
Philippe Proulx [Wed, 30 Mar 2016 21:50:16 +0000 (17:50 -0400)] 
README.md: "philosphy" -> "philosophy"

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
8 years agobarectf v2.1.4
Philippe Proulx [Wed, 30 Mar 2016 21:42:10 +0000 (17:42 -0400)] 
barectf v2.1.4

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
This page took 0.043909 seconds and 4 git commands to generate.