Introduce new barectf configuration API and YAML configuration schema
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 27 Jul 2020 19:38:11 +0000 (15:38 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 28 Jul 2020 11:53:29 +0000 (07:53 -0400)
This patch:

* Updates the configuration API (breaking change) to:

  * Match, more or less, Babeltrace 2's terminology.
  * Be more clear and consistent.
  * Prepare for CTF 2.

* Adds support for a new type of YAML configuration to match the updated
  configuration API.

  Internally, the new schema is named "v3" as it will be barectf 3's
  configuration format. The (now) old schema is named "v2".

* Updates all the existing code to deal with the updated configuration
  API.

I admit that this is a very big change, but it was too arduous to split
in various patches. This message explains what changes and why.

Configuration API changes (metadata)
====================================
barectf 2's metadata API has existed for five years now.

During those five years, I had the chance to work on Babeltrace 2,
CTF 2, and LTTng, and polished CTF's concepts, type relations, and
terminology.

The main goal of this patch is, as much as possible, to make barectf's
configuration API match what was done in Babeltrace 2's trace IR API [1]
at the metadata level.

A few examples:

* All metadata objects are "types" (classes in Babeltrace 2): field
  type, clock type, event type, stream type, and so on.

* A signed enumeration field type inherits an enumeration field type
  (which inherits an integer field type) and a signed integer field
  type.

* Integer and string field types have no encoding property.

  If we need them, we can introduce text array field types in the
  future.

  A string field type has a fixed UTF-8 (a superset of ASCII) encoding.

With this patch, an integer field type doesn't have any property
mapping. Instead, when you create a stream type, you can specify a
default clock type: the event time and packet beginning/end time members
refer to this default clock type in the generated TSDL metadata stream
so that each stream has an instance of it.

One other important change is that, with this patch, you cannot specify:

* The packet header field type of a trace type.
* The packet context field type of a stream type.
* The event header field type of a stream type.

I believe it was an error to let the user control those structure field
types as, fundamentally, they are "format" field types (reserved by
CTF).

As of this patch, you can enable/disable trace type and stream type
features which eventually translate to the automatic creation of the
field types listed above. For example, the "discarded events counter
field type" feature of a stream type controls whether or not the packets
of its instances (streams) contain a discarded events counter field. You
can either:

* Disable the feature (`None`).

* Enable the feature with a default field type (`DEFAULT_FIELD_TYPE`).

* Enable the feature with a custom field type
  (`UnsignedIntegerFieldType` instance).

The packet context field type is a bit of an exception here as it can
contain both format (total size, content size, beginning/end times, and
the rest) and user members. As such, when you create a stream type, you
can specify extra packet context field type members.

This feature approach hides all the reserved CTF member names (`id`,
`magic`, `uuid`, `timestamp_begin`, and the rest): barectf deals with
this internally. There are sane defaults, for example:

* The "magic" and "stream type ID" trace type features are enabled by
  default.

* If, when you create a stream type, you specify a default clock type
  and default features, then the event time and packet beginning/end
  times features are enabled.

All the configuration names are in `config.py` (removing `metadata.py`).

The big picture is:

* A configuration has a trace and options (prefixes and other generation
  options).

* A trace has an environment (think TSDL environment) and a type.

* A trace type has a default byte order, a UUID, features, and one or
  more stream types.

* A stream type has an ID, a name, an default clock type,
  features, extra packet context field type members, a common event
  context field type, and one or more event types.

* A clock type has a name, a frequency, a UUID, a description, a
  precision, an offset, and whether or not its origin is the Unix epoch.

* An event type has an ID, a name, a log level, and specific context and
  payload field types.

* A field type (abstract) has an alignment.

* A bit array field type (abstract) adds the size (bits) and byte order
  properties to a field type.

* An integer field type adds the preferred display base properties to a
  bit array field type.

* An enumeration field type adds the mappings property to an integer
  field type.

* A real field type is a bit array field type.

  The only valid sizes are 32 (single-precision) and 64
  (double-precision).

* An array field type (abstract) adds element field type property to a
  field type.

* A static array field type adds the length property to an array field
  type.

  This field type is only used for the "UUID field type" trace type
  feature.

* A structure field type has named members.

  Each member has a field type.

  In the future (CTF 2), a structure field type member could also
  contain custom user attributes.

New YAML configuration schema
=============================
The barectf 3 YAML configuration format mirrors the new configuration
API, with some sugar to make it easier to write a YAML configuration
file.

The most significant changes are:

* There's no configuration version property.

  Starting from barectf 3, a barectf YAML configuration node is a map
  with the YAML tag [2] `tag:barectf.org,2020/3/config`. Consequently, a
  barectf 3 YAML configuration file will typically start like this:

      %YAML 1.2
      --- !<tag:barectf.org,2020/3/config>

  As you can see, the barectf major version is encoded within the tag.
  The major version is enough: minor bumps of barectf 3 will only add
  features without breaking the schema.

  Only the configuration node needs an explicit tag: all the nodes under
  it have implicit tags according to the schema. This top-level tag
  makes it possible to integrate a barectf 3 configuration node within
  another YAML document, if this ever becomes a use case.

* The terminology, the property names, and, in general, the object
  layouts, are the same as with the configuration API.

* There are two ways to specify prefixes:

  Single prefix:
      Use `PREFIX_` for C identifiers, where `PREFIX` is the single
      prefix, and `PREFIX` for file names.

      For example, with

          prefix: hello

      identifiers start with `hello_` and file names with `hello`.

  Explicit prefixes:
      Specify the exact prefixes to be used for C identifiers and file
      names.

      For example, with

          prefix:
            identifier: lol_
            file-name: meow

      identifiers start with `lol_` and file names with `meow`.

* For the trace type and stream types, specify features in the
  `$features` property.

  Example:

      $features:
        magic-field-type: true
        uuid-field-type: false
        stream-type-id-field-type:
          class: unsigned-int
          size: 8
          byte-order: le

  A field type feature can be one of:

  True:
      Use the default field type.

  False:
      Disable the feature.

  Field type node:
      Use a specific field type.

* The only way to make a stream type the default stream type is with its
  `$is-default` property.

  Example:

      my_stream:
        $is-default: true

  Only one stream type can have this property set to true.

* Specify field type aliases with any order, whatever the dependencies.

  Example:

      $field-type-aliases:
        hello:
          $inherit: meow
          alignment: 32
        meow:
          class: signed-int
          size: 32

* An enumeration field type is an integer field type; there's no concept
  of "value field type" anymore.

  Example:

      class: unsigned-enum
      size: 32
      byte-order: le
      mappings:
        # ...

* An enumeration field type's `mappings` property is a map of labels to
  lists of integer ranges.

  The order of individual mappings is not important.

  An integer range is either a single integer or a pair of integers
  (lower and upper).

  Example:

      class: unsigned-enum
      size: 32
      mappings:
        HOLA: [2]
        MEOW:
          - 23
          - [4, 17]
        ROCK:
          - [1000, 2000]
          - [3000, 4000]
          - [5000, 6000]

* A real field type is a bit array field type.

  Example (single-precision):

      class: real
      size: 32

* Specify the members of a structure field type like a YAML ordered
  map [3], without having to specify the `tag:yaml.org,2002:omap`
  tag.

  This fixes a "bug" which exists since barectf 2.0: a YAML map is not
  ordered per se; as such, the members of a structure field type cannot
  be a simple map. It works in barectf 2 because PyYAML parses the map
  entries in order, but there's no requirement to do so.

  Example:

      class: struct
      members:
        - sup:
            field-type: uint32
        - meow:
            field-type:
              class: string
        - bob:
            field-type:
              $inherit: double
              byte-order: be

  It might seem silly to specify `field-type` for each member, but CTF 2
  might bring user attributes for individual structure field type
  members, so barectf 3 will be ready. For example:

      class: struct
      members:
        - sup:
            field-type: uint32
        - meow:
            field-type:
              class: string
            user-attributes:
              'https://example.com/ns/ctf':
                type: user-name
                color: blue
        - bob:
            field-type:
              $inherit: double
              byte-order: be

Internally, barectf detects the YAML configuration file's version. If
it's a barectf 2 configuration node, it converts it to a barectf 3
configuration node, and then it decodes it, as such:

    barectf 2 YAML    barectf 3 YAML
    config. node   -> config node.   -> barectf config. object (API)

What you get with `--dump-config` occurs after step 1.

barectf 3 will remain fully backward compatible regarding barectf 2 YAML
configurations and the CLI. This is why the `barectf/include` directory
contains inclusion files for both barectf 2 and 3: the CLI selects the
appropriate directory based on the detected version.

`barectf/schemas` also contains JSON schemas for both versions of the
configuration, as well as common schemas.

Configuration API changes (functions)
=====================================
The configuration API functions are now:

configuration_file_major_version():
    Returns the major version (2 or 3) of a YAML configuration file-like
    object.

effective_configuration_file():
    Returns the effective configuration file (YAML string) using a
    file-like object and a list of inclusion directories.

    An effective configuration file is a file where:

    * All field type nodes are expanded (aliases and inheritance).

    * Log level aliases are substituted for their integral equivalents.

    * Some properties are normalized.

      For example, the `be` byte order becomes `big-endian` (both are
      valid). Also, null properties are simply removed.

configuration_from_file():
    Returns a `barectf.Configuration` object from a YAML configuration
    file-like object.

Code generation API
===================
This patch also brings changes to the code generation API.

Now you create a `barectf.CodeGenerator` object, passing a barectf
configuration.

With such a code generator object, call its generate_c_headers(),
generate_c_sources(), and generate_metadata_stream() methods to generate
code.

generate_c_headers() and generate_c_sources() return lists of
`barectf.gen._GeneratedFile` objects. Such an object contains the name
of the file and its (UTF-8 text) contents.

generate_metadata_stream() returns a single `barectf.gen._GeneratedFile`
object.

`__init__.py`
=============
The whole barectf API is now available directly under its package.

`__init__.py` picks what needs to be exposed from its different modules.

Tests
=====
Tests which were directly under `tests/config` are moved to
`tests/config/2` as we could add barectf 3 configuration tests in the
future.

[1]: https://babeltrace.org/docs/v2.0/libbabeltrace2/group__api-tir.html
[2]: https://yaml.org/spec/1.2/spec.html#id2761292

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
450 files changed:
barectf/__init__.py
barectf/cli.py
barectf/codegen.py
barectf/config.py
barectf/config_parse.py
barectf/config_parse_common.py [new file with mode: 0644]
barectf/config_parse_v2.py [new file with mode: 0644]
barectf/config_parse_v3.py [new file with mode: 0644]
barectf/gen.py
barectf/include/2/lttng-ust-log-levels.yaml [new file with mode: 0644]
barectf/include/2/stdfloat.yaml [new file with mode: 0644]
barectf/include/2/stdint.yaml [new file with mode: 0644]
barectf/include/2/stdmisc.yaml [new file with mode: 0644]
barectf/include/2/trace-basic.yaml [new file with mode: 0644]
barectf/include/3/lttng-ust-log-levels.yaml [new file with mode: 0644]
barectf/include/3/stdint.yaml [new file with mode: 0644]
barectf/include/3/stdmisc.yaml [new file with mode: 0644]
barectf/include/3/stdreal.yaml [new file with mode: 0644]
barectf/include/lttng-ust-log-levels.yaml [deleted file]
barectf/include/stdfloat.yaml [deleted file]
barectf/include/stdint.yaml [deleted file]
barectf/include/stdmisc.yaml [deleted file]
barectf/include/trace-basic.yaml [deleted file]
barectf/metadata.py [deleted file]
barectf/schemas/2/config/byte-order-prop.yaml [deleted file]
barectf/schemas/2/config/clock-pre-include.yaml [deleted file]
barectf/schemas/2/config/clock-type-pre-include.yaml [new file with mode: 0644]
barectf/schemas/2/config/config-min.yaml [new file with mode: 0644]
barectf/schemas/2/config/config-pre-field-type-expansion.yaml
barectf/schemas/2/config/config-pre-log-level-expansion.yaml [deleted file]
barectf/schemas/2/config/config.yaml
barectf/schemas/2/config/event-pre-include.yaml [deleted file]
barectf/schemas/2/config/event-type-pre-include.yaml [new file with mode: 0644]
barectf/schemas/2/config/field-type.yaml
barectf/schemas/2/config/metadata-pre-include.yaml
barectf/schemas/2/config/stream-pre-include.yaml [deleted file]
barectf/schemas/2/config/stream-type-pre-include.yaml [new file with mode: 0644]
barectf/schemas/2/config/trace-pre-include.yaml [deleted file]
barectf/schemas/2/config/trace-type-pre-include.yaml [new file with mode: 0644]
barectf/schemas/2/config/uuid-prop.yaml [deleted file]
barectf/schemas/3/config/clock-type-pre-include.yaml [new file with mode: 0644]
barectf/schemas/3/config/config-pre-field-type-expansion.yaml [new file with mode: 0644]
barectf/schemas/3/config/config-pre-include.yaml [new file with mode: 0644]
barectf/schemas/3/config/config-pre-log-level-alias-sub.yaml [new file with mode: 0644]
barectf/schemas/3/config/config.yaml [new file with mode: 0644]
barectf/schemas/3/config/event-type-pre-include.yaml [new file with mode: 0644]
barectf/schemas/3/config/field-type.yaml [new file with mode: 0644]
barectf/schemas/3/config/include-prop.yaml [new file with mode: 0644]
barectf/schemas/3/config/stream-type-pre-include.yaml [new file with mode: 0644]
barectf/schemas/3/config/trace-pre-include.yaml [new file with mode: 0644]
barectf/schemas/3/config/trace-type-pre-include.yaml [new file with mode: 0644]
barectf/schemas/common/config/common.yaml [new file with mode: 0644]
barectf/schemas/config/config-min.yaml [deleted file]
barectf/tsdl182gen.py
barectf/version.py [new file with mode: 0644]
tests/config/.gitignore
tests/config/2/fail/clock/absolute-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/clock/description-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/clock/ec-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/clock/ec-invalid.yaml [new file with mode: 0644]
tests/config/2/fail/clock/fail.bats [new file with mode: 0644]
tests/config/2/fail/clock/freq-0.yaml [new file with mode: 0644]
tests/config/2/fail/clock/freq-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/clock/freq-neg.yaml [new file with mode: 0644]
tests/config/2/fail/clock/offset-cycles-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/clock/offset-cycles-neg.yaml [new file with mode: 0644]
tests/config/2/fail/clock/offset-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/clock/offset-seconds-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/clock/offset-seconds-neg.yaml [new file with mode: 0644]
tests/config/2/fail/clock/offset-unknown-prop.yaml [new file with mode: 0644]
tests/config/2/fail/clock/rct-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/clock/unknown-prop.yaml [new file with mode: 0644]
tests/config/2/fail/clock/uuid-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/clock/uuid-invalid.yaml [new file with mode: 0644]
tests/config/2/fail/config/fail.bats [new file with mode: 0644]
tests/config/2/fail/config/metadata-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/config/metadata-no.yaml [new file with mode: 0644]
tests/config/2/fail/config/options-gen-default-stream-def-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/config/options-gen-prefix-def-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/config/options-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/config/options-unknown-prop.yaml [new file with mode: 0644]
tests/config/2/fail/config/prefix-invalid-identifier.yaml [new file with mode: 0644]
tests/config/2/fail/config/prefix-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/config/unknown-prop.yaml [new file with mode: 0644]
tests/config/2/fail/config/version-invalid-19.yaml [new file with mode: 0644]
tests/config/2/fail/config/version-invalid-23.yaml [new file with mode: 0644]
tests/config/2/fail/config/version-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/config/version-no.yaml [new file with mode: 0644]
tests/config/2/fail/event/ct-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/event/ct-not-struct.yaml [new file with mode: 0644]
tests/config/2/fail/event/fail.bats [new file with mode: 0644]
tests/config/2/fail/event/ll-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/event/ll-non-existing.yaml [new file with mode: 0644]
tests/config/2/fail/event/no-fields-at-all.yaml [new file with mode: 0644]
tests/config/2/fail/event/pt-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/event/pt-not-struct.yaml [new file with mode: 0644]
tests/config/2/fail/event/unknown-prop.yaml [new file with mode: 0644]
tests/config/2/fail/include/cycle-sym.yaml [new file with mode: 0644]
tests/config/2/fail/include/cycle.yaml [new file with mode: 0644]
tests/config/2/fail/include/fail.bats [new file with mode: 0644]
tests/config/2/fail/include/file-not-found-abs.yaml [new file with mode: 0644]
tests/config/2/fail/include/file-not-found-in-array.yaml [new file with mode: 0644]
tests/config/2/fail/include/file-not-found-recursive.yaml [new file with mode: 0644]
tests/config/2/fail/include/file-not-found.yaml [new file with mode: 0644]
tests/config/2/fail/include/inc-empty.yaml [new file with mode: 0644]
tests/config/2/fail/include/inc-inc-not-found.yaml [new file with mode: 0644]
tests/config/2/fail/include/inc-recursive-sym1.yaml [new file with mode: 0644]
tests/config/2/fail/include/inc-recursive-sym2.yaml [new file with mode: 0644]
tests/config/2/fail/include/inc-recursive1.yaml [new file with mode: 0644]
tests/config/2/fail/include/inc-recursive2.yaml [new file with mode: 0644]
tests/config/2/fail/include/inc-recursive3.yaml [new file with mode: 0644]
tests/config/2/fail/include/include-include-replace.yaml [new file with mode: 0644]
tests/config/2/fail/include/invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/include/replace-file-not-found-in-array.yaml [new file with mode: 0644]
tests/config/2/fail/include/replace-file-not-found.yaml [new file with mode: 0644]
tests/config/2/fail/stream/default-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/stream/ect-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/stream/ect-not-struct.yaml [new file with mode: 0644]
tests/config/2/fail/stream/eht-id-no-multiple-events.yaml [new file with mode: 0644]
tests/config/2/fail/stream/eht-id-not-int.yaml [new file with mode: 0644]
tests/config/2/fail/stream/eht-id-too-small.yaml [new file with mode: 0644]
tests/config/2/fail/stream/eht-id-wrong-signed.yaml [new file with mode: 0644]
tests/config/2/fail/stream/eht-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/stream/eht-not-struct.yaml [new file with mode: 0644]
tests/config/2/fail/stream/eht-timestamp-not-int.yaml [new file with mode: 0644]
tests/config/2/fail/stream/eht-timestamp-wrong-pm.yaml [new file with mode: 0644]
tests/config/2/fail/stream/eht-timestamp-wrong-signed.yaml [new file with mode: 0644]
tests/config/2/fail/stream/events-empty.yaml [new file with mode: 0644]
tests/config/2/fail/stream/events-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/stream/events-key-invalid-identifier.yaml [new file with mode: 0644]
tests/config/2/fail/stream/events-no.yaml [new file with mode: 0644]
tests/config/2/fail/stream/fail.bats [new file with mode: 0644]
tests/config/2/fail/stream/pct-cs-not-int.yaml [new file with mode: 0644]
tests/config/2/fail/stream/pct-cs-wrong-signed.yaml [new file with mode: 0644]
tests/config/2/fail/stream/pct-cs-yes-ps-no.yaml [new file with mode: 0644]
tests/config/2/fail/stream/pct-ed-not-int.yaml [new file with mode: 0644]
tests/config/2/fail/stream/pct-ed-wrong-signed.yaml [new file with mode: 0644]
tests/config/2/fail/stream/pct-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/stream/pct-no.yaml [new file with mode: 0644]
tests/config/2/fail/stream/pct-not-struct.yaml [new file with mode: 0644]
tests/config/2/fail/stream/pct-ps-not-int.yaml [new file with mode: 0644]
tests/config/2/fail/stream/pct-ps-wrong-signed.yaml [new file with mode: 0644]
tests/config/2/fail/stream/pct-ps-yes-cs-no.yaml [new file with mode: 0644]
tests/config/2/fail/stream/pct-tb-not-int.yaml [new file with mode: 0644]
tests/config/2/fail/stream/pct-tb-te-different-clocks.yaml [new file with mode: 0644]
tests/config/2/fail/stream/pct-tb-wrong-pm.yaml [new file with mode: 0644]
tests/config/2/fail/stream/pct-tb-wrong-signed.yaml [new file with mode: 0644]
tests/config/2/fail/stream/pct-tb-yes-te-no.yaml [new file with mode: 0644]
tests/config/2/fail/stream/pct-te-not-int.yaml [new file with mode: 0644]
tests/config/2/fail/stream/pct-te-wrong-pm.yaml [new file with mode: 0644]
tests/config/2/fail/stream/pct-te-wrong-signed.yaml [new file with mode: 0644]
tests/config/2/fail/stream/pct-te-yes-tb-no.yaml [new file with mode: 0644]
tests/config/2/fail/stream/unknown-prop.yaml [new file with mode: 0644]
tests/config/2/fail/trace/bo-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/trace/bo-invalid.yaml [new file with mode: 0644]
tests/config/2/fail/trace/bo-no.yaml [new file with mode: 0644]
tests/config/2/fail/trace/fail.bats [new file with mode: 0644]
tests/config/2/fail/trace/ph-magic-not-int.yaml [new file with mode: 0644]
tests/config/2/fail/trace/ph-magic-wrong-signed.yaml [new file with mode: 0644]
tests/config/2/fail/trace/ph-magic-wrong-size.yaml [new file with mode: 0644]
tests/config/2/fail/trace/ph-not-struct.yaml [new file with mode: 0644]
tests/config/2/fail/trace/ph-streamid-not-int.yaml [new file with mode: 0644]
tests/config/2/fail/trace/ph-streamid-too-small.yaml [new file with mode: 0644]
tests/config/2/fail/trace/ph-streamid-wrong-signed.yaml [new file with mode: 0644]
tests/config/2/fail/trace/ph-uuid-et-not-int.yaml [new file with mode: 0644]
tests/config/2/fail/trace/ph-uuid-et-wrong-align.yaml [new file with mode: 0644]
tests/config/2/fail/trace/ph-uuid-et-wrong-signed.yaml [new file with mode: 0644]
tests/config/2/fail/trace/ph-uuid-et-wrong-size.yaml [new file with mode: 0644]
tests/config/2/fail/trace/ph-uuid-not-array.yaml [new file with mode: 0644]
tests/config/2/fail/trace/ph-uuid-wrong-length.yaml [new file with mode: 0644]
tests/config/2/fail/trace/unknown-prop.yaml [new file with mode: 0644]
tests/config/2/fail/trace/uuid-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/trace/uuid-invalid-uuid.yaml [new file with mode: 0644]
tests/config/2/fail/type-enum/fail.bats [new file with mode: 0644]
tests/config/2/fail/type-enum/members-el-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/type-enum/members-el-member-label-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/type-enum/members-el-member-unknown-prop.yaml [new file with mode: 0644]
tests/config/2/fail/type-enum/members-el-member-value-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/type-enum/members-el-member-value-outside-range-signed.yaml [new file with mode: 0644]
tests/config/2/fail/type-enum/members-el-member-value-outside-range-unsigned.yaml [new file with mode: 0644]
tests/config/2/fail/type-enum/members-empty.yaml [new file with mode: 0644]
tests/config/2/fail/type-enum/members-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/type-enum/members-no.yaml [new file with mode: 0644]
tests/config/2/fail/type-enum/members-overlap.yaml [new file with mode: 0644]
tests/config/2/fail/type-enum/unknown-prop.yaml [new file with mode: 0644]
tests/config/2/fail/type-enum/vt-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/type-enum/vt-no.yaml [new file with mode: 0644]
tests/config/2/fail/type-float/align-0.yaml [new file with mode: 0644]
tests/config/2/fail/type-float/align-3.yaml [new file with mode: 0644]
tests/config/2/fail/type-float/align-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/type-float/bo-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/type-float/bo-invalid.yaml [new file with mode: 0644]
tests/config/2/fail/type-float/fail.bats [new file with mode: 0644]
tests/config/2/fail/type-float/size-exp-mant-wrong-sum.yaml [new file with mode: 0644]
tests/config/2/fail/type-float/size-exp-no.yaml [new file with mode: 0644]
tests/config/2/fail/type-float/size-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/type-float/size-mant-no.yaml [new file with mode: 0644]
tests/config/2/fail/type-float/size-no.yaml [new file with mode: 0644]
tests/config/2/fail/type-float/size-unknown-prop.yaml [new file with mode: 0644]
tests/config/2/fail/type-float/unknown-prop.yaml [new file with mode: 0644]
tests/config/2/fail/type-int/align-0.yaml [new file with mode: 0644]
tests/config/2/fail/type-int/align-3.yaml [new file with mode: 0644]
tests/config/2/fail/type-int/align-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/type-int/base-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/type-int/base-invalid.yaml [new file with mode: 0644]
tests/config/2/fail/type-int/bo-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/type-int/bo-invalid.yaml [new file with mode: 0644]
tests/config/2/fail/type-int/fail.bats [new file with mode: 0644]
tests/config/2/fail/type-int/pm-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/type-int/pm-property-invalid.yaml [new file with mode: 0644]
tests/config/2/fail/type-int/pm-type-invalid.yaml [new file with mode: 0644]
tests/config/2/fail/type-int/pm-unknown-clock.yaml [new file with mode: 0644]
tests/config/2/fail/type-int/signed-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/type-int/size-0.yaml [new file with mode: 0644]
tests/config/2/fail/type-int/size-65.yaml [new file with mode: 0644]
tests/config/2/fail/type-int/size-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/type-int/size-no.yaml [new file with mode: 0644]
tests/config/2/fail/type-int/unknown-prop.yaml [new file with mode: 0644]
tests/config/2/fail/type-string/fail.bats [new file with mode: 0644]
tests/config/2/fail/type-string/unknown-prop.yaml [new file with mode: 0644]
tests/config/2/fail/type-struct/fail.bats [new file with mode: 0644]
tests/config/2/fail/type-struct/fields-field-invalid-identifier.yaml [new file with mode: 0644]
tests/config/2/fail/type-struct/fields-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/type-struct/ma-0.yaml [new file with mode: 0644]
tests/config/2/fail/type-struct/ma-3.yaml [new file with mode: 0644]
tests/config/2/fail/type-struct/ma-invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/type-struct/unknown-prop.yaml [new file with mode: 0644]
tests/config/2/fail/type/fail.bats [new file with mode: 0644]
tests/config/2/fail/type/inherit-forward.yaml [new file with mode: 0644]
tests/config/2/fail/type/inherit-unknown.yaml [new file with mode: 0644]
tests/config/2/fail/type/invalid-type.yaml [new file with mode: 0644]
tests/config/2/fail/type/no-class.yaml [new file with mode: 0644]
tests/config/2/fail/yaml/fail.bats [new file with mode: 0644]
tests/config/2/fail/yaml/invalid.yaml [new file with mode: 0644]
tests/config/2/pass/everything/config.yaml [new file with mode: 0644]
tests/config/2/pass/everything/inc-clock.yaml [new file with mode: 0644]
tests/config/2/pass/everything/inc-event.yaml [new file with mode: 0644]
tests/config/2/pass/everything/inc-metadata.yaml [new file with mode: 0644]
tests/config/2/pass/everything/inc-stream.yaml [new file with mode: 0644]
tests/config/2/pass/everything/inc-trace.yaml [new file with mode: 0644]
tests/config/2/pass/everything/pass.bats [new file with mode: 0644]
tests/config/common.bash
tests/config/fail/clock/absolute-invalid-type.yaml [deleted file]
tests/config/fail/clock/description-invalid-type.yaml [deleted file]
tests/config/fail/clock/ec-invalid-type.yaml [deleted file]
tests/config/fail/clock/ec-invalid.yaml [deleted file]
tests/config/fail/clock/fail.bats [deleted file]
tests/config/fail/clock/freq-0.yaml [deleted file]
tests/config/fail/clock/freq-invalid-type.yaml [deleted file]
tests/config/fail/clock/freq-neg.yaml [deleted file]
tests/config/fail/clock/offset-cycles-invalid-type.yaml [deleted file]
tests/config/fail/clock/offset-cycles-neg.yaml [deleted file]
tests/config/fail/clock/offset-invalid-type.yaml [deleted file]
tests/config/fail/clock/offset-seconds-invalid-type.yaml [deleted file]
tests/config/fail/clock/offset-seconds-neg.yaml [deleted file]
tests/config/fail/clock/offset-unknown-prop.yaml [deleted file]
tests/config/fail/clock/rct-invalid-type.yaml [deleted file]
tests/config/fail/clock/unknown-prop.yaml [deleted file]
tests/config/fail/clock/uuid-invalid-type.yaml [deleted file]
tests/config/fail/clock/uuid-invalid.yaml [deleted file]
tests/config/fail/config/fail.bats [deleted file]
tests/config/fail/config/metadata-invalid-type.yaml [deleted file]
tests/config/fail/config/metadata-no.yaml [deleted file]
tests/config/fail/config/options-gen-default-stream-def-invalid-type.yaml [deleted file]
tests/config/fail/config/options-gen-prefix-def-invalid-type.yaml [deleted file]
tests/config/fail/config/options-invalid-type.yaml [deleted file]
tests/config/fail/config/options-unknown-prop.yaml [deleted file]
tests/config/fail/config/prefix-invalid-identifier.yaml [deleted file]
tests/config/fail/config/prefix-invalid-type.yaml [deleted file]
tests/config/fail/config/unknown-prop.yaml [deleted file]
tests/config/fail/config/version-invalid-19.yaml [deleted file]
tests/config/fail/config/version-invalid-23.yaml [deleted file]
tests/config/fail/config/version-invalid-type.yaml [deleted file]
tests/config/fail/config/version-no.yaml [deleted file]
tests/config/fail/event/ct-invalid-type.yaml [deleted file]
tests/config/fail/event/ct-not-struct.yaml [deleted file]
tests/config/fail/event/fail.bats [deleted file]
tests/config/fail/event/ll-invalid-type.yaml [deleted file]
tests/config/fail/event/ll-non-existing.yaml [deleted file]
tests/config/fail/event/no-fields-at-all.yaml [deleted file]
tests/config/fail/event/pt-invalid-type.yaml [deleted file]
tests/config/fail/event/pt-not-struct.yaml [deleted file]
tests/config/fail/event/unknown-prop.yaml [deleted file]
tests/config/fail/include/cycle-sym.yaml [deleted file]
tests/config/fail/include/cycle.yaml [deleted file]
tests/config/fail/include/fail.bats [deleted file]
tests/config/fail/include/file-not-found-abs.yaml [deleted file]
tests/config/fail/include/file-not-found-in-array.yaml [deleted file]
tests/config/fail/include/file-not-found-recursive.yaml [deleted file]
tests/config/fail/include/file-not-found.yaml [deleted file]
tests/config/fail/include/inc-empty.yaml [deleted file]
tests/config/fail/include/inc-inc-not-found.yaml [deleted file]
tests/config/fail/include/inc-recursive-sym1.yaml [deleted file]
tests/config/fail/include/inc-recursive-sym2.yaml [deleted file]
tests/config/fail/include/inc-recursive1.yaml [deleted file]
tests/config/fail/include/inc-recursive2.yaml [deleted file]
tests/config/fail/include/inc-recursive3.yaml [deleted file]
tests/config/fail/include/include-include-replace.yaml [deleted file]
tests/config/fail/include/invalid-type.yaml [deleted file]
tests/config/fail/include/replace-file-not-found-in-array.yaml [deleted file]
tests/config/fail/include/replace-file-not-found.yaml [deleted file]
tests/config/fail/metadata/clocks-invalid-type.yaml [deleted file]
tests/config/fail/metadata/clocks-key-invalid-identifier.yaml [deleted file]
tests/config/fail/metadata/default-stream-invalid-type.yaml [deleted file]
tests/config/fail/metadata/default-stream-stream-default-duplicate.yaml [deleted file]
tests/config/fail/metadata/default-stream-unknown-stream.yaml [deleted file]
tests/config/fail/metadata/env-invalid-type.yaml [deleted file]
tests/config/fail/metadata/env-key-invalid-identifier.yaml [deleted file]
tests/config/fail/metadata/env-value-invalid-type.yaml [deleted file]
tests/config/fail/metadata/fail.bats [deleted file]
tests/config/fail/metadata/ll-invalid-type.yaml [deleted file]
tests/config/fail/metadata/ll-value-invalid-type.yaml [deleted file]
tests/config/fail/metadata/multiple-streams-trace-ph-no-stream-id.yaml [deleted file]
tests/config/fail/metadata/streams-empty.yaml [deleted file]
tests/config/fail/metadata/streams-invalid-type.yaml [deleted file]
tests/config/fail/metadata/streams-key-invalid-identifier.yaml [deleted file]
tests/config/fail/metadata/streams-no.yaml [deleted file]
tests/config/fail/metadata/ta-invalid-type.yaml [deleted file]
tests/config/fail/metadata/trace-empty.yaml [deleted file]
tests/config/fail/metadata/trace-invalid-type.yaml [deleted file]
tests/config/fail/metadata/trace-no.yaml [deleted file]
tests/config/fail/metadata/unknown-prop.yaml [deleted file]
tests/config/fail/stream/default-invalid-type.yaml [deleted file]
tests/config/fail/stream/ect-invalid-type.yaml [deleted file]
tests/config/fail/stream/ect-not-struct.yaml [deleted file]
tests/config/fail/stream/eht-id-no-multiple-events.yaml [deleted file]
tests/config/fail/stream/eht-id-not-int.yaml [deleted file]
tests/config/fail/stream/eht-id-too-small.yaml [deleted file]
tests/config/fail/stream/eht-id-wrong-signed.yaml [deleted file]
tests/config/fail/stream/eht-invalid-type.yaml [deleted file]
tests/config/fail/stream/eht-not-struct.yaml [deleted file]
tests/config/fail/stream/eht-timestamp-not-int.yaml [deleted file]
tests/config/fail/stream/eht-timestamp-wrong-pm.yaml [deleted file]
tests/config/fail/stream/eht-timestamp-wrong-signed.yaml [deleted file]
tests/config/fail/stream/events-empty.yaml [deleted file]
tests/config/fail/stream/events-invalid-type.yaml [deleted file]
tests/config/fail/stream/events-key-invalid-identifier.yaml [deleted file]
tests/config/fail/stream/events-no.yaml [deleted file]
tests/config/fail/stream/fail.bats [deleted file]
tests/config/fail/stream/pct-cs-gt-ps.yaml [deleted file]
tests/config/fail/stream/pct-cs-not-int.yaml [deleted file]
tests/config/fail/stream/pct-cs-wrong-signed.yaml [deleted file]
tests/config/fail/stream/pct-cs-yes-ps-no.yaml [deleted file]
tests/config/fail/stream/pct-ed-not-int.yaml [deleted file]
tests/config/fail/stream/pct-ed-wrong-signed.yaml [deleted file]
tests/config/fail/stream/pct-invalid-type.yaml [deleted file]
tests/config/fail/stream/pct-no.yaml [deleted file]
tests/config/fail/stream/pct-not-struct.yaml [deleted file]
tests/config/fail/stream/pct-ps-not-int.yaml [deleted file]
tests/config/fail/stream/pct-ps-wrong-signed.yaml [deleted file]
tests/config/fail/stream/pct-ps-yes-cs-no.yaml [deleted file]
tests/config/fail/stream/pct-tb-not-int.yaml [deleted file]
tests/config/fail/stream/pct-tb-te-different-clocks.yaml [deleted file]
tests/config/fail/stream/pct-tb-wrong-pm.yaml [deleted file]
tests/config/fail/stream/pct-tb-wrong-signed.yaml [deleted file]
tests/config/fail/stream/pct-tb-yes-te-no.yaml [deleted file]
tests/config/fail/stream/pct-te-not-int.yaml [deleted file]
tests/config/fail/stream/pct-te-wrong-pm.yaml [deleted file]
tests/config/fail/stream/pct-te-wrong-signed.yaml [deleted file]
tests/config/fail/stream/pct-te-yes-tb-no.yaml [deleted file]
tests/config/fail/stream/unknown-prop.yaml [deleted file]
tests/config/fail/trace/bo-invalid-type.yaml [deleted file]
tests/config/fail/trace/bo-invalid.yaml [deleted file]
tests/config/fail/trace/bo-no.yaml [deleted file]
tests/config/fail/trace/fail.bats [deleted file]
tests/config/fail/trace/ph-magic-not-int.yaml [deleted file]
tests/config/fail/trace/ph-magic-wrong-signed.yaml [deleted file]
tests/config/fail/trace/ph-magic-wrong-size.yaml [deleted file]
tests/config/fail/trace/ph-not-struct.yaml [deleted file]
tests/config/fail/trace/ph-streamid-not-int.yaml [deleted file]
tests/config/fail/trace/ph-streamid-too-small.yaml [deleted file]
tests/config/fail/trace/ph-streamid-wrong-signed.yaml [deleted file]
tests/config/fail/trace/ph-uuid-et-not-int.yaml [deleted file]
tests/config/fail/trace/ph-uuid-et-wrong-align.yaml [deleted file]
tests/config/fail/trace/ph-uuid-et-wrong-signed.yaml [deleted file]
tests/config/fail/trace/ph-uuid-et-wrong-size.yaml [deleted file]
tests/config/fail/trace/ph-uuid-not-array.yaml [deleted file]
tests/config/fail/trace/ph-uuid-wrong-length.yaml [deleted file]
tests/config/fail/trace/unknown-prop.yaml [deleted file]
tests/config/fail/trace/uuid-invalid-type.yaml [deleted file]
tests/config/fail/trace/uuid-invalid-uuid.yaml [deleted file]
tests/config/fail/type-enum/fail.bats [deleted file]
tests/config/fail/type-enum/members-el-invalid-type.yaml [deleted file]
tests/config/fail/type-enum/members-el-member-label-invalid-type.yaml [deleted file]
tests/config/fail/type-enum/members-el-member-unknown-prop.yaml [deleted file]
tests/config/fail/type-enum/members-el-member-value-invalid-type.yaml [deleted file]
tests/config/fail/type-enum/members-el-member-value-outside-range-signed.yaml [deleted file]
tests/config/fail/type-enum/members-el-member-value-outside-range-unsigned.yaml [deleted file]
tests/config/fail/type-enum/members-empty.yaml [deleted file]
tests/config/fail/type-enum/members-invalid-type.yaml [deleted file]
tests/config/fail/type-enum/members-no.yaml [deleted file]
tests/config/fail/type-enum/members-overlap.yaml [deleted file]
tests/config/fail/type-enum/unknown-prop.yaml [deleted file]
tests/config/fail/type-enum/vt-invalid-type.yaml [deleted file]
tests/config/fail/type-enum/vt-no.yaml [deleted file]
tests/config/fail/type-float/align-0.yaml [deleted file]
tests/config/fail/type-float/align-3.yaml [deleted file]
tests/config/fail/type-float/align-invalid-type.yaml [deleted file]
tests/config/fail/type-float/bo-invalid-type.yaml [deleted file]
tests/config/fail/type-float/bo-invalid.yaml [deleted file]
tests/config/fail/type-float/fail.bats [deleted file]
tests/config/fail/type-float/size-exp-mant-wrong-sum.yaml [deleted file]
tests/config/fail/type-float/size-exp-no.yaml [deleted file]
tests/config/fail/type-float/size-invalid-type.yaml [deleted file]
tests/config/fail/type-float/size-mant-no.yaml [deleted file]
tests/config/fail/type-float/size-no.yaml [deleted file]
tests/config/fail/type-float/size-unknown-prop.yaml [deleted file]
tests/config/fail/type-float/unknown-prop.yaml [deleted file]
tests/config/fail/type-int/align-0.yaml [deleted file]
tests/config/fail/type-int/align-3.yaml [deleted file]
tests/config/fail/type-int/align-invalid-type.yaml [deleted file]
tests/config/fail/type-int/base-invalid-type.yaml [deleted file]
tests/config/fail/type-int/base-invalid.yaml [deleted file]
tests/config/fail/type-int/bo-invalid-type.yaml [deleted file]
tests/config/fail/type-int/bo-invalid.yaml [deleted file]
tests/config/fail/type-int/fail.bats [deleted file]
tests/config/fail/type-int/pm-invalid-type.yaml [deleted file]
tests/config/fail/type-int/pm-property-invalid.yaml [deleted file]
tests/config/fail/type-int/pm-type-invalid.yaml [deleted file]
tests/config/fail/type-int/pm-unknown-clock.yaml [deleted file]
tests/config/fail/type-int/signed-invalid-type.yaml [deleted file]
tests/config/fail/type-int/size-0.yaml [deleted file]
tests/config/fail/type-int/size-65.yaml [deleted file]
tests/config/fail/type-int/size-invalid-type.yaml [deleted file]
tests/config/fail/type-int/size-no.yaml [deleted file]
tests/config/fail/type-int/unknown-prop.yaml [deleted file]
tests/config/fail/type-string/fail.bats [deleted file]
tests/config/fail/type-string/unknown-prop.yaml [deleted file]
tests/config/fail/type-struct/fail.bats [deleted file]
tests/config/fail/type-struct/fields-field-invalid-identifier.yaml [deleted file]
tests/config/fail/type-struct/fields-invalid-type.yaml [deleted file]
tests/config/fail/type-struct/ma-0.yaml [deleted file]
tests/config/fail/type-struct/ma-3.yaml [deleted file]
tests/config/fail/type-struct/ma-invalid-type.yaml [deleted file]
tests/config/fail/type-struct/unknown-prop.yaml [deleted file]
tests/config/fail/type/fail.bats [deleted file]
tests/config/fail/type/inherit-forward.yaml [deleted file]
tests/config/fail/type/inherit-unknown.yaml [deleted file]
tests/config/fail/type/invalid-type.yaml [deleted file]
tests/config/fail/type/no-class.yaml [deleted file]
tests/config/fail/yaml/fail.bats [deleted file]
tests/config/fail/yaml/invalid.yaml [deleted file]
tests/config/pass/everything/config.yaml [deleted file]
tests/config/pass/everything/inc-clock.yaml [deleted file]
tests/config/pass/everything/inc-event.yaml [deleted file]
tests/config/pass/everything/inc-metadata.yaml [deleted file]
tests/config/pass/everything/inc-stream.yaml [deleted file]
tests/config/pass/everything/inc-trace.yaml [deleted file]
tests/config/pass/everything/pass.bats [deleted file]
tests/test.bash

index b748deafe1c1f9210ea33f7300d8bd334cc4d862..bb0207c4d4984ebfc087f08cdf6ed906539c88d4 100644 (file)
 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-__major_version__ = 2
-__minor_version__ = 3
-__patch_version__ = 1
-__version__ = '{}.{}.{}'.format(__major_version__, __minor_version__,
-                                __patch_version__)
+import barectf.config_parse_common as barectf_config_parse_common
+import barectf.version as barectf_version
+import barectf.config as barectf_config
+import barectf.gen as barectf_gen
 
 
-def get_version_tuple():
-    return __major_version__, __minor_version__, __patch_version__
+# version API
+__major_version__ = barectf_version.__major_version__
+__minor_version__ = barectf_version.__minor_version__
+__patch_version__ = barectf_version.__patch_version__
+__version__ = barectf_version.__version__
+
+
+# configuration API
+_ArrayFieldType = barectf_config._ArrayFieldType
+_BitArrayFieldType = barectf_config._BitArrayFieldType
+_ConfigurationParseError = barectf_config_parse_common._ConfigurationParseError
+_EnumerationFieldType = barectf_config._EnumerationFieldType
+_FieldType = barectf_config._FieldType
+_IntegerFieldType = barectf_config._IntegerFieldType
+ByteOrder = barectf_config.ByteOrder
+ClockType = barectf_config.ClockType
+ClockTypeCTypes = barectf_config.ClockTypeCTypes
+ClockTypeOffset = barectf_config.ClockTypeOffset
+Configuration = barectf_config.Configuration
+configuration_file_major_version = barectf_config.configuration_file_major_version
+configuration_from_file = barectf_config.configuration_from_file
+ConfigurationCodeGenerationHeaderOptions = barectf_config.ConfigurationCodeGenerationHeaderOptions
+ConfigurationCodeGenerationOptions = barectf_config.ConfigurationCodeGenerationOptions
+ConfigurationOptions = barectf_config.ConfigurationOptions
+DEFAULT_FIELD_TYPE = barectf_config.DEFAULT_FIELD_TYPE
+DisplayBase = barectf_config.DisplayBase
+effective_configuration_file = barectf_config.effective_configuration_file
+EnumerationFieldTypeMapping = barectf_config.EnumerationFieldTypeMapping
+EnumerationFieldTypeMappingRange = barectf_config.EnumerationFieldTypeMappingRange
+EnumerationFieldTypeMappings = barectf_config.EnumerationFieldTypeMappings
+EventType = barectf_config.EventType
+RealFieldType = barectf_config.RealFieldType
+SignedEnumerationFieldType = barectf_config.SignedEnumerationFieldType
+SignedIntegerFieldType = barectf_config.SignedIntegerFieldType
+StaticArrayFieldType = barectf_config.StaticArrayFieldType
+StreamType = barectf_config.StreamType
+StreamTypeEventFeatures = barectf_config.StreamTypeEventFeatures
+StreamTypeFeatures = barectf_config.StreamTypeFeatures
+StreamTypePacketFeatures = barectf_config.StreamTypePacketFeatures
+StringFieldType = barectf_config.StringFieldType
+StructureFieldType = barectf_config.StructureFieldType
+StructureFieldTypeMember = barectf_config.StructureFieldTypeMember
+StructureFieldTypeMembers = barectf_config.StructureFieldTypeMembers
+Trace = barectf_config.Trace
+TraceEnvironment = barectf_config.TraceEnvironment
+TraceType = barectf_config.TraceType
+TraceTypeFeatures = barectf_config.TraceTypeFeatures
+UnsignedEnumerationFieldType = barectf_config.UnsignedEnumerationFieldType
+UnsignedIntegerFieldType = barectf_config.UnsignedIntegerFieldType
+
+
+# code generation API
+CodeGenerator = barectf_gen.CodeGenerator
+
+
+del barectf_config_parse_common
+del barectf_version
+del barectf_config
+del barectf_gen
index 184218b14d1169bae08650b7ead6a1d4fe2f6a37..effe4270048be9d668e28c5ed40d3b99ebd3538b 100644 (file)
 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-import barectf.tsdl182gen
-import barectf.config
 import pkg_resources
-import barectf.gen
 import termcolor
 import argparse
 import os.path
 import barectf
+import barectf.config_parse_common as barectf_config_parse_common
 import sys
 import os
 
 
-def _perror(msg):
+# Colors and prints the error message `msg` and exits with status code
+# 1.
+def _print_error(msg):
     termcolor.cprint('Error: ', 'red', end='', file=sys.stderr)
     termcolor.cprint(msg, 'red', attrs=['bold'], file=sys.stderr)
     sys.exit(1)
 
 
-def _pconfig_error(exc):
-    termcolor.cprint('Error:', 'red', file=sys.stderr)
-
+# Pretty-prints the barectf configuration error `exc` and exits with
+# status code 1.
+def _print_config_error(exc):
+    # reverse: most precise message comes last
     for ctx in reversed(exc.context):
+        msg = ''
+
         if ctx.message is not None:
             msg = f' {ctx.message}'
-        else:
-            msg = ''
 
-        termcolor.cprint(f'  {ctx.name}:{msg}', 'red', attrs=['bold'],
-                         file=sys.stderr)
+        color = 'red'
+        termcolor.cprint(f'{ctx.name}', color, attrs=['bold'], file=sys.stderr, end='')
+        termcolor.cprint(':', color, file=sys.stderr, end='')
+        termcolor.cprint(msg, color, file=sys.stderr)
 
     sys.exit(1)
 
 
-def _psuccess(msg):
-    termcolor.cprint(msg, 'green', attrs=['bold'])
+# Pretty-prints the unknown exception `exc`.
+def _print_unknown_exc(exc):
+    import traceback
+
+    traceback.print_exc()
+    _print_error(f'Unknown exception: {exc}')
 
 
 def _parse_args():
     ap = argparse.ArgumentParser()
 
-    ap.add_argument('-c', '--code-dir', metavar='DIR', action='store',
-                    default=os.getcwd(),
+    ap.add_argument('-c', '--code-dir', metavar='DIR', action='store', default=os.getcwd(),
                     help='output directory of C source file')
     ap.add_argument('--dump-config', action='store_true',
                     help='also dump the effective YAML configuration file used for generation')
-    ap.add_argument('-H', '--headers-dir', metavar='DIR', action='store',
-                    default=os.getcwd(),
+    ap.add_argument('-H', '--headers-dir', metavar='DIR', action='store', default=os.getcwd(),
                     help='output directory of C header files')
-    ap.add_argument('-I', '--include-dir', metavar='DIR', action='append',
-                    default=[],
+    ap.add_argument('-I', '--include-dir', metavar='DIR', action='append', default=[],
                     help='add directory DIR to the list of directories to be searched for include files')
     ap.add_argument('--ignore-include-not-found', action='store_true',
                     help='continue to process the configuration file when included files are not found')
-    ap.add_argument('-m', '--metadata-dir', metavar='DIR', action='store',
-                    default=os.getcwd(),
+    ap.add_argument('-m', '--metadata-dir', metavar='DIR', action='store', default=os.getcwd(),
                     help='output directory of CTF metadata')
     ap.add_argument('-p', '--prefix', metavar='PREFIX', action='store',
-                    help='override configuration\'s prefix')
+                    help='override configuration\'s prefixes')
     ap.add_argument('-V', '--version', action='version',
                     version='%(prog)s {}'.format(barectf.__version__))
     ap.add_argument('config', metavar='CONFIG', action='store',
@@ -88,77 +91,92 @@ def _parse_args():
     args = ap.parse_args()
 
     # validate output directories
-    for d in [args.code_dir, args.headers_dir, args.metadata_dir] + args.include_dir:
-        if not os.path.isdir(d):
-            _perror(f'`{d}` is not an existing directory')
+    for dir in [args.code_dir, args.headers_dir, args.metadata_dir] + args.include_dir:
+        if not os.path.isdir(dir):
+            _print_error(f'`{dir}` is not an existing directory')
 
     # validate that configuration file exists
     if not os.path.isfile(args.config):
-        _perror(f'`{args.config}` is not an existing, regular file')
+        _print_error(f'`{args.config}` is not an existing, regular file')
 
-    # append current working directory and provided include directory
+    # Load configuration file to get its major version in order to
+    # append the correct implicit inclusion directory.
+    try:
+        with open(args.config) as f:
+            config_major_version = barectf.configuration_file_major_version(f)
+    except barectf._ConfigurationParseError as exc:
+        _print_config_error(exc)
+    except Exception as exc:
+        _print_unknown_exc(exc)
+
+    # append current working directory and implicit inclusion directory
     args.include_dir += [
         os.getcwd(),
-        pkg_resources.resource_filename(__name__, 'include')
+        pkg_resources.resource_filename(__name__, f'include/{config_major_version}')
     ]
 
     return args
 
 
-def _write_file(d, name, content):
-    with open(os.path.join(d, name), 'w') as f:
-        f.write(content)
-
-
 def run():
     # parse arguments
     args = _parse_args()
 
     # create configuration
     try:
-        config = barectf.config.from_file(args.config, args.include_dir,
-                                          args.ignore_include_not_found,
-                                          args.dump_config)
-    except barectf.config._ConfigParseError as exc:
-        _pconfig_error(exc)
+        with open(args.config) as f:
+            if args.dump_config:
+                # print effective configuration file
+                print(barectf.effective_configuration_file(f, args.include_dir,
+                                                           args.ignore_include_not_found))
+
+                # barectf.configuration_from_file() reads the file again
+                # below: rewind.
+                f.seek(0)
+
+            config = barectf.configuration_from_file(f, args.include_dir,
+                                                     args.ignore_include_not_found)
+    except barectf._ConfigurationParseError as exc:
+        _print_config_error(exc)
     except Exception as exc:
-        import traceback
-
-        traceback.print_exc()
-        _perror(f'Unknown exception: {exc}')
+        _print_unknown_exc(exc)
 
-    # replace prefix if needed
     if args.prefix:
-        config = barectf.config.Config(config.metadata, args.prefix,
-                                       config.options)
-
-    # generate metadata
-    metadata = barectf.tsdl182gen.from_metadata(config.metadata)
-
-    try:
-        _write_file(args.metadata_dir, 'metadata', metadata)
-    except Exception as exc:
-        _perror(f'Cannot write metadata file: {exc}')
-
-    # create generator
-    generator = barectf.gen.CCodeGenerator(config)
-
-    # generate C headers
-    header = generator.generate_header()
-    bitfield_header = generator.generate_bitfield_header()
+        # Override prefixes.
+        #
+        # For historical reasons, the `--prefix` option applies the
+        # barectf 2 configuration prefix rules. Therefore, get the
+        # equivalent barectf 3 prefixes first.
+        v3_prefixes = barectf_config_parse_common._v3_prefixes_from_v2_prefix(args.prefix)
+        cg_opts = config.options.code_generation_options
+        cg_opts = barectf.ConfigurationCodeGenerationOptions(v3_prefixes.identifier,
+                                                             v3_prefixes.file_name,
+                                                             cg_opts.default_stream_type,
+                                                             cg_opts.header_options,
+                                                             cg_opts.clock_type_c_types)
+        config = barectf.Configuration(config.trace, barectf.ConfigurationOptions(cg_opts))
+
+    # create a barectf code generator
+    code_gen = barectf.CodeGenerator(config)
+
+    def write_file(dir, file):
+        with open(os.path.join(dir, file.name), 'w') as f:
+            f.write(file.contents)
+
+    def write_files(dir, files):
+        for file in files:
+            write_file(dir, file)
 
     try:
-        _write_file(args.headers_dir, generator.get_header_filename(), header)
-        _write_file(args.headers_dir, generator.get_bitfield_header_filename(),
-                    bitfield_header)
-    except Exception as exc:
-        _perror(f'Cannot write header files: {exc}')
+        # generate and write metadata stream file
+        write_file(args.metadata_dir, code_gen.generate_metadata_stream())
 
-    # generate C source
-    c_src = generator.generate_c_src()
+        # generate and write C header files
+        write_files(args.headers_dir, code_gen.generate_c_headers())
 
-    try:
-        _write_file(args.code_dir, '{}.c'.format(config.prefix.rstrip('_')),
-                    c_src)
+        # generate and write C source files
+        write_files(args.code_dir, code_gen.generate_c_sources())
     except Exception as exc:
-        _perror(f'Cannot write C source file: {exc}')
+        # We know `config` is valid, therefore the code generator cannot
+        # fail for a reason known to barectf.
+        _print_unknown_exc(exc)
index 900a546ac6572bb52d7cde5dbb48ab90bacd90e2..3a54ea30ad09543dc85e3e984411890ad431c103 100644 (file)
@@ -21,8 +21,7 @@
 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-
-class CodeGenerator:
+class _CodeGenerator:
     def __init__(self, indent_string):
         self._indent_string = indent_string
         self.reset()
index d9903098071e22a206e507bb3ec3c1888024aab2..a33dea4e063264ac336222f0e9965fcfa39fb0d1 100644 (file)
 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-from barectf import config_parse
+import barectf.config_parse as barectf_config_parse
+import barectf.version as barectf_version
+import collections.abc
+import collections
+import datetime
+import enum
 
 
-_ConfigParseError = config_parse._ConfigParseError
+@enum.unique
+class ByteOrder(enum.Enum):
+    LITTLE_ENDIAN = 'le'
+    BIG_ENDIAN = 'be'
 
 
-class Config:
-    def __init__(self, metadata, prefix=None, options=None):
-        self._metadata = metadata
+class _FieldType:
+    @property
+    def alignment(self):
+        raise NotImplementedError
 
-        if prefix is None:
-            self._prefix = 'barectf_'
-        else:
-            self._prefix = prefix
 
-        if options is None:
-            self._options = ConfigOptions()
-        else:
-            self._options = options
+class _BitArrayFieldType(_FieldType):
+    def __init__(self, size, byte_order=None, alignment=1):
+        self._size = size
+        self._byte_order = byte_order
+        self._alignment = alignment
 
     @property
-    def metadata(self):
-        return self._metadata
+    def size(self):
+        return self._size
 
     @property
-    def prefix(self):
-        return self._prefix
+    def byte_order(self):
+        return self._byte_order
 
     @property
-    def options(self):
-        return self._options
+    def alignment(self):
+        return self._alignment
+
+
+class DisplayBase(enum.Enum):
+    BINARY = 2
+    OCTAL = 8
+    DECIMAL = 10
+    HEXADECIMAL = 16
+
+
+class _IntegerFieldType(_BitArrayFieldType):
+    def __init__(self, size, byte_order=None, alignment=None,
+                 preferred_display_base=DisplayBase.DECIMAL):
+        effective_alignment = 1
+
+        if alignment is None and size % 8 == 0:
+            effective_alignment = 8
+
+        super().__init__(size, byte_order, effective_alignment)
+        self._preferred_display_base = preferred_display_base
+
+    @property
+    def preferred_display_base(self):
+        return self._preferred_display_base
+
+
+class UnsignedIntegerFieldType(_IntegerFieldType):
+    def __init__(self, *args):
+        super().__init__(*args)
+        self._mapped_clk_type_name = None
+
+
+class SignedIntegerFieldType(_IntegerFieldType):
+    pass
+
+
+class EnumerationFieldTypeMappingRange:
+    def __init__(self, lower, upper):
+        self._lower = lower
+        self._upper = upper
+
+    @property
+    def lower(self):
+        return self._lower
+
+    @property
+    def upper(self):
+        return self._upper
+
+    def __eq__(self, other):
+        if type(other) is not type(self):
+            return False
+
+        return (self._lower, self._upper) == (other._lower, other._upper)
+
+    def __hash__(self):
+        return hash((self._lower, self._upper))
+
+    def contains(self, value):
+        return self._lower <= value <= self._upper
+
+
+class EnumerationFieldTypeMapping:
+    def __init__(self, ranges):
+        self._ranges = frozenset(ranges)
+
+    @property
+    def ranges(self):
+        return self._ranges
+
+    def ranges_contain_value(self, value):
+        return any([rg.contains(value) for rg in self._ranges])
+
+
+class EnumerationFieldTypeMappings(collections.abc.Mapping):
+    def __init__(self, mappings):
+        self._mappings = {label: mapping for label, mapping in mappings.items()}
+
+    def __getitem__(self, key):
+        return self._mappings[key]
+
+    def __iter__(self):
+        return iter(self._mappings)
+
+    def __len__(self):
+        return len(self._mappings)
 
 
-class ConfigOptions:
-    def __init__(self, gen_prefix_def=False, gen_default_stream_def=False):
-        self._gen_prefix_def = False
-        self._gen_default_stream_def = False
+class _EnumerationFieldType(_IntegerFieldType):
+    def __init__(self, size, byte_order=None, alignment=None,
+                 preferred_display_base=DisplayBase.DECIMAL, mappings=None):
+        super().__init__(size, byte_order, alignment, preferred_display_base)
+        self._mappings = EnumerationFieldTypeMappings({})
+
+        if mappings is not None:
+            self._mappings = EnumerationFieldTypeMappings(mappings)
+
+    @property
+    def mappings(self):
+        return self._mappings
+
+    def labels_for_value(self, value):
+        labels = set()
+
+        for label, mapping in self._mappings.items():
+            if mapping.ranges_contain_value(value):
+                labels.add(label)
+
+        return labels
+
+
+class UnsignedEnumerationFieldType(_EnumerationFieldType, UnsignedIntegerFieldType):
+    pass
+
+
+class SignedEnumerationFieldType(_EnumerationFieldType, SignedIntegerFieldType):
+    pass
+
+
+class RealFieldType(_BitArrayFieldType):
+    pass
+
+
+class StringFieldType(_FieldType):
+    @property
+    def alignment(self):
+        return 8
+
+
+class _ArrayFieldType(_FieldType):
+    def __init__(self, element_field_type):
+        self._element_field_type = element_field_type
+
+    @property
+    def element_field_type(self):
+        return self._element_field_type
 
     @property
-    def gen_prefix_def(self):
-        return self._gen_prefix_def
+    def alignment(self):
+        return self._element_field_type.alignment
+
+
+class StaticArrayFieldType(_ArrayFieldType):
+    def __init__(self, length, element_field_type):
+        super().__init__(element_field_type)
+        self._length = length
 
     @property
-    def gen_default_stream_def(self):
-        return self._gen_default_stream_def
+    def length(self):
+        return self._length
+
+
+class StructureFieldTypeMember:
+    def __init__(self, field_type):
+        self._field_type = field_type
+
+    @property
+    def field_type(self):
+        return self._field_type
+
+
+class StructureFieldTypeMembers(collections.abc.Mapping):
+    def __init__(self, members):
+        self._members = collections.OrderedDict()
+
+        for name, member in members.items():
+            assert type(member) is StructureFieldTypeMember
+            self._members[name] = member
+
+    def __getitem__(self, key):
+        return self._members[key]
+
+    def __iter__(self):
+        return iter(self._members)
+
+    def __len__(self):
+        return len(self._members)
+
+
+class StructureFieldType(_FieldType):
+    def __init__(self, minimum_alignment=1, members=None):
+        self._minimum_alignment = minimum_alignment
+        self._members = StructureFieldTypeMembers({})
+
+        if members is not None:
+            self._members = StructureFieldTypeMembers(members)
+
+        self._set_alignment()
+
+    def _set_alignment(self):
+        self._alignment = self._minimum_alignment
+
+        for member in self._members.values():
+            if member.field_type.alignment > self._alignment:
+                self._alignment = member.field_type.alignment
+
+    @property
+    def minimum_alignment(self):
+        return self._minimum_alignment
+
+    @property
+    def alignment(self):
+        return self._alignment
+
+    @property
+    def members(self):
+        return self._members
+
+
+class _UniqueByName:
+    def __eq__(self, other):
+        if type(other) is not type(self):
+            return False
+
+        return self._name == other._name
+
+    def __lt__(self, other):
+        assert type(self) is type(other)
+        return self._name < other._name
+
+    def __hash__(self):
+        return hash(self._name)
+
+
+class EventType(_UniqueByName):
+    def __init__(self, name, log_level=None, specific_context_field_type=None,
+                 payload_field_type=None):
+        self._id = None
+        self._name = name
+        self._log_level = log_level
+        self._specific_context_field_type = specific_context_field_type
+        self._payload_field_type = payload_field_type
+
+    @property
+    def id(self):
+        return self._id
+
+    @property
+    def name(self):
+        return self._name
+
+    @property
+    def log_level(self):
+        return self._log_level
+
+    @property
+    def specific_context_field_type(self):
+        return self._specific_context_field_type
+
+    @property
+    def payload_field_type(self):
+        return self._payload_field_type
+
+
+class ClockTypeOffset:
+    def __init__(self, seconds=0, cycles=0):
+        self._seconds = seconds
+        self._cycles = cycles
+
+    @property
+    def seconds(self):
+        return self._seconds
+
+    @property
+    def cycles(self):
+        return self._cycles
+
+
+class ClockType(_UniqueByName):
+    def __init__(self, name, frequency=int(1e9), uuid=None, description=None, precision=0,
+                 offset=None, origin_is_unix_epoch=False):
+        self._name = name
+        self._frequency = frequency
+        self._uuid = uuid
+        self._description = description
+        self._precision = precision
+        self._offset = ClockTypeOffset()
+
+        if offset is not None:
+            self._offset = offset
+
+        self._origin_is_unix_epoch = origin_is_unix_epoch
+
+    @property
+    def name(self):
+        return self._name
+
+    @property
+    def frequency(self):
+        return self._frequency
+
+    @property
+    def uuid(self):
+        return self._uuid
+
+    @property
+    def description(self):
+        return self._description
+
+    @property
+    def precision(self):
+        return self._precision
+
+    @property
+    def offset(self):
+        return self._offset
+
+    @property
+    def origin_is_unix_epoch(self):
+        return self._origin_is_unix_epoch
+
+
+DEFAULT_FIELD_TYPE = 'default'
+
+
+class StreamTypePacketFeatures:
+    def __init__(self, total_size_field_type=DEFAULT_FIELD_TYPE,
+                 content_size_field_type=DEFAULT_FIELD_TYPE, beginning_time_field_type=None,
+                 end_time_field_type=None, discarded_events_counter_field_type=None):
+        def get_ft(user_ft):
+            if user_ft == DEFAULT_FIELD_TYPE:
+                return UnsignedIntegerFieldType(64)
+
+            return user_ft
+
+        self._total_size_field_type = get_ft(total_size_field_type)
+        self._content_size_field_type = get_ft(content_size_field_type)
+        self._beginning_time_field_type = get_ft(beginning_time_field_type)
+        self._end_time_field_type = get_ft(end_time_field_type)
+        self._discarded_events_counter_field_type = get_ft(discarded_events_counter_field_type)
+
+    @property
+    def total_size_field_type(self):
+        return self._total_size_field_type
+
+    @property
+    def content_size_field_type(self):
+        return self._content_size_field_type
+
+    @property
+    def beginning_time_field_type(self):
+        return self._beginning_time_field_type
+
+    @property
+    def end_time_field_type(self):
+        return self._end_time_field_type
+
+    @property
+    def discarded_events_counter_field_type(self):
+        return self._discarded_events_counter_field_type
+
+
+class StreamTypeEventFeatures:
+    def __init__(self, type_id_field_type=DEFAULT_FIELD_TYPE, time_field_type=None):
+        def get_ft(user_field_type):
+            if user_field_type == DEFAULT_FIELD_TYPE:
+                return UnsignedIntegerFieldType(64)
+
+            return user_field_type
+
+        self._type_id_field_type = get_ft(type_id_field_type)
+        self._time_field_type = get_ft(time_field_type)
+
+    @property
+    def type_id_field_type(self):
+        return self._type_id_field_type
+
+    @property
+    def time_field_type(self):
+        return self._time_field_type
+
+
+class StreamTypeFeatures:
+    def __init__(self, packet_features=None, event_features=None):
+        self._packet_features = StreamTypePacketFeatures()
+
+        if packet_features is not None:
+            self._packet_features = packet_features
+
+        self._event_features = StreamTypeEventFeatures()
+
+        if event_features is not None:
+            self._event_features = event_features
+
+    @property
+    def packet_features(self):
+        return self._packet_features
+
+    @property
+    def event_features(self):
+        return self._event_features
+
+
+class StreamType(_UniqueByName):
+    def __init__(self, name, event_types, default_clock_type=None, features=None,
+                 packet_context_field_type_extra_members=None,
+                 event_common_context_field_type=None):
+        self._id = None
+        self._name = name
+        self._default_clock_type = default_clock_type
+        self._event_common_context_field_type = event_common_context_field_type
+        self._event_types = frozenset(event_types)
+
+        # assign unique IDs
+        for index, ev_type in enumerate(sorted(self._event_types, key=lambda evt: evt.name)):
+            assert ev_type._id is None
+            ev_type._id = index
+
+        self._set_features(features)
+        self._packet_context_field_type_extra_members = StructureFieldTypeMembers({})
+
+        if packet_context_field_type_extra_members is not None:
+            self._packet_context_field_type_extra_members = StructureFieldTypeMembers(packet_context_field_type_extra_members)
+
+        self._set_pkt_ctx_ft()
+        self._set_ev_header_ft()
+
+    def _set_features(self, features):
+        if features is not None:
+            self._features = features
+            return
+
+        ev_time_ft = None
+        pkt_beginning_time_ft = None
+        pkt_end_time_ft = None
+
+        if self._default_clock_type is not None:
+            # Automatic time field types because the stream type has a
+            # default clock type.
+            ev_time_ft = DEFAULT_FIELD_TYPE
+            pkt_beginning_time_ft = DEFAULT_FIELD_TYPE
+            pkt_end_time_ft = DEFAULT_FIELD_TYPE
+
+        self._features = StreamTypeFeatures(StreamTypePacketFeatures(beginning_time_field_type=pkt_beginning_time_ft,
+                                                                     end_time_field_type=pkt_end_time_ft),
+                                            StreamTypeEventFeatures(time_field_type=ev_time_ft))
+
+    def _set_ft_mapped_clk_type_name(self, ft):
+        if ft is None:
+            return
+
+        if self._default_clock_type is not None:
+            assert isinstance(ft, UnsignedIntegerFieldType)
+            ft._mapped_clk_type_name = self._default_clock_type.name
+
+    def _set_pkt_ctx_ft(self):
+        def add_member_if_exists(name, ft, set_mapped_clk_type_name=False):
+            nonlocal members
+
+            if ft is not None:
+                if set_mapped_clk_type_name:
+                    self._set_ft_mapped_clk_type_name(ft)
+
+                members[name] = StructureFieldTypeMember(ft)
+
+        members = collections.OrderedDict([
+            (
+                'packet_size',
+                StructureFieldTypeMember(self._features.packet_features.total_size_field_type)
+            ),
+            (
+                'content_size',
+                StructureFieldTypeMember(self._features.packet_features.content_size_field_type)
+            )
+        ])
+
+        add_member_if_exists('timestamp_begin',
+                             self._features.packet_features.beginning_time_field_type, True)
+        add_member_if_exists('timestamp_end', self._features.packet_features.end_time_field_type,
+                             True)
+        add_member_if_exists('events_discarded',
+                             self._features.packet_features.discarded_events_counter_field_type)
+
+        if self._packet_context_field_type_extra_members is not None:
+            for name, field_type in self._packet_context_field_type_extra_members.items():
+                assert name not in members
+                members[name] = field_type
+
+        self._pkt_ctx_ft = StructureFieldType(8, members)
+
+    def _set_ev_header_ft(self):
+        members = collections.OrderedDict()
+
+        if self._features.event_features.type_id_field_type is not None:
+            members['id'] = StructureFieldTypeMember(self._features.event_features.type_id_field_type)
+
+        if self._features.event_features.time_field_type is not None:
+            ft = self._features.event_features.time_field_type
+            self._set_ft_mapped_clk_type_name(ft)
+            members['timestamp'] = StructureFieldTypeMember(ft)
+
+        self._ev_header_ft = StructureFieldType(8, members)
+
+    @property
+    def id(self):
+        return self._id
+
+    @property
+    def name(self):
+        return self._name
+
+    @property
+    def default_clock_type(self):
+        return self._default_clock_type
+
+    @property
+    def features(self):
+        return self._features
+
+    @property
+    def packet_context_field_type_extra_members(self):
+        return self._packet_context_field_type_extra_members
+
+    @property
+    def event_common_context_field_type(self):
+        return self._event_common_context_field_type
+
+    @property
+    def event_types(self):
+        return self._event_types
+
+
+class TraceTypeFeatures:
+    def __init__(self, magic_field_type=DEFAULT_FIELD_TYPE, uuid_field_type=None,
+                 stream_type_id_field_type=DEFAULT_FIELD_TYPE):
+        def get_field_type(user_field_type, default_field_type):
+            if user_field_type == DEFAULT_FIELD_TYPE:
+                return default_field_type
+
+            return user_field_type
+
+        self._magic_field_type = get_field_type(magic_field_type, UnsignedIntegerFieldType(32))
+        self._uuid_field_type = get_field_type(uuid_field_type,
+                                               StaticArrayFieldType(16, UnsignedIntegerFieldType(8)))
+        self._stream_type_id_field_type = get_field_type(stream_type_id_field_type,
+                                                         UnsignedIntegerFieldType(64))
+
+    @property
+    def magic_field_type(self):
+        return self._magic_field_type
+
+    @property
+    def uuid_field_type(self):
+        return self._uuid_field_type
+
+    @property
+    def stream_type_id_field_type(self):
+        return self._stream_type_id_field_type
+
+
+class TraceType:
+    def __init__(self, stream_types, default_byte_order, uuid=None, features=None):
+        self._default_byte_order = default_byte_order
+        self._stream_types = frozenset(stream_types)
+
+        # assign unique IDs
+        for index, stream_type in enumerate(sorted(self._stream_types, key=lambda st: st.name)):
+            assert stream_type._id is None
+            stream_type._id = index
+
+        self._uuid = uuid
+        self._set_features(features)
+        self._set_pkt_header_ft()
+        self._set_fts_effective_byte_order()
+
+    def _set_features(self, features):
+        if features is not None:
+            self._features = features
+            return
+
+        # automatic UUID field type because the trace type has a UUID
+        uuid_ft = None if self._uuid is None else DEFAULT_FIELD_TYPE
+        self._features = TraceTypeFeatures(uuid_field_type=uuid_ft)
+
+    def _set_pkt_header_ft(self):
+        def add_member_if_exists(name, field_type):
+            nonlocal members
+
+            if field_type is not None:
+                members[name] = StructureFieldTypeMember(field_type)
+
+        members = collections.OrderedDict()
+        add_member_if_exists('magic', self._features.magic_field_type)
+        add_member_if_exists('uuid', self._features.uuid_field_type)
+        add_member_if_exists('stream_id', self._features.stream_type_id_field_type)
+        self._pkt_header_ft = StructureFieldType(8, members)
+
+    def _set_fts_effective_byte_order(self):
+        def set_ft_effective_byte_order(ft):
+            if ft is None:
+                return
+
+            if isinstance(ft, _BitArrayFieldType):
+                if ft._byte_order is None:
+                    assert self._default_byte_order is not None
+                    ft._byte_order = self._default_byte_order
+            elif isinstance(ft, StaticArrayFieldType):
+                set_ft_effective_byte_order(ft.element_field_type)
+            elif isinstance(ft, StructureFieldType):
+                for member in ft.members.values():
+                    set_ft_effective_byte_order(member.field_type)
+
+        # packet header field type
+        set_ft_effective_byte_order(self._pkt_header_ft)
+
+        # stream type field types
+        for stream_type in self._stream_types:
+            set_ft_effective_byte_order(stream_type._pkt_ctx_ft)
+            set_ft_effective_byte_order(stream_type._ev_header_ft)
+            set_ft_effective_byte_order(stream_type._event_common_context_field_type)
+
+            # event type field types
+            for ev_type in stream_type.event_types:
+                set_ft_effective_byte_order(ev_type._specific_context_field_type)
+                set_ft_effective_byte_order(ev_type._payload_field_type)
+
+    @property
+    def default_byte_order(self):
+        return self._default_byte_order
+
+    @property
+    def uuid(self):
+        return self._uuid
+
+    @property
+    def stream_types(self):
+        return self._stream_types
+
+    def stream_type(self, name):
+        for cand_stream_type in self._stream_types:
+            if cand_stream_type.name == name:
+                return cand_stream_type
+
+    @property
+    def features(self):
+        return self._features
+
+
+class TraceEnvironment(collections.abc.Mapping):
+    def __init__(self, environment):
+        self._env = {name: value for name, value in environment.items()}
+
+    def __getitem__(self, key):
+        return self._env[key]
+
+    def __iter__(self):
+        return iter(self._env)
+
+    def __len__(self):
+        return len(self._env)
+
+
+class Trace:
+    def __init__(self, type, environment=None):
+        self._type = type
+        self._set_env(environment)
+
+    def _set_env(self, environment):
+        init_env = collections.OrderedDict([
+            ('domain', 'bare'),
+            ('tracer_name', 'barectf'),
+            ('tracer_major', barectf_version.__major_version__),
+            ('tracer_minor', barectf_version.__minor_version__),
+            ('tracer_patch', barectf_version.__patch_version__),
+            ('barectf_gen_date', str(datetime.datetime.now().isoformat())),
+        ])
+
+        if environment is None:
+            environment = {}
+
+        init_env.update(environment)
+        self._env = TraceEnvironment(init_env)
+
+    @property
+    def type(self):
+        return self._type
+
+    @property
+    def environment(self):
+        return self._env
+
+
+class ClockTypeCTypes(collections.abc.Mapping):
+    def __init__(self, c_types):
+        self._c_types = {clk_type: c_type for clk_type, c_type in c_types.items()}
+
+    def __getitem__(self, key):
+        return self._c_types[key]
+
+    def __iter__(self):
+        return iter(self._c_types)
+
+    def __len__(self):
+        return len(self._c_types)
+
+
+class ConfigurationCodeGenerationHeaderOptions:
+    def __init__(self, identifier_prefix_definition=False,
+                 default_stream_type_name_definition=False):
+        self._identifier_prefix_definition = identifier_prefix_definition
+        self._default_stream_type_name_definition = default_stream_type_name_definition
+
+    @property
+    def identifier_prefix_definition(self):
+        return self._identifier_prefix_definition
+
+    @property
+    def default_stream_type_name_definition(self):
+        return self._default_stream_type_name_definition
+
+
+class ConfigurationCodeGenerationOptions:
+    def __init__(self, identifier_prefix='barectf_', file_name_prefix='barectf',
+                 default_stream_type=None, header_options=None, clock_type_c_types=None):
+        self._identifier_prefix = identifier_prefix
+        self._file_name_prefix = file_name_prefix
+        self._default_stream_type = default_stream_type
+
+        self._header_options = ConfigurationCodeGenerationHeaderOptions()
+
+        if header_options is not None:
+            self._header_options = header_options
+
+        self._clock_type_c_types = ClockTypeCTypes({})
+
+        if clock_type_c_types is not None:
+            self._clock_type_c_types = ClockTypeCTypes(clock_type_c_types)
+
+    @property
+    def identifier_prefix(self):
+        return self._identifier_prefix
+
+    @property
+    def file_name_prefix(self):
+        return self._file_name_prefix
+
+    @property
+    def default_stream_type(self):
+        return self._default_stream_type
+
+    @property
+    def header_options(self):
+        return self._header_options
+
+    @property
+    def clock_type_c_types(self):
+        return self._clock_type_c_types
+
+
+class ConfigurationOptions:
+    def __init__(self, code_generation_options=None):
+        self._code_generation_options = ConfigurationCodeGenerationOptions()
+
+        if code_generation_options is not None:
+            self._code_generation_options = code_generation_options
+
+    @property
+    def code_generation_options(self):
+        return self._code_generation_options
+
+
+class Configuration:
+    def __init__(self, trace, options=None):
+        self._trace = trace
+        self._options = ConfigurationOptions()
+
+        if options is not None:
+            self._options = options
+
+        clk_type_c_types = self._options.code_generation_options.clock_type_c_types
+
+        for stream_type in trace.type.stream_types:
+            def_clk_type = stream_type.default_clock_type
+
+            if def_clk_type is None:
+                continue
+
+            if def_clk_type not in clk_type_c_types:
+                clk_type_c_types._c_types[def_clk_type] = 'uint32_t'
+
+    @property
+    def trace(self):
+        return self._trace
+
+    @property
+    def options(self):
+        return self._options
+
+
+def effective_configuration_file(file, inclusion_dirs, ignore_inclusion_not_found,
+                                 indent_space_count=2):
+    return barectf_config_parse._effective_config_file(file, inclusion_dirs,
+                                                       ignore_inclusion_not_found,
+                                                       indent_space_count)
 
 
-def from_file(path, include_dirs, ignore_include_not_found, dump_config):
-    return config_parse._from_file(path, include_dirs, ignore_include_not_found,
-                                   dump_config)
+def configuration_from_file(file, inclusion_dirs, ignore_inclusion_not_found):
+    return barectf_config_parse._from_file(file, inclusion_dirs, ignore_inclusion_not_found)
 
 
-# deprecated
-from_yaml_file = from_file
+def configuration_file_major_version(file):
+    return barectf_config_parse._config_file_major_version(file)
index 8457c5a137e04704ed54c59362ffe915701228f0..0899a349d9789290ef2d06e454f5e0330bfbb828 100644 (file)
 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-import barectf.metadata
-import barectf.config
-import pkg_resources
+import barectf.config_parse_common as barectf_config_parse_common
+from barectf.config_parse_common import _ConfigurationParseError
+import barectf.config_parse_v2 as barectf_config_parse_v2
+import barectf.config_parse_v3 as barectf_config_parse_v3
 import collections
-import jsonschema
-import os.path
-import enum
-import yaml
-import uuid
-import copy
-import os
 
 
-# The context of a configuration parsing error.
+# Creates and returns a barectf 3 YAML configuration file parser to
+# parse the file-like object `file`.
 #
-# Such a context object has a name and, optionally, a message.
-class _ConfigParseErrorContext:
-    def __init__(self, name, message=None):
-        self._name = name
-        self._msg = message
-
-    @property
-    def name(self):
-        return self._name
-
-    @property
-    def message(self):
-        return self._msg
-
-
-# Appends the context having the object name `obj_name` and the
-# (optional) message `message` to the `_ConfigParseError` exception
-# `exc` and then raises `exc` again.
-def _append_error_ctx(exc, obj_name, message=None):
-    exc._append_ctx(obj_name, message)
-    raise
-
-
-# A configuration parsing error.
-#
-# Such an error object contains a list of contexts (`context` property).
-#
-# The first context of this list is the most specific context, while the
-# last is the more general.
-#
-# Use _append_ctx() to append a context to an existing configuration
-# parsing error when you catch it before raising it again. You can use
-# _append_error_ctx() to do exactly this in a single call.
-class _ConfigParseError(RuntimeError):
-    def __init__(self, init_ctx_obj_name, init_ctx_msg=None):
-        self._ctx = []
-        self._append_ctx(init_ctx_obj_name, init_ctx_msg)
-
-    @property
-    def context(self):
-        return self._ctx
-
-    def _append_ctx(self, name, msg=None):
-        self._ctx.append(_ConfigParseErrorContext(name, msg))
-
-
-def _opt_to_public(obj):
-    if obj is None:
-        return
-
-    return obj.to_public()
-
-
-# Pseudo object base class.
-#
-# A concrete pseudo object contains the same data as its public version,
-# but it's mutable.
-#
-# The to_public() method converts the pseudo object to an equivalent
-# public, immutable object, caching the result so as to always return
-# the same Python object.
-class _PseudoObj:
-    def __init__(self):
-        self._public = None
-
-    def to_public(self):
-        if self._public is None:
-            self._public = self._to_public()
-
-        return self._public
-
-    def _to_public(self):
-        raise NotImplementedError
-
-
-class _PropertyMapping(_PseudoObj):
-    def __init__(self):
-        super().__init__()
-        self.object = None
-        self.prop = None
-
-    def _to_public(self):
-        return barectf.metadata.PropertyMapping(self.object.to_public(),
-                                                self.prop)
-
-
-class _Integer(_PseudoObj):
-    def __init__(self):
-        super().__init__()
-        self.size = None
-        self.byte_order = None
-        self.align = None
-        self.signed = False
-        self.base = 10
-        self.encoding = barectf.metadata.Encoding.NONE
-        self.property_mappings = []
-
-    @property
-    def real_align(self):
-        if self.align is None:
-            if self.size % 8 == 0:
-                return 8
-            else:
-                return 1
-        else:
-            return self.align
-
-    def _to_public(self):
-        prop_mappings = [pm.to_public() for pm in self.property_mappings]
-        return barectf.metadata.Integer(self.size, self.byte_order, self.align,
-                                        self.signed, self.base, self.encoding,
-                                        prop_mappings)
-
-
-class _FloatingPoint(_PseudoObj):
-    def __init__(self):
-        super().__init__()
-        self.exp_size = None
-        self.mant_size = None
-        self.byte_order = None
-        self.align = 8
-
-    @property
-    def real_align(self):
-        return self.align
-
-    def _to_public(self):
-        return barectf.metadata.FloatingPoint(self.exp_size, self.mant_size,
-                                              self.byte_order, self.align)
-
-
-class _Enum(_PseudoObj):
-    def __init__(self):
-        super().__init__()
-        self.value_type = None
-        self.members = collections.OrderedDict()
-
-    @property
-    def real_align(self):
-        return self.value_type.real_align
-
-    def _to_public(self):
-        return barectf.metadata.Enum(self.value_type.to_public(), self.members)
-
-
-class _String(_PseudoObj):
-    def __init__(self):
-        super().__init__()
-        self.encoding = barectf.metadata.Encoding.UTF8
-
-    @property
-    def real_align(self):
-        return 8
-
-    def _to_public(self):
-        return barectf.metadata.String(self.encoding)
-
-
-class _Array(_PseudoObj):
-    def __init__(self):
-        super().__init__()
-        self.element_type = None
-        self.length = None
-
-    @property
-    def real_align(self):
-        return self.element_type.real_align
-
-    def _to_public(self):
-        return barectf.metadata.Array(self.element_type.to_public(), self.length)
-
-
-class _Struct(_PseudoObj):
-    def __init__(self):
-        super().__init__()
-        self.min_align = 1
-        self.fields = collections.OrderedDict()
-
-    @property
-    def real_align(self):
-        align = self.min_align
-
-        for pseudo_field in self.fields.values():
-            if pseudo_field.real_align > align:
-                align = pseudo_field.real_align
-
-        return align
-
-    def _to_public(self):
-        fields = []
-
-        for name, pseudo_field in self.fields.items():
-            fields.append((name, pseudo_field.to_public()))
-
-        return barectf.metadata.Struct(self.min_align,
-                                       collections.OrderedDict(fields))
-
-
-class _Trace(_PseudoObj):
-    def __init__(self):
-        super().__init__()
-        self.byte_order = None
-        self.uuid = None
-        self.packet_header_type = None
-
-    def _to_public(self):
-        return barectf.metadata.Trace(self.byte_order, self.uuid,
-                                      _opt_to_public(self.packet_header_type))
-
-
-class _Clock(_PseudoObj):
-    def __init__(self):
-        super().__init__()
-        self.name = None
-        self.uuid = None
-        self.description = None
-        self.freq = int(1e9)
-        self.error_cycles = 0
-        self.offset_seconds = 0
-        self.offset_cycles = 0
-        self.absolute = False
-        self.return_ctype = 'uint32_t'
-
-    def _to_public(self):
-        return barectf.metadata.Clock(self.name, self.uuid,
-                                      self.description, self.freq,
-                                      self.error_cycles, self.offset_seconds,
-                                      self.offset_cycles, self.absolute,
-                                      self.return_ctype)
-
-
-class _Event(_PseudoObj):
-    def __init__(self):
-        super().__init__()
-        self.id = None
-        self.name = None
-        self.log_level = None
-        self.payload_type = None
-        self.context_type = None
-
-    def _to_public(self):
-        return barectf.metadata.Event(self.id, self.name, self.log_level,
-                                      _opt_to_public(self.payload_type),
-                                      _opt_to_public(self.context_type))
-
-
-class _Stream(_PseudoObj):
-    def __init__(self):
-        super().__init__()
-        self.id = None
-        self.name = None
-        self.packet_context_type = None
-        self.event_header_type = None
-        self.event_context_type = None
-        self.events = collections.OrderedDict()
-
-    def is_event_empty(self, event):
-        total_fields = 0
-
-        if self.event_header_type is not None:
-            total_fields += len(self.event_header_type.fields)
-
-        if self.event_context_type is not None:
-            total_fields += len(self.event_context_type.fields)
-
-        if event.context_type is not None:
-            total_fields += len(event.context_type.fields)
-
-        if event.payload_type is not None:
-            total_fields += len(event.payload_type.fields)
-
-        return total_fields == 0
-
-    def _to_public(self):
-        events = []
-
-        for name, pseudo_ev in self.events.items():
-            events.append((name, pseudo_ev.to_public()))
-
-        return barectf.metadata.Stream(self.id, self.name,
-                                       _opt_to_public(self.packet_context_type),
-                                       _opt_to_public(self.event_header_type),
-                                       _opt_to_public(self.event_context_type),
-                                       collections.OrderedDict(events))
-
-
-class _Metadata(_PseudoObj):
-    def __init__(self):
-        super().__init__()
-        self.trace = None
-        self.env = None
-        self.clocks = None
-        self.streams = None
-        self.default_stream_name = None
-
-    def _to_public(self):
-        clocks = []
-
-        for name, pseudo_clock in self.clocks.items():
-            clocks.append((name, pseudo_clock.to_public()))
-
-        streams = []
-
-        for name, pseudo_stream in self.streams.items():
-            streams.append((name, pseudo_stream.to_public()))
-
-        return barectf.metadata.Metadata(self.trace.to_public(), self.env,
-                                         collections.OrderedDict(clocks),
-                                         collections.OrderedDict(streams),
-                                         self.default_stream_name)
-
-
-# This JSON schema reference resolver only serves to detect when it
-# needs to resolve a remote URI.
-#
-# This must never happen in barectf because all our schemas are local;
-# it would mean a programming or schema error.
-class _RefResolver(jsonschema.RefResolver):
-    def resolve_remote(self, uri):
-        raise RuntimeError(f'Missing local schema with URI `{uri}`')
-
-
-# Schema validator which considers all the schemas found in the barectf
-# package's `schemas` directory.
-#
-# The only public method is validate() which accepts an instance to
-# validate as well as a schema short ID.
-class _SchemaValidator:
-    def __init__(self):
-        subdirs = ['config', os.path.join('2', 'config')]
-        schemas_dir = pkg_resources.resource_filename(__name__, 'schemas')
-        self._store = {}
-
-        for subdir in subdirs:
-            dir = os.path.join(schemas_dir, subdir)
-
-            for file_name in os.listdir(dir):
-                if not file_name.endswith('.yaml'):
-                    continue
-
-                with open(os.path.join(dir, file_name)) as f:
-                    schema = yaml.load(f, Loader=yaml.SafeLoader)
-
-                assert '$id' in schema
-                schema_id = schema['$id']
-                assert schema_id not in self._store
-                self._store[schema_id] = schema
-
-    @staticmethod
-    def _dict_from_ordered_dict(o_dict):
-        dct = {}
-
-        for k, v in o_dict.items():
-            new_v = v
-
-            if type(v) is collections.OrderedDict:
-                new_v = _SchemaValidator._dict_from_ordered_dict(v)
-
-            dct[k] = new_v
-
-        return dct
-
-    def _validate(self, instance, schema_short_id):
-        # retrieve full schema ID from short ID
-        schema_id = f'https://barectf.org/schemas/{schema_short_id}.json'
-        assert schema_id in self._store
-
-        # retrieve full schema
-        schema = self._store[schema_id]
-
-        # Create a reference resolver for this schema using this
-        # validator's schema store.
-        resolver = _RefResolver(base_uri=schema_id, referrer=schema,
-                                store=self._store)
-
-        # create a JSON schema validator using this reference resolver
-        validator = jsonschema.Draft7Validator(schema, resolver=resolver)
-
-        # Validate the instance, converting its
-        # `collections.OrderedDict` objects to `dict` objects so as to
-        # make any error message easier to read (because
-        # validator.validate() below uses str() for error messages, and
-        # collections.OrderedDict.__str__() returns a somewhat bulky
-        # representation).
-        validator.validate(self._dict_from_ordered_dict(instance))
-
-    # Validates `instance` using the schema having the short ID
-    # `schema_short_id`.
-    #
-    # A schema short ID is the part between `schemas/` and `.json` in
-    # its URI.
-    #
-    # Raises a `_ConfigParseError` object, hiding any `jsonschema`
-    # exception, on validation failure.
-    def validate(self, instance, schema_short_id):
-        try:
-            self._validate(instance, schema_short_id)
-        except jsonschema.ValidationError as exc:
-            # convert to barectf `_ConfigParseError` exception
-            contexts = ['Configuration object']
-
-            # Each element of the instance's absolute path is either an
-            # integer (array element's index) or a string (object
-            # property's name).
-            for elem in exc.absolute_path:
-                if type(elem) is int:
-                    ctx = f'Element {elem}'
-                else:
-                    ctx = f'`{elem}` property'
-
-                contexts.append(ctx)
-
-            schema_ctx = ''
-
-            if len(exc.context) > 0:
-                # According to the documentation of
-                # jsonschema.ValidationError.context(),
-                # the method returns a
-                #
-                # > list of errors from the subschemas
-                #
-                # This contains additional information about the
-                # validation failure which can help the user figure out
-                # what's wrong exactly.
-                #
-                # Join each message with `; ` and append this to our
-                # configuration parsing error's message.
-                msgs = '; '.join([e.message for e in exc.context])
-                schema_ctx = f': {msgs}'
-
-            new_exc = _ConfigParseError(contexts.pop(),
-                                        f'{exc.message}{schema_ctx} (from schema `{schema_short_id}`)')
-
-            for ctx in reversed(contexts):
-                new_exc._append_ctx(ctx)
-
-            raise new_exc
-
-
-# Converts the byte order string `bo_str` to a
-# `barectf.metadata.ByteOrder` enumerator.
-def _byte_order_str_to_bo(bo_str):
-    bo_str = bo_str.lower()
-
-    if bo_str == 'le':
-        return barectf.metadata.ByteOrder.LE
-    elif bo_str == 'be':
-        return barectf.metadata.ByteOrder.BE
-
-
-# Converts the encoding string `encoding_str` to a
-# `barectf.metadata.Encoding` enumerator.
-def _encoding_str_to_encoding(encoding_str):
-    encoding_str = encoding_str.lower()
-
-    if encoding_str == 'utf-8' or encoding_str == 'utf8':
-        return barectf.metadata.Encoding.UTF8
-    elif encoding_str == 'ascii':
-        return barectf.metadata.Encoding.ASCII
-    elif encoding_str == 'none':
-        return barectf.metadata.Encoding.NONE
-
-
-# Validates the TSDL identifier `iden`, raising a `_ConfigParseError`
-# exception using `ctx_obj_name` and `prop` to format the message if
-# it's invalid.
-def _validate_identifier(iden, ctx_obj_name, prop):
-    assert type(iden) is str
-    ctf_keywords = {
-        'align',
-        'callsite',
-        'clock',
-        'enum',
-        'env',
-        'event',
-        'floating_point',
-        'integer',
-        'stream',
-        'string',
-        'struct',
-        'trace',
-        'typealias',
-        'typedef',
-        'variant',
-    }
-
-    if iden in ctf_keywords:
-        msg = f'Invalid {prop} (not a valid identifier): `{iden}`'
-        raise _ConfigParseError(ctx_obj_name, msg)
-
-
-# Validates the alignment `align`, raising a `_ConfigParseError`
-# exception using `ctx_obj_name` if it's invalid.
-def _validate_alignment(align, ctx_obj_name):
-    assert align >= 1
-
-    if (align & (align - 1)) != 0:
-        raise _ConfigParseError(ctx_obj_name,
-                                f'Invalid alignment (not a power of two): {align}')
-
-
-# Entities.
-#
-# Order of values is important here.
-@enum.unique
-class _Entity(enum.IntEnum):
-    TRACE_PACKET_HEADER = 0
-    STREAM_PACKET_CONTEXT = 1
-    STREAM_EVENT_HEADER = 2
-    STREAM_EVENT_CONTEXT = 3
-    EVENT_CONTEXT = 4
-    EVENT_PAYLOAD = 5
-
-
-# A validator which validates the configured metadata for barectf
-# specific needs.
-#
-# barectf needs:
-#
-# * The alignments of all header/context field types are at least 8.
-#
-# * There are no nested structure or array field types, except the
-#   packet header field type's `uuid` field
-#
-class _BarectfMetadataValidator:
-    def __init__(self):
-        self._type_to_validate_type_func = {
-            _Struct: self._validate_struct_type,
-            _Array: self._validate_array_type,
-        }
-
-    def _validate_struct_type(self, t, entity_root):
-        if not entity_root:
-            raise _ConfigParseError('Structure field type',
-                                    'Inner structure field types are not supported as of this version')
-
-        for field_name, field_type in t.fields.items():
-            if entity_root and self._cur_entity is _Entity.TRACE_PACKET_HEADER:
-                if field_name == 'uuid':
-                    # allow
-                    continue
-
-            try:
-                self._validate_type(field_type, False)
-            except _ConfigParseError as exc:
-                _append_error_ctx(exc,
-                                  f'Structure field type\'s field `{field_name}`')
-
-    def _validate_array_type(self, t, entity_root):
-        raise _ConfigParseError('Array field type',
-                                'Not supported as of this version')
-
-    def _validate_type(self, t, entity_root):
-        func = self._type_to_validate_type_func.get(type(t))
-
-        if func is not None:
-            func(t, entity_root)
-
-    def _validate_entity(self, t):
-        if t is None:
-            return
-
-        # make sure root field type has a real alignment of at least 8
-        if t.real_align < 8:
-            raise _ConfigParseError('Root field type',
-                                    f'Effective alignment must be at least 8 (got {t.real_align})')
-
-        assert type(t) is _Struct
-
-        # validate field types
-        self._validate_type(t, True)
-
-    def _validate_event_entities_and_names(self, stream, ev):
-        try:
-            _validate_identifier(ev.name, 'Event type', 'event type name')
-
-            self._cur_entity = _Entity.EVENT_CONTEXT
-
-            try:
-                self._validate_entity(ev.context_type)
-            except _ConfigParseError as exc:
-                _append_error_ctx(exc, 'Event type',
-                                  'Invalid context field type')
-
-            self._cur_entity = _Entity.EVENT_PAYLOAD
-
-            try:
-                self._validate_entity(ev.payload_type)
-            except _ConfigParseError as exc:
-                _append_error_ctx(exc, 'Event type',
-                                  'Invalid payload field type')
-
-            if stream.is_event_empty(ev):
-                raise _ConfigParseError('Event type', 'Empty')
-        except _ConfigParseError as exc:
-            _append_error_ctx(exc, f'Event type `{ev.name}`')
-
-    def _validate_stream_entities_and_names(self, stream):
-        try:
-            _validate_identifier(stream.name, 'Stream type', 'stream type name')
-            self._cur_entity = _Entity.STREAM_PACKET_CONTEXT
-
-            try:
-                self._validate_entity(stream.packet_context_type)
-            except _ConfigParseError as exc:
-                _append_error_ctx(exc, 'Stream type',
-                                  'Invalid packet context field type')
-
-            self._cur_entity = _Entity.STREAM_EVENT_HEADER
-
-            try:
-                self._validate_entity(stream.event_header_type)
-            except _ConfigParseError as exc:
-                _append_error_ctx(exc, 'Stream type',
-                                  'Invalid event header field type')
-
-            self._cur_entity = _Entity.STREAM_EVENT_CONTEXT
-
-            try:
-                self._validate_entity(stream.event_context_type)
-            except _ConfigParseError as exc:
-                _append_error_ctx(exc, 'Stream type',
-                                  'Invalid event context field type')
-
-            for ev in stream.events.values():
-                self._validate_event_entities_and_names(stream, ev)
-        except _ConfigParseError as exc:
-            _append_error_ctx(exc, f'Stream type `{stream.name}`')
-
-    def _validate_entities_and_names(self, meta):
-        self._cur_entity = _Entity.TRACE_PACKET_HEADER
-
-        try:
-            self._validate_entity(meta.trace.packet_header_type)
-        except _ConfigParseError as exc:
-            _append_error_ctx(exc, 'Trace type',
-                              'Invalid packet header field type')
-
-        for stream in meta.streams.values():
-            self._validate_stream_entities_and_names(stream)
-
-    def _validate_default_stream(self, meta):
-        if meta.default_stream_name is not None:
-            if meta.default_stream_name not in meta.streams.keys():
-                msg = f'Default stream type name (`{meta.default_stream_name}`) does not name an existing stream type'
-                raise _ConfigParseError('Metadata', msg)
-
-    def validate(self, meta):
-        try:
-            self._validate_entities_and_names(meta)
-            self._validate_default_stream(meta)
-        except _ConfigParseError as exc:
-            _append_error_ctx(exc, 'barectf metadata')
-
-
-# A validator which validates special fields of trace, stream, and event
-# types.
-class _MetadataSpecialFieldsValidator:
-    # Validates the packet header field type `t`.
-    def _validate_trace_packet_header_type(self, t):
-        ctx_obj_name = '`packet-header-type` property'
-
-        # If there's more than one stream type, then the `stream_id`
-        # (stream type ID) field is required.
-        if len(self._meta.streams) > 1:
-            if t is None:
-                raise _ConfigParseError('Trace type',
-                                        '`stream_id` field is required (because there\'s more than one stream type), but packet header field type is missing')
-
-            if 'stream_id' not in t.fields:
-                raise _ConfigParseError(ctx_obj_name,
-                                        '`stream_id` field is required (because there\'s more than one stream type)')
-
-        if t is None:
-            return
-
-        # The `magic` field type must be the first one.
-        #
-        # The `stream_id` field type's size (bits) must be large enough
-        # to accomodate any stream type ID.
-        for i, (field_name, field_type) in enumerate(t.fields.items()):
-            if field_name == 'magic':
-                if i != 0:
-                    raise _ConfigParseError(ctx_obj_name,
-                                            '`magic` field must be the first packet header field type\'s field')
-            elif field_name == 'stream_id':
-                if len(self._meta.streams) > (1 << field_type.size):
-                    raise _ConfigParseError(ctx_obj_name,
-                                            f'`stream_id` field\'s size is too small to accomodate {len(self._meta.streams)} stream types')
-
-    # Validates the trace type of the metadata object `meta`.
-    def _validate_trace(self, meta):
-        self._validate_trace_packet_header_type(meta.trace.packet_header_type)
-
-    # Validates the packet context field type of the stream type
-    # `stream`.
-    def _validate_stream_packet_context(self, stream):
-        ctx_obj_name = '`packet-context-type` property'
-        t = stream.packet_context_type
-        assert t is not None
-
-        # The `timestamp_begin` and `timestamp_end` field types must be
-        # mapped to the `value` property of the same clock.
-        ts_begin = t.fields.get('timestamp_begin')
-        ts_end = t.fields.get('timestamp_end')
-
-        if ts_begin is not None and ts_end is not None:
-            if ts_begin.property_mappings[0].object.name != ts_end.property_mappings[0].object.name:
-                raise _ConfigParseError(ctx_obj_name,
-                                        '`timestamp_begin` and `timestamp_end` fields must be mapped to the same clock value')
-
-        # The `packet_size` field type's size must be greater than or
-        # equal to the `content_size` field type's size.
-        if t.fields['content_size'].size > t.fields['packet_size'].size:
-            raise _ConfigParseError(ctx_obj_name,
-                                    '`content_size` field\'s size must be less than or equal to `packet_size` field\'s size')
-
-    # Validates the event header field type of the stream type `stream`.
-    def _validate_stream_event_header(self, stream):
-        ctx_obj_name = '`event-header-type` property'
-        t = stream.event_header_type
-
-        # If there's more than one event type, then the `id` (event type
-        # ID) field is required.
-        if len(stream.events) > 1:
-            if t is None:
-                raise _ConfigParseError('Stream type',
-                                        '`id` field is required (because there\'s more than one event type), but event header field type is missing')
-
-            if 'id' not in t.fields:
-                raise _ConfigParseError(ctx_obj_name,
-                                        '`id` field is required (because there\'s more than one event type)')
-
-        if t is None:
-            return
-
-        # The `id` field type's size (bits) must be large enough to
-        # accomodate any event type ID.
-        eid = t.fields.get('id')
-
-        if eid is not None:
-            if len(stream.events) > (1 << eid.size):
-                raise _ConfigParseError(ctx_obj_name,
-                                        f'`id` field\'s size is too small to accomodate {len(stream.events)} event types')
-
-    # Validates the stream type `stream`.
-    def _validate_stream(self, stream):
-        self._validate_stream_packet_context(stream)
-        self._validate_stream_event_header(stream)
-
-    # Validates the trace and stream types of the metadata object
-    # `meta`.
-    def validate(self, meta):
-        self._meta = meta
-
-        try:
-            try:
-                self._validate_trace(meta)
-            except _ConfigParseError as exc:
-                _append_error_ctx(exc, 'Trace type')
-
-            for stream in meta.streams.values():
-                try:
-                    self._validate_stream(stream)
-                except _ConfigParseError as exc:
-                    _append_error_ctx(exc, f'Stream type `{stream.name}`')
-        except _ConfigParseError as exc:
-            _append_error_ctx(exc, 'Metadata')
-
-
-# A barectf YAML configuration parser.
-#
-# When you build such a parser, it parses the configuration file and
-# creates a corresponding `barectf.config.Config` object which you can
-# get with the `config` property.
-#
-# See the comments of _parse() for more implementation details about the
-# parsing stages and general strategy.
-class _YamlConfigParser:
-    # Builds a barectf YAML configuration parser and parses the
-    # configuration file having the path `path`.
-    #
-    # The parser considers the inclusion directories `include_dirs`,
-    # ignores nonexistent inclusion files if `ignore_include_not_found`
-    # is `True`, and dumps the effective configuration (as YAML) if
-    # `dump_config` is `True`.
-    #
-    # Raises `_ConfigParseError` on parsing error.
-    def __init__(self, path, include_dirs, ignore_include_not_found,
-                 dump_config):
-        self._root_path = path
-        self._class_name_to_create_field_type_func = {
-            'int': self._create_integer_field_type,
-            'integer': self._create_integer_field_type,
-            'flt': self._create_float_field_type,
-            'float': self._create_float_field_type,
-            'floating-point': self._create_float_field_type,
-            'enum': self._create_enum_field_type,
-            'enumeration': self._create_enum_field_type,
-            'str': self._create_string_field_type,
-            'string': self._create_string_field_type,
-            'struct': self._create_struct_field_type,
-            'structure': self._create_struct_field_type,
-            'array': self._create_array_field_type,
-        }
-        self._include_dirs = include_dirs
-        self._ignore_include_not_found = ignore_include_not_found
-        self._dump_config = dump_config
-        self._schema_validator = _SchemaValidator()
-        self._parse()
-
-    # Sets the default byte order as found in the `metadata_node` node.
-    def _set_byte_order(self, metadata_node):
-        self._bo = _byte_order_str_to_bo(metadata_node['trace']['byte-order'])
-        assert self._bo is not None
-
-    # Sets the clock value property mapping of the pseudo integer field
-    # type object `int_obj` as found in the `prop_mapping_node` node.
-    def _set_int_clock_prop_mapping(self, int_obj, prop_mapping_node):
-        clock_name = prop_mapping_node['name']
-        clock = self._clocks.get(clock_name)
-
-        if clock is None:
-            exc = _ConfigParseError('`property-mappings` property',
-                                    f'Clock type `{clock_name}` does not exist')
-            exc._append_ctx('Integer field type')
-            raise exc
-
-        prop_mapping = _PropertyMapping()
-        prop_mapping.object = clock
-        prop_mapping.prop = 'value'
-        int_obj.property_mappings.append(prop_mapping)
-
-    # Creates a pseudo integer field type from the node `node` and
-    # returns it.
-    def _create_integer_field_type(self, node):
-        obj = _Integer()
-        obj.size = node['size']
-        align_node = node.get('align')
-
-        if align_node is not None:
-            _validate_alignment(align_node, 'Integer field type')
-            obj.align = align_node
-
-        signed_node = node.get('signed')
-
-        if signed_node is not None:
-            obj.signed = signed_node
-
-        obj.byte_order = self._bo
-        bo_node = node.get('byte-order')
-
-        if bo_node is not None:
-            obj.byte_order = _byte_order_str_to_bo(bo_node)
-
-        base_node = node.get('base')
-
-        if base_node is not None:
-            if base_node == 'bin':
-                obj.base = 2
-            elif base_node == 'oct':
-                obj.base = 8
-            elif base_node == 'dec':
-                obj.base = 10
-            else:
-                assert base_node == 'hex'
-                obj.base = 16
-
-        encoding_node = node.get('encoding')
-
-        if encoding_node is not None:
-            obj.encoding = _encoding_str_to_encoding(encoding_node)
-
-        pm_node = node.get('property-mappings')
-
-        if pm_node is not None:
-            assert len(pm_node) == 1
-            self._set_int_clock_prop_mapping(obj, pm_node[0])
-
-        return obj
-
-    # Creates a pseudo floating point number field type from the node
-    # `node` and returns it.
-    def _create_float_field_type(self, node):
-        obj = _FloatingPoint()
-        size_node = node['size']
-        obj.exp_size = size_node['exp']
-        obj.mant_size = size_node['mant']
-        align_node = node.get('align')
-
-        if align_node is not None:
-            _validate_alignment(align_node, 'Floating point number field type')
-            obj.align = align_node
-
-        obj.byte_order = self._bo
-        bo_node = node.get('byte-order')
-
-        if bo_node is not None:
-            obj.byte_order = _byte_order_str_to_bo(bo_node)
-
-        return obj
-
-    # Creates a pseudo enumeration field type from the node `node` and
-    # returns it.
-    def _create_enum_field_type(self, node):
-        ctx_obj_name = 'Enumeration field type'
-        obj = _Enum()
-
-        # value (integer) field type
-        try:
-            obj.value_type = self._create_type(node['value-type'])
-        except _ConfigParseError as exc:
-            _append_error_ctx(exc, ctx_obj_name,
-                              'Cannot create value (integer) field type')
-
-        # members
-        members_node = node.get('members')
-
-        if members_node is not None:
-            if obj.value_type.signed:
-                value_min = -(1 << obj.value_type.size - 1)
-                value_max = (1 << (obj.value_type.size - 1)) - 1
-            else:
-                value_min = 0
-                value_max = (1 << obj.value_type.size) - 1
-
-            cur = 0
-
-            for m_node in members_node:
-                if type(m_node) is str:
-                    label = m_node
-                    value = (cur, cur)
-                    cur += 1
-                else:
-                    assert type(m_node) is collections.OrderedDict
-                    label = m_node['label']
-                    value = m_node['value']
-
-                    if type(value) is int:
-                        cur = value + 1
-                        value = (value, value)
-                    else:
-                        assert type(value) is list
-                        assert len(value) == 2
-                        mn = value[0]
-                        mx = value[1]
-
-                        if mn > mx:
-                            exc = _ConfigParseError(ctx_obj_name)
-                            exc._append_ctx(f'Member `{label}`',
-                                           f'Invalid integral range ({mn} > {mx})')
-                            raise exc
-
-                        value = (mn, mx)
-                        cur = mx + 1
-
-                # Make sure that all the integral values of the range
-                # fits the enumeration field type's integer value field
-                # type depending on its size (bits).
-                member_obj_name = f'Member `{label}`'
-                msg = f'Value {value[0]} is outside the value type range [{value_min}, {value_max}]'
-
-                try:
-                    if value[0] < value_min or value[0] > value_max:
-                        raise _ConfigParseError(member_obj_name, msg)
-
-                    if value[1] < value_min or value[1] > value_max:
-                        raise _ConfigParseError(member_obj_name, msg)
-                except _ConfigParseError as exc:
-                    _append_error_ctx(exc, ctx_obj_name)
-
-                obj.members[label] = value
-
-        return obj
-
-    # Creates a pseudo string field type from the node `node` and
-    # returns it.
-    def _create_string_field_type(self, node):
-        obj = _String()
-        encoding_node = node.get('encoding')
-
-        if encoding_node is not None:
-            obj.encoding = _encoding_str_to_encoding(encoding_node)
-
-        return obj
-
-    # Creates a pseudo structure field type from the node `node` and
-    # returns it.
-    def _create_struct_field_type(self, node):
-        ctx_obj_name = 'Structure field type'
-        obj = _Struct()
-        min_align_node = node.get('min-align')
-
-        if min_align_node is not None:
-            _validate_alignment(min_align_node, ctx_obj_name)
-            obj.min_align = min_align_node
-
-        fields_node = node.get('fields')
-
-        if fields_node is not None:
-            for field_name, field_node in fields_node.items():
-                _validate_identifier(field_name, ctx_obj_name, 'field name')
-
-                try:
-                    obj.fields[field_name] = self._create_type(field_node)
-                except _ConfigParseError as exc:
-                    _append_error_ctx(exc, ctx_obj_name,
-                                      f'Cannot create field `{field_name}`')
-
-        return obj
-
-    # Creates a pseudo array field type from the node `node` and returns
-    # it.
-    def _create_array_field_type(self, node):
-        obj = _Array()
-        obj.length = node['length']
-
-        try:
-            obj.element_type = self._create_type(node['element-type'])
-        except _ConfigParseError as exc:
-            _append_error_ctx(exc, 'Array field type',
-                              'Cannot create element field type')
-
-        return obj
-
-    # Creates a pseudo field type from the node `node` and returns it.
-    #
-    # This method checks the `class` property of `node` to determine
-    # which function of `self._class_name_to_create_field_type_func` to
-    # call to create the corresponding pseudo field type.
-    def _create_type(self, type_node):
-        return self._class_name_to_create_field_type_func[type_node['class']](type_node)
-
-    # Creates a pseudo clock type from the node `node` and returns it.
-    def _create_clock(self, node):
-        clock = _Clock()
-        uuid_node = node.get('uuid')
-
-        if uuid_node is not None:
-            try:
-                clock.uuid = uuid.UUID(uuid_node)
-            except ValueError as exc:
-                raise _ConfigParseError('Clock type',
-                                        f'Malformed UUID `{uuid_node}`: {exc}')
-
-        descr_node = node.get('description')
-
-        if descr_node is not None:
-            clock.description = descr_node
-
-        freq_node = node.get('freq')
-
-        if freq_node is not None:
-            clock.freq = freq_node
-
-        error_cycles_node = node.get('error-cycles')
-
-        if error_cycles_node is not None:
-            clock.error_cycles = error_cycles_node
-
-        offset_node = node.get('offset')
-
-        if offset_node is not None:
-            offset_cycles_node = offset_node.get('cycles')
-
-            if offset_cycles_node is not None:
-                clock.offset_cycles = offset_cycles_node
-
-            offset_seconds_node = offset_node.get('seconds')
-
-            if offset_seconds_node is not None:
-                clock.offset_seconds = offset_seconds_node
-
-        absolute_node = node.get('absolute')
-
-        if absolute_node is not None:
-            clock.absolute = absolute_node
-
-        return_ctype_node = node.get('$return-ctype')
-
-        if return_ctype_node is None:
-            # barectf 2.1: `return-ctype` property was renamed to
-            # `$return-ctype`
-            return_ctype_node = node.get('return-ctype')
-
-        if return_ctype_node is not None:
-            clock.return_ctype = return_ctype_node
-
-        return clock
-
-    # Registers all the clock types of the metadata node
-    # `metadata_node`, creating pseudo clock types during the process,
-    # within this parser.
-    #
-    # The pseudo clock types in `self._clocks` are then accessible when
-    # creating a pseudo integer field type (see
-    # _create_integer_field_type() and _set_int_clock_prop_mapping()).
-    def _register_clocks(self, metadata_node):
-        self._clocks = collections.OrderedDict()
-        clocks_node = metadata_node.get('clocks')
-
-        if clocks_node is None:
-            return
-
-        for clock_name, clock_node in clocks_node.items():
-            _validate_identifier(clock_name, 'Metadata', 'clock type name')
-            assert clock_name not in self._clocks
-
-            try:
-                clock = self._create_clock(clock_node)
-            except _ConfigParseError as exc:
-                _append_error_ctx(exc, 'Metadata',
-                                  f'Cannot create clock type `{clock}`')
-
-            clock.name = clock_name
-            self._clocks[clock_name] = clock
-
-    # Creates an environment object (`collections.OrderedDict`) from the
-    # metadata node `metadata_node` and returns it.
-    def _create_env(self, metadata_node):
-        env_node = metadata_node.get('env')
-
-        if env_node is None:
-            return collections.OrderedDict()
-
-        for env_name, env_value in env_node.items():
-            _validate_identifier(env_name, 'Metadata',
-                                 'environment variable name')
-
-        return copy.deepcopy(env_node)
-
-    # Creates a pseudo trace type from the metadata node `metadata_node`
-    # and returns it.
-    def _create_trace(self, metadata_node):
-        ctx_obj_name = 'Trace type'
-        trace = _Trace()
-        trace_node = metadata_node['trace']
-        trace.byte_order = self._bo
-        uuid_node = trace_node.get('uuid')
-
-        if uuid_node is not None:
-            # The `uuid` property of the trace type node can be `auto`
-            # to make barectf generate a UUID.
-            if uuid_node == 'auto':
-                trace.uuid = uuid.uuid1()
-            else:
-                try:
-                    trace.uuid = uuid.UUID(uuid_node)
-                except ValueError as exc:
-                    raise _ConfigParseError(ctx_obj_name,
-                                            f'Malformed UUID `{uuid_node}`: {exc}')
-
-        pht_node = trace_node.get('packet-header-type')
-
-        if pht_node is not None:
-            try:
-                trace.packet_header_type = self._create_type(pht_node)
-            except _ConfigParseError as exc:
-                _append_error_ctx(exc, ctx_obj_name,
-                                  'Cannot create packet header field type')
-
-        return trace
-
-    # Creates a pseudo event type from the event node `event_node` and
-    # returns it.
-    def _create_event(self, event_node):
-        ctx_obj_name = 'Event type'
-        event = _Event()
-        log_level_node = event_node.get('log-level')
-
-        if log_level_node is not None:
-            assert type(log_level_node) is int
-            event.log_level = barectf.metadata.LogLevel(None, log_level_node)
-
-        ct_node = event_node.get('context-type')
-
-        if ct_node is not None:
-            try:
-                event.context_type = self._create_type(ct_node)
-            except _ConfigParseError as exc:
-                _append_error_ctx(exc, ctx_obj_name,
-                                  'Cannot create context field type')
-
-        pt_node = event_node.get('payload-type')
-
-        if pt_node is not None:
-            try:
-                event.payload_type = self._create_type(pt_node)
-            except _ConfigParseError as exc:
-                _append_error_ctx(exc, ctx_obj_name,
-                                  'Cannot create payload field type')
-
-        return event
-
-    # Creates a pseudo stream type named `stream_name` from the stream
-    # node `stream_node` and returns it.
-    def _create_stream(self, stream_name, stream_node):
-        ctx_obj_name = 'Stream type'
-        stream = _Stream()
-        pct_node = stream_node.get('packet-context-type')
-
-        if pct_node is not None:
-            try:
-                stream.packet_context_type = self._create_type(pct_node)
-            except _ConfigParseError as exc:
-                _append_error_ctx(exc, ctx_obj_name,
-                                  'Cannot create packet context field type')
-
-        eht_node = stream_node.get('event-header-type')
-
-        if eht_node is not None:
-            try:
-                stream.event_header_type = self._create_type(eht_node)
-            except _ConfigParseError as exc:
-                _append_error_ctx(exc, ctx_obj_name,
-                                  'Cannot create event header field type')
-
-        ect_node = stream_node.get('event-context-type')
-
-        if ect_node is not None:
-            try:
-                stream.event_context_type = self._create_type(ect_node)
-            except _ConfigParseError as exc:
-                _append_error_ctx(exc, ctx_obj_name,
-                                  'Cannot create event context field type')
-
-        events_node = stream_node['events']
-        cur_id = 0
-
-        for ev_name, ev_node in events_node.items():
-            try:
-                ev = self._create_event(ev_node)
-            except _ConfigParseError as exc:
-                _append_error_ctx(exc, ctx_obj_name,
-                                  f'Cannot create event type `{ev_name}`')
-
-            ev.id = cur_id
-            ev.name = ev_name
-            stream.events[ev_name] = ev
-            cur_id += 1
-
-        default_node = stream_node.get('$default')
-
-        if default_node is not None:
-            if self._meta.default_stream_name is not None and self._meta.default_stream_name != stream_name:
-                msg = f'Cannot specify more than one default stream type (default stream type already set to `{self._meta.default_stream_name}`)'
-                raise _ConfigParseError('Stream type', msg)
-
-            self._meta.default_stream_name = stream_name
-
-        return stream
-
-    # Creates a `collections.OrderedDict` object where keys are stream
-    # type names and values are pseudo stream types from the metadata
-    # node `metadata_node` and returns it.
-    def _create_streams(self, metadata_node):
-        streams = collections.OrderedDict()
-        streams_node = metadata_node['streams']
-        cur_id = 0
-
-        for stream_name, stream_node in streams_node.items():
-            try:
-                stream = self._create_stream(stream_name, stream_node)
-            except _ConfigParseError as exc:
-                _append_error_ctx(exc, 'Metadata',
-                                  f'Cannot create stream type `{stream_name}`')
-
-            stream.id = cur_id
-            stream.name = stream_name
-            streams[stream_name] = stream
-            cur_id += 1
-
-        return streams
-
-    # Creates a pseudo metadata object from the configuration node
-    # `root` and returns it.
-    def _create_metadata(self, root):
-        self._meta = _Metadata()
-        metadata_node = root['metadata']
-
-        if '$default-stream' in metadata_node and metadata_node['$default-stream'] is not None:
-            default_stream_node = metadata_node['$default-stream']
-            self._meta.default_stream_name = default_stream_node
-
-        self._set_byte_order(metadata_node)
-        self._register_clocks(metadata_node)
-        self._meta.clocks = self._clocks
-        self._meta.env = self._create_env(metadata_node)
-        self._meta.trace = self._create_trace(metadata_node)
-        self._meta.streams = self._create_streams(metadata_node)
-
-        # validate the pseudo metadata object
-        _MetadataSpecialFieldsValidator().validate(self._meta)
-        _BarectfMetadataValidator().validate(self._meta)
-
-        return self._meta
-
-    # Gets and validates the tracing prefix as found in the
-    # configuration node `config_node` and returns it.
-    def _get_prefix(self, config_node):
-        prefix = config_node.get('prefix', 'barectf_')
-        _validate_identifier(prefix, '`prefix` property', 'prefix')
-        return prefix
-
-    # Gets the options as found in the configuration node `config_node`
-    # and returns a corresponding `barectf.config.ConfigOptions` object.
-    def _get_options(self, config_node):
-        gen_prefix_def = False
-        gen_default_stream_def = False
-        options_node = config_node.get('options')
-
-        if options_node is not None:
-            gen_prefix_def = options_node.get('gen-prefix-def',
-                                              gen_prefix_def)
-            gen_default_stream_def = options_node.get('gen-default-stream-def',
-                                                      gen_default_stream_def)
-
-        return barectf.config.ConfigOptions(gen_prefix_def,
-                                            gen_default_stream_def)
-
-    # Returns the last included file name from the parser's inclusion
-    # file name stack.
-    def _get_last_include_file(self):
-        if self._include_stack:
-            return self._include_stack[-1]
-
-        return self._root_path
-
-    # Loads the inclusion file having the path `yaml_path` and returns
-    # its content as a `collections.OrderedDict` object.
-    def _load_include(self, yaml_path):
-        for inc_dir in self._include_dirs:
-            # Current inclusion dir + file name path.
-            #
-            # Note: os.path.join() only takes the last argument if it's
-            # absolute.
-            inc_path = os.path.join(inc_dir, yaml_path)
-
-            # real path (symbolic links resolved)
-            real_path = os.path.realpath(inc_path)
-
-            # normalized path (weird stuff removed!)
-            norm_path = os.path.normpath(real_path)
-
-            if not os.path.isfile(norm_path):
-                # file doesn't exist: skip
-                continue
-
-            if norm_path in self._include_stack:
-                base_path = self._get_last_include_file()
-                raise _ConfigParseError(f'File `{base_path}`',
-                                        f'Cannot recursively include file `{norm_path}`')
-
-            self._include_stack.append(norm_path)
-
-            # load raw content
-            return self._yaml_ordered_load(norm_path)
-
-        if not self._ignore_include_not_found:
-            base_path = self._get_last_include_file()
-            raise _ConfigParseError(f'File `{base_path}`',
-                                    f'Cannot include file `{yaml_path}`: file not found in inclusion directories')
-
-    # Returns a list of all the inclusion file paths as found in the
-    # inclusion node `include_node`.
-    def _get_include_paths(self, include_node):
-        if include_node is None:
-            # none
-            return []
-
-        if type(include_node) is str:
-            # wrap as array
-            return [include_node]
-
-        # already an array
-        assert type(include_node) is list
-        return include_node
-
-    # Updates the node `base_node` with an overlay node `overlay_node`.
-    #
-    # Both the inclusion and field type inheritance features use this
-    # update mechanism.
-    def _update_node(self, base_node, overlay_node):
-        for olay_key, olay_value in overlay_node.items():
-            if olay_key in base_node:
-                base_value = base_node[olay_key]
-
-                if type(olay_value) is collections.OrderedDict and type(base_value) is collections.OrderedDict:
-                    # merge both objects
-                    self._update_node(base_value, olay_value)
-                elif type(olay_value) is list and type(base_value) is list:
-                    # append extension array items to base items
-                    base_value += olay_value
-                else:
-                    # fall back to replacing base property
-                    base_node[olay_key] = olay_value
-            else:
-                # set base property from overlay property
-                base_node[olay_key] = olay_value
-
-    # Processes inclusions using `last_overlay_node` as the last overlay
-    # node to use to "patch" the node.
-    #
-    # If `last_overlay_node` contains an `$include` property, then this
-    # method patches the current base node (initially empty) in order
-    # using the content of the inclusion files (recursively).
-    #
-    # At the end, this method removes the `$include` of
-    # `last_overlay_node` and then patches the current base node with
-    # its other properties before returning the result (always a deep
-    # copy).
-    def _process_node_include(self, last_overlay_node,
-                              process_base_include_cb,
-                              process_children_include_cb=None):
-        # process children inclusions first
-        if process_children_include_cb is not None:
-            process_children_include_cb(last_overlay_node)
-
-        incl_prop_name = '$include'
-
-        if incl_prop_name in last_overlay_node:
-            include_node = last_overlay_node[incl_prop_name]
+# `file` can be a barectf 2 or 3 configuration file.
+def _create_v3_parser(file, include_dirs, ignore_include_not_found):
+    try:
+        root_node = barectf_config_parse_common._yaml_load(file)
+
+        if type(root_node) is barectf_config_parse_common._ConfigNodeV3:
+            # barectf 3 configuration file
+            return barectf_config_parse_v3._Parser(file, root_node, include_dirs,
+                                                   ignore_include_not_found)
+        elif type(root_node) is collections.OrderedDict:
+            # barectf 2 configuration file
+            v2_parser = barectf_config_parse_v2._Parser(file, root_node, include_dirs,
+                                                        ignore_include_not_found)
+            return barectf_config_parse_v3._Parser(file, v2_parser.config_node, include_dirs,
+                                                   ignore_include_not_found)
         else:
-            # no inclusions!
-            return last_overlay_node
-
-        include_paths = self._get_include_paths(include_node)
-        cur_base_path = self._get_last_include_file()
-        base_node = None
-
-        # keep the inclusion paths and remove the `$include` property
-        include_paths = copy.deepcopy(include_paths)
-        del last_overlay_node[incl_prop_name]
-
-        for include_path in include_paths:
-            # load raw YAML from included file
-            overlay_node = self._load_include(include_path)
-
-            if overlay_node is None:
-                # Cannot find inclusion file, but we're ignoring those
-                # errors, otherwise _load_include() itself raises a
-                # config error.
-                continue
-
-            # recursively process inclusions
-            try:
-                overlay_node = process_base_include_cb(overlay_node)
-            except _ConfigParseError as exc:
-                _append_error_ctx(exc, f'File `{cur_base_path}`')
-
-            # pop inclusion stack now that we're done including
-            del self._include_stack[-1]
-
-            # At this point, `base_node` is fully resolved (does not
-            # contain any `$include` property).
-            if base_node is None:
-                base_node = overlay_node
-            else:
-                self._update_node(base_node, overlay_node)
-
-        # Finally, update the latest base node with our last overlay
-        # node.
-        if base_node is None:
-            # Nothing was included, which is possible when we're
-            # ignoring inclusion errors.
-            return last_overlay_node
-
-        self._update_node(base_node, last_overlay_node)
-        return base_node
-
-    # Process the inclusions of the event type node `event_node`,
-    # returning the effective node.
-    def _process_event_include(self, event_node):
-        # Make sure the event type node is valid for the inclusion
-        # processing stage.
-        self._schema_validator.validate(event_node,
-                                        '2/config/event-pre-include')
-
-        # process inclusions
-        return self._process_node_include(event_node,
-                                          self._process_event_include)
-
-    # Process the inclusions of the stream type node `stream_node`,
-    # returning the effective node.
-    def _process_stream_include(self, stream_node):
-        def process_children_include(stream_node):
-            if 'events' in stream_node:
-                events_node = stream_node['events']
-
-                for key in list(events_node):
-                    events_node[key] = self._process_event_include(events_node[key])
-
-        # Make sure the stream type node is valid for the inclusion
-        # processing stage.
-        self._schema_validator.validate(stream_node,
-                                        '2/config/stream-pre-include')
-
-        # process inclusions
-        return self._process_node_include(stream_node,
-                                          self._process_stream_include,
-                                          process_children_include)
-
-    # Process the inclusions of the trace type node `trace_node`,
-    # returning the effective node.
-    def _process_trace_include(self, trace_node):
-        # Make sure the trace type node is valid for the inclusion
-        # processing stage.
-        self._schema_validator.validate(trace_node,
-                                        '2/config/trace-pre-include')
-
-        # process inclusions
-        return self._process_node_include(trace_node,
-                                          self._process_trace_include)
-
-    # Process the inclusions of the clock type node `clock_node`,
-    # returning the effective node.
-    def _process_clock_include(self, clock_node):
-        # Make sure the clock type node is valid for the inclusion
-        # processing stage.
-        self._schema_validator.validate(clock_node,
-                                        '2/config/clock-pre-include')
-
-        # process inclusions
-        return self._process_node_include(clock_node,
-                                          self._process_clock_include)
-
-    # Process the inclusions of the metadata node `metadata_node`,
-    # returning the effective node.
-    def _process_metadata_include(self, metadata_node):
-        def process_children_include(metadata_node):
-            if 'trace' in metadata_node:
-                metadata_node['trace'] = self._process_trace_include(metadata_node['trace'])
-
-            if 'clocks' in metadata_node:
-                clocks_node = metadata_node['clocks']
-
-                for key in list(clocks_node):
-                    clocks_node[key] = self._process_clock_include(clocks_node[key])
-
-            if 'streams' in metadata_node:
-                streams_node = metadata_node['streams']
-
-                for key in list(streams_node):
-                    streams_node[key] = self._process_stream_include(streams_node[key])
-
-        # Make sure the metadata node is valid for the inclusion
-        # processing stage.
-        self._schema_validator.validate(metadata_node,
-                                        '2/config/metadata-pre-include')
-
-        # process inclusions
-        return self._process_node_include(metadata_node,
-                                          self._process_metadata_include,
-                                          process_children_include)
-
-    # Process the inclusions of the configuration node `config_node`,
-    # returning the effective node.
-    def _process_config_includes(self, config_node):
-        # Process inclusions in this order:
-        #
-        # 1. Clock type node, event type nodes, and trace type nodes
-        #    (the order between those is not important).
-        #
-        # 2. Stream type nodes.
-        #
-        # 3. Metadata node.
-        #
-        # This is because:
-        #
-        # * A metadata node can include clock type nodes, a trace type
-        #   node, stream type nodes, and event type nodes (indirectly).
-        #
-        # * A stream type node can include event type nodes.
-        #
-        # We keep a stack of absolute paths to included files
-        # (`self._include_stack`) to detect recursion.
-        #
-        # First, make sure the configuration object itself is valid for
-        # the inclusion processing stage.
-        self._schema_validator.validate(config_node,
-                                        '2/config/config-pre-include')
-
-        # Process metadata node inclusions.
-        #
-        # self._process_metadata_include() returns a new (or the same)
-        # metadata node without any `$include` property in it,
-        # recursively.
-        config_node['metadata'] = self._process_metadata_include(config_node['metadata'])
-
-        return config_node
-
-    # Expands the field type aliases found in the metadata node
-    # `metadata_node` using the aliases of the `type_aliases_node` node.
-    #
-    # This method modifies `metadata_node`.
-    #
-    # When this method returns:
-    #
-    # * Any field type alias is replaced with its full field type
-    #   equivalent.
-    #
-    # * The `type-aliases` property of `metadata_node` is removed.
-    def _expand_field_type_aliases(self, metadata_node, type_aliases_node):
-        def resolve_field_type_aliases(parent_node, key, from_descr,
-                                       alias_set=None):
-            if key not in parent_node:
-                return
-
-            # This set holds all the aliases we need to expand,
-            # recursively. This is used to detect cycles.
-            if alias_set is None:
-                alias_set = set()
-
-            node = parent_node[key]
-
-            if node is None:
-                return
-
-            if type(node) is str:
-                alias = node
-
-                if alias not in resolved_aliases:
-                    # Only check for a field type alias cycle when we
-                    # didn't resolve the alias yet, as a given node can
-                    # refer to the same field type alias more than once.
-                    if alias in alias_set:
-                        msg = f'Cycle detected during the `{alias}` field type alias resolution'
-                        raise _ConfigParseError(from_descr, msg)
-
-                    # try to load field type alias node named `alias`
-                    if alias not in type_aliases_node:
-                        raise _ConfigParseError(from_descr,
-                                                f'Field type alias `{alias}` does not exist')
-
-                    # resolve it
-                    alias_set.add(alias)
-                    resolve_field_type_aliases(type_aliases_node, alias,
-                                               from_descr, alias_set)
-                    resolved_aliases.add(alias)
-
-                parent_node[key] = copy.deepcopy(type_aliases_node[node])
-                return
-
-            # traverse, resolving field type aliases as needed
-            for pkey in ['$inherit', 'inherit', 'value-type', 'element-type']:
-                resolve_field_type_aliases(node, pkey, from_descr, alias_set)
-
-            # structure field type fields
-            pkey = 'fields'
-
-            if pkey in node:
-                assert type(node[pkey]) is collections.OrderedDict
-
-                for field_name in node[pkey]:
-                    resolve_field_type_aliases(node[pkey], field_name,
-                                               from_descr, alias_set)
-
-        def resolve_field_type_aliases_from(parent_node, key):
-            resolve_field_type_aliases(parent_node, key,
-                                       f'`{key}` property')
-
-        # set of resolved field type aliases
-        resolved_aliases = set()
-
-        # Expand field type aliases within trace, stream, and event
-        # types now.
-        try:
-            resolve_field_type_aliases_from(metadata_node['trace'],
-                                            'packet-header-type')
-        except _ConfigParseError as exc:
-            _append_error_ctx(exc, 'Trace type')
-
-        for stream_name, stream in metadata_node['streams'].items():
-            try:
-                resolve_field_type_aliases_from(stream, 'packet-context-type')
-                resolve_field_type_aliases_from(stream, 'event-header-type')
-                resolve_field_type_aliases_from(stream, 'event-context-type')
-
-                for event_name, event in stream['events'].items():
-                    try:
-                        resolve_field_type_aliases_from(event, 'context-type')
-                        resolve_field_type_aliases_from(event, 'payload-type')
-                    except _ConfigParseError as exc:
-                        _append_error_ctx(exc, f'Event type `{event_name}`')
-            except _ConfigParseError as exc:
-                _append_error_ctx(exc, f'Stream type `{stream_name}`')
-
-        # remove the (now unneeded) `type-aliases` node
-        del metadata_node['type-aliases']
-
-    # Applies field type inheritance to all field types found in
-    # `metadata_node`.
-    #
-    # This method modifies `metadata_node`.
-    #
-    # When this method returns, no field type node has an `$inherit` or
-    # `inherit` property.
-    def _expand_field_type_inheritance(self, metadata_node):
-        def apply_inheritance(parent_node, key):
-            if key not in parent_node:
-                return
-
-            node = parent_node[key]
-
-            if node is None:
-                return
-
-            # process children first
-            for pkey in ['$inherit', 'inherit', 'value-type', 'element-type']:
-                apply_inheritance(node, pkey)
-
-            # structure field type fields
-            pkey = 'fields'
-
-            if pkey in node:
-                assert type(node[pkey]) is collections.OrderedDict
-
-                for field_name, field_type in node[pkey].items():
-                    apply_inheritance(node[pkey], field_name)
-
-            # apply inheritance of this node
-            if 'inherit' in node:
-                # barectf 2.1: `inherit` property was renamed to `$inherit`
-                assert '$inherit' not in node
-                node['$inherit'] = node['inherit']
-                del node['inherit']
-
-            inherit_key = '$inherit'
-
-            if inherit_key in node:
-                assert type(node[inherit_key]) is collections.OrderedDict
-
-                # apply inheritance below
-                apply_inheritance(node, inherit_key)
-
-                # `node` is an overlay on the `$inherit` node
-                base_node = node[inherit_key]
-                del node[inherit_key]
-                self._update_node(base_node, node)
-
-                # set updated base node as this node
-                parent_node[key] = base_node
-
-        apply_inheritance(metadata_node['trace'], 'packet-header-type')
-
-        for stream in metadata_node['streams'].values():
-            apply_inheritance(stream, 'packet-context-type')
-            apply_inheritance(stream, 'event-header-type')
-            apply_inheritance(stream, 'event-context-type')
-
-            for event in stream['events'].values():
-                apply_inheritance(event, 'context-type')
-                apply_inheritance(event, 'payload-type')
-
-    # Calls _expand_field_type_aliases() and
-    # _expand_field_type_inheritance() if the metadata node
-    # `metadata_node` has a `type-aliases` property.
-    def _expand_field_types(self, metadata_node):
-        type_aliases_node = metadata_node.get('type-aliases')
-
-        if type_aliases_node is None:
-            # If there's no `type-aliases` node, then there's no field
-            # type aliases and therefore no possible inheritance.
-            return
-
-        # first, expand field type aliases
-        self._expand_field_type_aliases(metadata_node, type_aliases_node)
-
-        # next, apply inheritance to create effective field types
-        self._expand_field_type_inheritance(metadata_node)
-
-    # Replaces the textual log levels in event type nodes of the
-    # metadata node `metadata_node` with their numeric equivalent (as
-    # found in the `$log-levels` or `log-levels` node of
-    # `metadata_node`).
-    #
-    # This method modifies `metadata_node`.
-    #
-    # When this method returns, the `$log-levels` or `log-level`
-    # property of `metadata_node` is removed.
-    def _expand_log_levels(self, metadata_node):
-        if 'log-levels' in metadata_node:
-            # barectf 2.1: `log-levels` property was renamed to
-            # `$log-levels`
-            assert '$log-levels' not in metadata_node
-            metadata_node['$log-levels'] = metadata_node['log-levels']
-            del metadata_node['log-levels']
-
-        log_levels_key = '$log-levels'
-        log_levels_node = metadata_node.get(log_levels_key)
-
-        if log_levels_node is None:
-            # no log level aliases
-            return
-
-        # not needed anymore
-        del metadata_node[log_levels_key]
-
-        for stream_name, stream in metadata_node['streams'].items():
-            try:
-                for event_name, event in stream['events'].items():
-                    prop_name = 'log-level'
-                    ll_node = event.get(prop_name)
-
-                    if ll_node is None:
-                        continue
-
-                    if type(ll_node) is str:
-                        if ll_node not in log_levels_node:
-                            exc = _ConfigParseError('`log-level` property',
-                                                    f'Log level alias `{ll_node}` does not exist')
-                            exc._append_ctx(f'Event type `{event_name}`')
-                            raise exc
-
-                        event[prop_name] = log_levels_node[ll_node]
-            except _ConfigParseError as exc:
-                _append_error_ctx(exc, f'Stream type `{stream_name}`')
-
-    # Dumps the node `node` as YAML, passing `kwds` to yaml.dump().
-    def _yaml_ordered_dump(self, node, **kwds):
-        class ODumper(yaml.Dumper):
-            pass
-
-        def dict_representer(dumper, node):
-            return dumper.represent_mapping(yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG,
-                                            node.items())
-
-        ODumper.add_representer(collections.OrderedDict, dict_representer)
-
-        # Python -> YAML
-        return yaml.dump(node, Dumper=ODumper, **kwds)
-
-    # Loads the content of the YAML file having the path `yaml_path` as
-    # a Python object.
-    #
-    # All YAML maps are loaded as `collections.OrderedDict` objects.
-    def _yaml_ordered_load(self, yaml_path):
-        class OLoader(yaml.Loader):
-            pass
-
-        def construct_mapping(loader, node):
-            loader.flatten_mapping(node)
-
-            return collections.OrderedDict(loader.construct_pairs(node))
-
-        OLoader.add_constructor(yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG,
-                                construct_mapping)
-
-        # YAML -> Python
-        try:
-            with open(yaml_path, 'r') as f:
-                node = yaml.load(f, OLoader)
-        except (OSError, IOError) as exc:
-            raise _ConfigParseError(f'File `{yaml_path}`',
-                                    f'Cannot open file: {exc}')
-
-        assert type(node) is collections.OrderedDict
-        return node
-
-    def _parse(self):
-        self._version = None
-        self._include_stack = []
-
-        # load the configuration object as is from the root YAML file
-        try:
-            config_node = self._yaml_ordered_load(self._root_path)
-        except _ConfigParseError as exc:
-            _append_error_ctx(exc, 'Configuration',
-                              f'Cannot parse YAML file `{self._root_path}`')
-
-        # Make sure the configuration object is minimally valid, that
-        # is, it contains a valid `version` property.
-        #
-        # This step does not validate the whole configuration object
-        # yet because we don't have an effective configuration object;
-        # we still need to:
-        #
-        # * Process inclusions.
-        # * Expand field types (inheritance and aliases).
-        self._schema_validator.validate(config_node, 'config/config-min')
-
-        # Process configuration object inclusions.
-        #
-        # self._process_config_includes() returns a new (or the same)
-        # configuration object without any `$include` property in it,
-        # recursively.
-        config_node = self._process_config_includes(config_node)
-
-        # Make sure that the current configuration object is valid
-        # considering field types are not expanded yet.
-        self._schema_validator.validate(config_node,
-                                        '2/config/config-pre-field-type-expansion')
-
-        # Expand field types.
-        #
-        # This process:
-        #
-        # 1. Replaces field type aliases with "effective" field
-        #    types, recursively.
-        #
-        #    After this step, the `type-aliases` property of the
-        #    `metadata` node is gone.
-        #
-        # 2. Applies inheritance, following the `$inherit`/`inherit`
-        #    properties.
-        #
-        #    After this step, field type objects do not contain
-        #    `$inherit` or `inherit` properties.
-        #
-        # This is done blindly, in that the process _doesn't_ validate
-        # field type objects at this point.
-        self._expand_field_types(config_node['metadata'])
-
-        # Make sure that the current configuration object is valid
-        # considering log levels are not expanded yet.
-        self._schema_validator.validate(config_node,
-                                        '2/config/config-pre-log-level-expansion')
-
-        # Expand log levels, that is, replace log level strings with
-        # their equivalent numeric values.
-        self._expand_log_levels(config_node['metadata'])
-
-        # validate the whole, effective configuration object
-        self._schema_validator.validate(config_node, '2/config/config')
+            raise _ConfigurationParseError('Configuration',
+                                           f'Root (configuration) node is not an object (it\'s a `{type(root_node)}`)')
+    except _ConfigurationParseError as exc:
+        barectf_config_parse_common._append_error_ctx(exc, 'Configuration',
+                                                      'Cannot create configuration from YAML file')
 
-        # dump config if required
-        if self._dump_config:
-            print(self._yaml_ordered_dump(config_node, indent=2,
-                                          default_flow_style=False))
 
-        # get prefix, options, and metadata pseudo-object
-        prefix = self._get_prefix(config_node)
-        opts = self._get_options(config_node)
-        pseudo_meta = self._create_metadata(config_node)
+def _from_file(file, include_dirs, ignore_include_not_found):
+    return _create_v3_parser(file, include_dirs, ignore_include_not_found).config
 
-        # create public configuration
-        self._config = barectf.config.Config(pseudo_meta.to_public(), prefix,
-                                             opts)
 
-    @property
-    def config(self):
-        return self._config
+def _effective_config_file(file, include_dirs, ignore_include_not_found, indent_space_count=2):
+    config_node = _create_v3_parser(file, include_dirs, ignore_include_not_found).config_node
+    return barectf_config_parse_common._yaml_dump(config_node, indent=indent_space_count,
+                                                  default_flow_style=False, explicit_start=True,
+                                                  explicit_end=True)
 
 
-def _from_file(path, include_dirs, ignore_include_not_found, dump_config):
+def _config_file_major_version(file):
     try:
-        return _YamlConfigParser(path, include_dirs, ignore_include_not_found,
-                                 dump_config).config
-    except _ConfigParseError as exc:
-        _append_error_ctx(exc, 'Configuration',
-                          f'Cannot create configuration from YAML file `{path}`')
+        root_node = barectf_config_parse_common._yaml_load(file)
+
+        if type(root_node) is barectf_config_parse_common._ConfigNodeV3:
+            # barectf 3 configuration file
+            return 3
+        elif type(root_node) is collections.OrderedDict:
+            # barectf 2 configuration file
+            return 2
+    except _ConfigurationParseError as exc:
+        barectf_config_parse_common._append_error_ctx(exc, 'Configuration', 'Cannot load YAML file')
diff --git a/barectf/config_parse_common.py b/barectf/config_parse_common.py
new file mode 100644 (file)
index 0000000..8a468c0
--- /dev/null
@@ -0,0 +1,773 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2015-2020 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documeneffective_filetation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+import pkg_resources
+import collections
+import jsonschema
+import os.path
+import yaml
+import copy
+import os
+
+
+# The context of a configuration parsing error.
+#
+# Such a context object has a name and, optionally, a message.
+class _ConfigurationParseErrorContext:
+    def __init__(self, name, message=None):
+        self._name = name
+        self._msg = message
+
+    @property
+    def name(self):
+        return self._name
+
+    @property
+    def message(self):
+        return self._msg
+
+
+# Appends the context having the object name `obj_name` and the
+# (optional) message `message` to the `_ConfigurationParseError`
+# exception `exc` and then raises `exc` again.
+def _append_error_ctx(exc, obj_name, message=None):
+    exc._append_ctx(obj_name, message)
+    raise exc
+
+
+# A configuration parsing error.
+#
+# Such an error object contains a list of contexts (`context` property).
+#
+# The first context of this list is the most specific context, while the
+# last is the more general.
+#
+# Use _append_ctx() to append a context to an existing configuration
+# parsing error when you catch it before raising it again. You can use
+# _append_error_ctx() to do exactly this in a single call.
+class _ConfigurationParseError(Exception):
+    def __init__(self, init_ctx_obj_name, init_ctx_msg=None):
+        super().__init__()
+        self._ctx = []
+        self._append_ctx(init_ctx_obj_name, init_ctx_msg)
+
+    @property
+    def context(self):
+        return self._ctx
+
+    def _append_ctx(self, name, msg=None):
+        self._ctx.append(_ConfigurationParseErrorContext(name, msg))
+
+    def __str__(self):
+        lines = []
+
+        for ctx in reversed(self._ctx):
+            line = f'{ctx.name}:'
+
+            if ctx.message is not None:
+                line += f' {ctx.message}'
+
+            lines.append(line)
+
+        return '\n'.join(lines)
+
+
+_V3Prefixes = collections.namedtuple('_V3Prefixes', ['identifier', 'file_name'])
+
+
+# Convers a v2 prefix to v3 prefixes.
+def _v3_prefixes_from_v2_prefix(v2_prefix):
+    return _V3Prefixes(v2_prefix, v2_prefix.rstrip('_'))
+
+
+# This JSON schema reference resolver only serves to detect when it
+# needs to resolve a remote URI.
+#
+# This must never happen in barectf because all our schemas are local;
+# it would mean a programming or schema error.
+class _RefResolver(jsonschema.RefResolver):
+    def resolve_remote(self, uri):
+        raise RuntimeError(f'Missing local schema with URI `{uri}`')
+
+
+# Schema validator which considers all the schemas found in the
+# subdirectories `subdirs` (at build time) of the barectf package's
+# `schemas` directory.
+#
+# The only public method is validate() which accepts an instance to
+# validate as well as a schema short ID.
+class _SchemaValidator:
+    def __init__(self, subdirs):
+        schemas_dir = pkg_resources.resource_filename(__name__, 'schemas')
+        self._store = {}
+
+        for subdir in subdirs:
+            dir = os.path.join(schemas_dir, subdir)
+
+            for file_name in os.listdir(dir):
+                if not file_name.endswith('.yaml'):
+                    continue
+
+                with open(os.path.join(dir, file_name)) as f:
+                    schema = yaml.load(f, Loader=yaml.SafeLoader)
+
+                assert '$id' in schema
+                schema_id = schema['$id']
+                assert schema_id not in self._store
+                self._store[schema_id] = schema
+
+    @staticmethod
+    def _dict_from_ordered_dict(obj):
+        if type(obj) is not collections.OrderedDict:
+            return obj
+
+        dct = {}
+
+        for k, v in obj.items():
+            new_v = v
+
+            if type(v) is collections.OrderedDict:
+                new_v = _SchemaValidator._dict_from_ordered_dict(v)
+            elif type(v) is list:
+                new_v = [_SchemaValidator._dict_from_ordered_dict(elem) for elem in v]
+
+            dct[k] = new_v
+
+        return dct
+
+    def _validate(self, instance, schema_short_id):
+        # retrieve full schema ID from short ID
+        schema_id = f'https://barectf.org/schemas/{schema_short_id}.json'
+        assert schema_id in self._store
+
+        # retrieve full schema
+        schema = self._store[schema_id]
+
+        # Create a reference resolver for this schema using this
+        # validator's schema store.
+        resolver = _RefResolver(base_uri=schema_id, referrer=schema,
+                                store=self._store)
+
+        # create a JSON schema validator using this reference resolver
+        validator = jsonschema.Draft7Validator(schema, resolver=resolver)
+
+        # Validate the instance, converting its
+        # `collections.OrderedDict` objects to `dict` objects so as to
+        # make any error message easier to read (because
+        # validator.validate() below uses str() for error messages, and
+        # collections.OrderedDict.__str__() returns a somewhat bulky
+        # representation).
+        validator.validate(self._dict_from_ordered_dict(instance))
+
+    # Validates `instance` using the schema having the short ID
+    # `schema_short_id`.
+    #
+    # A schema short ID is the part between `schemas/` and `.json` in
+    # its URI.
+    #
+    # Raises a `_ConfigurationParseError` object, hiding any
+    # `jsonschema` exception, on validation failure.
+    def validate(self, instance, schema_short_id):
+        try:
+            self._validate(instance, schema_short_id)
+        except jsonschema.ValidationError as exc:
+            # convert to barectf `_ConfigurationParseError` exception
+            contexts = ['Configuration object']
+
+            # Each element of the instance's absolute path is either an
+            # integer (array element's index) or a string (object
+            # property's name).
+            for elem in exc.absolute_path:
+                if type(elem) is int:
+                    ctx = f'Element #{elem + 1}'
+                else:
+                    ctx = f'`{elem}` property'
+
+                contexts.append(ctx)
+
+            schema_ctx = ''
+
+            if len(exc.context) > 0:
+                # According to the documentation of
+                # jsonschema.ValidationError.context(), the method
+                # returns a
+                #
+                # > list of errors from the subschemas
+                #
+                # This contains additional information about the
+                # validation failure which can help the user figure out
+                # what's wrong exactly.
+                #
+                # Join each message with `; ` and append this to our
+                # configuration parsing error's message.
+                msgs = '; '.join([e.message for e in exc.context])
+                schema_ctx = f': {msgs}'
+
+            new_exc = _ConfigurationParseError(contexts.pop(),
+                                               f'{exc.message}{schema_ctx} (from schema `{schema_short_id}`)')
+
+            for ctx in reversed(contexts):
+                new_exc._append_ctx(ctx)
+
+            raise new_exc
+
+
+# barectf 3 YAML configuration node.
+class _ConfigNodeV3:
+    def __init__(self, config_node):
+        self._config_node = config_node
+
+    @property
+    def config_node(self):
+        return self._config_node
+
+
+_CONFIG_V3_YAML_TAG = 'tag:barectf.org,2020/3/config'
+
+
+# Loads the content of the YAML file-like object `file` as a Python
+# object and returns it.
+#
+# If the file's object has the barectf 3 configuration tag, then this
+# function returns a `_ConfigNodeV3` object. Otherwise, it returns a
+# `collections.OrderedDict` object.
+#
+# All YAML maps are loaded as `collections.OrderedDict` objects.
+def _yaml_load(file):
+    class Loader(yaml.Loader):
+        pass
+
+    def config_ctor(loader, node):
+        if not isinstance(node, yaml.MappingNode):
+            problem = f'Expecting a map for the tag `{node.tag}`'
+            raise yaml.constructor.ConstructorError(problem=problem)
+
+        loader.flatten_mapping(node)
+        return _ConfigNodeV3(collections.OrderedDict(loader.construct_pairs(node)))
+
+    def mapping_ctor(loader, node):
+        loader.flatten_mapping(node)
+        return collections.OrderedDict(loader.construct_pairs(node))
+
+    Loader.add_constructor(_CONFIG_V3_YAML_TAG, config_ctor)
+    Loader.add_constructor(yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG, mapping_ctor)
+
+    # YAML -> Python
+    try:
+        return yaml.load(file, Loader=Loader)
+    except (yaml.YAMLError, OSError, IOError) as exc:
+        raise _ConfigurationParseError('YAML loader', f'Cannot load file: {exc}')
+
+
+def _yaml_load_path(path):
+    with open(path) as f:
+        return _yaml_load(f)
+
+
+# Dumps the content of the Python object `obj`
+# (`collections.OrderedDict` or `_ConfigNodeV3`) as a YAML string and
+# returns it.
+def _yaml_dump(node, **kwds):
+    class Dumper(yaml.Dumper):
+        pass
+
+    def config_repr(dumper, node):
+        return dumper.represent_mapping(_CONFIG_V3_YAML_TAG, node.config_node.items())
+
+    def mapping_repr(dumper, node):
+        return dumper.represent_mapping(yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG,
+                                        node.items())
+
+    Dumper.add_representer(_ConfigNodeV3, config_repr)
+    Dumper.add_representer(collections.OrderedDict, mapping_repr)
+
+    # Python -> YAML
+    return yaml.dump(node, Dumper=Dumper, version=(1, 2), **kwds)
+
+
+# A common barectf YAML configuration parser.
+#
+# This is the base class of any barectf YAML configuration parser. It
+# mostly contains helpers.
+class _Parser:
+    # Builds a base barectf YAML configuration parser to process the
+    # configuration node `node` (already loaded from the file having the
+    # path `path`).
+    #
+    # For its _process_node_include() method, the parser considers the
+    # inclusion directories `include_dirs` and ignores nonexistent
+    # inclusion files if `ignore_include_not_found` is `True`.
+    def __init__(self, path, node, include_dirs, ignore_include_not_found, major_version):
+        self._root_path = path
+        self._root_node = node
+        self._ft_prop_names = [
+            # barectf 2.1+
+            '$inherit',
+
+            # barectf 2
+            'inherit',
+            'value-type',
+            'element-type',
+
+            # barectf 3
+            'element-field-type',
+        ]
+        self._include_dirs = include_dirs
+        self._ignore_include_not_found = ignore_include_not_found
+        self._include_stack = []
+        self._resolved_ft_aliases = set()
+        self._schema_validator = _SchemaValidator({'common/config', f'{major_version}/config'})
+        self._major_version = major_version
+
+    @property
+    def _struct_ft_node_members_prop_name(self):
+        if self._major_version == 2:
+            return 'fields'
+        else:
+            return 'members'
+
+    # Returns the last included file name from the parser's inclusion
+    # file name stack.
+    def _get_last_include_file(self):
+        if self._include_stack:
+            return self._include_stack[-1]
+
+        return self._root_path
+
+    # Loads the inclusion file having the path `yaml_path` and returns
+    # its content as a `collections.OrderedDict` object.
+    def _load_include(self, yaml_path):
+        for inc_dir in self._include_dirs:
+            # Current inclusion dir + file name path.
+            #
+            # Note: os.path.join() only takes the last argument if it's
+            # absolute.
+            inc_path = os.path.join(inc_dir, yaml_path)
+
+            # real path (symbolic links resolved)
+            real_path = os.path.realpath(inc_path)
+
+            # normalized path (weird stuff removed!)
+            norm_path = os.path.normpath(real_path)
+
+            if not os.path.isfile(norm_path):
+                # file doesn't exist: skip
+                continue
+
+            if norm_path in self._include_stack:
+                base_path = self._get_last_include_file()
+                raise _ConfigurationParseError(f'File `{base_path}`',
+                                               f'Cannot recursively include file `{norm_path}`')
+
+            self._include_stack.append(norm_path)
+
+            # load raw content
+            return _yaml_load_path(norm_path)
+
+        if not self._ignore_include_not_found:
+            base_path = self._get_last_include_file()
+            raise _ConfigurationParseError(f'File `{base_path}`',
+                                           f'Cannot include file `{yaml_path}`: file not found in inclusion directories')
+
+    # Returns a list of all the inclusion file paths as found in the
+    # inclusion node `include_node`.
+    def _get_include_paths(self, include_node):
+        if include_node is None:
+            # none
+            return []
+
+        if type(include_node) is str:
+            # wrap as array
+            return [include_node]
+
+        # already an array
+        assert type(include_node) is list
+        return include_node
+
+    # Updates the node `base_node` with an overlay node `overlay_node`.
+    #
+    # Both the inclusion and field type node inheritance features use
+    # this update mechanism.
+    def _update_node(self, base_node, overlay_node):
+        # see the comment about the `members` property below
+        def update_members_node(base_value, olay_value):
+            assert type(olay_value) is list
+            assert type(base_value) is list
+
+            for olay_item in olay_value:
+                # assume we append `olay_item` to `base_value` initially
+                append_olay_item = True
+
+                if type(olay_item) is collections.OrderedDict:
+                    # overlay item is an object
+                    if len(olay_item) == 1:
+                        # overlay object item contains a single property
+                        olay_name = list(olay_item)[0]
+
+                        # find corresponding base item
+                        for base_item in base_value:
+                            if type(base_item) is collections.OrderedDict:
+                                if len(olay_item) == 1:
+                                    base_name = list(base_item)[0]
+
+                                    if olay_name == base_name:
+                                        # Names match: update with usual
+                                        # strategy.
+                                        self._update_node(base_item, olay_item)
+
+                                        # Do _not_ append `olay_item` to
+                                        # `base_value`: we just updated
+                                        # `base_item`.
+                                        append_olay_item = False
+                                        break
+
+                if append_olay_item:
+                    base_value.append(copy.deepcopy(olay_item))
+
+        for olay_key, olay_value in overlay_node.items():
+            if olay_key in base_node:
+                base_value = base_node[olay_key]
+
+                if type(olay_value) is collections.OrderedDict and type(base_value) is collections.OrderedDict:
+                    # merge both objects
+                    self._update_node(base_value, olay_value)
+                elif type(olay_value) is list and type(base_value) is list:
+                    if olay_key == 'members' and self._major_version == 3:
+                        # This is a "temporary" hack.
+                        #
+                        # In barectf 2, a structure field type node
+                        # looks like this:
+                        #
+                        #     class: struct
+                        #     fields:
+                        #       hello: uint8
+                        #       world: string
+                        #
+                        # Having an overlay such as
+                        #
+                        #     fields:
+                        #       hello: float
+                        #
+                        # will result in
+                        #
+                        #     class: struct
+                        #     fields:
+                        #       hello: float
+                        #       world: string
+                        #
+                        # because the `fields` property is a map.
+                        #
+                        # In barectf 3, this is fixed (a YAML map is not
+                        # ordered), so that the same initial structure
+                        # field type node looks like this:
+                        #
+                        #     class: struct
+                        #     members:
+                        #       - hello: uint8
+                        #       - world:
+                        #           field-type:
+                        #             class: str
+                        #
+                        # Although the `members` property is
+                        # syntaxically an array, it's semantically an
+                        # ordered map, where an entry's key is the array
+                        # item's map's first key (like YAML's `!!omap`).
+                        #
+                        # Having an overlay such as
+                        #
+                        #     members:
+                        #       - hello: float
+                        #
+                        # would result in
+                        #
+                        #     class: struct
+                        #     members:
+                        #       - hello: uint8
+                        #       - world:
+                        #           field-type:
+                        #             class: str
+                        #       - hello: float
+                        #
+                        # with the naive strategy, while what we really
+                        # want is:
+                        #
+                        #     class: struct
+                        #     members:
+                        #       - hello: float
+                        #       - world:
+                        #           field-type:
+                        #             class: str
+                        #
+                        # As of this version of barectf, the _only_
+                        # property with a list value which acts as an
+                        # ordered map is named `members`. This is why we
+                        # can only check the value of `olay_key`,
+                        # whatever our context.
+                        #
+                        # update_members_node() attempts to perform
+                        # this below. For a given item of `olay_value`,
+                        # if
+                        #
+                        # * It's not an object.
+                        #
+                        # * It contains more than one property.
+                        #
+                        # * Its single property's name does not match
+                        #   the name of the single property of any
+                        #   object item of `base_value`.
+                        #
+                        # then we append the item to `base_value` as
+                        # usual.
+                        update_members_node(base_value, olay_value)
+                    else:
+                        # append extension array items to base items
+                        base_value += copy.deepcopy(olay_value)
+                else:
+                    # fall back to replacing base property
+                    base_node[olay_key] = copy.deepcopy(olay_value)
+            else:
+                # set base property from overlay property
+                base_node[olay_key] = copy.deepcopy(olay_value)
+
+    # Processes inclusions using `last_overlay_node` as the last overlay
+    # node to use to "patch" the node.
+    #
+    # If `last_overlay_node` contains an `$include` property, then this
+    # method patches the current base node (initially empty) in order
+    # using the content of the inclusion files (recursively).
+    #
+    # At the end, this method removes the `$include` property of
+    # `last_overlay_node` and then patches the current base node with
+    # its other properties before returning the result (always a deep
+    # copy).
+    def _process_node_include(self, last_overlay_node,
+                              process_base_include_cb,
+                              process_children_include_cb=None):
+        # process children inclusions first
+        if process_children_include_cb is not None:
+            process_children_include_cb(last_overlay_node)
+
+        incl_prop_name = '$include'
+
+        if incl_prop_name in last_overlay_node:
+            include_node = last_overlay_node[incl_prop_name]
+        else:
+            # no inclusions!
+            return last_overlay_node
+
+        include_paths = self._get_include_paths(include_node)
+        cur_base_path = self._get_last_include_file()
+        base_node = None
+
+        # keep the inclusion paths and remove the `$include` property
+        include_paths = copy.deepcopy(include_paths)
+        del last_overlay_node[incl_prop_name]
+
+        for include_path in include_paths:
+            # load raw YAML from included file
+            overlay_node = self._load_include(include_path)
+
+            if overlay_node is None:
+                # Cannot find inclusion file, but we're ignoring those
+                # errors, otherwise _load_include() itself raises a
+                # config error.
+                continue
+
+            # recursively process inclusions
+            try:
+                overlay_node = process_base_include_cb(overlay_node)
+            except _ConfigurationParseError as exc:
+                _append_error_ctx(exc, f'File `{cur_base_path}`')
+
+            # pop inclusion stack now that we're done including
+            del self._include_stack[-1]
+
+            # At this point, `base_node` is fully resolved (does not
+            # contain any `$include` property).
+            if base_node is None:
+                base_node = overlay_node
+            else:
+                self._update_node(base_node, overlay_node)
+
+        # Finally, update the latest base node with our last overlay
+        # node.
+        if base_node is None:
+            # Nothing was included, which is possible when we're
+            # ignoring inclusion errors.
+            return last_overlay_node
+
+        self._update_node(base_node, last_overlay_node)
+        return base_node
+
+    # Generates pairs of member node and field type node property name
+    # (in the member node) for the structure field type node's members
+    # node `node`.
+    def _struct_ft_member_fts_iter(self, node):
+        if type(node) is list:
+            # barectf 3
+            assert self._major_version == 3
+
+            for member_node in node:
+                assert type(member_node) is collections.OrderedDict
+                name, val = list(member_node.items())[0]
+
+                if type(val) is collections.OrderedDict:
+                    member_node = val
+                    name = 'field-type'
+
+                yield member_node, name
+        else:
+            # barectf 2
+            assert self._major_version == 2
+            assert type(node) is collections.OrderedDict
+
+            for name in node:
+                yield node, name
+
+    # Resolves the field type alias `key` in the node `parent_node`, as
+    # well as any nested field type aliases, using the aliases of the
+    # `ft_aliases_node` node.
+    #
+    # If `key` is not in `parent_node`, this method returns.
+    #
+    # This method can modify `ft_aliases_node` and `parent_node[key]`.
+    #
+    # `ctx_obj_name` is the context's object name when this method
+    # raises a `_ConfigurationParseError` exception.
+    def _resolve_ft_alias(self, ft_aliases_node, parent_node, key, ctx_obj_name, alias_set=None):
+        if key not in parent_node:
+            return
+
+        node = parent_node[key]
+
+        if node is None:
+            # some nodes can be null to use their default value
+            return
+
+        # This set holds all the field type aliases to be expanded,
+        # recursively. This is used to detect cycles.
+        if alias_set is None:
+            alias_set = set()
+
+        if type(node) is str:
+            alias = node
+
+            # Make sure this alias names an existing field type node, at
+            # least.
+            if alias not in ft_aliases_node:
+                raise _ConfigurationParseError(ctx_obj_name,
+                                               f'Field type alias `{alias}` does not exist')
+
+            if alias not in self._resolved_ft_aliases:
+                # Only check for a field type alias cycle when we didn't
+                # resolve the alias yet, as a given node can refer to
+                # the same field type alias more than once.
+                if alias in alias_set:
+                    msg = f'Cycle detected during the `{alias}` field type alias resolution'
+                    raise _ConfigurationParseError(ctx_obj_name, msg)
+
+                # Resolve it.
+                #
+                # Add `alias` to the set of encountered field type
+                # aliases before calling self._resolve_ft_alias() to
+                # detect cycles.
+                alias_set.add(alias)
+                self._resolve_ft_alias(ft_aliases_node, ft_aliases_node, alias, ctx_obj_name,
+                                       alias_set)
+                self._resolved_ft_aliases.add(alias)
+
+            # replace alias with field type node copy
+            parent_node[key] = copy.deepcopy(ft_aliases_node[alias])
+            return
+
+        # resolve nested field type aliases
+        for pkey in self._ft_prop_names:
+            self._resolve_ft_alias(ft_aliases_node, node, pkey, ctx_obj_name, alias_set)
+
+        # Resolve field type aliases of structure field type node member
+        # nodes.
+        pkey = self._struct_ft_node_members_prop_name
+
+        if pkey in node:
+            for member_node, ft_prop_name in self._struct_ft_member_fts_iter(node[pkey]):
+                self._resolve_ft_alias(ft_aliases_node, member_node, ft_prop_name,
+                                       ctx_obj_name, alias_set)
+
+    # Like _resolve_ft_alias(), but builds a context object name for any
+    # `ctx_obj_name` exception.
+    def _resolve_ft_alias_from(self, ft_aliases_node, parent_node, key):
+        self._resolve_ft_alias(ft_aliases_node, parent_node, key, f'`{key}` property')
+
+    # Applies field type node inheritance to the property `key` of
+    # `parent_node`.
+    #
+    # `parent_node[key]`, if it exists, must not contain any field type
+    # alias (all field type objects are complete).
+    #
+    # This method can modify `parent[key]`.
+    #
+    # When this method returns, no field type node has an `$inherit` or
+    # `inherit` property.
+    def _apply_ft_inheritance(self, parent_node, key):
+        if key not in parent_node:
+            return
+
+        node = parent_node[key]
+
+        if node is None:
+            return
+
+        # process children first
+        for pkey in self._ft_prop_names:
+            self._apply_ft_inheritance(node, pkey)
+
+        # Process the field types of structure field type node member
+        # nodes.
+        pkey = self._struct_ft_node_members_prop_name
+
+        if pkey in node:
+            for member_node, ft_prop_name in self._struct_ft_member_fts_iter(node[pkey]):
+                self._apply_ft_inheritance(member_node, ft_prop_name)
+
+        # apply inheritance for this node
+        if 'inherit' in node:
+            # barectf 2.1: `inherit` property was renamed to `$inherit`
+            assert '$inherit' not in node
+            node['$inherit'] = node['inherit']
+            del node['inherit']
+
+        inherit_key = '$inherit'
+
+        if inherit_key in node:
+            assert type(node[inherit_key]) is collections.OrderedDict
+
+            # apply inheritance below
+            self._apply_ft_inheritance(node, inherit_key)
+
+            # `node` is an overlay on the `$inherit` node
+            base_node = node[inherit_key]
+            del node[inherit_key]
+            self._update_node(base_node, node)
+
+            # set updated base node as this node
+            parent_node[key] = base_node
diff --git a/barectf/config_parse_v2.py b/barectf/config_parse_v2.py
new file mode 100644 (file)
index 0000000..454cba5
--- /dev/null
@@ -0,0 +1,837 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2015-2020 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+from barectf.config_parse_common import _ConfigurationParseError
+from barectf.config_parse_common import _append_error_ctx
+import barectf.config_parse_common as config_parse_common
+import collections
+import copy
+
+
+def _del_prop_if_exists(node, prop_name):
+    if prop_name in node:
+        del node[prop_name]
+
+
+def _rename_prop(node, old_prop_name, new_prop_name):
+    if old_prop_name in node:
+        node[new_prop_name] = node[old_prop_name]
+        del node[old_prop_name]
+
+
+def _copy_prop_if_exists(dst_node, src_node, src_prop_name, dst_prop_name=None):
+    if dst_prop_name is None:
+        dst_prop_name = src_prop_name
+
+    if src_prop_name in src_node:
+        dst_node[dst_prop_name] = copy.deepcopy(src_node[src_prop_name])
+
+
+# A barectf 2 YAML configuration parser.
+#
+# The only purpose of such a parser is to transform the passed root
+# configuration node so that it's a valid barectf 3 configuration node.
+#
+# The parser's `config_node` property is the equivalent barectf 3
+# configuration node.
+#
+# See the comments of _parse() for more implementation details about the
+# parsing stages and general strategy.
+class _Parser(config_parse_common._Parser):
+    # Builds a barectf 2 YAML configuration parser and parses the root
+    # configuration node `node` (already loaded from `path`).
+    def __init__(self, path, node, include_dirs, ignore_include_not_found):
+        super().__init__(path, node, include_dirs, ignore_include_not_found, 2)
+        self._ft_cls_name_to_conv_method = {
+            'int': self._conv_int_ft_node,
+            'integer': self._conv_int_ft_node,
+            'enum': self._conv_enum_ft_node,
+            'enumeration': self._conv_enum_ft_node,
+            'flt': self._conv_real_ft_node,
+            'float': self._conv_real_ft_node,
+            'floating-point': self._conv_real_ft_node,
+            'str': self._conv_string_ft_node,
+            'string': self._conv_string_ft_node,
+            'array': self._conv_static_array_ft_node,
+            'struct': self._conv_struct_ft_node,
+            'structure': self._conv_struct_ft_node,
+        }
+        self._parse()
+
+    # Converts a v2 field type node to a v3 field type node and returns
+    # it.
+    def _conv_ft_node(self, v2_ft_node):
+        assert 'class' in v2_ft_node
+        cls = v2_ft_node['class']
+        assert cls in self._ft_cls_name_to_conv_method
+        return self._ft_cls_name_to_conv_method[cls](v2_ft_node)
+
+    def _conv_ft_node_if_exists(self, v2_parent_node, key):
+        if v2_parent_node is None:
+            return
+
+        if key not in v2_parent_node:
+            return
+
+        return self._conv_ft_node(v2_parent_node[key])
+
+    # Converts a v2 integer field type node to a v3 integer field type
+    # node and returns it.
+    def _conv_int_ft_node(self, v2_ft_node):
+        # copy v2 integer field type node
+        v3_ft_node = copy.deepcopy(v2_ft_node)
+
+        # signedness depends on the class, not a property
+        cls_name = 'uint'
+        prop_name = 'signed'
+        is_signed_node = v3_ft_node.get(prop_name)
+
+        if is_signed_node is True:
+            cls_name = 'sint'
+
+        v3_ft_node['class'] = cls_name
+        _del_prop_if_exists(v3_ft_node, prop_name)
+
+        # rename `align` property to `alignment`
+        _rename_prop(v3_ft_node, 'align', 'alignment')
+
+        # rename `base` property to `preferred-display-base`
+        _rename_prop(v3_ft_node, 'base', 'preferred-display-base')
+
+        # remove `encoding` property
+        _del_prop_if_exists(v3_ft_node, 'encoding')
+
+        # remove `property-mappings` property
+        _del_prop_if_exists(v3_ft_node, 'property-mappings')
+
+        return v3_ft_node
+
+    # Converts a v2 enumeration field type node to a v3 enumeration
+    # field type node and returns it.
+    def _conv_enum_ft_node(self, v2_ft_node):
+        # An enumeration field type _is_ an integer field type, so use a
+        # copy of the converted v2 value field type node.
+        v3_ft_node = copy.deepcopy(self._conv_ft_node(v2_ft_node['value-type']))
+
+        # transform class name accordingly
+        prop_name = 'class'
+        cls_name = 'uenum'
+
+        if v3_ft_node[prop_name] == 'sint':
+            cls_name = 'senum'
+
+        v3_ft_node[prop_name] = cls_name
+
+        # convert members to mappings
+        prop_name = 'members'
+        members_node = v2_ft_node.get(prop_name)
+
+        if members_node is not None:
+            mappings_node = collections.OrderedDict()
+            cur = 0
+
+            for member_node in members_node:
+                if type(member_node) is str:
+                    label = member_node
+                    v3_value_node = cur
+                    cur += 1
+                else:
+                    assert type(member_node) is collections.OrderedDict
+                    label = member_node['label']
+                    v2_value_node = member_node['value']
+
+                    if type(v2_value_node) is int:
+                        cur = v2_value_node + 1
+                        v3_value_node = v2_value_node
+                    else:
+                        assert type(v2_value_node) is list
+                        assert len(v2_value_node) == 2
+                        v3_value_node = list(v2_value_node)
+                        cur = v2_value_node[1] + 1
+
+                if label not in mappings_node:
+                    mappings_node[label] = []
+
+                mappings_node[label].append(v3_value_node)
+
+            v3_ft_node['mappings'] = mappings_node
+
+        return v3_ft_node
+
+    # Converts a v2 real field type node to a v3 real field type node
+    # and returns it.
+    def _conv_real_ft_node(self, v2_ft_node):
+        # copy v2 real field type node
+        v3_ft_node = copy.deepcopy(v2_ft_node)
+
+        # set class to `real`
+        v3_ft_node['class'] = 'real'
+
+        # rename `align` property to `alignment`
+        _rename_prop(v3_ft_node, 'align', 'alignment')
+
+        # set `size` property to a single integer (total size, in bits)
+        prop_name = 'size'
+        v3_ft_node[prop_name] = v3_ft_node[prop_name]['exp'] + v3_ft_node[prop_name]['mant']
+
+        return v3_ft_node
+
+    # Converts a v2 string field type node to a v3 string field type
+    # node and returns it.
+    def _conv_string_ft_node(self, v2_ft_node):
+        # copy v2 string field type node
+        v3_ft_node = copy.deepcopy(v2_ft_node)
+
+        # remove `encoding` property
+        _del_prop_if_exists(v3_ft_node, 'encoding')
+
+        return v3_ft_node
+
+    # Converts a v2 array field type node to a v3 (static) array field
+    # type node and returns it.
+    def _conv_static_array_ft_node(self, v2_ft_node):
+        # class renamed to `static-array`
+        v3_ft_node = collections.OrderedDict({'class': 'static-array'})
+
+        # copy `length` property
+        _copy_prop_if_exists(v3_ft_node, v2_ft_node, 'length')
+
+        # convert element field type
+        v3_ft_node['element-field-type'] = self._conv_ft_node(v2_ft_node['element-type'])
+
+        return v3_ft_node
+
+    # Converts a v2 structure field type node to a v3 structure field
+    # type node and returns it.
+    def _conv_struct_ft_node(self, v2_ft_node):
+        # Create fresh v3 structure field type node, reusing the class
+        # of `v2_ft_node`.
+        v3_ft_node = collections.OrderedDict({'class': v2_ft_node['class']})
+
+        # rename `min-align` property to `minimum-alignment`
+        _copy_prop_if_exists(v3_ft_node, v2_ft_node, 'min-align', 'minimum-alignment')
+
+        # convert fields to members
+        prop_name = 'fields'
+
+        if prop_name in v2_ft_node:
+            members_node = []
+
+            for member_name, v2_member_ft_node in v2_ft_node[prop_name].items():
+                members_node.append(collections.OrderedDict({
+                    member_name: collections.OrderedDict({
+                        'field-type': self._conv_ft_node(v2_member_ft_node)
+                    })
+                }))
+
+            v3_ft_node['members'] = members_node
+
+        return v3_ft_node
+
+    # Converts a v2 clock type node to a v3 clock type node and returns
+    # it.
+    def _conv_clk_type_node(self, v2_clk_type_node):
+        # copy v2 clock type node
+        v3_clk_type_node = copy.deepcopy(v2_clk_type_node)
+
+        # rename `freq` property to `frequency`
+        _rename_prop(v3_clk_type_node, 'freq', 'frequency')
+
+        # rename `error-cycles` property to `precision`
+        _rename_prop(v3_clk_type_node, 'error-cycles', 'precision')
+
+        # rename `absolute` property to `origin-is-unix-epoch`
+        _rename_prop(v3_clk_type_node, 'absolute', 'origin-is-unix-epoch')
+
+        # rename `$return-ctype`/`return-ctype` property to `$c-type`
+        new_prop_name = '$c-type'
+        _rename_prop(v3_clk_type_node, 'return-ctype', new_prop_name)
+        _rename_prop(v3_clk_type_node, '$return-ctype', new_prop_name)
+
+        return v3_clk_type_node
+
+    # Converts a v2 event type node to a v3 event type node and returns
+    # it.
+    def _conv_ev_type_node(self, v2_ev_type_node):
+        # create empty v3 event type node
+        v3_ev_type_node = collections.OrderedDict()
+
+        # copy `log-level` property
+        _copy_prop_if_exists(v3_ev_type_node, v2_ev_type_node, 'log-level')
+
+        # convert specific context field type node
+        v2_ft_node = v2_ev_type_node.get('context-type')
+
+        if v2_ft_node is not None:
+            v3_ev_type_node['specific-context-field-type'] = self._conv_ft_node(v2_ft_node)
+
+        # convert payload field type node
+        v2_ft_node = v2_ev_type_node.get('payload-type')
+
+        if v2_ft_node is not None:
+            v3_ev_type_node['payload-field-type'] = self._conv_ft_node(v2_ft_node)
+
+        return v3_ev_type_node
+
+    @staticmethod
+    def _set_v3_feature_ft_if_exists(v3_features_node, key, node):
+        val = node
+
+        if val is None:
+            val = False
+
+        v3_features_node[key] = val
+
+    # Converts a v2 stream type node to a v3 stream type node and
+    # returns it.
+    def _conv_stream_type_node(self, v2_stream_type_node):
+        # This function creates a v3 stream type features node from the
+        # packet context and event header field type nodes of a
+        # v2 stream type node.
+        def v3_features_node_from_v2_ft_nodes(v2_pkt_ctx_ft_fields_node,
+                                              v2_ev_header_ft_fields_node):
+            if v2_ev_header_ft_fields_node is None:
+                v2_ev_header_ft_fields_node = collections.OrderedDict()
+
+            v3_pkt_total_size_ft_node = self._conv_ft_node(v2_pkt_ctx_ft_fields_node['packet_size'])
+            v3_pkt_content_size_ft_node = self._conv_ft_node(v2_pkt_ctx_ft_fields_node['content_size'])
+            v3_pkt_beg_time_ft_node = self._conv_ft_node_if_exists(v2_pkt_ctx_ft_fields_node,
+                                                                   'timestamp_begin')
+            v3_pkt_end_time_ft_node = self._conv_ft_node_if_exists(v2_pkt_ctx_ft_fields_node,
+                                                                   'timestamp_end')
+            v3_pkt_disc_ev_counter_ft_node = self._conv_ft_node_if_exists(v2_pkt_ctx_ft_fields_node,
+                                                                          'events_discarded')
+            v3_ev_type_id_ft_node = self._conv_ft_node_if_exists(v2_ev_header_ft_fields_node, 'id')
+            v3_ev_time_ft_node = self._conv_ft_node_if_exists(v2_ev_header_ft_fields_node,
+                                                              'timestamp')
+            v3_features_node = collections.OrderedDict()
+            v3_pkt_node = collections.OrderedDict()
+            v3_ev_node = collections.OrderedDict()
+            v3_pkt_node['total-size-field-type'] = v3_pkt_total_size_ft_node
+            v3_pkt_node['content-size-field-type'] = v3_pkt_content_size_ft_node
+            self._set_v3_feature_ft_if_exists(v3_pkt_node, 'beginning-time-field-type',
+                                              v3_pkt_beg_time_ft_node)
+            self._set_v3_feature_ft_if_exists(v3_pkt_node, 'end-time-field-type',
+                                              v3_pkt_end_time_ft_node)
+            self._set_v3_feature_ft_if_exists(v3_pkt_node, 'discarded-events-counter-field-type',
+                                              v3_pkt_disc_ev_counter_ft_node)
+            self._set_v3_feature_ft_if_exists(v3_ev_node, 'type-id-field-type',
+                                              v3_ev_type_id_ft_node)
+            self._set_v3_feature_ft_if_exists(v3_ev_node, 'time-field-type', v3_ev_time_ft_node)
+            v3_features_node['packet'] = v3_pkt_node
+            v3_features_node['event'] = v3_ev_node
+            return v3_features_node
+
+        def clk_type_name_from_v2_int_ft_node(v2_int_ft_node):
+            if v2_int_ft_node is None:
+                return
+
+            assert v2_int_ft_node['class'] in ('int', 'integer')
+            prop_mappings_node = v2_int_ft_node.get('property-mappings')
+
+            if prop_mappings_node is not None and len(prop_mappings_node) > 0:
+                return prop_mappings_node[0]['name']
+
+        # create empty v3 stream type node
+        v3_stream_type_node = collections.OrderedDict()
+
+        # rename `$default` property to `$is-default`
+        _copy_prop_if_exists(v3_stream_type_node, v2_stream_type_node, '$default', '$is-default')
+
+        # set default clock type node
+        pct_prop_name = 'packet-context-type'
+        v2_pkt_ctx_ft_fields_node = v2_stream_type_node[pct_prop_name]['fields']
+        eht_prop_name = 'event-header-type'
+        v2_ev_header_ft_fields_node = None
+        v2_ev_header_ft_node = v2_stream_type_node.get(eht_prop_name)
+
+        if v2_ev_header_ft_node is not None:
+            v2_ev_header_ft_fields_node = v2_ev_header_ft_node['fields']
+
+        def_clk_type_name = None
+
+        try:
+            ts_begin_prop_name = 'timestamp_begin'
+            ts_begin_clk_type_name = clk_type_name_from_v2_int_ft_node(v2_pkt_ctx_ft_fields_node.get(ts_begin_prop_name))
+            ts_end_prop_name = 'timestamp_end'
+            ts_end_clk_type_name = clk_type_name_from_v2_int_ft_node(v2_pkt_ctx_ft_fields_node.get(ts_end_prop_name))
+
+            if ts_begin_clk_type_name is not None and ts_end_clk_type_name is not None:
+                if ts_begin_clk_type_name != ts_end_clk_type_name:
+                    raise _ConfigurationParseError(f'`{ts_begin_prop_name}`/`{ts_end_prop_name}` properties',
+                                                   'Field types are not mapped to the same clock type')
+        except _ConfigurationParseError as exc:
+            _append_error_ctx(exc, f'`{pct_prop_name}` property')
+
+        try:
+            if def_clk_type_name is None and v2_ev_header_ft_fields_node is not None:
+                def_clk_type_name = clk_type_name_from_v2_int_ft_node(v2_ev_header_ft_fields_node.get('timestamp'))
+
+            if def_clk_type_name is None and ts_begin_clk_type_name is not None:
+                def_clk_type_name = ts_begin_clk_type_name
+
+            if def_clk_type_name is None and ts_end_clk_type_name is not None:
+                def_clk_type_name = ts_end_clk_type_name
+        except _ConfigurationParseError as exc:
+            _append_error_ctx(exc, f'`{eht_prop_name}` property')
+
+        if def_clk_type_name is not None:
+            v3_stream_type_node['$default-clock-type-name'] = def_clk_type_name
+
+        # set features node
+        v3_stream_type_node['$features'] = v3_features_node_from_v2_ft_nodes(v2_pkt_ctx_ft_fields_node,
+                                                                             v2_ev_header_ft_fields_node)
+
+        # set extra packet context field type members node
+        pkt_ctx_ft_extra_members = []
+        ctf_member_names = [
+            'packet_size',
+            'content_size',
+            'timestamp_begin',
+            'timestamp_end',
+            'events_discarded',
+            'packet_seq_num',
+        ]
+
+        for member_name, v2_ft_node in v2_pkt_ctx_ft_fields_node.items():
+            if member_name in ctf_member_names:
+                continue
+
+            pkt_ctx_ft_extra_members.append(collections.OrderedDict({
+                member_name: collections.OrderedDict({
+                    'field-type': self._conv_ft_node(v2_ft_node)
+                })
+            }))
+
+        if len(pkt_ctx_ft_extra_members) > 0:
+            v3_stream_type_node['packet-context-field-type-extra-members'] = pkt_ctx_ft_extra_members
+
+        # convert event common context field type node
+        v2_ft_node = v2_stream_type_node.get('event-context-type')
+
+        if v2_ft_node is not None:
+            v3_stream_type_node['event-common-context-field-type'] = self._conv_ft_node(v2_ft_node)
+
+        # convert event type nodes
+        v3_event_types_node = collections.OrderedDict()
+
+        for ev_type_name, v2_ev_type_node in v2_stream_type_node['events'].items():
+            try:
+                v3_event_types_node[ev_type_name] = self._conv_ev_type_node(v2_ev_type_node)
+            except _ConfigurationParseError as exc:
+                _append_error_ctx(exc, f'Event type `{ev_type_name}`')
+
+        v3_stream_type_node['event-types'] = v3_event_types_node
+
+        return v3_stream_type_node
+
+    # Converts a v2 metadata node to a v3 trace node and returns it.
+    def _conv_meta_node(self, v2_meta_node):
+        def v3_features_node_from_v2_ft_node(v2_pkt_header_ft_node):
+            def set_if_exists(key, node):
+                return self._set_v3_feature_ft_if_exists(v3_features_node, key, node)
+
+            v2_pkt_header_ft_fields_node = collections.OrderedDict()
+
+            if v2_pkt_header_ft_node is not None:
+                v2_pkt_header_ft_fields_node = v2_pkt_header_ft_node['fields']
+
+            v3_magic_ft_node = self._conv_ft_node_if_exists(v2_pkt_header_ft_fields_node, 'magic')
+            v3_uuid_ft_node = self._conv_ft_node_if_exists(v2_pkt_header_ft_fields_node, 'uuid')
+            v3_stream_type_id_ft_node = self._conv_ft_node_if_exists(v2_pkt_header_ft_fields_node,
+                                                                     'stream_id')
+            v3_features_node = collections.OrderedDict()
+            set_if_exists('magic-field-type', v3_magic_ft_node)
+            set_if_exists('uuid-field-type', v3_uuid_ft_node)
+            set_if_exists('stream-type-id-field-type', v3_stream_type_id_ft_node)
+            return v3_features_node
+
+        v3_trace_node = collections.OrderedDict()
+        v3_trace_type_node = collections.OrderedDict()
+        v2_trace_node = v2_meta_node['trace']
+
+        # rename `byte-order` property to `$default-byte-order`
+        _copy_prop_if_exists(v3_trace_type_node, v2_trace_node, 'byte-order', '$default-byte-order')
+
+        # copy `uuid` property
+        _copy_prop_if_exists(v3_trace_type_node, v2_trace_node, 'uuid')
+
+        # copy `$log-levels`/`log-levels` property
+        new_prop_name = '$log-level-aliases'
+        _copy_prop_if_exists(v3_trace_type_node, v2_meta_node, 'log-levels', new_prop_name)
+        _copy_prop_if_exists(v3_trace_type_node, v2_meta_node, '$log-levels', new_prop_name)
+
+        # copy `clocks` property, converting clock type nodes
+        v2_clk_types_node = v2_meta_node.get('clocks')
+
+        if v2_clk_types_node is not None:
+            v3_clk_types_node = collections.OrderedDict()
+
+            for name, v2_clk_type_node in v2_clk_types_node.items():
+                v3_clk_types_node[name] = self._conv_clk_type_node(v2_clk_type_node)
+
+            v3_trace_type_node['clock-types'] = v3_clk_types_node
+
+        # set features node
+        v2_pkt_header_ft_node = v2_trace_node.get('packet-header-type')
+        v3_trace_type_node['$features'] = v3_features_node_from_v2_ft_node(v2_pkt_header_ft_node)
+
+        # convert stream type nodes
+        v3_stream_types_node = collections.OrderedDict()
+
+        for stream_type_name, v2_stream_type_node in v2_meta_node['streams'].items():
+            try:
+                v3_stream_types_node[stream_type_name] = self._conv_stream_type_node(v2_stream_type_node)
+            except _ConfigurationParseError as exc:
+                _append_error_ctx(exc, f'Stream type `{stream_type_name}`')
+
+        v3_trace_type_node['stream-types'] = v3_stream_types_node
+
+        # If `v2_meta_node` has a `$default-stream` property, find the
+        # corresponding v3 stream type node and set its `$is-default`
+        # property to `True`.
+        prop_name = '$default-stream'
+        v2_def_stream_type_node = v2_meta_node.get(prop_name)
+
+        if v2_def_stream_type_node is not None:
+            found = False
+
+            for stream_type_name, v3_stream_type_node in v3_stream_types_node.items():
+                if stream_type_name == v2_def_stream_type_node:
+                    v3_stream_type_node['$is-default'] = True
+                    found = True
+                    break
+
+            if not found:
+                raise _ConfigurationParseError(f'`{prop_name}` property',
+                                               f'Stream type `{v2_def_stream_type_node}` does not exist')
+
+        # set environment node
+        v2_env_node = v2_meta_node.get('env')
+
+        if v2_env_node is not None:
+            v3_trace_node['environment'] = copy.deepcopy(v2_env_node)
+
+        # set v3 trace node's type node
+        v3_trace_node['type'] = v3_trace_type_node
+
+        return v3_trace_node
+
+    # Transforms the root configuration node into a valid v3
+    # configuration node.
+    def _transform_config_node(self):
+        # remove the `version` property
+        del self._root_node['version']
+
+        # relocate prefix and option nodes
+        prefix_prop_name = 'prefix'
+        v2_prefix_node = self._root_node.get(prefix_prop_name, 'barectf_')
+        _del_prop_if_exists(self._root_node, prefix_prop_name)
+        opt_prop_name = 'options'
+        v2_options_node = self._root_node.get(opt_prop_name)
+        _del_prop_if_exists(self._root_node, opt_prop_name)
+        code_gen_node = collections.OrderedDict()
+        v3_prefixes = config_parse_common._v3_prefixes_from_v2_prefix(v2_prefix_node)
+        v3_prefix_node = collections.OrderedDict([
+            ('identifier', v3_prefixes.identifier),
+            ('file-name', v3_prefixes.file_name),
+        ])
+        code_gen_node[prefix_prop_name] = v3_prefix_node
+
+        if v2_options_node is not None:
+            header_node = collections.OrderedDict()
+            _copy_prop_if_exists(header_node, v2_options_node, 'gen-prefix-def',
+                                 'identifier-prefix-definition')
+            _copy_prop_if_exists(header_node, v2_options_node, 'gen-default-stream-def',
+                                 'default-stream-type-name-definition')
+            code_gen_node['header'] = header_node
+
+        self._root_node[opt_prop_name] = collections.OrderedDict({
+            'code-generation': code_gen_node,
+        })
+
+        # convert the v2 metadata node into a v3 trace node
+        try:
+            self._root_node['trace'] = self._conv_meta_node(self._root_node['metadata'])
+        except _ConfigurationParseError as exc:
+            _append_error_ctx(exc, 'Metadata object')
+
+        del self._root_node['metadata']
+
+    # Expands the field type aliases found in the metadata node.
+    #
+    # This method modifies the metadata node.
+    #
+    # When this method returns:
+    #
+    # * Any field type alias is replaced with its full field type node
+    #   equivalent.
+    #
+    # * The `type-aliases` property of metadata node is removed.
+    def _expand_ft_aliases(self):
+        meta_node = self._root_node['metadata']
+        ft_aliases_node = meta_node['type-aliases']
+
+        # Expand field type aliases within trace, stream, and event
+        # types now.
+        try:
+            self._resolve_ft_alias_from(ft_aliases_node, meta_node['trace'], 'packet-header-type')
+        except _ConfigurationParseError as exc:
+            _append_error_ctx(exc, 'Trace type')
+
+        for stream_type_name, stream_type_node in meta_node['streams'].items():
+            try:
+                self._resolve_ft_alias_from(ft_aliases_node, stream_type_node,
+                                            'packet-context-type')
+                self._resolve_ft_alias_from(ft_aliases_node, stream_type_node, 'event-header-type')
+                self._resolve_ft_alias_from(ft_aliases_node, stream_type_node,
+                                            'event-context-type')
+
+                for ev_type_name, ev_type_node in stream_type_node['events'].items():
+                    try:
+                        self._resolve_ft_alias_from(ft_aliases_node, ev_type_node, 'context-type')
+                        self._resolve_ft_alias_from(ft_aliases_node, ev_type_node, 'payload-type')
+                    except _ConfigurationParseError as exc:
+                        _append_error_ctx(exc, f'Event type `{ev_type_name}`')
+            except _ConfigurationParseError as exc:
+                _append_error_ctx(exc, f'Stream type `{stream_type_name}`')
+
+        # remove the (now unneeded) `type-aliases` node
+        del meta_node['type-aliases']
+
+    # Applies field type inheritance to all field type nodes found in
+    # the metadata node.
+    #
+    # This method modifies the metadata node.
+    #
+    # When this method returns, no field type node has an `$inherit` or
+    # `inherit` property.
+    def _apply_fts_inheritance(self):
+        meta_node = self._root_node['metadata']
+        self._apply_ft_inheritance(meta_node['trace'], 'packet-header-type')
+
+        for stream_type_node in meta_node['streams'].values():
+            self._apply_ft_inheritance(stream_type_node, 'packet-context-type')
+            self._apply_ft_inheritance(stream_type_node, 'event-header-type')
+            self._apply_ft_inheritance(stream_type_node, 'event-context-type')
+
+            for ev_type_node in stream_type_node['events'].values():
+                self._apply_ft_inheritance(ev_type_node, 'context-type')
+                self._apply_ft_inheritance(ev_type_node, 'payload-type')
+
+    # Calls _expand_ft_aliases() and _apply_fts_inheritance() if the
+    # metadata node has a `type-aliases` property.
+    def _expand_fts(self):
+        # Make sure that the current configuration node is valid
+        # considering field types are not expanded yet.
+        self._schema_validator.validate(self._root_node,
+                                        '2/config/config-pre-field-type-expansion')
+
+        meta_node = self._root_node['metadata']
+        ft_aliases_node = meta_node.get('type-aliases')
+
+        if ft_aliases_node is None:
+            # If there's no `type-aliases` node, then there's no field
+            # type aliases and therefore no possible inheritance.
+            return
+
+        # first, expand field type aliases
+        self._expand_ft_aliases()
+
+        # next, apply inheritance to create effective field types
+        self._apply_fts_inheritance()
+
+    # Processes the inclusions of the event type node `ev_type_node`,
+    # returning the effective node.
+    def _process_ev_type_node_include(self, ev_type_node):
+        # Make sure the event type node is valid for the inclusion
+        # processing stage.
+        self._schema_validator.validate(ev_type_node, '2/config/event-type-pre-include')
+
+        # process inclusions
+        return self._process_node_include(ev_type_node, self._process_ev_type_node_include)
+
+    # Processes the inclusions of the stream type node
+    # `stream_type_node`, returning the effective node.
+    def _process_stream_type_node_include(self, stream_type_node):
+        def process_children_include(stream_type_node):
+            prop_name = 'events'
+
+            if prop_name in stream_type_node:
+                ev_types_node = stream_type_node[prop_name]
+
+                for key in list(ev_types_node):
+                    ev_types_node[key] = self._process_ev_type_node_include(ev_types_node[key])
+
+        # Make sure the stream type node is valid for the inclusion
+        # processing stage.
+        self._schema_validator.validate(stream_type_node, '2/config/stream-type-pre-include')
+
+        # process inclusions
+        return self._process_node_include(stream_type_node, self._process_stream_type_node_include,
+                                          process_children_include)
+
+    # Processes the inclusions of the trace type node `trace_type_node`,
+    # returning the effective node.
+    def _process_trace_type_node_include(self, trace_type_node):
+        # Make sure the trace type node is valid for the inclusion
+        # processing stage.
+        self._schema_validator.validate(trace_type_node, '2/config/trace-type-pre-include')
+
+        # process inclusions
+        return self._process_node_include(trace_type_node, self._process_trace_type_node_include)
+
+    # Processes the inclusions of the clock type node `clk_type_node`,
+    # returning the effective node.
+    def _process_clk_type_node_include(self, clk_type_node):
+        # Make sure the clock type node is valid for the inclusion
+        # processing stage.
+        self._schema_validator.validate(clk_type_node, '2/config/clock-type-pre-include')
+
+        # process inclusions
+        return self._process_node_include(clk_type_node, self._process_clk_type_node_include)
+
+    # Processes the inclusions of the metadata node `meta_node`,
+    # returning the effective node.
+    def _process_meta_node_include(self, meta_node):
+        def process_children_include(meta_node):
+            prop_name = 'trace'
+
+            if prop_name in meta_node:
+                meta_node[prop_name] = self._process_trace_type_node_include(meta_node[prop_name])
+
+            prop_name = 'clocks'
+
+            if prop_name in meta_node:
+                clk_types_node = meta_node[prop_name]
+
+                for key in list(clk_types_node):
+                    clk_types_node[key] = self._process_clk_type_node_include(clk_types_node[key])
+
+            prop_name = 'streams'
+
+            if prop_name in meta_node:
+                stream_types_node = meta_node[prop_name]
+
+                for key in list(stream_types_node):
+                    stream_types_node[key] = self._process_stream_type_node_include(stream_types_node[key])
+
+        # Make sure the metadata node is valid for the inclusion
+        # processing stage.
+        self._schema_validator.validate(meta_node, '2/config/metadata-pre-include')
+
+        # process inclusions
+        return self._process_node_include(meta_node, self._process_meta_node_include,
+                                          process_children_include)
+
+    # Processes the inclusions of the configuration node, modifying it
+    # during the process.
+    def _process_config_includes(self):
+        # Process inclusions in this order:
+        #
+        # 1. Clock type node, event type nodes, and trace type nodes
+        #    (the order between those is not important).
+        #
+        # 2. Stream type nodes.
+        #
+        # 3. Metadata node.
+        #
+        # This is because:
+        #
+        # * A metadata node can include clock type nodes, a trace type
+        #   node, stream type nodes, and event type nodes (indirectly).
+        #
+        # * A stream type node can include event type nodes.
+        #
+        # First, make sure the configuration node itself is valid for
+        # the inclusion processing stage.
+        self._schema_validator.validate(self._root_node,
+                                        '2/config/config-pre-include')
+
+        # Process metadata node inclusions.
+        #
+        # self._process_meta_node_include() returns a new (or the same)
+        # metadata node without any `$include` property in it,
+        # recursively.
+        prop_name = 'metadata'
+        self._root_node[prop_name] = self._process_meta_node_include(self._root_node[prop_name])
+
+    def _parse(self):
+        # Make sure the configuration node is minimally valid, that is,
+        # it contains a valid `version` property.
+        #
+        # This step does not validate the whole configuration node yet
+        # because we don't have an effective configuration node; we
+        # still need to:
+        #
+        # * Process inclusions.
+        # * Expand field types (aliases and inheritance).
+        self._schema_validator.validate(self._root_node, '2/config/config-min')
+
+        # process configuration node inclusions
+        self._process_config_includes()
+
+        # Expand field type nodes.
+        #
+        # This process:
+        #
+        # 1. Replaces field type aliases with "effective" field type
+        #    nodes, recursively.
+        #
+        #    After this step, the `type-aliases` property of the
+        #    metadata node is gone.
+        #
+        # 2. Applies inheritance, following the `$inherit`/`inherit`
+        #    properties.
+        #
+        #    After this step, field type nodes do not contain `$inherit`
+        #    or `inherit` properties.
+        #
+        # This is done blindly, in that the process _doesn't_ validate
+        # field type nodes at this point.
+        #
+        # The reason we must do this here for a barectf 2 configuration,
+        # considering that barectf 3 also supports field type node
+        # aliases and inheritance, is that we need to find specific
+        # packet header and packet context field type member nodes (for
+        # example, `stream_id`, `packet_size`, or `timestamp_end`) to
+        # set the `$features` properties of barectf 3 trace type and
+        # stream type nodes. Those field type nodes can be aliases,
+        # contain aliases, or inherit from other nodes.
+        self._expand_fts()
+
+        # Validate the whole, (almost) effective configuration node.
+        #
+        # It's almost effective because the `log-level` property of
+        # event type nodes can be log level aliases. Log level aliases
+        # are also a feature of a barectf 3 configuration node,
+        # therefore this is compatible.
+        self._schema_validator.validate(self._root_node, '2/config/config')
+
+        # Transform the current configuration node into a valid v3
+        # configuration node.
+        self._transform_config_node()
+
+    @property
+    def config_node(self):
+        return config_parse_common._ConfigNodeV3(self._root_node)
diff --git a/barectf/config_parse_v3.py b/barectf/config_parse_v3.py
new file mode 100644 (file)
index 0000000..18378b9
--- /dev/null
@@ -0,0 +1,1378 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2015-2020 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+import barectf.config_parse_common as barectf_config_parse_common
+from barectf.config_parse_common import _ConfigurationParseError
+from barectf.config_parse_common import _append_error_ctx
+import barectf.config as barectf_config
+import collections
+import uuid
+
+
+# A barectf 3 YAML configuration parser.
+#
+# When you build such a parser, it parses the configuration node `node`
+# (already loaded from the file having the path `path`) and creates a
+# corresponding `barectf.Configuration` object which you can get with
+# the `config` property.
+#
+# See the comments of _parse() for more implementation details about the
+# parsing stages and general strategy.
+class _Parser(barectf_config_parse_common._Parser):
+    # Builds a barectf 3 YAML configuration parser and parses the root
+    # configuration node `node` (already loaded from `path`).
+    def __init__(self, path, node, inclusion_dirs, ignore_include_not_found):
+        super().__init__(path, node, inclusion_dirs, ignore_include_not_found, 3)
+        self._ft_cls_name_to_create_method = {
+            'unsigned-integer': self._create_int_ft,
+            'signed-integer': self._create_int_ft,
+            'unsigned-enumeration': self._create_enum_ft,
+            'signed-enumeration': self._create_enum_ft,
+            'real': self._create_real_ft,
+            'string': self._create_string_ft,
+            'static-array': self._create_static_array_ft,
+            'structure': self._create_struct_ft,
+        }
+        self._parse()
+
+    # Validates the alignment `alignment`, raising a
+    # `_ConfigurationParseError` exception using `ctx_obj_name` if it's
+    # invalid.
+    @staticmethod
+    def _validate_alignment(alignment, ctx_obj_name):
+        assert alignment >= 1
+
+        # check for power of two
+        if (alignment & (alignment - 1)) != 0:
+            raise _ConfigurationParseError(ctx_obj_name,
+                                           f'Invalid alignment (not a power of two): {alignment}')
+
+    # Validates the TSDL identifier `iden`, raising a
+    # `_ConfigurationParseError` exception using `ctx_obj_name` and
+    # `prop` to format the message if it's invalid.
+    @staticmethod
+    def _validate_iden(iden, ctx_obj_name, prop):
+        assert type(iden) is str
+        ctf_keywords = {
+            'align',
+            'callsite',
+            'clock',
+            'enum',
+            'env',
+            'event',
+            'floating_point',
+            'integer',
+            'stream',
+            'string',
+            'struct',
+            'trace',
+            'typealias',
+            'typedef',
+            'variant',
+        }
+
+        if iden in ctf_keywords:
+            msg = f'Invalid {prop} (not a valid identifier): `{iden}`'
+            raise _ConfigurationParseError(ctx_obj_name, msg)
+
+    @staticmethod
+    def _alignment_prop(ft_node, prop_name):
+        alignment = ft_node.get(prop_name)
+
+        if alignment is not None:
+            _Parser._validate_alignment(alignment, '`prop_name` property')
+
+        return alignment
+
+    @property
+    def _trace_type_node(self):
+        return self._root_node.config_node['trace']['type']
+
+    @staticmethod
+    def _byte_order_from_node(node):
+        return {
+            'big-endian': barectf_config.ByteOrder.BIG_ENDIAN,
+            'little-endian': barectf_config.ByteOrder.LITTLE_ENDIAN,
+        }[node]
+
+    # Creates a bit array field type having the type `ft_type` from the
+    # bit array field type node `ft_node`, passing the additional
+    # `*args` to ft_type.__init__().
+    def _create_common_bit_array_ft(self, ft_node, ft_type, default_alignment, *args):
+        byte_order = self._byte_order_from_node(ft_node['byte-order'])
+        alignment = self._alignment_prop(ft_node, 'alignment')
+
+        if alignment is None:
+            alignment = default_alignment
+
+        return ft_type(ft_node['size'], byte_order, alignment, *args)
+
+    # Creates an integer field type having the type `ft_type` from the
+    # integer field type node `ft_node`, passing the additional `*args`
+    # to ft_type.__init__().
+    def _create_common_int_ft(self, ft_node, ft_type, *args):
+        preferred_display_base = {
+            'binary': barectf_config.DisplayBase.BINARY,
+            'octal': barectf_config.DisplayBase.OCTAL,
+            'decimal': barectf_config.DisplayBase.DECIMAL,
+            'hexadecimal': barectf_config.DisplayBase.HEXADECIMAL,
+        }[ft_node.get('preferred-display-base', 'decimal')]
+        return self._create_common_bit_array_ft(ft_node, ft_type, None, preferred_display_base, *args)
+
+    # Creates an integer field type from the unsigned/signed integer
+    # field type node `ft_node`.
+    def _create_int_ft(self, ft_node):
+        ft_type = {
+            'unsigned-integer': barectf_config.UnsignedIntegerFieldType,
+            'signed-integer': barectf_config.SignedIntegerFieldType,
+        }[ft_node['class']]
+        return self._create_common_int_ft(ft_node, ft_type)
+
+    # Creates an enumeration field type from the unsigned/signed
+    # enumeration field type node `ft_node`.
+    def _create_enum_ft(self, ft_node):
+        ft_type = {
+            'unsigned-enumeration': barectf_config.UnsignedEnumerationFieldType,
+            'signed-enumeration': barectf_config.SignedEnumerationFieldType,
+        }[ft_node['class']]
+        mappings = collections.OrderedDict()
+
+        for label, mapping_node in ft_node.get('mappings', {}).items():
+            ranges = set()
+
+            for range_node in mapping_node:
+                if type(range_node) is list:
+                    ranges.add(barectf_config.EnumerationFieldTypeMappingRange(range_node[0],
+                                                                               range_node[1]))
+                else:
+                    assert type(range_node) is int
+                    ranges.add(barectf_config.EnumerationFieldTypeMappingRange(range_node,
+                                                                               range_node))
+
+            mappings[label] = barectf_config.EnumerationFieldTypeMapping(ranges)
+
+        return self._create_common_int_ft(ft_node, ft_type,
+                                          barectf_config.EnumerationFieldTypeMappings(mappings))
+
+    # Creates a real field type from the real field type node `ft_node`.
+    def _create_real_ft(self, ft_node):
+        return self._create_common_bit_array_ft(ft_node, barectf_config.RealFieldType, 8)
+
+    # Creates a string field type from the string field type node
+    # `ft_node`.
+    def _create_string_ft(self, ft_node):
+        return barectf_config.StringFieldType()
+
+    # Creates a static array field type from the static array field type
+    # node `ft_node`.
+    def _create_static_array_ft(self, ft_node):
+        prop_name = 'element-field-type'
+
+        try:
+            element_ft = self._create_ft(ft_node[prop_name])
+        except _ConfigurationParseError as exc:
+            _append_error_ctx(exc, f'`{prop_name}` property')
+
+        return barectf_config.StaticArrayFieldType(ft_node['length'], element_ft)
+
+    # Creates structure field type members from the structure field type
+    # members node `members_node`.
+    #
+    # `prop_name` is the name of the property of which `members_node` is
+    # the value.
+    def _create_struct_ft_members(self, members_node, prop_name):
+        members = collections.OrderedDict()
+        member_names = set()
+
+        for member_node in members_node:
+            member_name, member_node = list(member_node.items())[0]
+
+            if member_name in member_names:
+                raise _ConfigurationParseError(f'`{prop_name}` property',
+                                               f'Duplicate member `{member_name}`')
+
+            self._validate_iden(member_name, f'`{prop_name}` property',
+                                'structure field type member name')
+            member_names.add(member_name)
+            ft_prop_name = 'field-type'
+            ft_node = member_node[ft_prop_name]
+
+            try:
+                if ft_node['class'] in ['structure', 'static-array']:
+                    raise _ConfigurationParseError(f'`{ft_prop_name}` property',
+                                                   'Nested structure and static array field types are not supported')
+
+                try:
+                    member_ft = self._create_ft(ft_node)
+                except _ConfigurationParseError as exc:
+                    exc._append_ctx(f'`{ft_prop_name}` property')
+            except _ConfigurationParseError as exc:
+                _append_error_ctx(exc, f'Structure field type member `{member_name}`')
+
+            members[member_name] = barectf_config.StructureFieldTypeMember(member_ft)
+
+        return barectf_config.StructureFieldTypeMembers(members)
+
+    # Creates a structure field type from the structure field type node
+    # `ft_node`.
+    def _create_struct_ft(self, ft_node):
+        minimum_alignment = self._alignment_prop(ft_node, 'minimum-alignment')
+
+        if minimum_alignment is None:
+            minimum_alignment = 1
+
+        members = None
+        prop_name = 'members'
+        members_node = ft_node.get(prop_name)
+
+        if members_node is not None:
+            members = self._create_struct_ft_members(members_node, prop_name)
+
+        return barectf_config.StructureFieldType(minimum_alignment, members)
+
+    # Creates a field type from the field type node `ft_node`.
+    def _create_ft(self, ft_node):
+        return self._ft_cls_name_to_create_method[ft_node['class']](ft_node)
+
+    # Creates a field type from the field type node `parent_node[key]`
+    # if it exists.
+    def _try_create_ft(self, parent_node, key):
+        if key not in parent_node:
+            return
+
+        try:
+            return self._create_ft(parent_node[key])
+        except _ConfigurationParseError as exc:
+            _append_error_ctx(exc, f'`{key}` property')
+
+    # Returns the total number of members in the structure field type
+    # node `ft_node` if it exists, otherwise 0.
+    @staticmethod
+    def _total_struct_ft_node_members(ft_node):
+        if ft_node is None:
+            return 0
+
+        members_node = ft_node.get('members')
+
+        if members_node is None:
+            return 0
+
+        return len(members_node)
+
+    # Creates an event type from the event type node `ev_type_node`
+    # named `name`.
+    #
+    # `ev_member_count` is the total number of structure field type
+    # members within the event type so far (from the common part in its
+    # stream type). For example, if the stream type has a event header
+    # field type with `id` and `timestamp` members, then
+    # `ev_member_count` is 2.
+    def _create_ev_type(self, name, ev_type_node, ev_member_count):
+        try:
+            self._validate_iden(name, '`name` property', 'event type name')
+
+            # make sure the event type is not empty
+            spec_ctx_ft_prop_name = 'specific-context-field-type'
+            payload_ft_prop_name = 'payload-field-type'
+            ev_member_count += self._total_struct_ft_node_members(ev_type_node.get(spec_ctx_ft_prop_name))
+            ev_member_count += self._total_struct_ft_node_members(ev_type_node.get(payload_ft_prop_name))
+
+            if ev_member_count == 0:
+                raise _ConfigurationParseError('Event type', 'Event type is empty (no members).')
+
+            # create event type
+            return barectf_config.EventType(name, ev_type_node.get('log-level'),
+                                            self._try_create_ft(ev_type_node, spec_ctx_ft_prop_name),
+                                            self._try_create_ft(ev_type_node, payload_ft_prop_name))
+        except _ConfigurationParseError as exc:
+            _append_error_ctx(exc, f'Event type `{name}`')
+
+    # Returns the effective feature field type for the field type
+    # node `parent_node[key]`, if any.
+    #
+    # Returns:
+    #
+    # If `parent_node[key]` is `False`:
+    #     `None`.
+    #
+    # If `parent_node[key]` is `True`:
+    #     `barectf_config.DEFAULT_FIELD_TYPE`.
+    #
+    # If `parent_node[key]` doesn't exist:
+    #     `none` (parameter).
+    #
+    # Otherwise:
+    #     A created field type.
+    def _feature_ft(self, parent_node, key, none=None):
+        if key not in parent_node:
+            # missing: default feature field type
+            return none
+
+        ft_node = parent_node[key]
+        assert ft_node is not None
+
+        if ft_node is True:
+            # default feature field type
+            return barectf_config.DEFAULT_FIELD_TYPE
+
+        if ft_node is False:
+            # disabled feature
+            return None
+
+        assert type(ft_node) is collections.OrderedDict
+        return self._create_ft(ft_node)
+
+    def _create_stream_type(self, name, stream_type_node):
+        try:
+            # validate stream type's name
+            self._validate_iden(name, '`name` property', 'stream type name')
+
+            # get default clock type, if any
+            def_clk_type = None
+            prop_name = '$default-clock-type-name'
+            def_clk_type_name = stream_type_node.get(prop_name)
+
+            if def_clk_type_name is not None:
+                try:
+                    def_clk_type = self._clk_type(def_clk_type_name, prop_name)
+                except _ConfigurationParseError as exc:
+                    _append_error_ctx(exc, f'`{prop_name}` property')
+
+            # create feature field types
+            pkt_total_size_ft = barectf_config.DEFAULT_FIELD_TYPE
+            pkt_content_size_ft = barectf_config.DEFAULT_FIELD_TYPE
+            pkt_beginning_time_ft = None
+            pkt_end_time_ft = None
+            pkt_discarded_events_counter_ft = None
+            ev_type_id_ft = barectf_config.DEFAULT_FIELD_TYPE
+            ev_time_ft = None
+
+            if def_clk_type is not None:
+                # The stream type has a default clock type. Initialize
+                # the packet beginning time, packet end time, and event
+                # time field types to default field types.
+                #
+                # This means your stream type node only needs a default
+                # clock type name to enable those features
+                # automatically. Those features do not add any parameter
+                # to the tracing event functions.
+                pkt_beginning_time_ft = barectf_config.DEFAULT_FIELD_TYPE
+                pkt_end_time_ft = barectf_config.DEFAULT_FIELD_TYPE
+                ev_time_ft = barectf_config.DEFAULT_FIELD_TYPE
+
+            features_node = stream_type_node.get('$features')
+
+            if features_node is not None:
+                # create packet feature field types
+                pkt_node = features_node.get('packet')
+
+                if pkt_node is not None:
+                    pkt_total_size_ft = self._feature_ft(pkt_node, 'total-size-field-type',
+                                                         pkt_total_size_ft)
+                    pkt_content_size_ft = self._feature_ft(pkt_node, 'content-size-field-type',
+                                                           pkt_content_size_ft)
+                    pkt_beginning_time_ft = self._feature_ft(pkt_node, 'beginning-time-field-type',
+                                                             pkt_beginning_time_ft)
+                    pkt_end_time_ft = self._feature_ft(pkt_node, 'end-time-field-type',
+                                                       pkt_end_time_ft)
+                    pkt_discarded_events_counter_ft = self._feature_ft(pkt_node,
+                                                                       'discarded-events-counter-field-type',
+                                                                       pkt_discarded_events_counter_ft)
+
+                # create event feature field types
+                ev_node = features_node.get('event')
+                type_id_ft_prop_name = 'type-id-field-type'
+
+                if ev_node is not None:
+                    ev_type_id_ft = self._feature_ft(ev_node, type_id_ft_prop_name, ev_type_id_ft)
+                    ev_time_ft = self._feature_ft(ev_node, 'time-field-type', ev_time_ft)
+
+            ev_types_prop_name = 'event-types'
+            ev_type_count = len(stream_type_node[ev_types_prop_name])
+
+            try:
+                if ev_type_id_ft is None and ev_type_count > 1:
+                    raise _ConfigurationParseError(f'`{type_id_ft_prop_name}` property',
+                                                   'Event type ID field type feature is required because stream type has more than one event type')
+
+                if isinstance(ev_type_id_ft, barectf_config._FieldType) and ev_type_count > (1 << ev_type_id_ft.size):
+                    raise _ConfigurationParseError(f'`{type_id_ft_prop_name}` property',
+                                                   f'Field type\'s size ({ev_type_id_ft.size} bits) is too small to accomodate {ev_type_count} event types')
+            except _ConfigurationParseError as exc:
+                exc._append_ctx('`event` property')
+                _append_error_ctx(exc, '`$features` property')
+
+            pkt_features = barectf_config.StreamTypePacketFeatures(pkt_total_size_ft,
+                                                                   pkt_content_size_ft,
+                                                                   pkt_beginning_time_ft,
+                                                                   pkt_end_time_ft,
+                                                                   pkt_discarded_events_counter_ft)
+            ev_features = barectf_config.StreamTypeEventFeatures(ev_type_id_ft, ev_time_ft)
+            features = barectf_config.StreamTypeFeatures(pkt_features, ev_features)
+
+            # create packet context (structure) field type extra members
+            pkt_ctx_ft_extra_members = None
+            prop_name = 'packet-context-field-type-extra-members'
+            pkt_ctx_ft_extra_members_node = stream_type_node.get(prop_name)
+
+            if pkt_ctx_ft_extra_members_node is not None:
+                pkt_ctx_ft_extra_members = self._create_struct_ft_members(pkt_ctx_ft_extra_members_node,
+                                                                          prop_name)
+
+                # check for illegal packet context field type member names
+                reserved_member_names = {
+                    'packet_size',
+                    'content_size',
+                    'timestamp_begin',
+                    'timestamp_end',
+                    'events_discarded',
+                    'packet_seq_num',
+                }
+
+                for member_name in pkt_ctx_ft_extra_members:
+                    if member_name in reserved_member_names:
+                        raise _ConfigurationParseError(f'`{prop_name}` property',
+                                                       f'Packet context field type member name `{member_name}` is reserved.')
+
+            # create event types
+            ev_header_common_ctx_member_count = 0
+
+            if ev_features.type_id_field_type is not None:
+                ev_header_common_ctx_member_count += 1
+
+            if ev_features.time_field_type is not None:
+                ev_header_common_ctx_member_count += 1
+
+            ev_common_ctx_ft_prop_name = 'event-common-context-field-type'
+            ev_common_ctx_ft_node = stream_type_node.get(ev_common_ctx_ft_prop_name)
+            ev_header_common_ctx_member_count += self._total_struct_ft_node_members(ev_common_ctx_ft_node)
+            ev_types = set()
+
+            for ev_name, ev_type_node in stream_type_node[ev_types_prop_name].items():
+                ev_types.add(self._create_ev_type(ev_name, ev_type_node, ev_header_common_ctx_member_count))
+
+            # create stream type
+            return barectf_config.StreamType(name, ev_types, def_clk_type, features,
+                                             pkt_ctx_ft_extra_members,
+                                             self._try_create_ft(stream_type_node,
+                                                                 ev_common_ctx_ft_prop_name))
+        except _ConfigurationParseError as exc:
+            _append_error_ctx(exc, f'Stream type `{name}`')
+
+    def _clk_type(self, name, prop_name):
+        clk_type = self._clk_types.get(name)
+
+        if clk_type is None:
+            raise _ConfigurationParseError(f'`{prop_name}` property',
+                                           f'Clock type `{name}` does not exist')
+
+        return clk_type
+
+    def _create_clk_type(self, name, clk_type_node):
+        self._validate_iden(name, '`name` property', 'clock type name')
+        clk_type_uuid = None
+        uuid_node = clk_type_node.get('uuid')
+
+        if uuid_node is not None:
+            clk_type_uuid = uuid.UUID(uuid_node)
+
+        offset_seconds = 0
+        offset_cycles = 0
+        offset_node = clk_type_node.get('offset')
+
+        if offset_node is not None:
+            offset_seconds = offset_node.get('seconds', 0)
+            offset_cycles = offset_node.get('cycles', 0)
+
+        return barectf_config.ClockType(name, clk_type_node.get('frequency', int(1e9)),
+                                        clk_type_uuid, clk_type_node.get('description'),
+                                        clk_type_node.get('precision', 0),
+                                        barectf_config.ClockTypeOffset(offset_seconds, offset_cycles),
+                                        clk_type_node.get('origin-is-unix-epoch', False))
+
+    def _create_clk_types(self):
+        self._clk_types = {}
+
+        for clk_type_name, clk_type_node in self._trace_type_node.get('clock-types', {}).items():
+            self._clk_types[clk_type_name] = self._create_clk_type(clk_type_name, clk_type_node)
+
+    def _create_trace_type(self):
+        try:
+            # create clock types (_create_stream_type() needs them)
+            self._create_clk_types()
+
+            # get UUID
+            trace_type_uuid = None
+            uuid_node = self._trace_type_node.get('uuid')
+
+            if uuid_node is not None:
+                if uuid_node == 'auto':
+                    trace_type_uuid = uuid.uuid1()
+                else:
+                    trace_type_uuid = uuid.UUID(uuid_node)
+
+            # create feature field types
+            magic_ft = barectf_config.DEFAULT_FIELD_TYPE
+            uuid_ft = None
+            stream_type_id_ft = barectf_config.DEFAULT_FIELD_TYPE
+
+            if trace_type_uuid is not None:
+                # Trace type has a UUID: initialize UUID field type to
+                # a default field type.
+                uuid_ft = barectf_config.DEFAULT_FIELD_TYPE
+
+            features_node = self._trace_type_node.get('$features')
+            stream_type_id_ft_prop_name = 'stream-type-id-field-type'
+
+            if features_node is not None:
+                magic_ft = self._feature_ft(features_node, 'magic-field-type',
+                                            magic_ft)
+                uuid_ft = self._feature_ft(features_node, 'uuid-field-type', uuid_ft)
+                stream_type_id_ft = self._feature_ft(features_node, stream_type_id_ft_prop_name,
+                                                     stream_type_id_ft)
+
+            stream_types_prop_name = 'stream-types'
+            stream_type_count = len(self._trace_type_node[stream_types_prop_name])
+
+            try:
+                if stream_type_id_ft is None and stream_type_count > 1:
+                    raise _ConfigurationParseError(f'`{stream_type_id_ft_prop_name}` property',
+                                                   'Stream type ID field type feature is required because trace type has more than one stream type')
+
+                if isinstance(stream_type_id_ft, barectf_config._FieldType) and stream_type_count > (1 << stream_type_id_ft.size):
+                    raise _ConfigurationParseError(f'`{stream_type_id_ft_prop_name}` property',
+                                                   f'Field type\'s size ({stream_type_id_ft.size} bits) is too small to accomodate {stream_type_count} stream types')
+            except _ConfigurationParseError as exc:
+                _append_error_ctx(exc, '`$features` property')
+
+            features = barectf_config.TraceTypeFeatures(magic_ft, uuid_ft, stream_type_id_ft)
+
+            # create stream types
+            stream_types = set()
+
+            for stream_name, stream_type_node in self._trace_type_node[stream_types_prop_name].items():
+                stream_types.add(self._create_stream_type(stream_name, stream_type_node))
+
+            # create trace type
+            return barectf_config.TraceType(stream_types, self._default_byte_order,
+                                            trace_type_uuid, features)
+        except _ConfigurationParseError as exc:
+            _append_error_ctx(exc, 'Trace type')
+
+    def _create_trace(self):
+        try:
+            trace_type = self._create_trace_type()
+            trace_node = self._root_node.config_node['trace']
+            env = None
+            env_node = trace_node.get('environment')
+
+            if env_node is not None:
+                # validate each environment variable name
+                for name in env_node:
+                    self._validate_iden(name, '`environment` property',
+                                        'environment variable name')
+
+                # the node already has the expected structure
+                env = barectf_config.TraceEnvironment(env_node)
+
+            return barectf_config.Trace(trace_type, env)
+
+        except _ConfigurationParseError as exc:
+            _append_error_ctx(exc, 'Trace')
+
+    def _create_config(self):
+        # create trace first
+        trace = self._create_trace()
+
+        # find default stream type, if any
+        def_stream_type = None
+
+        for stream_type_name, stream_type_node in self._trace_type_node['stream-types'].items():
+            prop_name = '$is-default'
+            is_default = stream_type_node.get(prop_name)
+
+            if is_default is True:
+                if def_stream_type is not None:
+                    exc = _ConfigurationParseError(f'`{prop_name}` property',
+                                                   f'Duplicate default stream type (`{def_stream_type.name}`)')
+                    exc._append_ctx(f'Stream type `{stream_type_name}`')
+                    _append_error_ctx(exc, 'Trace type')
+
+                def_stream_type = trace.type.stream_type(stream_type_name)
+
+        # create clock type C type mapping
+        clk_types_node = self._trace_type_node.get('clock-types')
+        clk_type_c_types = None
+
+        if clk_types_node is not None:
+            clk_type_c_types = collections.OrderedDict()
+
+            for stream_type in trace.type.stream_types:
+                if stream_type.default_clock_type is None:
+                    continue
+
+                clk_type_node = clk_types_node[stream_type.default_clock_type.name]
+                c_type = clk_type_node.get('$c-type')
+
+                if c_type is not None:
+                    clk_type_c_types[stream_type.default_clock_type] = c_type
+
+        # create options
+        iden_prefix_def = False
+        def_stream_type_name_def = False
+        opts_node = self._root_node.config_node.get('options')
+
+        if opts_node is not None:
+            code_gen_opts_node = opts_node.get('code-generation')
+
+            if code_gen_opts_node is not None:
+                prefix_node = code_gen_opts_node.get('prefix', 'barectf')
+
+                if type(prefix_node) is str:
+                    # automatic prefixes
+                    iden_prefix = f'{prefix_node}_'
+                    file_name_prefix = prefix_node
+                else:
+                    iden_prefix = prefix_node['identifier']
+                    file_name_prefix = prefix_node['file-name']
+
+                header_opts = code_gen_opts_node.get('header')
+
+                if header_opts is not None:
+                    iden_prefix_def = header_opts.get('identifier-prefix-definition', False)
+                    def_stream_type_name_def = header_opts.get('default-stream-type-name-definition',
+                                                               False)
+
+        header_opts = barectf_config.ConfigurationCodeGenerationHeaderOptions(iden_prefix_def,
+                                                                              def_stream_type_name_def)
+        cg_opts = barectf_config.ConfigurationCodeGenerationOptions(iden_prefix, file_name_prefix,
+                                                                    def_stream_type, header_opts,
+                                                                    clk_type_c_types)
+        opts = barectf_config.ConfigurationOptions(cg_opts)
+
+        # create configuration
+        self._config = barectf_config.Configuration(trace, opts)
+
+    # Expands the field type aliases found in the trace type node.
+    #
+    # This method modifies the trace type node.
+    #
+    # When this method returns:
+    #
+    # * Any field type alias is replaced with its full field type
+    #   node equivalent.
+    #
+    # * The `$field-type-aliases` property of the trace type node is
+    #   removed.
+    def _expand_ft_aliases(self):
+        def resolve_ft_alias_from(parent_node, key):
+            if key not in parent_node:
+                return
+
+            if type(parent_node[key]) not in [collections.OrderedDict, str]:
+                return
+
+            return self._resolve_ft_alias_from(ft_aliases_node, parent_node, key)
+
+        ft_aliases_node = self._trace_type_node['$field-type-aliases']
+
+        # Expand field type aliases within trace, stream, and event type
+        # nodes.
+        features_prop_name = '$features'
+
+        try:
+            features_node = self._trace_type_node.get(features_prop_name)
+
+            if features_node is not None:
+                try:
+                    resolve_ft_alias_from(features_node, 'magic-field-type')
+                    resolve_ft_alias_from(features_node, 'uuid-field-type')
+                    resolve_ft_alias_from(features_node, 'stream-type-id-field-type')
+                except _ConfigurationParseError as exc:
+                    _append_error_ctx(exc, f'`{features_prop_name}` property')
+        except _ConfigurationParseError as exc:
+            _append_error_ctx(exc, 'Trace type')
+
+        for stream_type_name, stream_type_node in self._trace_type_node['stream-types'].items():
+            try:
+                features_node = stream_type_node.get(features_prop_name)
+
+                if features_node is not None:
+                    try:
+                        pkt_prop_name = 'packet'
+                        pkt_node = features_node.get(pkt_prop_name)
+
+                        if pkt_node is not None:
+                            try:
+                                resolve_ft_alias_from(pkt_node, 'total-size-field-type')
+                                resolve_ft_alias_from(pkt_node, 'content-size-field-type')
+                                resolve_ft_alias_from(pkt_node, 'beginning-time-field-type')
+                                resolve_ft_alias_from(pkt_node, 'end-time-field-type')
+                                resolve_ft_alias_from(pkt_node,
+                                                      'discarded-events-counter-field-type')
+                            except _ConfigurationParseError as exc:
+                                _append_error_ctx(exc, f'`{pkt_prop_name}` property')
+
+                        ev_prop_name = 'event'
+                        ev_node = features_node.get(ev_prop_name)
+
+                        if ev_node is not None:
+                            try:
+                                resolve_ft_alias_from(ev_node, 'type-id-field-type')
+                                resolve_ft_alias_from(ev_node, 'time-field-type')
+                            except _ConfigurationParseError as exc:
+                                _append_error_ctx(exc, f'`{ev_prop_name}` property')
+                    except _ConfigurationParseError as exc:
+                        _append_error_ctx(exc, f'`{features_prop_name}` property')
+
+                pkt_ctx_ft_extra_members_prop_name = 'packet-context-field-type-extra-members'
+                pkt_ctx_ft_extra_members_node = stream_type_node.get(pkt_ctx_ft_extra_members_prop_name)
+
+                if pkt_ctx_ft_extra_members_node is not None:
+                    try:
+                        for member_node in pkt_ctx_ft_extra_members_node:
+                            member_node = list(member_node.values())[0]
+                            resolve_ft_alias_from(member_node, 'field-type')
+                    except _ConfigurationParseError as exc:
+                        _append_error_ctx(exc, f'`{pkt_ctx_ft_extra_members_prop_name}` property')
+
+                resolve_ft_alias_from(stream_type_node, 'event-common-context-field-type')
+
+                for ev_type_name, ev_type_node in stream_type_node['event-types'].items():
+                    try:
+                        resolve_ft_alias_from(ev_type_node, 'specific-context-field-type')
+                        resolve_ft_alias_from(ev_type_node, 'payload-field-type')
+                    except _ConfigurationParseError as exc:
+                        _append_error_ctx(exc, f'Event type `{ev_type_name}`')
+            except _ConfigurationParseError as exc:
+                _append_error_ctx(exc, f'Stream type `{stream_type_name}`')
+
+        # remove the (now unneeded) `$field-type-aliases` property
+        del self._trace_type_node['$field-type-aliases']
+
+    # Applies field type inheritance to all field type nodes found in
+    # the trace type node.
+    #
+    # This method modifies the trace type node.
+    #
+    # When this method returns, no field type node has an `$inherit`
+    # property.
+    def _apply_fts_inheritance(self):
+        def apply_ft_inheritance(parent_node, key):
+            if key not in parent_node:
+                return
+
+            if type(parent_node[key]) is not collections.OrderedDict:
+                return
+
+            return self._apply_ft_inheritance(parent_node, key)
+
+        features_prop_name = '$features'
+        features_node = self._trace_type_node.get(features_prop_name)
+
+        if features_node is not None:
+            apply_ft_inheritance(features_node, 'magic-field-type')
+            apply_ft_inheritance(features_node, 'uuid-field-type')
+            apply_ft_inheritance(features_node, 'stream-type-id-field-type')
+
+        for stream_type_node in self._trace_type_node['stream-types'].values():
+            features_node = stream_type_node.get(features_prop_name)
+
+            if features_node is not None:
+                pkt_node = features_node.get('packet')
+
+                if pkt_node is not None:
+                    apply_ft_inheritance(pkt_node, 'total-size-field-type')
+                    apply_ft_inheritance(pkt_node, 'content-size-field-type')
+                    apply_ft_inheritance(pkt_node, 'beginning-time-field-type')
+                    apply_ft_inheritance(pkt_node, 'end-time-field-type')
+                    apply_ft_inheritance(pkt_node, 'discarded-events-counter-field-type')
+
+                ev_node = features_node.get('event')
+
+                if ev_node is not None:
+                    apply_ft_inheritance(ev_node, 'type-id-field-type')
+                    apply_ft_inheritance(ev_node, 'time-field-type')
+
+            pkt_ctx_ft_extra_members_node = stream_type_node.get('packet-context-field-type-extra-members')
+
+            if pkt_ctx_ft_extra_members_node is not None:
+                for member_node in pkt_ctx_ft_extra_members_node:
+                    member_node = list(member_node.values())[0]
+                    apply_ft_inheritance(member_node, 'field-type')
+
+            apply_ft_inheritance(stream_type_node, 'event-common-context-field-type')
+
+            for ev_type_node in stream_type_node['event-types'].values():
+                apply_ft_inheritance(ev_type_node, 'specific-context-field-type')
+                apply_ft_inheritance(ev_type_node, 'payload-field-type')
+
+    # Normalizes structure field type member nodes.
+    #
+    # A structure field type member node can look like this:
+    #
+    #     - msg: custom-string
+    #
+    # which is the equivalent of this:
+    #
+    #     - msg:
+    #         field-type: custom-string
+    #
+    # This method normalizes form 1 to use form 2.
+    def _normalize_struct_ft_member_nodes(self):
+        def normalize_members_node(members_node):
+            ft_prop_name = 'field-type'
+
+            for member_node in members_node:
+                member_name, val_node = list(member_node.items())[0]
+
+                if type(val_node) is str:
+                    member_node[member_name] = collections.OrderedDict({
+                        ft_prop_name: val_node
+                    })
+
+                normalize_struct_ft_member_nodes(member_node[member_name], ft_prop_name)
+
+        def normalize_struct_ft_member_nodes(parent_node, key):
+            if type(parent_node) is not collections.OrderedDict:
+                return
+
+            ft_node = parent_node.get(key)
+
+            if type(ft_node) is not collections.OrderedDict:
+                return
+
+            members_nodes = ft_node.get('members')
+
+            if members_nodes is not None:
+                normalize_members_node(members_nodes)
+
+        prop_name = '$field-type-aliases'
+        ft_aliases_node = self._trace_type_node.get(prop_name)
+
+        if ft_aliases_node is not None:
+            for alias in ft_aliases_node:
+                normalize_struct_ft_member_nodes(ft_aliases_node, alias)
+
+        features_prop_name = '$features'
+        features_node = self._trace_type_node.get(features_prop_name)
+
+        if features_node is not None:
+            normalize_struct_ft_member_nodes(features_node, 'magic-field-type')
+            normalize_struct_ft_member_nodes(features_node, 'uuid-field-type')
+            normalize_struct_ft_member_nodes(features_node, 'stream-type-id-field-type')
+
+        for stream_type_node in self._trace_type_node['stream-types'].values():
+            features_node = stream_type_node.get(features_prop_name)
+
+            if features_node is not None:
+                pkt_node = features_node.get('packet')
+
+                if pkt_node is not None:
+                    normalize_struct_ft_member_nodes(pkt_node, 'total-size-field-type')
+                    normalize_struct_ft_member_nodes(pkt_node, 'content-size-field-type')
+                    normalize_struct_ft_member_nodes(pkt_node, 'beginning-time-field-type')
+                    normalize_struct_ft_member_nodes(pkt_node, 'end-time-field-type')
+                    normalize_struct_ft_member_nodes(pkt_node,
+                                                     'discarded-events-counter-field-type')
+
+                ev_node = features_node.get('event')
+
+                if ev_node is not None:
+                    normalize_struct_ft_member_nodes(ev_node, 'type-id-field-type')
+                    normalize_struct_ft_member_nodes(ev_node, 'time-field-type')
+
+            pkt_ctx_ft_extra_members_node = stream_type_node.get('packet-context-field-type-extra-members')
+
+            if pkt_ctx_ft_extra_members_node is not None:
+                normalize_members_node(pkt_ctx_ft_extra_members_node)
+
+            normalize_struct_ft_member_nodes(stream_type_node, 'event-common-context-field-type')
+
+            for ev_type_node in stream_type_node['event-types'].values():
+                normalize_struct_ft_member_nodes(ev_type_node, 'specific-context-field-type')
+                normalize_struct_ft_member_nodes(ev_type_node, 'payload-field-type')
+
+    # Calls _expand_ft_aliases() and _apply_fts_inheritance() if the
+    # trace type node has a `$field-type-aliases` property.
+    def _expand_fts(self):
+        # Make sure that the current configuration node is valid
+        # considering field types are not expanded yet.
+        self._schema_validator.validate(self._root_node.config_node,
+                                        '3/config/config-pre-field-type-expansion')
+
+        prop_name = '$field-type-aliases'
+        ft_aliases_node = self._trace_type_node.get(prop_name)
+
+        if ft_aliases_node is None:
+            # If there's no `'$field-type-aliases'` node, then there's
+            # no field type aliases and therefore no possible
+            # inheritance.
+            if prop_name in self._trace_type_node:
+                del self._trace_type_node[prop_name]
+
+            return
+
+        # normalize structure field type member nodes
+        self._normalize_struct_ft_member_nodes()
+
+        # first, expand field type aliases
+        self._expand_ft_aliases()
+
+        # next, apply inheritance to create effective field type nodes
+        self._apply_fts_inheritance()
+
+    # Substitute the event type node log level aliases with their
+    # numeric equivalents.
+    #
+    # Removes the `$log-level-aliases` property of the trace type node.
+    def _sub_log_level_aliases(self):
+        # Make sure that the current configuration node is valid
+        # considering log level aliases are not substituted yet.
+        self._schema_validator.validate(self._root_node.config_node,
+                                        '3/config/config-pre-log-level-alias-sub')
+
+        log_level_aliases_prop_name = '$log-level-aliases'
+        log_level_aliases_node = self._trace_type_node.get(log_level_aliases_prop_name)
+
+        if log_level_aliases_prop_name in self._trace_type_node:
+            del self._trace_type_node[log_level_aliases_prop_name]
+
+        if log_level_aliases_node is None:
+            # no log level aliases
+            return
+
+        # substitute log level aliases
+        for stream_type_name, stream_type_node in self._trace_type_node['stream-types'].items():
+            try:
+                for ev_type_name, ev_type_node in stream_type_node['event-types'].items():
+                    try:
+                        prop_name = 'log-level'
+                        ll_node = ev_type_node.get(prop_name)
+
+                        if ll_node is None:
+                            continue
+
+                        if type(ll_node) is str:
+                            if ll_node not in log_level_aliases_node:
+                                raise _ConfigurationParseError(f'`{prop_name}` property',
+                                                               f'Log level alias `{ll_node}` does not exist')
+
+                            ev_type_node[prop_name] = log_level_aliases_node[ll_node]
+                    except _ConfigurationParseError as exc:
+                        _append_error_ctx(exc, f'Event type `{ev_type_name}`')
+            except _ConfigurationParseError as exc:
+                _append_error_ctx(exc, f'Stream type `{stream_type_name}`')
+
+    # Generator of parent node and key pairs for all the nodes,
+    # recursively, of `node`.
+    #
+    # It is safe to delete a yielded node during the iteration.
+    @staticmethod
+    def _props(node):
+        if type(node) is collections.OrderedDict:
+            for key in list(node):
+                yield from _Parser._props(node[key])
+                yield node, key
+        elif type(node) is list:
+            for item_node in node:
+                yield from _Parser._props(item_node)
+
+    def _trace_type_props(self):
+        yield from _Parser._props(self._root_node.config_node['trace']['type'])
+
+    # Normalize the properties of the configuration node.
+    #
+    # This method, for each property of the trace type node:
+    #
+    # 1. Removes it if it's `None` (means default).
+    #
+    # 2. Chooses a specific `class` property value.
+    #
+    # 3. Chooses a specific `byte-order`/`$default-byte-order` property
+    #    value.
+    #
+    # 4. Chooses a specific `preferred-display-base` property value.
+    #
+    # This method also applies 1. to the trace node's `environment`
+    # property.
+    def _normalize_props(self):
+        def normalize_byte_order_prop(parent_node, key):
+            node = parent_node[key]
+
+            if node in ['be', 'big']:
+                parent_node[key] = 'big-endian'
+            elif node in ['le', 'little']:
+                parent_node[key] = 'little-endian'
+
+        trace_node = self._root_node.config_node['trace']
+        trace_type_node = trace_node['type']
+        prop_name = '$default-byte-order'
+
+        if prop_name in trace_type_node and type(trace_type_node[prop_name]) is str:
+            normalize_byte_order_prop(trace_type_node, prop_name)
+
+        for parent_node, key in self._trace_type_props():
+            node = parent_node[key]
+
+            if node is None:
+                # a `None` property is equivalent to not having it
+                del parent_node[key]
+                continue
+
+            if key == 'class' and type(node) is str:
+                # field type class aliases
+                if node in ['uint', 'unsigned-int']:
+                    parent_node[key] = 'unsigned-integer'
+                elif node in ['sint', 'signed-int']:
+                    parent_node[key] = 'signed-integer'
+                elif node in ['uenum', 'unsigned-enum']:
+                    parent_node[key] = 'unsigned-enumeration'
+                elif node in ['senum', 'signed-enum']:
+                    parent_node[key] = 'signed-enumeration'
+                elif node == 'str':
+                    parent_node[key] = 'string'
+                elif node == 'struct':
+                    parent_node[key] = 'structure'
+            elif key == 'byte-order' and type(node) is str:
+                # byte order aliases
+                normalize_byte_order_prop(parent_node, key)
+            elif key == 'preferred-display-base' and type(node) is str:
+                # display base aliases
+                if node == 'bin':
+                    parent_node[key] = 'binary'
+                elif node == 'oct':
+                    parent_node[key] = 'octal'
+                elif node == 'dec':
+                    parent_node[key] = 'decimal'
+                elif node == 'hex':
+                    parent_node[key] = 'hexadecimal'
+
+        prop_name = 'environment'
+
+        if prop_name in trace_node:
+            node = trace_node[prop_name]
+
+            if node is None:
+                del trace_node[prop_name]
+
+    # Substitutes missing/`None` `byte-order` properties with the trace
+    # type node's default byte order (`$default-byte-order` property),
+    # if any.
+    def _sub_ft_nodes_byte_order(self):
+        ba_ft_class_names = {
+            'unsigned-integer',
+            'signed-integer',
+            'unsigned-enumeration',
+            'signed-enumeration',
+            'real',
+        }
+
+        def set_ft_node_byte_order_prop(parent_node, key):
+            if key not in parent_node:
+                return
+
+            ft_node = parent_node[key]
+
+            if type(ft_node) is not collections.OrderedDict:
+                return
+
+            if ft_node['class'] in ba_ft_class_names:
+                prop_name = 'byte-order'
+                byte_order_node = ft_node.get(prop_name)
+
+                if byte_order_node is None:
+                    if default_byte_order_node is None:
+                        raise _ConfigurationParseError(f'`{key}` property`',
+                                                       '`byte-order` property is not set or null, but trace type has no `$default-byte-order` property')
+
+                    ft_node[prop_name] = default_byte_order_node
+
+            members_node = ft_node.get('members')
+
+            if members_node is not None:
+                set_struct_ft_node_members_byte_order_prop(members_node)
+
+            set_ft_node_byte_order_prop(ft_node, 'element-field-type')
+
+        def set_struct_ft_node_members_byte_order_prop(members_node):
+            for member_node in members_node:
+                member_name, member_node = list(member_node.items())[0]
+
+                try:
+                    set_ft_node_byte_order_prop(member_node, 'field-type')
+                except _ConfigurationParseError as exc:
+                    _append_error_ctx(exc, f'Structure field type member `{member_name}`')
+
+        default_byte_order_prop_name = '$default-byte-order'
+        default_byte_order_node = self._trace_type_node.get(default_byte_order_prop_name)
+
+        if default_byte_order_prop_name in self._trace_type_node:
+            del self._trace_type_node[default_byte_order_prop_name]
+
+        self._default_byte_order = None
+
+        if default_byte_order_node is not None:
+            self._default_byte_order = self._byte_order_from_node(default_byte_order_node)
+
+        features_prop_name = '$features'
+        features_node = self._trace_type_node.get(features_prop_name)
+
+        if features_node is not None:
+            try:
+                set_ft_node_byte_order_prop(features_node, 'magic-field-type')
+                set_ft_node_byte_order_prop(features_node, 'uuid-field-type')
+                set_ft_node_byte_order_prop(features_node, 'stream-type-id-field-type')
+            except _ConfigurationParseError as exc:
+                exc._append_ctx(exc, f'`{features_prop_name}` property')
+                _append_error_ctx(exc, 'Trace type')
+
+        for stream_type_name, stream_type_node in self._trace_type_node['stream-types'].items():
+            try:
+                features_node = stream_type_node.get(features_prop_name)
+
+                if features_node is not None:
+                    pkt_node = features_node.get('packet')
+
+                    if pkt_node is not None:
+                        set_ft_node_byte_order_prop(pkt_node, 'total-size-field-type')
+                        set_ft_node_byte_order_prop(pkt_node, 'content-size-field-type')
+                        set_ft_node_byte_order_prop(pkt_node, 'beginning-time-field-type')
+                        set_ft_node_byte_order_prop(pkt_node, 'end-time-field-type')
+                        set_ft_node_byte_order_prop(pkt_node,
+                                                    'discarded-events-counter-field-type')
+
+                    ev_node = features_node.get('event')
+
+                    if ev_node is not None:
+                        set_ft_node_byte_order_prop(ev_node, 'type-id-field-type')
+                        set_ft_node_byte_order_prop(ev_node, 'time-field-type')
+
+                prop_name = 'packet-context-field-type-extra-members'
+                pkt_ctx_ft_extra_members_node = stream_type_node.get(prop_name)
+
+                if pkt_ctx_ft_extra_members_node is not None:
+                    try:
+                        set_struct_ft_node_members_byte_order_prop(pkt_ctx_ft_extra_members_node)
+                    except _ConfigurationParseError as exc:
+                        _append_error_ctx(exc, f'`{pkt_ctx_ft_extra_members_node}` property')
+
+                set_ft_node_byte_order_prop(stream_type_node, 'event-common-context-field-type')
+
+                for ev_type_name, ev_type_node in stream_type_node['event-types'].items():
+                    try:
+                        set_ft_node_byte_order_prop(ev_type_node, 'specific-context-field-type')
+                        set_ft_node_byte_order_prop(ev_type_node, 'payload-field-type')
+                    except _ConfigurationParseError as exc:
+                        _append_error_ctx(exc, f'Event type `{ev_type_name}`')
+            except _ConfigurationParseError as exc:
+                _append_error_ctx(exc, f'Stream type `{stream_type_name}`')
+
+    # Processes the inclusions of the event type node `ev_type_node`,
+    # returning the effective node.
+    def _process_ev_type_node_include(self, ev_type_node):
+        # Make sure the event type node is valid for the inclusion
+        # processing stage.
+        self._schema_validator.validate(ev_type_node, '3/config/event-type-pre-include')
+
+        # process inclusions
+        return self._process_node_include(ev_type_node, self._process_ev_type_node_include)
+
+    # Processes the inclusions of the stream type node
+    # `stream_type_node`, returning the effective node.
+    def _process_stream_type_node_include(self, stream_type_node):
+        def process_children_include(stream_type_node):
+            prop_name = 'event-types'
+
+            if prop_name in stream_type_node:
+                ev_types_node = stream_type_node[prop_name]
+
+                for key in list(ev_types_node):
+                    ev_types_node[key] = self._process_ev_type_node_include(ev_types_node[key])
+
+        # Make sure the stream type node is valid for the inclusion
+        # processing stage.
+        self._schema_validator.validate(stream_type_node, '3/config/stream-type-pre-include')
+
+        # process inclusions
+        return self._process_node_include(stream_type_node, self._process_stream_type_node_include,
+                                          process_children_include)
+
+    # Processes the inclusions of the clock type node `clk_type_node`,
+    # returning the effective node.
+    def _process_clk_type_node_include(self, clk_type_node):
+        # Make sure the clock type node is valid for the inclusion
+        # processing stage.
+        self._schema_validator.validate(clk_type_node, '3/config/clock-type-pre-include')
+
+        # process inclusions
+        return self._process_node_include(clk_type_node, self._process_clk_type_node_include)
+
+    # Processes the inclusions of the trace type node `trace_type_node`,
+    # returning the effective node.
+    def _process_trace_type_node_include(self, trace_type_node):
+        def process_children_include(trace_type_node):
+            prop_name = 'clock-types'
+
+            if prop_name in trace_type_node:
+                clk_types_node = trace_type_node[prop_name]
+
+                for key in list(clk_types_node):
+                    clk_types_node[key] = self._process_clk_type_node_include(clk_types_node[key])
+
+            prop_name = 'stream-types'
+
+            if prop_name in trace_type_node:
+                stream_types_node = trace_type_node[prop_name]
+
+                for key in list(stream_types_node):
+                    stream_types_node[key] = self._process_stream_type_node_include(stream_types_node[key])
+
+        # Make sure the trace type node is valid for the inclusion
+        # processing stage.
+        self._schema_validator.validate(trace_type_node, '3/config/trace-type-pre-include')
+
+        # process inclusions
+        return self._process_node_include(trace_type_node, self._process_trace_type_node_include,
+                                          process_children_include)
+
+    # Processes the inclusions of the trace node `trace_node`, returning
+    # the effective node.
+    def _process_trace_node_include(self, trace_node):
+        def process_children_include(trace_node):
+            prop_name = 'type'
+            trace_node[prop_name] = self._process_trace_type_node_include(trace_node[prop_name])
+
+        # Make sure the trace node is valid for the inclusion processing
+        # stage.
+        self._schema_validator.validate(trace_node, '3/config/trace-pre-include')
+
+        # process inclusions
+        return self._process_node_include(trace_node, self._process_trace_node_include,
+                                          process_children_include)
+
+    # Processes the inclusions of the configuration node, modifying it
+    # during the process.
+    def _process_config_includes(self):
+        # Process inclusions in this order:
+        #
+        # 1. Clock type node and event type nodes (the order between
+        #    those is not important).
+        #
+        # 2. Stream type nodes.
+        #
+        # 3. Trace type node.
+        #
+        # 4. Trace node.
+        #
+        # This is because:
+        #
+        # * A trace node can include a trace type node, clock type
+        #   nodes, stream type nodes, and event type nodes.
+        #
+        # * A trace type node can include clock type nodes, stream type
+        #   nodes, and event type nodes.
+        #
+        # * A stream type node can include event type nodes.
+        #
+        # First, make sure the configuration node itself is valid for
+        # the inclusion processing stage.
+        self._schema_validator.validate(self._root_node.config_node, '3/config/config-pre-include')
+
+        # Process trace node inclusions.
+        #
+        # self._process_trace_node_include() returns a new (or the same)
+        # trace node without any `$include` property in it, recursively.
+        self._root_node.config_node['trace'] = self._process_trace_node_include(self._root_node.config_node['trace'])
+
+    def _parse(self):
+        # process configuration node inclusions
+        self._process_config_includes()
+
+        # Expand field type nodes.
+        #
+        # This process:
+        #
+        # 1. Replaces field type aliases with "effective" field type
+        #    nodes, recursively.
+        #
+        #    After this step, the `$field-type-aliases` property of the
+        #    trace type node is gone.
+        #
+        # 2. Applies inheritance, following the `$inherit` properties.
+        #
+        #    After this step, field type nodes do not contain `$inherit`
+        #    properties.
+        #
+        # This is done blindly, in that the process _doesn't_ validate
+        # field type nodes at this point.
+        self._expand_fts()
+
+        # Substitute log level aliases.
+        #
+        # This process:
+        #
+        # 1. Replaces log level aliases in event type nodes with their
+        #    numeric equivalents as found in the `$log-level-aliases`
+        #    property of the trace type node.
+        #
+        # 2. Removes the `$log-level-aliases` property from the trace
+        #    type node.
+        self._sub_log_level_aliases()
+
+        # At this point, the configuration node must be valid as an
+        # effective configuration node.
+        self._schema_validator.validate(self._root_node.config_node, '3/config/config')
+
+        # Normalize properties.
+        #
+        # This process removes `None` properties and chooses specific
+        # enumerators when aliases exist (for example, `big-endian`
+        # instead of `be`).
+        #
+        # The goal of this is that, if the user then gets this parser's
+        # `config_node` property, it has a normal and very readable
+        # form.
+        #
+        # It also makes _create_config() easier to implement because it
+        # doesn't need to check for `None` nodes or enumerator aliases.
+        self._normalize_props()
+
+        # Set `byte-order` properties of bit array field type nodes
+        # missing one.
+        #
+        # This process also removes the `$default-byte-order` property
+        # from the trace type node.
+        self._sub_ft_nodes_byte_order()
+
+        # Create a barectf configuration object from the configuration
+        # node.
+        self._create_config()
+
+    @property
+    def config(self):
+        return self._config
+
+    @property
+    def config_node(self):
+        return self._root_node
index 3d95f21306c118e95239e57d2c97db3d6a718045..4b11fe449ff48df91364b2742bbdc6cbfd303695 100644 (file)
 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-from barectf import templates
-from barectf import metadata
-import barectf.codegen
-import collections
+import barectf.tsdl182gen as barectf_tsdl182gen
+import barectf.templates as barectf_templates
+import barectf.codegen as barectf_codegen
+import barectf.config as barectf_config
+import barectf.version as barectf_version
 import itertools
-import argparse
 import datetime
-import barectf
 import copy
-import sys
-import os
-import re
+
+
+class _GeneratedFile:
+    def __init__(self, name, contents):
+        self._name = name
+        self._contents = contents
+
+    @property
+    def name(self):
+        return self._name
+
+    @property
+    def contents(self):
+        return self._contents
+
+
+class CodeGenerator:
+    def __init__(self, configuration):
+        self._config = configuration
+        self._file_name_prefix = configuration.options.code_generation_options.file_name_prefix
+        self._ccode_gen = _CCodeGenerator(configuration)
+        self._c_headers = None
+        self._c_sources = None
+        self._metadata_stream = None
+
+    @property
+    def _barectf_header_name(self):
+        return f'{self._file_name_prefix}.h'
+
+    def generate_c_headers(self):
+        if self._c_headers is None:
+            bitfield_header_name = f'{self._file_name_prefix}-bitfield.h'
+            self._c_headers = [
+                _GeneratedFile(self._barectf_header_name,
+                               self._ccode_gen.generate_header(bitfield_header_name)),
+                _GeneratedFile(bitfield_header_name,
+                               self._ccode_gen.generate_bitfield_header()),
+            ]
+
+        return self._c_headers
+
+    def generate_c_sources(self):
+        if self._c_sources is None:
+            self._c_sources = [
+                _GeneratedFile(f'{self._file_name_prefix}.c',
+                               self._ccode_gen.generate_c_src(self._barectf_header_name))
+            ]
+
+        return self._c_sources
+
+    def generate_metadata_stream(self):
+        if self._metadata_stream is None:
+            self._metadata_stream = _GeneratedFile('metadata',
+                                                   barectf_tsdl182gen._from_config(self._config))
+
+        return self._metadata_stream
 
 
 def _align(v, align):
@@ -40,10 +92,10 @@ def _align(v, align):
 
 
 class _SerializationAction:
-    def __init__(self, offset_in_byte, type, names):
+    def __init__(self, offset_in_byte, ft, names):
         assert(offset_in_byte >= 0 and offset_in_byte < 8)
         self._offset_in_byte = offset_in_byte
-        self._type = type
+        self._ft = ft
         self._names = copy.deepcopy(names)
 
     @property
@@ -51,8 +103,8 @@ class _SerializationAction:
         return self._offset_in_byte
 
     @property
-    def type(self):
-        return self._type
+    def ft(self):
+        return self._ft
 
     @property
     def names(self):
@@ -60,8 +112,8 @@ class _SerializationAction:
 
 
 class _AlignSerializationAction(_SerializationAction):
-    def __init__(self, offset_in_byte, type, names, value):
-        super().__init__(offset_in_byte, type, names)
+    def __init__(self, offset_in_byte, ft, names, value):
+        super().__init__(offset_in_byte, ft, names)
         self._value = value
 
     @property
@@ -70,8 +122,7 @@ class _AlignSerializationAction(_SerializationAction):
 
 
 class _SerializeSerializationAction(_SerializationAction):
-    def __init__(self, offset_in_byte, type, names):
-        super().__init__(offset_in_byte, type, names)
+    pass
 
 
 class _SerializationActions:
@@ -85,13 +136,13 @@ class _SerializationActions:
         self._names = []
         self._offset_in_byte = 0
 
-    def append_root_scope_type(self, t, name):
-        if t is None:
+    def append_root_scope_ft(self, ft, name):
+        if ft is None:
             return
 
-        assert(type(t) is metadata.Struct)
+        assert(type(ft) is barectf_config.StructureFieldType)
         self._names = [name]
-        self._append_type(t)
+        self._append_ft(ft)
 
     @property
     def actions(self):
@@ -106,60 +157,50 @@ class _SerializationActions:
     def _must_align(self, align_req):
         return self._last_alignment != align_req or self._last_bit_array_size % align_req != 0
 
-    def _append_type(self, t):
-        assert(type(t) in (metadata.Struct, metadata.String, metadata.Integer,
-                           metadata.FloatingPoint, metadata.Enum,
-                           metadata.Array))
-
-        if type(t) in (metadata.String, metadata.Array):
-            assert(type(t) is metadata.String or self._names[-1] == 'uuid')
+    def _append_ft(self, ft):
+        if isinstance(ft, (barectf_config.StringFieldType, barectf_config._ArrayFieldType)):
+            assert(type(ft) is barectf_config.StringFieldType or self._names[-1] == 'uuid')
             do_align = self._must_align(8)
             self._last_alignment = 8
             self._last_bit_array_size = 8
-            self._try_append_align_action(8, do_align, t)
-            self._append_serialize_action(t)
-        elif type(t) in (metadata.Integer, metadata.FloatingPoint,
-                         metadata.Enum, metadata.Struct):
-            do_align = self._must_align(t.align)
-            self._last_alignment = t.align
-
-            if type(t) is metadata.Struct:
-                self._last_bit_array_size = t.align
+            self._try_append_align_action(8, do_align, ft)
+            self._append_serialize_action(ft)
+        else:
+            do_align = self._must_align(ft.alignment)
+            self._last_alignment = ft.alignment
+
+            if type(ft) is barectf_config.StructureFieldType:
+                self._last_bit_array_size = ft.alignment
             else:
-                self._last_bit_array_size = t.size
+                self._last_bit_array_size = ft.size
 
-            self._try_append_align_action(t.align, do_align, t)
+            self._try_append_align_action(ft.alignment, do_align, ft)
 
-            if type(t) is metadata.Struct:
-                for field_name, field_type in t.fields.items():
-                    self._names.append(field_name)
-                    self._append_type(field_type)
+            if type(ft) is barectf_config.StructureFieldType:
+                for member_name, member in ft.members.items():
+                    self._names.append(member_name)
+                    self._append_ft(member.field_type)
                     del self._names[-1]
             else:
-                self._append_serialize_action(t, t.size)
+                self._append_serialize_action(ft)
 
-    def _try_append_align_action(self, alignment, do_align, t=None):
+    def _try_append_align_action(self, alignment, do_align, ft=None):
         offset_in_byte = self._offset_in_byte
         self._offset_in_byte = _align(self._offset_in_byte, alignment) % 8
 
         if do_align and alignment > 1:
-            self._actions.append(_AlignSerializationAction(offset_in_byte,
-                                                           t, self._names,
+            self._actions.append(_AlignSerializationAction(offset_in_byte, ft, self._names,
                                                            alignment))
 
-    def _append_serialize_action(self, t, size=None):
-        assert(type(t) in (metadata.Integer, metadata.FloatingPoint,
-                           metadata.Enum, metadata.String,
-                           metadata.Array))
-
+    def _append_serialize_action(self, ft):
+        assert(type(ft) is not barectf_config.StructureFieldType)
         offset_in_byte = self._offset_in_byte
 
-        if t.size is not None:
-            self._offset_in_byte += t.size
+        if isinstance(ft, barectf_config._BitArrayFieldType):
+            self._offset_in_byte += ft.size
             self._offset_in_byte %= 8
 
-        self._actions.append(_SerializeSerializationAction(offset_in_byte,
-                                                           t, self._names))
+        self._actions.append(_SerializeSerializationAction(offset_in_byte, ft, self._names))
 
 
 _PREFIX_TPH = 'tph_'
@@ -178,105 +219,80 @@ _PREFIX_TO_NAME = {
 }
 
 
-class CCodeGenerator:
+class _CCodeGenerator:
     def __init__(self, cfg):
         self._cfg = cfg
-        self._cg = barectf.codegen.CodeGenerator('\t')
-        self._type_to_get_ctype_func = {
-            metadata.Integer: self._get_int_ctype,
-            metadata.FloatingPoint: self._get_float_ctype,
-            metadata.Enum: self._get_enum_ctype,
-            metadata.String: self._get_string_ctype,
-        }
-        self._type_to_generate_serialize_func = {
-            metadata.Integer: self._generate_serialize_int,
-            metadata.FloatingPoint: self._generate_serialize_float,
-            metadata.Enum: self._generate_serialize_enum,
-            metadata.String: self._generate_serialize_string,
-        }
+        code_gen_opts = cfg.options.code_generation_options
+        self._iden_prefix = code_gen_opts.identifier_prefix
+        self._cg = barectf_codegen._CodeGenerator('\t')
         self._saved_serialization_actions = {}
 
-    def _get_stream_clock(self, stream):
-        field = None
-
-        if stream.event_header_type is not None:
-            if 'timestamp' in stream.event_header_type.fields:
-                field = stream.event_header_type['timestamp']
-
-        if stream.packet_context_type is not None:
-            if field is None and 'timestamp_begin' in stream.packet_context_type.fields:
-                field = stream.packet_context_type['timestamp_begin']
-
-            if field is None and 'timestamp_end' in stream.packet_context_type.fields:
-                field = stream.packet_context_type['timestamp_end']
-
-        if field is None:
-            return
+    @property
+    def _trace_type(self):
+        return self._cfg.trace.type
 
-        if field.property_mappings:
-            return field.property_mappings[0].object
+    def _clk_type_c_type(self, clk_type):
+        return self._cfg.options.code_generation_options.clock_type_c_types[clk_type]
 
     def _generate_ctx_parent(self):
-        tmpl = templates._CTX_PARENT
-        self._cg.add_lines(tmpl.format(prefix=self._cfg.prefix))
-
-    def _generate_ctx(self, stream):
-        tmpl = templates._CTX_BEGIN
-        self._cg.add_lines(tmpl.format(prefix=self._cfg.prefix,
-                                       sname=stream.name))
-        tmpl = 'uint32_t off_tph_{fname};'
-        self._cg.indent()
-        trace_packet_header_type = self._cfg.metadata.trace.packet_header_type
+        tmpl = barectf_templates._CTX_PARENT
+        self._cg.add_lines(tmpl.format(prefix=self._iden_prefix))
 
-        if trace_packet_header_type is not None:
-            for field_name in trace_packet_header_type.fields:
-                self._cg.add_lines(tmpl.format(fname=field_name))
-
-        tmpl = 'uint32_t off_spc_{fname};'
+    def _generate_ctx(self, stream_type):
+        tmpl = barectf_templates._CTX_BEGIN
+        self._cg.add_lines(tmpl.format(prefix=self._iden_prefix, sname=stream_type.name))
+        self._cg.indent()
+        pkt_header_ft = self._trace_type._pkt_header_ft
 
-        if stream.packet_context_type is not None:
-            for field_name in stream.packet_context_type.fields:
-                self._cg.add_lines(tmpl.format(fname=field_name))
+        if pkt_header_ft is not None:
+            for member_name in pkt_header_ft.members:
+                self._cg.add_lines(f'uint32_t off_tph_{member_name};')
 
-        clock = self._get_stream_clock(stream)
+        for member_name in stream_type._pkt_ctx_ft.members:
+            self._cg.add_lines(f'uint32_t off_spc_{member_name};')
 
-        if clock is not None:
-            line = '{} cur_last_event_ts;'.format(clock.return_ctype)
-            self._cg.add_line(line)
+        if stream_type.default_clock_type is not None:
+            self._cg.add_line(f'{self._clk_type_c_type(stream_type.default_clock_type)} cur_last_event_ts;')
 
         self._cg.unindent()
-        tmpl = templates._CTX_END
+        tmpl = barectf_templates._CTX_END
         self._cg.add_lines(tmpl)
 
     def _generate_ctxs(self):
-        for stream in self._cfg.metadata.streams.values():
-            self._generate_ctx(stream)
+        for stream_type in self._trace_type.stream_types:
+            self._generate_ctx(stream_type)
 
-    def _generate_clock_cb(self, clock):
-        tmpl = templates._CLOCK_CB
-        self._cg.add_lines(tmpl.format(return_ctype=clock.return_ctype,
-                                       cname=clock.name))
+    def _generate_clock_cb(self, clk_type):
+        tmpl = barectf_templates._CLOCK_CB
+        self._cg.add_lines(tmpl.format(return_ctype=self._clk_type_c_type(clk_type),
+                                       cname=clk_type.name))
 
     def _generate_clock_cbs(self):
-        for clock in self._cfg.metadata.clocks.values():
-            self._generate_clock_cb(clock)
+        clk_names = set()
+
+        for stream_type in self._trace_type.stream_types:
+            def_clk_type = stream_type.default_clock_type
+
+            if def_clk_type is not None and def_clk_type not in clk_names:
+                self._generate_clock_cb(def_clk_type)
+                clk_names.add(def_clk_type)
 
     def _generate_platform_callbacks(self):
-        tmpl = templates._PLATFORM_CALLBACKS_BEGIN
-        self._cg.add_lines(tmpl.format(prefix=self._cfg.prefix))
+        tmpl = barectf_templates._PLATFORM_CALLBACKS_BEGIN
+        self._cg.add_lines(tmpl.format(prefix=self._iden_prefix))
         self._cg.indent()
         self._generate_clock_cbs()
         self._cg.unindent()
-        tmpl = templates._PLATFORM_CALLBACKS_END
+        tmpl = barectf_templates._PLATFORM_CALLBACKS_END
         self._cg.add_lines(tmpl)
 
     def generate_bitfield_header(self):
         self._cg.reset()
-        tmpl = templates._BITFIELD
-        tmpl = tmpl.replace('$prefix$', self._cfg.prefix)
-        tmpl = tmpl.replace('$PREFIX$', self._cfg.prefix.upper())
+        tmpl = barectf_templates._BITFIELD
+        tmpl = tmpl.replace('$prefix$', self._iden_prefix)
+        tmpl = tmpl.replace('$PREFIX$', self._iden_prefix.upper())
 
-        if self._cfg.metadata.trace.byte_order == metadata.ByteOrder.BE:
+        if self._trace_type.default_byte_order == barectf_config.ByteOrder.BIG_ENDIAN:
             endian_def = 'BIG_ENDIAN'
         else:
             endian_def = 'LITTLE_ENDIAN'
@@ -287,164 +303,144 @@ class CCodeGenerator:
         return self._cg.code
 
     def _generate_func_init_proto(self):
-        tmpl = templates._FUNC_INIT_PROTO
-        self._cg.add_lines(tmpl.format(prefix=self._cfg.prefix))
-
-    def _get_int_ctype(self, t):
-        signed = 'u' if not t.signed else ''
-
-        if t.size <= 8:
-            sz = '8'
-        elif t.size <= 16:
-            sz = '16'
-        elif t.size <= 32:
-            sz = '32'
-        elif t.size == 64:
-            sz = '64'
-
-        return '{}int{}_t'.format(signed, sz)
-
-    def _get_float_ctype(self, t):
-        if t.exp_size == 8 and t.mant_size == 24 and t.align == 32:
-            ctype = 'float'
-        elif t.exp_size == 11 and t.mant_size == 53 and t.align == 64:
-            ctype = 'double'
+        tmpl = barectf_templates._FUNC_INIT_PROTO
+        self._cg.add_lines(tmpl.format(prefix=self._iden_prefix))
+
+    def _get_ft_c_type(self, ft):
+        if isinstance(ft, barectf_config._IntegerFieldType):
+            sign_prefix = 'u' if isinstance(ft, barectf_config.UnsignedIntegerFieldType) else ''
+
+            if ft.size <= 8:
+                sz = 8
+            elif ft.size <= 16:
+                sz = 16
+            elif ft.size <= 32:
+                sz = 32
+            else:
+                assert ft.size == 64
+                sz = 64
+
+            return f'{sign_prefix}int{sz}_t'
+        elif type(ft) is barectf_config.RealFieldType:
+            if ft.size == 32 and ft.alignment == 32:
+                return 'float'
+            elif ft.size == 64 and ft.alignment == 64:
+                return 'double'
+            else:
+                return 'uint64_t'
         else:
-            ctype = 'uint64_t'
-
-        return ctype
+            assert type(ft) is barectf_config.StringFieldType
+            return 'const char *'
 
-    def _get_enum_ctype(self, t):
-        return self._get_int_ctype(t.value_type)
+    def _generate_ft_c_type(self, ft):
+        c_type = self._get_ft_c_type(ft)
+        self._cg.append_to_last_line(c_type)
 
-    def _get_string_ctype(self, t):
-        return 'const char *'
-
-    def _get_type_ctype(self, t):
-        return self._type_to_get_ctype_func[type(t)](t)
-
-    def _generate_type_ctype(self, t):
-        ctype = self._get_type_ctype(t)
-        self._cg.append_to_last_line(ctype)
-
-    def _generate_proto_param(self, t, name):
-        self._generate_type_ctype(t)
+    def _generate_proto_param(self, ft, name):
+        self._generate_ft_c_type(ft)
         self._cg.append_to_last_line(' ')
         self._cg.append_to_last_line(name)
 
-    def _generate_proto_params(self, t, name_prefix, exclude_list):
+    def _generate_proto_params(self, ft, name_prefix, exclude_set=None):
+        if exclude_set is None:
+            exclude_set = set()
+
         self._cg.indent()
 
-        for field_name, field_type in t.fields.items():
-            if field_name in exclude_list:
+        for member_name, member in ft.members.items():
+            if member_name in exclude_set:
                 continue
 
-            name = name_prefix + field_name
             self._cg.append_to_last_line(',')
             self._cg.add_line('')
-            self._generate_proto_param(field_type, name)
+            self._generate_proto_param(member.field_type, name_prefix + member_name)
 
         self._cg.unindent()
 
-    def _generate_func_open_proto(self, stream):
-        tmpl = templates._FUNC_OPEN_PROTO_BEGIN
-        self._cg.add_lines(tmpl.format(prefix=self._cfg.prefix,
-                                       sname=stream.name))
-        trace_packet_header_type = self._cfg.metadata.trace.packet_header_type
-
-        if trace_packet_header_type is not None:
-            exclude_list = ['magic', 'stream_id', 'uuid']
-            self._generate_proto_params(trace_packet_header_type, _PREFIX_TPH,
-                                        exclude_list)
-
-        if stream.packet_context_type is not None:
-            exclude_list = [
-                'timestamp_begin',
-                'timestamp_end',
-                'packet_size',
-                'content_size',
-                'events_discarded',
-            ]
-            self._generate_proto_params(stream.packet_context_type,
-                                        _PREFIX_SPC, exclude_list)
+    def _generate_func_open_proto(self, stream_type):
+        tmpl = barectf_templates._FUNC_OPEN_PROTO_BEGIN
+        self._cg.add_lines(tmpl.format(prefix=self._iden_prefix, sname=stream_type.name))
+
+        if self._trace_type._pkt_header_ft is not None:
+            self._generate_proto_params(self._trace_type._pkt_header_ft, _PREFIX_TPH,
+                                        {'magic', 'stream_id', 'uuid'})
 
-        tmpl = templates._FUNC_OPEN_PROTO_END
+        exclude_set = {
+            'timestamp_begin',
+            'timestamp_end',
+            'packet_size',
+            'content_size',
+            'events_discarded',
+        }
+        self._generate_proto_params(stream_type._pkt_ctx_ft, _PREFIX_SPC, exclude_set)
+        tmpl = barectf_templates._FUNC_OPEN_PROTO_END
         self._cg.add_lines(tmpl)
 
-    def _generate_func_close_proto(self, stream):
-        tmpl = templates._FUNC_CLOSE_PROTO
-        self._cg.add_lines(tmpl.format(prefix=self._cfg.prefix,
-                                       sname=stream.name))
+    def _generate_func_close_proto(self, stream_type):
+        tmpl = barectf_templates._FUNC_CLOSE_PROTO
+        self._cg.add_lines(tmpl.format(prefix=self._iden_prefix, sname=stream_type.name))
 
-    def _generate_func_trace_proto_params(self, stream, event):
-        if stream.event_header_type is not None:
-            exclude_list = [
-                'id',
-                'timestamp',
-            ]
-            self._generate_proto_params(stream.event_header_type,
-                                        _PREFIX_SEH, exclude_list)
-
-        if stream.event_context_type is not None:
-            self._generate_proto_params(stream.event_context_type,
-                                        _PREFIX_SEC, [])
-
-        if event.context_type is not None:
-            self._generate_proto_params(event.context_type,
-                                        _PREFIX_EC, [])
-
-        if event.payload_type is not None:
-            self._generate_proto_params(event.payload_type,
-                                        _PREFIX_EP, [])
-
-    def _generate_func_trace_proto(self, stream, event):
-        tmpl = templates._FUNC_TRACE_PROTO_BEGIN
-        self._cg.add_lines(tmpl.format(prefix=self._cfg.prefix,
-                                       sname=stream.name, evname=event.name))
-        self._generate_func_trace_proto_params(stream, event)
-        tmpl = templates._FUNC_TRACE_PROTO_END
+    def _generate_func_trace_proto_params(self, stream_type, ev_type):
+        if stream_type._ev_header_ft is not None:
+            self._generate_proto_params(stream_type._ev_header_ft, _PREFIX_SEH, {'id', 'timestamp'})
+
+        if stream_type.event_common_context_field_type is not None:
+            self._generate_proto_params(stream_type.event_common_context_field_type, _PREFIX_SEC)
+
+        if ev_type.specific_context_field_type is not None:
+            self._generate_proto_params(ev_type.specific_context_field_type, _PREFIX_EC)
+
+        if ev_type.payload_field_type is not None:
+            self._generate_proto_params(ev_type.payload_field_type, _PREFIX_EP)
+
+    def _generate_func_trace_proto(self, stream_type, ev_type):
+        tmpl = barectf_templates._FUNC_TRACE_PROTO_BEGIN
+        self._cg.add_lines(tmpl.format(prefix=self._iden_prefix, sname=stream_type.name,
+                                       evname=ev_type.name))
+        self._generate_func_trace_proto_params(stream_type, ev_type)
+        tmpl = barectf_templates._FUNC_TRACE_PROTO_END
         self._cg.add_lines(tmpl)
 
     def _punctuate_proto(self):
         self._cg.append_to_last_line(';')
 
-    def generate_header(self):
+    def generate_header(self, bitfield_header_name):
         self._cg.reset()
         dt = datetime.datetime.now().isoformat()
-        bh_filename = self.get_bitfield_header_filename()
         prefix_def = ''
-        default_stream_def = ''
+        def_stream_type_name_def = ''
+        cg_opts = self._cfg.options.code_generation_options
+        header_opts = cg_opts.header_options
+
+        if header_opts.identifier_prefix_definition:
+            prefix_def = f'#define _BARECTF_PREFIX {self._iden_prefix}'
 
-        if self._cfg.options.gen_prefix_def:
-            prefix_def = '#define _BARECTF_PREFIX {}'.format(self._cfg.prefix)
+        def_stream_type = cg_opts.default_stream_type
 
-        if self._cfg.options.gen_default_stream_def and self._cfg.metadata.default_stream_name is not None:
-            default_stream_def = '#define _BARECTF_DEFAULT_STREAM {}'.format(self._cfg.metadata.default_stream_name)
+        if header_opts.default_stream_type_name_definition and def_stream_type is not None:
+            def_stream_type_name_def = f'#define _BARECTF_DEFAULT_STREAM {def_stream_type.name}'
 
-        default_stream_trace_defs = ''
-        default_stream_name = self._cfg.metadata.default_stream_name
+        def_stream_type_trace_defs = ''
 
-        if default_stream_name is not None:
-            default_stream = self._cfg.metadata.streams[default_stream_name]
+        if def_stream_type is not None:
             lines = []
 
-            for ev_name in default_stream.events.keys():
-                tmpl = templates._DEFINE_DEFAULT_STREAM_TRACE
-                define = tmpl.format(prefix=self._cfg.prefix,
-                                     sname=default_stream_name,
-                                     evname=ev_name)
+            for ev_type in def_stream_type.event_types:
+                tmpl = barectf_templates._DEFINE_DEFAULT_STREAM_TRACE
+                define = tmpl.format(prefix=self._iden_prefix, sname=def_stream_type.name,
+                                     evname=ev_type.name)
                 lines.append(define)
 
-            default_stream_trace_defs = '\n'.join(lines)
+            def_stream_type_trace_defs = '\n'.join(lines)
 
-        tmpl = templates._HEADER_BEGIN
-        self._cg.add_lines(tmpl.format(prefix=self._cfg.prefix,
-                                       ucprefix=self._cfg.prefix.upper(),
-                                       bitfield_header_filename=bh_filename,
-                                       version=barectf.__version__, date=dt,
+        tmpl = barectf_templates._HEADER_BEGIN
+        self._cg.add_lines(tmpl.format(prefix=self._iden_prefix,
+                                       ucprefix=self._iden_prefix.upper(),
+                                       bitfield_header_filename=bitfield_header_name,
+                                       version=barectf_version.__version__, date=dt,
                                        prefix_def=prefix_def,
-                                       default_stream_def=default_stream_def,
-                                       default_stream_trace_defs=default_stream_trace_defs))
+                                       default_stream_def=def_stream_type_name_def,
+                                       default_stream_trace_defs=def_stream_type_trace_defs))
         self._cg.add_empty_line()
 
         # platform callbacks structure
@@ -464,414 +460,372 @@ class CCodeGenerator:
         self._punctuate_proto()
         self._cg.add_empty_line()
 
-        for stream in self._cfg.metadata.streams.values():
-            self._generate_func_open_proto(stream)
+        for stream_type in self._trace_type.stream_types:
+            self._generate_func_open_proto(stream_type)
             self._punctuate_proto()
             self._cg.add_empty_line()
-            self._generate_func_close_proto(stream)
+            self._generate_func_close_proto(stream_type)
             self._punctuate_proto()
             self._cg.add_empty_line()
 
-            for ev in stream.events.values():
-                self._generate_func_trace_proto(stream, ev)
+            for ev_type in stream_type.event_types:
+                self._generate_func_trace_proto(stream_type, ev_type)
                 self._punctuate_proto()
                 self._cg.add_empty_line()
 
-        tmpl = templates._HEADER_END
-        self._cg.add_lines(tmpl.format(ucprefix=self._cfg.prefix.upper()))
-
+        tmpl = barectf_templates._HEADER_END
+        self._cg.add_lines(tmpl.format(ucprefix=self._iden_prefix.upper()))
         return self._cg.code
 
-    def _get_call_event_param_list_from_struct(self, t, prefix, exclude_list):
+    def _get_call_event_param_list_from_struct_ft(self, ft, prefix, exclude_set=None):
+        if exclude_set is None:
+            exclude_set = set()
+
         lst = ''
 
-        for field_name in t.fields:
-            if field_name in exclude_list:
+        for member_name in ft.members:
+            if member_name in exclude_set:
                 continue
 
-            lst += ', {}{}'.format(prefix, field_name)
+            lst += f', {prefix}{member_name}'
 
         return lst
 
-    def _get_call_event_param_list(self, stream, event):
+    def _get_call_event_param_list(self, stream_type, ev_type):
         lst = ''
-        gcp_func = self._get_call_event_param_list_from_struct
 
-        if stream.event_header_type is not None:
-            exclude_list = [
-                'id',
-                'timestamp',
-            ]
-            lst += gcp_func(stream.event_header_type, _PREFIX_SEH, exclude_list)
+        if stream_type._ev_header_ft is not None:
+            lst += self._get_call_event_param_list_from_struct_ft(stream_type._ev_header_ft,
+                                                                  _PREFIX_SEH, {'id', 'timestamp'})
 
-        if stream.event_context_type is not None:
-            lst += gcp_func(stream.event_context_type, _PREFIX_SEC, [])
+        if stream_type.event_common_context_field_type is not None:
+            lst += self._get_call_event_param_list_from_struct_ft(stream_type.event_common_context_field_type,
+                                                                  _PREFIX_SEC)
 
-        if event.context_type is not None:
-            lst += gcp_func(event.context_type, _PREFIX_EC, [])
+        if ev_type.specific_context_field_type is not None:
+            lst += self._get_call_event_param_list_from_struct_ft(ev_type.specific_context_field_type,
+                                                                  _PREFIX_EC)
 
-        if event.payload_type is not None:
-            lst += gcp_func(event.payload_type, _PREFIX_EP, [])
+        if ev_type.payload_field_type is not None:
+            lst += self._get_call_event_param_list_from_struct_ft(ev_type.payload_field_type,
+                                                                  _PREFIX_EP)
 
         return lst
 
     def _generate_align(self, at, align):
-        self._cg.add_line('_ALIGN({}, {});'.format(at, align))
-
-    def _generate_align_type(self, at, t):
-        if t.align == 1:
-            return
-
-        self._generate_align(at, t.align)
+        self._cg.add_line(f'_ALIGN({at}, {align});')
 
     def _generate_incr_pos(self, var, value):
-        self._cg.add_line('{} += {};'.format(var, value))
+        self._cg.add_line(f'{var} += {value};')
 
     def _generate_incr_pos_bytes(self, var, value):
-        self._generate_incr_pos(var, '_BYTES_TO_BITS({})'.format(value))
-
-    def _generate_func_get_event_size_proto(self, stream, event):
-        tmpl = templates._FUNC_GET_EVENT_SIZE_PROTO_BEGIN
-        self._cg.add_lines(tmpl.format(prefix=self._cfg.prefix,
-                                       sname=stream.name, evname=event.name))
-        self._generate_func_trace_proto_params(stream, event)
-        tmpl = templates._FUNC_GET_EVENT_SIZE_PROTO_END
+        self._generate_incr_pos(var, f'_BYTES_TO_BITS({value})')
+
+    def _generate_func_get_event_size_proto(self, stream_type, ev_type):
+        tmpl = barectf_templates._FUNC_GET_EVENT_SIZE_PROTO_BEGIN
+        self._cg.add_lines(tmpl.format(prefix=self._iden_prefix, sname=stream_type.name,
+                                       evname=ev_type.name))
+        self._generate_func_trace_proto_params(stream_type, ev_type)
+        tmpl = barectf_templates._FUNC_GET_EVENT_SIZE_PROTO_END
         self._cg.add_lines(tmpl)
 
-    def _generate_func_get_event_size(self, stream, event):
-        self._generate_func_get_event_size_proto(stream, event)
-        tmpl = templates._FUNC_GET_EVENT_SIZE_BODY_BEGIN
-        lines = tmpl.format(prefix=self._cfg.prefix)
+    def _generate_func_get_event_size(self, stream_type, ev_type):
+        self._generate_func_get_event_size_proto(stream_type, ev_type)
+        tmpl = barectf_templates._FUNC_GET_EVENT_SIZE_BODY_BEGIN
+        lines = tmpl.format(prefix=self._iden_prefix)
         self._cg.add_lines(lines)
         self._cg.add_empty_line()
         self._cg.indent()
         ser_actions = _SerializationActions()
-        ser_actions.append_root_scope_type(stream.event_header_type,
-                                            _PREFIX_SEH)
-        ser_actions.append_root_scope_type(stream.event_context_type,
-                                            _PREFIX_SEC)
-        ser_actions.append_root_scope_type(event.context_type, _PREFIX_EC)
-        ser_actions.append_root_scope_type(event.payload_type, _PREFIX_EP)
+        ser_actions.append_root_scope_ft(stream_type._ev_header_ft, _PREFIX_SEH)
+        ser_actions.append_root_scope_ft(stream_type.event_common_context_field_type, _PREFIX_SEC)
+        ser_actions.append_root_scope_ft(ev_type.specific_context_field_type, _PREFIX_EC)
+        ser_actions.append_root_scope_ft(ev_type.payload_field_type, _PREFIX_EP)
 
         for action in ser_actions.actions:
             if type(action) is _AlignSerializationAction:
                 if action.names:
                     if len(action.names) == 1:
-                        line = 'align {} structure'.format(_PREFIX_TO_NAME[action.names[0]])
+                        line = f'align {_PREFIX_TO_NAME[action.names[0]]} structure'
                     else:
-                        fmt = 'align field `{}` ({})'
-                        line = fmt.format(action.names[-1],
-                                          _PREFIX_TO_NAME[action.names[0]])
+                        line = f'align field `{action.names[-1]}` ({_PREFIX_TO_NAME[action.names[0]]})'
 
                     self._cg.add_cc_line(line)
 
                 self._generate_align('at', action.value)
                 self._cg.add_empty_line()
-            elif type(action) is _SerializeSerializationAction:
+            else:
+                assert type(action) is _SerializeSerializationAction
                 assert(len(action.names) >= 2)
-                fmt = 'add size of field `{}` ({})'
-                line = fmt.format(action.names[-1], _PREFIX_TO_NAME[action.names[0]])
+                line = f'add size of field `{action.names[-1]}` ({_PREFIX_TO_NAME[action.names[0]]})'
                 self._cg.add_cc_line(line)
 
-                if type(action.type) is metadata.String:
+                if type(action.ft) is barectf_config.StringFieldType:
                     param = ''.join(action.names)
-                    self._generate_incr_pos_bytes('at',
-                                                  'strlen({}) + 1'.format(param))
+                    self._generate_incr_pos_bytes('at', f'strlen({param}) + 1')
                 else:
-                    self._generate_incr_pos('at', action.type.size)
+                    self._generate_incr_pos('at', action.ft.size)
 
                 self._cg.add_empty_line()
 
         self._cg.unindent()
-        tmpl = templates._FUNC_GET_EVENT_SIZE_BODY_END
+        tmpl = barectf_templates._FUNC_GET_EVENT_SIZE_BODY_END
         self._cg.add_lines(tmpl)
 
-    def _generate_func_serialize_event_proto(self, stream, event):
-        tmpl = templates._FUNC_SERIALIZE_EVENT_PROTO_BEGIN
-        self._cg.add_lines(tmpl.format(prefix=self._cfg.prefix,
-                                       sname=stream.name, evname=event.name))
-        self._generate_func_trace_proto_params(stream, event)
-        tmpl = templates._FUNC_SERIALIZE_EVENT_PROTO_END
+    def _generate_func_serialize_event_proto(self, stream_type, ev_type):
+        tmpl = barectf_templates._FUNC_SERIALIZE_EVENT_PROTO_BEGIN
+        self._cg.add_lines(tmpl.format(prefix=self._iden_prefix, sname=stream_type.name,
+                                       evname=ev_type.name))
+        self._generate_func_trace_proto_params(stream_type, ev_type)
+        tmpl = barectf_templates._FUNC_SERIALIZE_EVENT_PROTO_END
         self._cg.add_lines(tmpl)
 
-    def _generate_bitfield_write(self, ctype, var, ctx, action):
-        ptr = '&{ctx}->buf[_BITS_TO_BYTES({ctx}->at)]'.format(ctx=ctx)
-        start = action.offset_in_byte
-        suffix = 'le' if action.type.byte_order is metadata.ByteOrder.LE else 'be'
-        func = '{}bt_bitfield_write_{}'.format(self._cfg.prefix, suffix)
-        call_fmt = '{func}({ptr}, uint8_t, {start}, {size}, {ctype}, ({ctype}) {var});'
-        call = call_fmt.format(func=func, ptr=ptr, start=start,
-                               size=action.type.size, ctype=ctype, var=var)
-        self._cg.add_line(call)
-
-    def _generate_serialize_int(self, var, ctx, action):
-        ctype = self._get_int_ctype(action.type)
-        self._generate_bitfield_write(ctype, var, ctx, action)
-        self._generate_incr_pos('{}->at'.format(ctx), action.type.size)
-
-    def _generate_serialize_float(self, var, ctx, action):
-        ctype = self._get_type_ctype(action.type)
-        flt_dbl = False
-
-        if ctype == 'float' or ctype == 'double':
-            flt_dbl = True
-
-            if ctype == 'float':
-                union_name = 'f2u'
-                int_ctype = 'uint32_t'
-            elif ctype == 'double':
-                union_name = 'd2u'
-                int_ctype = 'uint64_t'
-
-            # union for reading the bytes of the floating point number
-            self._cg.add_empty_line()
-            self._cg.add_line('{')
-            self._cg.indent()
-            self._cg.add_line('union {name} {name};'.format(name=union_name))
-            self._cg.add_empty_line()
-            self._cg.add_line('{}.f = {};'.format(union_name, var))
-            bf_var = '{}.u'.format(union_name)
-        else:
-            bf_var = '({}) {}'.format(ctype, var)
-            int_ctype = ctype
+    def _generate_serialize_from_action(self, var, ctx, action):
+        def gen_bitfield_write(c_type, var, ctx, action):
+            ptr = f'&{ctx}->buf[_BITS_TO_BYTES({ctx}->at)]'
+            start = action.offset_in_byte
+            suffix = 'le' if action.ft.byte_order is barectf_config.ByteOrder.LITTLE_ENDIAN else 'be'
+            func = f'{self._iden_prefix}bt_bitfield_write_{suffix}'
+            call = f'{func}({ptr}, uint8_t, {start}, {action.ft.size}, {c_type}, ({c_type}) {var});'
+            self._cg.add_line(call)
+
+        def gen_serialize_int(var, ctx, action):
+            c_type = self._get_ft_c_type(action.ft)
+            gen_bitfield_write(c_type, var, ctx, action)
+            self._generate_incr_pos(f'{ctx}->at', action.ft.size)
+
+        def gen_serialize_real(var, ctx, action):
+            c_type = self._get_ft_c_type(action.ft)
+            flt_dbl = False
+
+            if c_type == 'float' or c_type == 'double':
+                flt_dbl = True
+
+                if c_type == 'float':
+                    union_name = 'f2u'
+                    int_c_type = 'uint32_t'
+                else:
+                    assert c_type == 'double'
+                    union_name = 'd2u'
+                    int_c_type = 'uint64_t'
 
-        self._generate_bitfield_write(int_ctype, bf_var, ctx, action)
+                # union for reading the bytes of the floating point number
+                self._cg.add_empty_line()
+                self._cg.add_line('{')
+                self._cg.indent()
+                self._cg.add_line(f'union {union_name} {union_name};')
+                self._cg.add_empty_line()
+                self._cg.add_line(f'{union_name}.f = {var};')
+                bf_var = f'{union_name}.u'
+            else:
+                bf_var = f'({c_type}) {var}'
+                int_c_type = c_type
 
-        if flt_dbl:
-            self._cg.unindent()
-            self._cg.add_line('}')
-            self._cg.add_empty_line()
+            gen_bitfield_write(int_c_type, bf_var, ctx, action)
 
-        self._generate_incr_pos('{}->at'.format(ctx), action.type.size)
+            if flt_dbl:
+                self._cg.unindent()
+                self._cg.add_line('}')
+                self._cg.add_empty_line()
 
-    def _generate_serialize_enum(self, var, ctx, action):
-        sub_action = _SerializeSerializationAction(action.offset_in_byte,
-                                                   action.type.value_type,
-                                                   action.names)
-        self._generate_serialize_from_action(var, ctx, sub_action)
+            self._generate_incr_pos(f'{ctx}->at', action.ft.size)
 
-    def _generate_serialize_string(self, var, ctx, action):
-        tmpl = '_write_cstring({}, {});'.format(ctx, var)
-        self._cg.add_lines(tmpl)
+        def gen_serialize_string(var, ctx, action):
+            self._cg.add_lines(f'_write_cstring({ctx}, {var});')
 
-    def _generate_serialize_from_action(self, var, ctx, action):
-        func = self._type_to_generate_serialize_func[type(action.type)]
-        func(var, ctx, action)
+        if isinstance(action.ft, barectf_config._IntegerFieldType):
+            return gen_serialize_int(var, ctx, action)
+        elif type(action.ft) is barectf_config.RealFieldType:
+            return gen_serialize_real(var, ctx, action)
+        else:
+            assert type(action.ft) is barectf_config.StringFieldType
+            return gen_serialize_string(var, ctx, action)
 
-    def _generate_serialize_statements_from_actions(self, prefix, action_iter,
-                                                    spec_src=None):
+    def _generate_serialize_statements_from_actions(self, prefix, action_iter, spec_src=None):
         for action in action_iter:
             if type(action) is _AlignSerializationAction:
                 if action.names:
                     if len(action.names) == 1:
-                        line = 'align {} structure'.format(_PREFIX_TO_NAME[action.names[0]])
+                        line = f'align {_PREFIX_TO_NAME[action.names[0]]} structure'
                     else:
-                        fmt = 'align field `{}` ({})'
-                        line = fmt.format(action.names[-1],
-                                          _PREFIX_TO_NAME[action.names[0]])
+                        line = f'align field `{action.names[-1]}` ({_PREFIX_TO_NAME[action.names[0]]})'
 
                     self._cg.add_cc_line(line)
 
                 self._generate_align('ctx->at', action.value)
                 self._cg.add_empty_line()
-            elif type(action) is _SerializeSerializationAction:
+            else:
+                assert type(action) is _SerializeSerializationAction
                 assert(len(action.names) >= 2)
-                fmt = 'serialize field `{}` ({})'
-                line = fmt.format(action.names[-1],
-                                  _PREFIX_TO_NAME[action.names[0]])
+                member_name = action.names[-1]
+                line = f'serialize field `{member_name}` ({_PREFIX_TO_NAME[action.names[0]]})'
                 self._cg.add_cc_line(line)
-                field_name = action.names[-1]
-                src = prefix + field_name
+                src = prefix + member_name
 
-                if spec_src is not None and field_name in spec_src:
-                    src = spec_src[field_name]
+                if spec_src is not None and member_name in spec_src:
+                    src = spec_src[member_name]
 
                 self._generate_serialize_from_action(src, 'ctx', action)
                 self._cg.add_empty_line()
 
-    def _generate_func_serialize_event(self, stream, event, orig_ser_actions):
-        self._generate_func_serialize_event_proto(stream, event)
-        tmpl = templates._FUNC_SERIALIZE_EVENT_BODY_BEGIN
-        lines = tmpl.format(prefix=self._cfg.prefix)
+    def _generate_func_serialize_event(self, stream_type, ev_type, orig_ser_actions):
+        self._generate_func_serialize_event_proto(stream_type, ev_type)
+        tmpl = barectf_templates._FUNC_SERIALIZE_EVENT_BODY_BEGIN
+        lines = tmpl.format(prefix=self._iden_prefix)
         self._cg.add_lines(lines)
         self._cg.indent()
         self._cg.add_empty_line()
 
-        if stream.event_header_type is not None:
-            t = stream.event_header_type
-            exclude_list = ['timestamp', 'id']
-            params = self._get_call_event_param_list_from_struct(t, _PREFIX_SEH,
-                                                                 exclude_list)
-            tmpl = '_serialize_stream_event_header_{sname}(ctx, {evid}{params});'
+        if stream_type._ev_header_ft is not None:
+            params = self._get_call_event_param_list_from_struct_ft(stream_type._ev_header_ft,
+                                                                    _PREFIX_SEH,
+                                                                    {'timestamp', 'id'})
             self._cg.add_cc_line('stream event header')
-            self._cg.add_line(tmpl.format(sname=stream.name, evid=event.id,
-                                          params=params))
+            line = f'_serialize_stream_event_header_{stream_type.name}(ctx, {ev_type.id}{params});'
+            self._cg.add_line(line)
             self._cg.add_empty_line()
 
-        if stream.event_context_type is not None:
-            t = stream.event_context_type
-            params = self._get_call_event_param_list_from_struct(t, _PREFIX_SEC,
-                                                                 [])
-            tmpl = '_serialize_stream_event_context_{sname}(ctx{params});'
+        if stream_type.event_common_context_field_type is not None:
+            params = self._get_call_event_param_list_from_struct_ft(stream_type.event_common_context_field_type,
+                                                                    _PREFIX_SEC)
             self._cg.add_cc_line('stream event context')
-            self._cg.add_line(tmpl.format(sname=stream.name, params=params))
+            line = f'_serialize_stream_event_context_{stream_type.name}(ctx{params});'
+            self._cg.add_line(line)
             self._cg.add_empty_line()
 
-        if event.context_type is not None or event.payload_type is not None:
+        if ev_type.specific_context_field_type is not None or ev_type.payload_field_type is not None:
             ser_actions = copy.deepcopy(orig_ser_actions)
 
-        if event.context_type is not None:
+        if ev_type.specific_context_field_type is not None:
             ser_action_index = len(ser_actions.actions)
-            ser_actions.append_root_scope_type(event.context_type, _PREFIX_EC)
-            ser_action_iter = itertools.islice(ser_actions.actions,
-                                               ser_action_index, None)
-            self._generate_serialize_statements_from_actions(_PREFIX_EC,
-                                                             ser_action_iter)
+            ser_actions.append_root_scope_ft(ev_type.specific_context_field_type, _PREFIX_EC)
+            ser_action_iter = itertools.islice(ser_actions.actions, ser_action_index, None)
+            self._generate_serialize_statements_from_actions(_PREFIX_EC, ser_action_iter)
 
-        if event.payload_type is not None:
+        if ev_type.payload_field_type is not None:
             ser_action_index = len(ser_actions.actions)
-            ser_actions.append_root_scope_type(event.payload_type, _PREFIX_EP)
-            ser_action_iter = itertools.islice(ser_actions.actions,
-                                               ser_action_index, None)
-            self._generate_serialize_statements_from_actions(_PREFIX_EP,
-                                                             ser_action_iter)
+            ser_actions.append_root_scope_ft(ev_type.payload_field_type, _PREFIX_EP)
+            ser_action_iter = itertools.islice(ser_actions.actions, ser_action_index, None)
+            self._generate_serialize_statements_from_actions(_PREFIX_EP, ser_action_iter)
 
         self._cg.unindent()
-        tmpl = templates._FUNC_SERIALIZE_EVENT_BODY_END
+        tmpl = barectf_templates._FUNC_SERIALIZE_EVENT_BODY_END
         self._cg.add_lines(tmpl)
 
-    def _generate_func_serialize_stream_event_header_proto(self, stream):
-        tmpl = templates._FUNC_SERIALIZE_STREAM_EVENT_HEADER_PROTO_BEGIN
-        clock_ctype = 'const int'
-        self._cg.add_lines(tmpl.format(prefix=self._cfg.prefix,
-                                       sname=stream.name))
+    def _generate_func_serialize_event_header_proto(self, stream_type):
+        tmpl = barectf_templates._FUNC_SERIALIZE_STREAM_EVENT_HEADER_PROTO_BEGIN
+        self._cg.add_lines(tmpl.format(prefix=self._iden_prefix, sname=stream_type.name))
 
-        if stream.event_header_type is not None:
-            exclude_list = [
-                'id',
-                'timestamp',
-            ]
-            self._generate_proto_params(stream.event_header_type,
-                                        _PREFIX_SEH, exclude_list)
+        if stream_type._ev_header_ft is not None:
+            self._generate_proto_params(stream_type._ev_header_ft, _PREFIX_SEH,
+                                        {'id', 'timestamp'})
 
-        tmpl = templates._FUNC_SERIALIZE_STREAM_EVENT_HEADER_PROTO_END
+        tmpl = barectf_templates._FUNC_SERIALIZE_STREAM_EVENT_HEADER_PROTO_END
         self._cg.add_lines(tmpl)
 
-    def _generate_func_serialize_stream_event_context_proto(self, stream):
-        tmpl = templates._FUNC_SERIALIZE_STREAM_EVENT_CONTEXT_PROTO_BEGIN
-        self._cg.add_lines(tmpl.format(prefix=self._cfg.prefix,
-                                       sname=stream.name))
+    def _generate_func_serialize_event_common_context_proto(self, stream_type):
+        tmpl = barectf_templates._FUNC_SERIALIZE_STREAM_EVENT_CONTEXT_PROTO_BEGIN
+        self._cg.add_lines(tmpl.format(prefix=self._iden_prefix, sname=stream_type.name))
 
-        if stream.event_context_type is not None:
-            self._generate_proto_params(stream.event_context_type,
-                                        _PREFIX_SEC, [])
+        if stream_type.event_common_context_field_type is not None:
+            self._generate_proto_params(stream_type.event_common_context_field_type, _PREFIX_SEC)
 
-        tmpl = templates._FUNC_SERIALIZE_STREAM_EVENT_CONTEXT_PROTO_END
+        tmpl = barectf_templates._FUNC_SERIALIZE_STREAM_EVENT_CONTEXT_PROTO_END
         self._cg.add_lines(tmpl)
 
-    def _generate_func_serialize_stream_event_header(self, stream,
-                                                     ser_action_iter):
-        self._generate_func_serialize_stream_event_header_proto(stream)
-        tmpl = templates._FUNC_SERIALIZE_STREAM_EVENT_HEADER_BODY_BEGIN
-        lines = tmpl.format(prefix=self._cfg.prefix, sname=stream.name)
+    def _generate_func_serialize_event_header(self, stream_type, ser_action_iter):
+        self._generate_func_serialize_event_header_proto(stream_type)
+        tmpl = barectf_templates._FUNC_SERIALIZE_STREAM_EVENT_HEADER_BODY_BEGIN
+        lines = tmpl.format(prefix=self._iden_prefix, sname=stream_type.name)
         self._cg.add_lines(lines)
         self._cg.indent()
-        clock = self._get_stream_clock(stream)
 
-        if clock is not None:
-            tmpl = 'struct {prefix}{sname}_ctx *s_ctx = FROM_VOID_PTR(struct {prefix}{sname}_ctx, vctx);'
-            line = tmpl.format(prefix=self._cfg.prefix,
-                               sname=stream.name)
+        if stream_type.default_clock_type is not None:
+            line = f'struct {self._iden_prefix}{stream_type.name}_ctx *s_ctx = FROM_VOID_PTR(struct {self._iden_prefix}{stream_type.name}_ctx, vctx);'
             self._cg.add_line(line)
-            tmpl = 'const {} ts = s_ctx->cur_last_event_ts;'
-            line = tmpl.format(clock.return_ctype)
+            line = f'const {self._clk_type_c_type(stream_type.default_clock_type)} ts = s_ctx->cur_last_event_ts;'
             self._cg.add_line(line)
 
         self._cg.add_empty_line()
 
-        if stream.event_header_type is not None:
+        if stream_type._ev_header_ft is not None:
             spec_src = {}
+            member_name = 'id'
+            member = stream_type._ev_header_ft.members.get(member_name)
+
+            if member is not None:
+                spec_src[member_name] = f'({self._get_ft_c_type(member.field_type)}) event_id'
 
-            if 'id' in stream.event_header_type.fields:
-                id_t = stream.event_header_type.fields['id']
-                id_t_ctype = self._get_int_ctype(id_t)
-                spec_src['id'] = '({}) event_id'.format(id_t_ctype)
+            member_name = 'timestamp'
+            member = stream_type._ev_header_ft.members.get(member_name)
 
-            if 'timestamp' in stream.event_header_type.fields:
-                field = stream.event_header_type.fields['timestamp']
-                ts_ctype = self._get_int_ctype(field)
-                spec_src['timestamp'] = '({}) ts'.format(ts_ctype)
+            if member is not None:
+                spec_src[member_name] = f'({self._get_ft_c_type(member.field_type)}) ts'
 
-            self._generate_serialize_statements_from_actions(_PREFIX_SEH,
-                                                             ser_action_iter,
+            self._generate_serialize_statements_from_actions(_PREFIX_SEH, ser_action_iter,
                                                              spec_src)
 
         self._cg.unindent()
-        tmpl = templates._FUNC_SERIALIZE_STREAM_EVENT_HEADER_BODY_END
+        tmpl = barectf_templates._FUNC_SERIALIZE_STREAM_EVENT_HEADER_BODY_END
         self._cg.add_lines(tmpl)
 
-    def _generate_func_serialize_stream_event_context(self, stream,
-                                                      ser_action_iter):
-        self._generate_func_serialize_stream_event_context_proto(stream)
-        tmpl = templates._FUNC_SERIALIZE_STREAM_EVENT_CONTEXT_BODY_BEGIN
-        lines = tmpl.format(prefix=self._cfg.prefix)
+    def _generate_func_serialize_event_common_context(self, stream_type, ser_action_iter):
+        self._generate_func_serialize_event_common_context_proto(stream_type)
+        tmpl = barectf_templates._FUNC_SERIALIZE_STREAM_EVENT_CONTEXT_BODY_BEGIN
+        lines = tmpl.format(prefix=self._iden_prefix)
         self._cg.add_lines(lines)
         self._cg.indent()
 
-        if stream.event_context_type is not None:
-            self._generate_serialize_statements_from_actions(_PREFIX_SEC,
-                                                             ser_action_iter)
+        if stream_type.event_common_context_field_type is not None:
+            self._generate_serialize_statements_from_actions(_PREFIX_SEC, ser_action_iter)
 
         self._cg.unindent()
-        tmpl = templates._FUNC_SERIALIZE_STREAM_EVENT_CONTEXT_BODY_END
+        tmpl = barectf_templates._FUNC_SERIALIZE_STREAM_EVENT_CONTEXT_BODY_END
         self._cg.add_lines(tmpl)
 
-    def _generate_func_trace(self, stream, event):
-        self._generate_func_trace_proto(stream, event)
-        params = self._get_call_event_param_list(stream, event)
-        clock = self._get_stream_clock(stream)
+    def _generate_func_trace(self, stream_type, ev_type):
+        self._generate_func_trace_proto(stream_type, ev_type)
+        params = self._get_call_event_param_list(stream_type, ev_type)
+        def_clk_type = stream_type.default_clock_type
 
-        if clock is not None:
-            tmpl = 'ctx->cur_last_event_ts = ctx->parent.cbs.{}_clock_get_value(ctx->parent.data);'
-            save_ts_line = tmpl.format(clock.name)
+        if def_clk_type is not None:
+            save_ts_line = f'ctx->cur_last_event_ts = ctx->parent.cbs.{def_clk_type.name}_clock_get_value(ctx->parent.data);'
         else:
             save_ts_line = '/* (no clock) */'
 
-        tmpl = templates._FUNC_TRACE_BODY
-        self._cg.add_lines(tmpl.format(sname=stream.name, evname=event.name,
-                                       params=params, save_ts=save_ts_line))
+        tmpl = barectf_templates._FUNC_TRACE_BODY
+        self._cg.add_lines(tmpl.format(sname=stream_type.name, evname=ev_type.name, params=params,
+                                       save_ts=save_ts_line))
 
     def _generate_func_init(self):
         self._generate_func_init_proto()
-        tmpl = templates._FUNC_INIT_BODY
-        self._cg.add_lines(tmpl.format(prefix=self._cfg.prefix))
+        tmpl = barectf_templates._FUNC_INIT_BODY
+        self._cg.add_lines(tmpl.format(prefix=self._iden_prefix))
 
-    def _generate_field_name_cc_line(self, field_name):
-        self._cg.add_cc_line('`{}` field'.format(field_name))
+    def _generate_member_name_cc_line(self, member_name):
+        self._cg.add_cc_line(f'`{member_name}` field')
 
     def _save_serialization_action(self, name, action):
         self._saved_serialization_actions[name] = action
 
-    def _get_open_close_ts_line(self, stream):
-        clock = self._get_stream_clock(stream)
+    def _get_open_close_ts_line(self, stream_type):
+        def_clk_type = stream_type.default_clock_type
 
-        if clock is None:
+        if def_clk_type is None:
             return ''
 
-        tmpl = '\tconst {} ts = ctx->parent.use_cur_last_event_ts ? ctx->cur_last_event_ts : ctx->parent.cbs.{}_clock_get_value(ctx->parent.data);'
-        line = tmpl.format(clock.return_ctype, clock.name)
-        return line
+        c_type = self._clk_type_c_type(def_clk_type)
+        return f'\tconst {c_type} ts = ctx->parent.use_cur_last_event_ts ? ctx->cur_last_event_ts : ctx->parent.cbs.{def_clk_type.name}_clock_get_value(ctx->parent.data);'
 
-    def _generate_func_open(self, stream):
+    def _generate_func_open(self, stream_type):
         def generate_save_offset(name, action):
-            tmpl = 'ctx->off_spc_{} = ctx->parent.at;'.format(name)
-            self._cg.add_line(tmpl)
+            self._cg.add_line(f'ctx->off_spc_{name} = ctx->parent.at;')
             self._save_serialization_action(name, action)
 
-        self._generate_func_open_proto(stream)
-        tmpl = templates._FUNC_OPEN_BODY_BEGIN
-        spc_type = stream.packet_context_type
-        ts_line = self._get_open_close_ts_line(stream)
+        self._generate_func_open_proto(stream_type)
+        tmpl = barectf_templates._FUNC_OPEN_BODY_BEGIN
+        pkt_ctx_ft = stream_type._pkt_ctx_ft
+        ts_line = self._get_open_close_ts_line(stream_type)
         lines = tmpl.format(ts=ts_line)
         self._cg.add_lines(lines)
         self._cg.indent()
@@ -884,15 +838,15 @@ class CCodeGenerator:
         self._cg.add_line('}')
         self._cg.add_empty_line()
         self._cg.add_line('ctx->parent.at = 0;')
-        tph_type = self._cfg.metadata.trace.packet_header_type
+        pkt_header_ft = self._trace_type._pkt_header_ft
         ser_actions = _SerializationActions()
 
-        if tph_type is not None:
+        if pkt_header_ft is not None:
             self._cg.add_empty_line()
             self._cg.add_cc_line('trace packet header')
             self._cg.add_line('{')
             self._cg.indent()
-            ser_actions.append_root_scope_type(tph_type, _PREFIX_TPH)
+            ser_actions.append_root_scope_ft(pkt_header_ft, _PREFIX_TPH)
 
             for action in ser_actions.actions:
                 if type(action) is _AlignSerializationAction:
@@ -900,33 +854,32 @@ class CCodeGenerator:
                         if len(action.names) == 1:
                             line = 'align trace packet header structure'
                         else:
-                            line = 'align field `{}`'.format(action.names[-1])
+                            line = f'align field `{action.names[-1]}`'
 
                         self._cg.add_cc_line(line)
 
                     self._generate_align('ctx->parent.at', action.value)
                     self._cg.add_empty_line()
-                elif type(action) is _SerializeSerializationAction:
+                else:
+                    assert type(action) is _SerializeSerializationAction
                     assert(len(action.names) >= 2)
-                    fmt = 'serialize field `{}`'
-                    line = fmt.format(action.names[-1])
+                    member_name = action.names[-1]
+                    line = f'serialize field `{member_name}`'
                     self._cg.add_cc_line(line)
-                    field_name = action.names[-1]
-                    src = _PREFIX_TPH + field_name
+                    src = _PREFIX_TPH + member_name
 
-                    if field_name == 'magic':
+                    if member_name == 'magic':
                         src = '0xc1fc1fc1UL'
-                    elif field_name == 'stream_id':
-                        stream_id_ctype = self._get_int_ctype(action.type)
-                        src = '({}) {}'.format(stream_id_ctype, stream.id)
-                    elif field_name == 'uuid':
+                    elif member_name == 'stream_id':
+                        src = f'({self._get_ft_c_type(action.ft)}) {stream_type.id}'
+                    elif member_name == 'uuid':
                         self._cg.add_line('{')
                         self._cg.indent()
                         self._cg.add_line('static uint8_t uuid[] = {')
                         self._cg.indent()
 
-                        for b in self._cfg.metadata.trace.uuid.bytes:
-                            self._cg.add_line('{},'.format(b))
+                        for b in self._trace_type.uuid.bytes:
+                            self._cg.add_line(f'{b},')
 
                         self._cg.unindent()
                         self._cg.add_line('};')
@@ -947,72 +900,62 @@ class CCodeGenerator:
             self._cg.add_lines('}')
 
         spc_action_index = len(ser_actions.actions)
+        self._cg.add_empty_line()
+        self._cg.add_cc_line('stream packet context')
+        self._cg.add_line('{')
+        self._cg.indent()
+        ser_actions.append_root_scope_ft(pkt_ctx_ft, _PREFIX_SPC)
 
-        if spc_type is not None:
-            self._cg.add_empty_line()
-            self._cg.add_cc_line('stream packet context')
-            self._cg.add_line('{')
-            self._cg.indent()
-            ser_actions.append_root_scope_type(spc_type, _PREFIX_SPC)
-            tmpl_off = 'off_spc_{fname}'
-
-            for action in itertools.islice(ser_actions.actions, spc_action_index, None):
-                if type(action) is _AlignSerializationAction:
-                    if action.names:
-                        if len(action.names) == 1:
-                            line = 'align stream packet context structure'
-                        else:
-                            line = 'align field `{}`'.format(action.names[-1])
-
-                        self._cg.add_cc_line(line)
+        for action in itertools.islice(ser_actions.actions, spc_action_index, None):
+            if type(action) is _AlignSerializationAction:
+                if action.names:
+                    if len(action.names) == 1:
+                        line = 'align stream packet context structure'
+                    else:
+                        line = f'align field `{action.names[-1]}`'
 
-                    self._generate_align('ctx->parent.at', action.value)
-                    self._cg.add_empty_line()
-                elif type(action) is _SerializeSerializationAction:
-                    assert(len(action.names) >= 2)
-                    fmt = 'serialize field `{}`'
-                    line = fmt.format(action.names[-1])
                     self._cg.add_cc_line(line)
-                    field_name = action.names[-1]
-                    src = _PREFIX_SPC + field_name
-                    skip_int = False
-
-                    if field_name == 'timestamp_begin':
-                        ctype = self._get_type_ctype(action.type)
-                        src = '({}) ts'.format(ctype)
-                    elif field_name in ['timestamp_end', 'content_size',
-                                        'events_discarded']:
-                        skip_int = True
-                    elif field_name == 'packet_size':
-                        ctype = self._get_type_ctype(action.type)
-                        src = '({}) ctx->parent.packet_size'.format(ctype)
-
-                    if skip_int:
-                        generate_save_offset(field_name, action)
-                        self._generate_incr_pos('ctx->parent.at',
-                                                action.type.size)
-                    else:
-                        self._generate_serialize_from_action(src, '(&ctx->parent)',
-                                                      action)
 
-                    self._cg.add_empty_line()
+                self._generate_align('ctx->parent.at', action.value)
+                self._cg.add_empty_line()
+            else:
+                assert type(action) is _SerializeSerializationAction
+                assert(len(action.names) >= 2)
+                member_name = action.names[-1]
+                line = f'serialize field `{member_name}`'
+                self._cg.add_cc_line(line)
+                src = _PREFIX_SPC + member_name
+                skip_int = False
+
+                if member_name == 'timestamp_begin':
+                    src = f'({self._get_ft_c_type(action.ft)}) ts'
+                elif member_name in {'timestamp_end', 'content_size', 'events_discarded'}:
+                    skip_int = True
+                elif member_name == 'packet_size':
+                    src = f'({self._get_ft_c_type(action.ft)}) ctx->parent.packet_size'
+
+                if skip_int:
+                    generate_save_offset(member_name, action)
+                    self._generate_incr_pos('ctx->parent.at', action.ft.size)
+                else:
+                    self._generate_serialize_from_action(src, '(&ctx->parent)', action)
 
-            self._cg.unindent()
-            self._cg.add_lines('}')
+                self._cg.add_empty_line()
 
         self._cg.unindent()
-        tmpl = templates._FUNC_OPEN_BODY_END
+        self._cg.add_lines('}')
+        self._cg.unindent()
+        tmpl = barectf_templates._FUNC_OPEN_BODY_END
         self._cg.add_lines(tmpl)
 
-    def _generate_func_close(self, stream):
+    def _generate_func_close(self, stream_type):
         def generate_goto_offset(name):
-            tmpl = 'ctx->parent.at = ctx->off_spc_{};'.format(name)
-            self._cg.add_line(tmpl)
+            self._cg.add_line(f'ctx->parent.at = ctx->off_spc_{name};')
 
-        self._generate_func_close_proto(stream)
-        tmpl = templates._FUNC_CLOSE_BODY_BEGIN
-        spc_type = stream.packet_context_type
-        ts_line = self._get_open_close_ts_line(stream)
+        self._generate_func_close_proto(stream_type)
+        tmpl = barectf_templates._FUNC_CLOSE_BODY_BEGIN
+        pkt_ctx_ft = stream_type._pkt_ctx_ft
+        ts_line = self._get_open_close_ts_line(stream_type)
         lines = tmpl.format(ts=ts_line)
         self._cg.add_lines(lines)
         self._cg.indent()
@@ -1026,98 +969,83 @@ class CCodeGenerator:
         self._cg.add_empty_line()
         self._cg.add_cc_line('save content size')
         self._cg.add_line('ctx->parent.content_size = ctx->parent.at;')
+        member_name = 'timestamp_end'
+        member = pkt_ctx_ft.members.get(member_name)
 
-        if spc_type is not None:
-            field_name = 'timestamp_end'
-
-            if field_name in spc_type.fields:
-                t = spc_type.fields[field_name]
-                ctype = self._get_type_ctype(t)
-                src = '({}) ts'.format(ctype)
-                self._cg.add_empty_line()
-                self._generate_field_name_cc_line(field_name)
-                generate_goto_offset(field_name)
-                action = self._saved_serialization_actions[field_name]
-                self._generate_serialize_from_action(src, '(&ctx->parent)', action)
+        if member is not None:
+            self._cg.add_empty_line()
+            self._generate_member_name_cc_line(member_name)
+            generate_goto_offset(member_name)
+            action = self._saved_serialization_actions[member_name]
+            c_type = self._get_ft_c_type(member.field_type)
+            self._generate_serialize_from_action(f'({c_type}) ts', '(&ctx->parent)', action)
 
-            field_name = 'content_size'
+        member_name = 'content_size'
+        member = pkt_ctx_ft.members.get(member_name)
 
-            if 'content_size' in spc_type.fields:
-                t = spc_type.fields[field_name]
-                ctype = self._get_type_ctype(t)
-                src = '({}) ctx->parent.content_size'.format(ctype)
-                self._cg.add_empty_line()
-                self._generate_field_name_cc_line(field_name)
-                generate_goto_offset(field_name)
-                action = self._saved_serialization_actions[field_name]
-                self._generate_serialize_from_action(src, '(&ctx->parent)', action)
+        if member is not None:
+            self._cg.add_empty_line()
+            self._generate_member_name_cc_line(member_name)
+            generate_goto_offset(member_name)
+            action = self._saved_serialization_actions[member_name]
+            c_type = self._get_ft_c_type(member.field_type)
+            self._generate_serialize_from_action(f'({c_type}) ctx->parent.content_size',
+                                                 '(&ctx->parent)', action)
 
-            field_name = 'events_discarded'
+        member_name = 'events_discarded'
+        member = pkt_ctx_ft.members.get(member_name)
 
-            if field_name in spc_type.fields:
-                t = spc_type.fields[field_name]
-                ctype = self._get_type_ctype(t)
-                src = '({}) ctx->parent.events_discarded'.format(ctype)
-                self._cg.add_empty_line()
-                self._generate_field_name_cc_line(field_name)
-                generate_goto_offset(field_name)
-                action = self._saved_serialization_actions[field_name]
-                self._generate_serialize_from_action(src, '(&ctx->parent)', action)
+        if member is not None:
+            self._cg.add_empty_line()
+            self._generate_member_name_cc_line(member_name)
+            generate_goto_offset(member_name)
+            action = self._saved_serialization_actions[member_name]
+            c_type = self._get_ft_c_type(member.field_type)
+            self._generate_serialize_from_action(f'({c_type}) ctx->parent.events_discarded',
+                                                 '(&ctx->parent)', action)
 
         self._cg.unindent()
-        tmpl = templates._FUNC_CLOSE_BODY_END
+        tmpl = barectf_templates._FUNC_CLOSE_BODY_END
         self._cg.add_lines(tmpl)
 
-    def generate_c_src(self):
+    def generate_c_src(self, header_name):
         self._cg.reset()
         dt = datetime.datetime.now().isoformat()
-        header_filename = self.get_header_filename()
-        tmpl = templates._C_SRC
-        self._cg.add_lines(tmpl.format(prefix=self._cfg.prefix,
-                                       header_filename=header_filename,
-                                       version=barectf.__version__, date=dt))
+        tmpl = barectf_templates._C_SRC
+        self._cg.add_lines(tmpl.format(prefix=self._iden_prefix, header_filename=header_name,
+                                       version=barectf_version.__version__, date=dt))
         self._cg.add_empty_line()
 
         # initialization function
         self._generate_func_init()
         self._cg.add_empty_line()
 
-        for stream in self._cfg.metadata.streams.values():
-            self._generate_func_open(stream)
+        for stream_type in self._trace_type.stream_types:
+            self._generate_func_open(stream_type)
             self._cg.add_empty_line()
-            self._generate_func_close(stream)
+            self._generate_func_close(stream_type)
             self._cg.add_empty_line()
             ser_actions = _SerializationActions()
 
-            if stream.event_header_type is not None:
-                ser_actions.append_root_scope_type(stream.event_header_type,
-                                                   _PREFIX_SEH)
-                self._generate_func_serialize_stream_event_header(stream,
-                                                                  iter(ser_actions.actions))
+            if stream_type._ev_header_ft is not None:
+                ser_actions.append_root_scope_ft(stream_type._ev_header_ft, _PREFIX_SEH)
+                self._generate_func_serialize_event_header(stream_type, iter(ser_actions.actions))
                 self._cg.add_empty_line()
 
-            if stream.event_context_type is not None:
+            if stream_type.event_common_context_field_type is not None:
                 ser_action_index = len(ser_actions.actions)
-                ser_actions.append_root_scope_type(stream.event_context_type,
-                                                   _PREFIX_SEC)
-                ser_action_iter = itertools.islice(ser_actions.actions,
-                                                   ser_action_index, None)
-                self._generate_func_serialize_stream_event_context(stream,
-                                                                   ser_action_iter)
+                ser_actions.append_root_scope_ft(stream_type.event_common_context_field_type,
+                                                 _PREFIX_SEC)
+                ser_action_iter = itertools.islice(ser_actions.actions, ser_action_index, None)
+                self._generate_func_serialize_event_common_context(stream_type, ser_action_iter)
                 self._cg.add_empty_line()
 
-            for ev in stream.events.values():
-                self._generate_func_get_event_size(stream, ev)
+            for ev_type in stream_type.event_types:
+                self._generate_func_get_event_size(stream_type, ev_type)
                 self._cg.add_empty_line()
-                self._generate_func_serialize_event(stream, ev, ser_actions)
+                self._generate_func_serialize_event(stream_type, ev_type, ser_actions)
                 self._cg.add_empty_line()
-                self._generate_func_trace(stream, ev)
+                self._generate_func_trace(stream_type, ev_type)
                 self._cg.add_empty_line()
 
         return self._cg.code
-
-    def get_header_filename(self):
-        return '{}.h'.format(self._cfg.prefix.rstrip('_'))
-
-    def get_bitfield_header_filename(self):
-        return '{}-bitfield.h'.format(self._cfg.prefix.rstrip('_'))
diff --git a/barectf/include/2/lttng-ust-log-levels.yaml b/barectf/include/2/lttng-ust-log-levels.yaml
new file mode 100644 (file)
index 0000000..10d86f3
--- /dev/null
@@ -0,0 +1,23 @@
+# Include this in a metadata object to have access to the LTTng-UST log
+# level aliases.
+#
+# Note that the values from 0 to 7 are compatible with syslog log
+# levels, although the debug severity in syslog is named `DEBUG_SYSTEM`
+# here.
+
+$log-levels:
+  EMERG: 0
+  ALERT: 1
+  CRIT: 2
+  ERR: 3
+  WARNING: 4
+  NOTICE: 5
+  INFO: 6
+  DEBUG_SYSTEM: 7
+  DEBUG_PROGRAM: 8
+  DEBUG_PROCESS: 9
+  DEBUG_MODULE: 10
+  DEBUG_UNIT: 11
+  DEBUG_FUNCTION: 12
+  DEBUG_LINE: 13
+  DEBUG: 14
diff --git a/barectf/include/2/stdfloat.yaml b/barectf/include/2/stdfloat.yaml
new file mode 100644 (file)
index 0000000..fccfb36
--- /dev/null
@@ -0,0 +1,19 @@
+# Include this in a metadata object to have access to basic real field
+# type aliases.
+
+type-aliases:
+  # IEEE 754-2008 binary32 (single-precision)
+  float:
+    class: floating-point
+    size:
+      exp: 8
+      mant: 24
+    align: 32
+
+  # IEEE 754-2008 binary64 (double-precision)
+  double:
+    class: floating-point
+    size:
+      exp: 11
+      mant: 53
+    align: 64
diff --git a/barectf/include/2/stdint.yaml b/barectf/include/2/stdint.yaml
new file mode 100644 (file)
index 0000000..8ce0481
--- /dev/null
@@ -0,0 +1,126 @@
+# Include this in a metadata object to have access to basic integer
+# field type aliases.
+
+type-aliases:
+  # 8-bit unsigned integer, 8-bit aligned
+  uint8:
+    class: int
+    size: 8
+    align: 8
+  byte: uint8
+
+  # 8-bit signed integer, 8-bit aligned
+  int8:
+    $inherit: uint8
+    signed: true
+
+  # 16-bit unsigned integer, 16-bit aligned
+  uint16:
+    class: int
+    size: 16
+    align: 16
+  word: uint16
+
+  # 16-bit signed integer, 16-bit aligned
+  int16:
+    $inherit: uint16
+    signed: true
+
+  # 32-bit unsigned integer, 32-bit aligned
+  uint32:
+    class: int
+    size: 32
+    align: 32
+  dword: uint32
+
+  # 32-bit signed integer, 32-bit aligned
+  int32:
+    $inherit: uint32
+    signed: true
+
+  # 64-bit unsigned integer, 64-bit aligned
+  uint64:
+    class: int
+    size: 64
+    align: 64
+
+  # 64-bit signed integer, 64-bit aligned
+  int64:
+    $inherit: uint64
+    signed: true
+
+  # byte-packed 8-bit unsigned integer
+  byte-packed-uint8: uint8
+
+  # byte-packed 8-bit signed integer
+  byte-packed-int8: int8
+
+  # byte-packed 16-bit unsigned integer
+  byte-packed-uint16:
+    $inherit: uint16
+    align: 8
+
+  # byte-packed 16-bit signed integer
+  byte-packed-int16:
+    $inherit: int16
+    align: 8
+
+  # byte-packed 32-bit unsigned integer
+  byte-packed-uint32:
+    $inherit: uint32
+    align: 8
+
+  # byte-packed 32-bit signed integer
+  byte-packed-int32:
+    $inherit: int32
+    align: 8
+
+  # byte-packed 64-bit unsigned integer
+  byte-packed-uint64:
+    $inherit: uint64
+    align: 8
+
+  # byte-packed 64-bit signed integer
+  byte-packed-int64:
+    $inherit: int64
+    align: 8
+
+  # byte-packed 8-bit unsigned integer
+  bit-packed-uint8:
+    $inherit: uint8
+    align: 1
+
+  # bit-packed 8-bit signed integer
+  bit-packed-int8:
+    $inherit: int8
+    align: 1
+
+  # bit-packed 16-bit unsigned integer
+  bit-packed-uint16:
+    $inherit: uint16
+    align: 1
+
+  # bit-packed 16-bit signed integer
+  bit-packed-int16:
+    $inherit: int16
+    align: 1
+
+  # bit-packed 32-bit unsigned integer
+  bit-packed-uint32:
+    $inherit: uint32
+    align: 1
+
+  # bit-packed 32-bit signed integer
+  bit-packed-int32:
+    $inherit: int32
+    align: 1
+
+  # bit-packed 64-bit unsigned integer
+  bit-packed-uint64:
+    $inherit: uint64
+    align: 1
+
+  # bit-packed 64-bit signed integer
+  bit-packed-int64:
+    $inherit: int64
+    align: 1
diff --git a/barectf/include/2/stdmisc.yaml b/barectf/include/2/stdmisc.yaml
new file mode 100644 (file)
index 0000000..3971718
--- /dev/null
@@ -0,0 +1,21 @@
+# Include this in a metadata object to have access to various,
+# uncategorized field type aliases.
+
+type-aliases:
+  # UUID array
+  uuid:
+    class: array
+    length: 16
+    element-type:
+      class: int
+      size: 8
+
+  # CTF magic number type
+  ctf-magic:
+    class: int
+    size: 32
+    align: 32
+
+  # a simple string
+  string:
+    class: string
diff --git a/barectf/include/2/trace-basic.yaml b/barectf/include/2/trace-basic.yaml
new file mode 100644 (file)
index 0000000..2a8649a
--- /dev/null
@@ -0,0 +1,29 @@
+# Include this in a trace type object to get a default, basic trace type
+# object with a little-endian byte order.
+#
+# The packet header field type contains:
+#
+# * A 32-bit magic number unsigned integer field type.
+# * A UUID static array field type.
+# * An 8-bit stream type ID unsigned integer field type.
+#
+# The trace type's UUID is automatically generated by barectf.
+
+byte-order: le
+uuid: auto
+packet-header-type:
+  class: struct
+  fields:
+    magic:
+      class: int
+      size: 32
+      align: 32
+    uuid:
+      class: array
+      length: 16
+      element-type:
+        class: int
+        size: 8
+    stream_id:
+      class: int
+      size: 8
diff --git a/barectf/include/3/lttng-ust-log-levels.yaml b/barectf/include/3/lttng-ust-log-levels.yaml
new file mode 100644 (file)
index 0000000..7adcc9a
--- /dev/null
@@ -0,0 +1,23 @@
+# Include this in a trace type object to have access to the LTTng-UST
+# log level aliases.
+#
+# Note that the values from 0 to 7 are compatible with syslog log
+# levels, although the debug severity in syslog is named `DEBUG_SYSTEM`
+# here.
+
+$log-level-aliases:
+  EMERG: 0
+  ALERT: 1
+  CRIT: 2
+  ERR: 3
+  WARNING: 4
+  NOTICE: 5
+  INFO: 6
+  DEBUG_SYSTEM: 7
+  DEBUG_PROGRAM: 8
+  DEBUG_PROCESS: 9
+  DEBUG_MODULE: 10
+  DEBUG_UNIT: 11
+  DEBUG_FUNCTION: 12
+  DEBUG_LINE: 13
+  DEBUG: 14
diff --git a/barectf/include/3/stdint.yaml b/barectf/include/3/stdint.yaml
new file mode 100644 (file)
index 0000000..16c7faf
--- /dev/null
@@ -0,0 +1,439 @@
+# Include this in a trace type object to have access to basic integer
+# type aliases.
+
+$field-type-aliases:
+  # 8-bit unsigned integer, 8-bit aligned
+  uint8:
+    class: uint
+    size: 8
+    alignment: 8
+  byte: uint8
+  uint8-le:
+    $inherit: uint8
+    byte-order: le
+  byte-le:
+    $inherit: byte
+    byte-order: le
+  uint8-be:
+    $inherit: uint8
+    byte-order: be
+  byte-be:
+    $inherit: byte
+    byte-order: be
+
+  # 8-bit signed integer, 8-bit aligned
+  sint8:
+    class: sint
+    size: 8
+    alignment: 8
+  int8: sint8
+  sint8-le:
+    $inherit: sint8
+    byte-order: le
+  int8-le:
+    $inherit: int8
+    byte-order: le
+  sint8-be:
+    $inherit: sint8
+    byte-order: be
+  int8-be:
+    $inherit: int8
+    byte-order: be
+
+  # 16-bit unsigned integer, 16-bit aligned
+  uint16:
+    class: uint
+    size: 16
+    alignment: 16
+  word: uint16
+  uint16-le:
+    $inherit: uint16
+    byte-order: le
+  word-le:
+    $inherit: word
+    byte-order: le
+  uint16-be:
+    $inherit: uint16
+    byte-order: be
+  word-be:
+    $inherit: word
+    byte-order: be
+
+  # 16-bit signed integer, 16-bit aligned
+  sint16:
+    class: sint
+    size: 16
+    alignment: 16
+  int16: sint16
+  sint16-le:
+    $inherit: sint16
+    byte-order: le
+  int16-le:
+    $inherit: int16
+    byte-order: le
+  sint16-be:
+    $inherit: sint16
+    byte-order: be
+  int16-be:
+    $inherit: int16
+    byte-order: be
+
+  # 32-bit unsigned integer, 32-bit aligned
+  uint32:
+    class: uint
+    size: 32
+    alignment: 32
+  dword: uint32
+  uint32-le:
+    $inherit: uint32
+    byte-order: le
+  dword-le:
+    $inherit: dword
+    byte-order: le
+  uint32-be:
+    $inherit: uint32
+    byte-order: be
+  dword-be:
+    $inherit: dword
+    byte-order: be
+
+  # 32-bit signed integer, 32-bit aligned
+  sint32:
+    class: sint
+    size: 32
+    alignment: 32
+  int32: sint32
+  sint32-le:
+    $inherit: sint32
+    byte-order: le
+  int32-le:
+    $inherit: int32
+    byte-order: le
+  sint32-be:
+    $inherit: sint32
+    byte-order: be
+  int32-be:
+    $inherit: int32
+    byte-order: be
+
+  # 64-bit unsigned integer, 64-bit aligned
+  uint64:
+    class: uint
+    size: 64
+    alignment: 64
+  qword: uint64
+  uint64-le:
+    $inherit: uint64
+    byte-order: le
+  qword-le:
+    $inherit: qword
+    byte-order: le
+  uint64-be:
+    $inherit: uint64
+    byte-order: be
+  qword-be:
+    $inherit: qword
+    byte-order: be
+
+  # 64-bit signed integer, 64-bit aligned
+  sint64:
+    class: sint
+    size: 64
+    alignment: 64
+  int64: sint64
+  sint64-le:
+    $inherit: sint64
+    byte-order: le
+  int64-le:
+    $inherit: int64
+    byte-order: le
+  sint64-be:
+    $inherit: sint64
+    byte-order: be
+  int64-be:
+    $inherit: int64
+    byte-order: be
+
+  # byte-packed 8-bit unsigned integer
+  byte-packed-uint8: uint8
+  byte-packed-byte: byte-packed-uint8
+  byte-packed-uint8-le:
+    $inherit: byte-packed-uint8
+    byte-order: le
+  byte-packed-byte-le:
+    $inherit: byte-packed-byte
+    byte-order: le
+  byte-packed-uint8-be:
+    $inherit: byte-packed-uint8
+    byte-order: be
+  byte-packed-byte-be:
+    $inherit: byte-packed-byte
+    byte-order: be
+
+  # byte-packed 8-bit signed integer
+  byte-packed-sint8: sint8
+  byte-packed-int8: byte-packed-sint8
+  byte-packed-sint8-le:
+    $inherit: byte-packed-sint8
+    byte-order: le
+  byte-packed-int8-le:
+    $inherit: byte-packed-int8
+    byte-order: le
+  byte-packed-sint8-be:
+    $inherit: byte-packed-sint8
+    byte-order: be
+  byte-packed-int8-be:
+    $inherit: byte-packed-int8
+    byte-order: be
+
+  # byte-packed 16-bit unsigned integer
+  byte-packed-uint16:
+    $inherit: uint16
+    alignment: 8
+  byte-packed-word: byte-packed-uint16
+  byte-packed-uint16-le:
+    $inherit: byte-packed-uint16
+    byte-order: le
+  byte-packed-word-le:
+    $inherit: byte-packed-word
+    byte-order: le
+  byte-packed-uint16-be:
+    $inherit: byte-packed-uint16
+    byte-order: be
+  byte-packed-word-be:
+    $inherit: byte-packed-word
+    byte-order: be
+
+  # byte-packed 16-bit signed integer
+  byte-packed-sint16:
+    $inherit: sint16
+    alignment: 8
+  byte-packed-int16: byte-packed-sint16
+  byte-packed-sint16-le:
+    $inherit: byte-packed-sint16
+    byte-order: le
+  byte-packed-int16-le:
+    $inherit: byte-packed-int16
+    byte-order: le
+  byte-packed-sint16-be:
+    $inherit: byte-packed-sint16
+    byte-order: be
+  byte-packed-int16-be:
+    $inherit: byte-packed-int16
+    byte-order: be
+
+  # byte-packed 32-bit unsigned integer
+  byte-packed-uint32:
+    $inherit: uint32
+    alignment: 8
+  byte-packed-dword: byte-packed-uint32
+  byte-packed-uint32-le:
+    $inherit: byte-packed-uint32
+    byte-order: le
+  byte-packed-dword-le:
+    $inherit: byte-packed-dword
+    byte-order: le
+  byte-packed-uint32-be:
+    $inherit: byte-packed-uint32
+    byte-order: be
+  byte-packed-dword-be:
+    $inherit: byte-packed-dword
+    byte-order: be
+
+  # byte-packed 32-bit signed integer
+  byte-packed-sint32:
+    $inherit: sint32
+    alignment: 8
+  byte-packed-int32: byte-packed-sint32
+  byte-packed-sint32-le:
+    $inherit: byte-packed-sint32
+    byte-order: le
+  byte-packed-int32-le:
+    $inherit: byte-packed-int32
+    byte-order: le
+  byte-packed-sint32-be:
+    $inherit: byte-packed-sint32
+    byte-order: be
+  byte-packed-int32-be:
+    $inherit: byte-packed-int32
+    byte-order: be
+
+  # byte-packed 64-bit unsigned integer
+  byte-packed-uint64:
+    $inherit: uint64
+    alignment: 8
+  byte-packed-qword: byte-packed-uint64
+  byte-packed-uint64-le:
+    $inherit: byte-packed-uint64
+    byte-order: le
+  byte-packed-qword-le:
+    $inherit: byte-packed-qword
+    byte-order: le
+  byte-packed-uint64-be:
+    $inherit: byte-packed-uint64
+    byte-order: be
+  byte-packed-qword-be:
+    $inherit: byte-packed-qword
+    byte-order: be
+
+  # byte-packed 64-bit signed integer
+  byte-packed-sint64:
+    $inherit: sint64
+    alignment: 8
+  byte-packed-int64: byte-packed-sint64
+  byte-packed-sint64-le:
+    $inherit: byte-packed-sint64
+    byte-order: le
+  byte-packed-int64-le:
+    $inherit: byte-packed-int64
+    byte-order: le
+  byte-packed-sint64-be:
+    $inherit: byte-packed-sint64
+    byte-order: be
+  byte-packed-int64-be:
+    $inherit: byte-packed-int64
+    byte-order: be
+
+  # byte-packed 8-bit unsigned integer
+  bit-packed-uint8:
+    $inherit: uint8
+    alignment: 1
+  bit-packed-byte: bit-packed-uint8
+  bit-packed-uint8-le:
+    $inherit: bit-packed-uint8
+    byte-order: le
+  bit-packed-byte-le:
+    $inherit: bit-packed-byte
+    byte-order: le
+  bit-packed-uint8-be:
+    $inherit: bit-packed-uint8
+    byte-order: be
+  bit-packed-byte-be:
+    $inherit: bit-packed-byte
+    byte-order: be
+
+  # bit-packed 8-bit signed integer
+  bit-packed-sint8:
+    $inherit: sint8
+    alignment: 1
+  bit-packed-int8: bit-packed-sint8
+  bit-packed-sint8-le:
+    $inherit: bit-packed-sint8
+    byte-order: le
+  bit-packed-int8-le:
+    $inherit: bit-packed-int8
+    byte-order: le
+  bit-packed-sint8-be:
+    $inherit: bit-packed-sint8
+    byte-order: be
+  bit-packed-int8-be:
+    $inherit: bit-packed-int8
+    byte-order: be
+
+  # bit-packed 16-bit unsigned integer
+  bit-packed-uint16:
+    $inherit: uint16
+    alignment: 1
+  bit-packed-word: bit-packed-uint16
+  bit-packed-uint16-le:
+    $inherit: bit-packed-uint16
+    byte-order: le
+  bit-packed-word-le:
+    $inherit: bit-packed-word
+    byte-order: le
+  bit-packed-uint16-be:
+    $inherit: bit-packed-uint16
+    byte-order: be
+  bit-packed-word-be:
+    $inherit: bit-packed-word
+    byte-order: be
+
+  # bit-packed 16-bit signed integer
+  bit-packed-sint16:
+    $inherit: sint16
+    alignment: 1
+  bit-packed-int16: bit-packed-sint16
+  bit-packed-sint16-le:
+    $inherit: bit-packed-sint16
+    byte-order: le
+  bit-packed-int16-le:
+    $inherit: bit-packed-int16
+    byte-order: le
+  bit-packed-sint16-be:
+    $inherit: bit-packed-sint16
+    byte-order: be
+  bit-packed-int16-be:
+    $inherit: bit-packed-int16
+    byte-order: be
+
+  # bit-packed 32-bit unsigned integer
+  bit-packed-uint32:
+    $inherit: uint32
+    alignment: 1
+  bit-packed-dword: bit-packed-uint32
+  bit-packed-uint32-le:
+    $inherit: bit-packed-uint32
+    byte-order: le
+  bit-packed-dword-le:
+    $inherit: bit-packed-dword
+    byte-order: le
+  bit-packed-uint32-be:
+    $inherit: bit-packed-uint32
+    byte-order: be
+  bit-packed-dword-be:
+    $inherit: bit-packed-dword
+    byte-order: be
+
+  # bit-packed 32-bit signed integer
+  bit-packed-sint32:
+    $inherit: sint32
+    alignment: 1
+  bit-packed-int32: bit-packed-sint32
+  bit-packed-sint32-le:
+    $inherit: bit-packed-sint32
+    byte-order: le
+  bit-packed-int32-le:
+    $inherit: bit-packed-int32
+    byte-order: le
+  bit-packed-sint32-be:
+    $inherit: bit-packed-sint32
+    byte-order: be
+  bit-packed-int32-be:
+    $inherit: bit-packed-int32
+    byte-order: be
+
+  # bit-packed 64-bit unsigned integer
+  bit-packed-uint64:
+    $inherit: uint64
+    alignment: 1
+  bit-packed-qword: bit-packed-uint64
+  bit-packed-uint64-le:
+    $inherit: bit-packed-uint64
+    byte-order: le
+  bit-packed-qword-le:
+    $inherit: bit-packed-qword
+    byte-order: le
+  bit-packed-uint64-be:
+    $inherit: bit-packed-uint64
+    byte-order: be
+  bit-packed-qword-be:
+    $inherit: bit-packed-qword
+    byte-order: be
+
+  # bit-packed 64-bit signed integer
+  bit-packed-sint64:
+    $inherit: sint64
+    alignment: 1
+  bit-packed-int64: bit-packed-sint64
+  bit-packed-sint64-le:
+    $inherit: bit-packed-sint64
+    byte-order: le
+  bit-packed-int64-le:
+    $inherit: bit-packed-int64
+    byte-order: le
+  bit-packed-sint64-be:
+    $inherit: bit-packed-sint64
+    byte-order: be
+  bit-packed-int64-be:
+    $inherit: bit-packed-int64
+    byte-order: be
diff --git a/barectf/include/3/stdmisc.yaml b/barectf/include/3/stdmisc.yaml
new file mode 100644 (file)
index 0000000..83e8a86
--- /dev/null
@@ -0,0 +1,8 @@
+# Include this in a trace type object to have access to various,
+# uncategorized field type aliases.
+
+$field-type-aliases:
+  # a simple string
+  string:
+    class: string
+  str: string
diff --git a/barectf/include/3/stdreal.yaml b/barectf/include/3/stdreal.yaml
new file mode 100644 (file)
index 0000000..058d7b0
--- /dev/null
@@ -0,0 +1,71 @@
+# Include this in a trace type object to have access to basic real field
+# type aliases.
+
+$field-type-aliases:
+  # IEEE 754-2008 binary32 (single-precision)
+  float:
+    class: real
+    size: 32
+    align: 32
+  float-le:
+    $inherit: float
+    byte-order: le
+  float-be:
+    $inherit: float
+    byte-order: be
+
+  # IEEE 754-2008 binary64 (double-precision)
+  double:
+    class: real
+    size: 64
+    align: 64
+  double-le:
+    $inherit: double
+    byte-order: le
+  double-be:
+    $inherit: double
+    byte-order: be
+
+  # byte-packed IEEE 754-2008 binary32 (single-precision)
+  byte-packed-float:
+    $inherit: float
+    align: 8
+  byte-packed-float-le:
+    $inherit: byte-packed-float
+    byte-order: le
+  byte-packed-float-be:
+    $inherit: byte-packed-float
+    byte-order: be
+
+  # byte-packed IEEE 754-2008 binary64 (double-precision)
+  byte-packed-double:
+    $inherit: double
+    align: 8
+  byte-packed-double-le:
+    $inherit: byte-packed-double
+    byte-order: le
+  byte-packed-double-be:
+    $inherit: byte-packed-double
+    byte-order: be
+
+  # bit-packed IEEE 754-2008 binary32 (single-precision)
+  bit-packed-float:
+    $inherit: float
+    align: 1
+  bit-packed-float-le:
+    $inherit: bit-packed-float
+    byte-order: le
+  bit-packed-float-be:
+    $inherit: bit-packed-float
+    byte-order: be
+
+  # bit-packed IEEE 754-2008 binary64 (double-precision)
+  bit-packed-double:
+    $inherit: double
+    align: 1
+  bit-packed-double-le:
+    $inherit: bit-packed-double
+    byte-order: le
+  bit-packed-double-be:
+    $inherit: bit-packed-double
+    byte-order: be
diff --git a/barectf/include/lttng-ust-log-levels.yaml b/barectf/include/lttng-ust-log-levels.yaml
deleted file mode 100644 (file)
index 76d2544..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-# Include this in the metadata object to have access to the LTTng-UST
-# log level values by name.
-#
-# Note that the values from 0 to 7 are compatible with syslog log
-# levels, although the debug severity in syslog is named DEBUG_SYSTEM
-# here.
-
-$log-levels:
-  EMERG: 0
-  ALERT: 1
-  CRIT: 2
-  ERR: 3
-  WARNING: 4
-  NOTICE: 5
-  INFO: 6
-  DEBUG_SYSTEM: 7
-  DEBUG_PROGRAM: 8
-  DEBUG_PROCESS: 9
-  DEBUG_MODULE: 10
-  DEBUG_UNIT: 11
-  DEBUG_FUNCTION: 12
-  DEBUG_LINE: 13
-  DEBUG: 14
diff --git a/barectf/include/stdfloat.yaml b/barectf/include/stdfloat.yaml
deleted file mode 100644 (file)
index dfd2180..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-# Include this in the metadata object of your configuration to have
-# access to basic floating point number type aliases.
-
-type-aliases:
-  # IEEE 754-2008 binary32 (single-precision)
-  float:
-    class: floating-point
-    size:
-      exp: 8
-      mant: 24
-    align: 32
-
-  # IEEE 754-2008 binary64 (double-precision)
-  double:
-    class: floating-point
-    size:
-      exp: 11
-      mant: 53
-    align: 64
diff --git a/barectf/include/stdint.yaml b/barectf/include/stdint.yaml
deleted file mode 100644 (file)
index 415d8dd..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-# Include this in the metadata object of your configuratio
-# access to basic integer type aliases.
-
-type-aliases:
-  # 8-bit unsigned integer, 8-bit aligned
-  uint8:
-    class: int
-    size: 8
-    align: 8
-  byte: uint8
-
-  # 8-bit signed integer, 8-bit aligned
-  int8:
-    $inherit: uint8
-    signed: true
-
-  # 16-bit unsigned integer, 16-bit aligned
-  uint16:
-    class: int
-    size: 16
-    align: 16
-  word: uint16
-
-  # 16-bit signed integer, 16-bit aligned
-  int16:
-    $inherit: uint16
-    signed: true
-
-  # 32-bit unsigned integer, 32-bit aligned
-  uint32:
-    class: int
-    size: 32
-    align: 32
-  dword: uint32
-
-  # 32-bit signed integer, 32-bit aligned
-  int32:
-    $inherit: uint32
-    signed: true
-
-  # 64-bit unsigned integer, 64-bit aligned
-  uint64:
-    class: int
-    size: 64
-    align: 64
-
-  # 64-bit signed integer, 64-bit aligned
-  int64:
-    $inherit: uint64
-    signed: true
-
-  # byte-packed 8-bit unsigned integer
-  byte-packed-uint8: uint8
-
-  # byte-packed 8-bit signed integer
-  byte-packed-int8: int8
-
-  # byte-packed 16-bit unsigned integer
-  byte-packed-uint16:
-    $inherit: uint16
-    align: 8
-
-  # byte-packed 16-bit signed integer
-  byte-packed-int16:
-    $inherit: int16
-    align: 8
-
-  # byte-packed 32-bit unsigned integer
-  byte-packed-uint32:
-    $inherit: uint32
-    align: 8
-
-  # byte-packed 32-bit signed integer
-  byte-packed-int32:
-    $inherit: int32
-    align: 8
-
-  # byte-packed 64-bit unsigned integer
-  byte-packed-uint64:
-    $inherit: uint64
-    align: 8
-
-  # byte-packed 64-bit signed integer
-  byte-packed-int64:
-    $inherit: int64
-    align: 8
-
-  # byte-packed 8-bit unsigned integer
-  bit-packed-uint8:
-    $inherit: uint8
-    align: 1
-
-  # bit-packed 8-bit signed integer
-  bit-packed-int8:
-    $inherit: int8
-    align: 1
-
-  # bit-packed 16-bit unsigned integer
-  bit-packed-uint16:
-    $inherit: uint16
-    align: 1
-
-  # bit-packed 16-bit signed integer
-  bit-packed-int16:
-    $inherit: int16
-    align: 1
-
-  # bit-packed 32-bit unsigned integer
-  bit-packed-uint32:
-    $inherit: uint32
-    align: 1
-
-  # bit-packed 32-bit signed integer
-  bit-packed-int32:
-    $inherit: int32
-    align: 1
-
-  # bit-packed 64-bit unsigned integer
-  bit-packed-uint64:
-    $inherit: uint64
-    align: 1
-
-  # bit-packed 64-bit signed integer
-  bit-packed-int64:
-    $inherit: int64
-    align: 1
diff --git a/barectf/include/stdmisc.yaml b/barectf/include/stdmisc.yaml
deleted file mode 100644 (file)
index 4177aa1..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# Include this in the metadata object of your configuration to have
-# access to various useful type aliases.
-
-type-aliases:
-  # UUID array
-  uuid:
-    class: array
-    length: 16
-    element-type:
-      class: int
-      size: 8
-
-  # CTF magic number type
-  ctf-magic:
-    class: int
-    size: 32
-    align: 32
-
-  # a simple string
-  string:
-    class: string
diff --git a/barectf/include/trace-basic.yaml b/barectf/include/trace-basic.yaml
deleted file mode 100644 (file)
index 20c2a2e..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-# Include this in the trace object of your configuration to get a
-# default, basic trace object with a little-endian byte order. The
-# packet header type contains the 32-bit magic number, followed by the
-# UUID, followed by an 8-bit stream ID. The trace's UUID is
-# automatically generated by barectf.
-
-byte-order: le
-uuid: auto
-packet-header-type:
-  class: struct
-  fields:
-    magic:
-      class: int
-      size: 32
-      align: 32
-    uuid:
-      class: array
-      length: 16
-      element-type:
-        class: int
-        size: 8
-    stream_id:
-      class: int
-      size: 8
diff --git a/barectf/metadata.py b/barectf/metadata.py
deleted file mode 100644 (file)
index 62e0a04..0000000
+++ /dev/null
@@ -1,473 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2015-2020 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import enum
-import collections
-import barectf
-import datetime
-
-
-@enum.unique
-class ByteOrder(enum.Enum):
-    LE = 0
-    BE = 1
-
-
-@enum.unique
-class Encoding(enum.Enum):
-    NONE = 0
-    UTF8 = 1
-    ASCII = 2
-
-
-class Type:
-    @property
-    def align(self):
-        return None
-
-    @property
-    def size(self):
-        pass
-
-    @property
-    def is_dynamic(self):
-        return False
-
-
-class PropertyMapping:
-    def __init__(self, object, prop):
-        self._object = object
-        self._prop = prop
-
-    @property
-    def object(self):
-        return self._object
-
-    @property
-    def prop(self):
-        return self.prop
-
-
-class Integer(Type):
-    def __init__(self, size, byte_order, align=None, signed=False,
-                 base=10, encoding=Encoding.NONE, property_mappings=None):
-        self._size = size
-        self._byte_order = byte_order
-
-        if align is None:
-            if size % 8 == 0:
-                self._align = 8
-            else:
-                self._align = 1
-        else:
-            self._align = align
-
-        self._signed = signed
-        self._base = base
-        self._encoding = encoding
-
-        if property_mappings is None:
-            self._property_mappings = []
-        else:
-            self._property_mappings = property_mappings
-
-    @property
-    def signed(self):
-        return self._signed
-
-    @property
-    def byte_order(self):
-        return self._byte_order
-
-    @property
-    def base(self):
-        return self._base
-
-    @property
-    def encoding(self):
-        return self._encoding
-
-    @property
-    def align(self):
-        return self._align
-
-    @property
-    def size(self):
-        return self._size
-
-    @property
-    def property_mappings(self):
-        return self._property_mappings
-
-
-class FloatingPoint(Type):
-    def __init__(self, exp_size, mant_size, byte_order, align=8):
-        self._exp_size = exp_size
-        self._mant_size = mant_size
-        self._byte_order = byte_order
-        self._align = align
-
-    @property
-    def exp_size(self):
-        return self._exp_size
-
-    @property
-    def mant_size(self):
-        return self._mant_size
-
-    @property
-    def size(self):
-        return self._exp_size + self._mant_size
-
-    @property
-    def byte_order(self):
-        return self._byte_order
-
-    @property
-    def align(self):
-        return self._align
-
-
-class Enum(Type):
-    def __init__(self, value_type, members=None):
-        self._value_type = value_type
-
-        if members is None:
-            self._members = collections.OrderedDict()
-        else:
-            self._members = members
-
-    @property
-    def align(self):
-        return self._value_type.align
-
-    @property
-    def size(self):
-        return self._value_type.size
-
-    @property
-    def value_type(self):
-        return self._value_type
-
-    @property
-    def members(self):
-        return self._members
-
-    @property
-    def last_value(self):
-        if len(self._members) == 0:
-            return
-
-        return list(self._members.values())[-1][1]
-
-    def value_of(self, label):
-        return self._members[label]
-
-    def label_of(self, value):
-        for label, vrange in self._members.items():
-            if value >= vrange[0] and value <= vrange[1]:
-                return label
-
-    def __getitem__(self, key):
-        if type(key) is str:
-            return self.value_of(key)
-        elif type(key) is int:
-            return self.label_of(key)
-
-        raise TypeError('Wrong subscript type')
-
-
-class String(Type):
-    def __init__(self, encoding=Encoding.UTF8):
-        self._encoding = encoding.UTF8
-
-    @property
-    def align(self):
-        return 8
-
-    @property
-    def encoding(self):
-        return self._encoding
-
-    @property
-    def is_dynamic(self):
-        return True
-
-
-class Array(Type):
-    def __init__(self, element_type, length):
-        self._element_type = element_type
-        self._length = length
-
-    @property
-    def align(self):
-        return self._element_type.align
-
-    @property
-    def element_type(self):
-        return self._element_type
-
-    @property
-    def length(self):
-        return self._length
-
-
-class Struct(Type):
-    def __init__(self, min_align=1, fields=None):
-        self._min_align = min_align
-
-        if fields is None:
-            self._fields = collections.OrderedDict()
-        else:
-            self._fields = fields
-
-        self._align = self.min_align
-
-        for field in self.fields.values():
-            if field.align is None:
-                continue
-
-            if field.align > self._align:
-                self._align = field.align
-
-    @property
-    def min_align(self):
-        return self._min_align
-
-    @property
-    def align(self):
-        return self._align
-
-    @property
-    def fields(self):
-        return self._fields
-
-    def __getitem__(self, key):
-        return self.fields[key]
-
-    def __len__(self):
-        return len(self._fields)
-
-
-class Trace:
-    def __init__(self, byte_order, uuid=None, packet_header_type=None):
-        self._byte_order = byte_order
-        self._uuid = uuid
-        self._packet_header_type = packet_header_type
-
-    @property
-    def uuid(self):
-        return self._uuid
-
-    @property
-    def byte_order(self):
-        return self._byte_order
-
-    @property
-    def packet_header_type(self):
-        return self._packet_header_type
-
-
-class Clock:
-    def __init__(self, name, uuid=None, description=None, freq=int(1e9),
-                 error_cycles=0, offset_seconds=0, offset_cycles=0,
-                 absolute=False, return_ctype='uint32_t'):
-        self._name = name
-        self._uuid = uuid
-        self._description = description
-        self._freq = freq
-        self._error_cycles = error_cycles
-        self._offset_seconds = offset_seconds
-        self._offset_cycles = offset_cycles
-        self._absolute = absolute
-        self._return_ctype = return_ctype
-
-    @property
-    def name(self):
-        return self._name
-
-    @property
-    def uuid(self):
-        return self._uuid
-
-    @property
-    def description(self):
-        return self._description
-
-    @property
-    def error_cycles(self):
-        return self._error_cycles
-
-    @property
-    def freq(self):
-        return self._freq
-
-    @property
-    def offset_seconds(self):
-        return self._offset_seconds
-
-    @property
-    def offset_cycles(self):
-        return self._offset_cycles
-
-    @property
-    def absolute(self):
-        return self._absolute
-
-    @property
-    def return_ctype(self):
-        return self._return_ctype
-
-
-LogLevel = collections.namedtuple('LogLevel', ['name', 'value'])
-
-
-class Event:
-    def __init__(self, id, name, log_level=None, payload_type=None,
-                 context_type=None):
-        self._id = id
-        self._name = name
-        self._payload_type = payload_type
-        self._log_level = log_level
-        self._context_type = context_type
-
-    @property
-    def id(self):
-        return self._id
-
-    @property
-    def name(self):
-        return self._name
-
-    @property
-    def log_level(self):
-        return self._log_level
-
-    @property
-    def context_type(self):
-        return self._context_type
-
-    @property
-    def payload_type(self):
-        return self._payload_type
-
-    def __getitem__(self, key):
-        if self.payload_type is None:
-            raise KeyError(key)
-
-        return self.payload_type[key]
-
-
-class Stream:
-    def __init__(self, id, name=None, packet_context_type=None,
-                 event_header_type=None, event_context_type=None,
-                 events=None):
-        self._id = id
-        self._name = name
-        self._packet_context_type = packet_context_type
-        self._event_header_type = event_header_type
-        self._event_context_type = event_context_type
-
-        if events is None:
-            self._events = collections.OrderedDict()
-        else:
-            self._events = events
-
-    @property
-    def name(self):
-        return self._name
-
-    @property
-    def id(self):
-        return self._id
-
-    @property
-    def packet_context_type(self):
-        return self._packet_context_type
-
-    @property
-    def event_header_type(self):
-        return self._event_header_type
-
-    @property
-    def event_context_type(self):
-        return self._event_context_type
-
-    @property
-    def events(self):
-        return self._events
-
-
-class Metadata:
-    def __init__(self, trace, env=None, clocks=None, streams=None,
-                 default_stream_name=None):
-        self._trace = trace
-        version_tuple = barectf.get_version_tuple()
-        self._env = collections.OrderedDict([
-            ('domain', 'bare'),
-            ('tracer_name', 'barectf'),
-            ('tracer_major', version_tuple[0]),
-            ('tracer_minor', version_tuple[1]),
-            ('tracer_patch', version_tuple[2]),
-            ('barectf_gen_date', str(datetime.datetime.now().isoformat())),
-        ])
-
-        if env is not None:
-            self._env.update(env)
-
-        if clocks is None:
-            self._clocks = collections.OrderedDict()
-        else:
-            self._clocks = clocks
-
-        if streams is None:
-            self._streams = collections.OrderedDict()
-        else:
-            self._streams = streams
-
-        self._default_stream_name = default_stream_name
-
-    @property
-    def trace(self):
-        return self._trace
-
-    @property
-    def env(self):
-        return self._env
-
-    @property
-    def clocks(self):
-        return self._clocks
-
-    @property
-    def streams(self):
-        return self._streams
-
-    @property
-    def default_stream_name(self):
-        return self._default_stream_name
-
-    @property
-    def default_stream(self):
-        if self._default_stream_name in self._streams:
-            return self._streams[self._default_stream_name]
diff --git a/barectf/schemas/2/config/byte-order-prop.yaml b/barectf/schemas/2/config/byte-order-prop.yaml
deleted file mode 100644 (file)
index 27c5fdd..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-$schema: http://json-schema.org/draft-07/schema#
-$id: https://barectf.org/schemas/2/config/byte-order-prop.json
-title: Byte order property value
-type: string
-enum:
-  - le
-  - be
diff --git a/barectf/schemas/2/config/clock-pre-include.yaml b/barectf/schemas/2/config/clock-pre-include.yaml
deleted file mode 100644 (file)
index d99ab28..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-$schema: http://json-schema.org/draft-07/schema#
-$id: https://barectf.org/schemas/2/config/clock-pre-include.json
-title: Clock object before inclusions
-type: object
-properties:
-  $include:
-    $ref: https://barectf.org/schemas/2/config/include-prop.json
diff --git a/barectf/schemas/2/config/clock-type-pre-include.yaml b/barectf/schemas/2/config/clock-type-pre-include.yaml
new file mode 100644 (file)
index 0000000..5ca2cf1
--- /dev/null
@@ -0,0 +1,30 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+$schema: http://json-schema.org/draft-07/schema#
+$id: https://barectf.org/schemas/2/config/clock-type-pre-include.json
+title: Clock type object before inclusions
+type: object
+properties:
+  $include:
+    $ref: https://barectf.org/schemas/2/config/include-prop.json
diff --git a/barectf/schemas/2/config/config-min.yaml b/barectf/schemas/2/config/config-min.yaml
new file mode 100644 (file)
index 0000000..1984f21
--- /dev/null
@@ -0,0 +1,36 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+$schema: http://json-schema.org/draft-07/schema#
+$id: https://barectf.org/schemas/2/config/config-min.json
+title: Minimal configuration object
+type: object
+properties:
+  version:
+    type: string
+    enum:
+      - '2.0'
+      - '2.1'
+      - '2.2'
+required:
+  - version
index 143135578ff91c63562c0619b86e1f0c7d28b890..d31088594a28f4c5a4e0d70cc1e91abbc498aefd 100644 (file)
@@ -25,7 +25,7 @@ $schema: http://json-schema.org/draft-07/schema#
 $id: https://barectf.org/schemas/2/config/config-pre-field-type-expansion.json
 title: Configuration object before field type expansions
 definitions:
-  partial-field-type:
+  partial-ft:
     title: Partial field type object
     if:
       type: object
@@ -48,14 +48,18 @@ definitions:
             - $inherit
       properties:
         value-type:
-          $ref: '#/definitions/partial-field-type'
+          $ref: '#/definitions/partial-ft'
         element-type:
-          $ref: '#/definitions/partial-field-type'
+          $ref: '#/definitions/partial-ft'
         fields:
-          type: object
-          patternProperties:
-            '':
-              $ref: '#/definitions/partial-field-type'
+          if:
+            type: object
+          then:
+            patternProperties:
+              '.*':
+                $ref: '#/definitions/partial-ft'
+          else:
+            type: 'null'
     else:
       oneOf:
         - type: string
@@ -67,41 +71,45 @@ properties:
     type: object
     properties:
       type-aliases:
-        title: Type aliases object before field type expansions
-        type: object
-        patternProperties:
-          '':
-            $ref: '#/definitions/partial-field-type'
+        title: Field type aliases object before field type expansions
+        if:
+          type: object
+        then:
+          patternProperties:
+            '.*':
+              $ref: '#/definitions/partial-ft'
+        else:
+          type: 'null'
       trace:
-        title: Trace object before field type expansions
+        title: Trace type object before field type expansions
         type: object
         properties:
           packet-header-type:
-            $ref: '#/definitions/partial-field-type'
+            $ref: '#/definitions/partial-ft'
       streams:
-        title: Streams object before field type expansions
+        title: Stream types object before field type expansions
         type: object
         patternProperties:
-          '':
-            title: Stream object before field type expansions
+          '.*':
+            title: Stream type object before field type expansions
             type: object
             properties:
               packet-context-type:
-                $ref: '#/definitions/partial-field-type'
+                $ref: '#/definitions/partial-ft'
               event-header-type:
-                $ref: '#/definitions/partial-field-type'
+                $ref: '#/definitions/partial-ft'
               event-context-type:
-                $ref: '#/definitions/partial-field-type'
+                $ref: '#/definitions/partial-ft'
               events:
                 type: object
                 patternProperties:
-                  '':
+                  '.*':
                     type: object
                     properties:
                       context-type:
-                        $ref: '#/definitions/partial-field-type'
+                        $ref: '#/definitions/partial-ft'
                       payload-type:
-                        $ref: '#/definitions/partial-field-type'
+                        $ref: '#/definitions/partial-ft'
             required:
               - events
     required:
diff --git a/barectf/schemas/2/config/config-pre-log-level-expansion.yaml b/barectf/schemas/2/config/config-pre-log-level-expansion.yaml
deleted file mode 100644 (file)
index 5d4734a..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-$schema: http://json-schema.org/draft-07/schema#
-$id: https://barectf.org/schemas/2/config/config-pre-log-level-expansion.json
-title: Configuration object before log level expansions
-definitions:
-  opt-log-levels:
-    title: Log level values object
-    oneOf:
-      - type: object
-        patternProperties:
-          '':
-            type: integer
-            minimum: 0
-      - type: 'null'
-type: object
-properties:
-  metadata:
-    title: Metadata object before log level expansions
-    type: object
-    oneOf:
-      - required:
-          - $log-levels
-      - required:
-          - log-levels
-      - allOf:
-          - not:
-              required:
-                - $log-levels
-          - not:
-              required:
-                - log-levels
-    properties:
-      $log-levels:
-        $ref: '#/definitions/opt-log-levels'
-      log-levels:
-        $ref: '#/definitions/opt-log-levels'
-      streams:
-        title: Streams object before log level expansions
-        type: object
-        patternProperties:
-          '':
-            title: Stream object before log level expansions
-            type: object
-            properties:
-              events:
-                type: object
-                patternProperties:
-                  '':
-                    type: object
-                    properties:
-                      log-level:
-                        oneOf:
-                          - type: string
-                          - type: integer
-                            minimum: 0
-                          - type: 'null'
-            required:
-              - events
-    required:
-      - streams
-required:
-  - metadata
index 81559bd3f4f067d69fb92d4496a69b2570097d55..eb38c55fa8ac88e60ee52eb6bded2ea0d9795b00 100644 (file)
@@ -25,52 +25,30 @@ $schema: http://json-schema.org/draft-07/schema#
 $id: https://barectf.org/schemas/2/config/config.json
 title: Effective configuration object
 definitions:
-  opt-bool:
-    oneOf:
-      - type: boolean
-      - type: 'null'
-  opt-string:
-    oneOf:
-      - type: string
-      - type: 'null'
-  opt-int-min-0:
-    if:
-      type: integer
-    then:
-      minimum: 0
-    else:
-      type: 'null'
-  opt-field-type:
+  opt-struct-ft:
     if:
       type: object
     then:
-      $ref: https://barectf.org/schemas/2/config/field-type.json
+      $ref: https://barectf.org/schemas/2/config/field-type.json#/definitions/struct-ft
     else:
       type: 'null'
-  opt-struct-field-type:
-    if:
-      type: object
-    then:
-      $ref: https://barectf.org/schemas/2/config/field-type.json#/definitions/struct-field-type
-    else:
-      type: 'null'
-  unsigned-int-field-type:
+  uint-ft:
     allOf:
-      - $ref: https://barectf.org/schemas/2/config/field-type.json#/definitions/int-field-type
+      - $ref: https://barectf.org/schemas/2/config/field-type.json#/definitions/int-ft
       - properties:
           signed:
             const: false
-  unsigned-int-field-type-ts:
+  uint-ft-ts:
     allOf:
-      - $ref: '#/definitions/unsigned-int-field-type'
+      - $ref: '#/definitions/uint-ft'
       - properties:
           property-mappings:
             type: array
         required:
           - property-mappings
-  packet-header-type-prop:
+  packet-header-ft-prop:
     allOf:
-      - $ref: '#/definitions/opt-struct-field-type'
+      - $ref: '#/definitions/opt-struct-ft'
       - if:
           type: object
           properties:
@@ -82,19 +60,19 @@ definitions:
               properties:
                 magic:
                   allOf:
-                    - $ref: '#/definitions/unsigned-int-field-type'
+                    - $ref: '#/definitions/uint-ft'
                     - properties:
                         size:
                           const: 32
                 uuid:
                   allOf:
-                    - $ref: https://barectf.org/schemas/2/config/field-type.json#/definitions/array-field-type
+                    - $ref: https://barectf.org/schemas/2/config/field-type.json#/definitions/static-array-ft
                     - properties:
                         length:
                           const: 16
                         element-type:
                           allOf:
-                            - $ref: https://barectf.org/schemas/2/config/field-type.json#/definitions/int-field-type
+                            - $ref: https://barectf.org/schemas/2/config/field-type.json#/definitions/int-ft
                             - properties:
                                 size:
                                   const: 8
@@ -107,32 +85,24 @@ definitions:
                                     - 4
                                     - 8
                 stream_id:
-                  $ref: '#/definitions/unsigned-int-field-type'
+                  $ref: '#/definitions/uint-ft'
                 stream_instance_id:
-                  $ref: '#/definitions/unsigned-int-field-type'
-  trace:
-    title: Trace object
+                  $ref: '#/definitions/uint-ft'
+  trace-type:
+    title: Trace type object
     type: object
     properties:
       byte-order:
-        $ref: https://barectf.org/schemas/2/config/byte-order-prop.json
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/byte-order-prop
       uuid:
-        if:
-          type: string
-        then:
-          oneOf:
-            - $ref: https://barectf.org/schemas/2/config/uuid-prop.json
-            - type: string
-              const: auto
-        else:
-          type: 'null'
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-trace-type-uuid-prop
       packet-header-type:
-        $ref: '#/definitions/packet-header-type-prop'
+        $ref: '#/definitions/packet-header-ft-prop'
     required:
       - byte-order
     additionalProperties: false
-  clock:
-    title: Clock object
+  clock-type:
+    title: Clock type object
     type: object
     oneOf:
       - required:
@@ -148,41 +118,21 @@ definitions:
                 - return-ctype
     properties:
       uuid:
-        if:
-          type: object
-        then:
-          $ref: https://barectf.org/schemas/2/config/uuid-prop.json
-        else:
-          type: 'null'
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-uuid-prop
       description:
-        $ref: '#/definitions/opt-string'
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-string
       freq:
-        if:
-          type: integer
-        then:
-          minimum: 1
-        else:
-          type: 'null'
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-int-min-1
       error-cycles:
-        $ref: '#/definitions/opt-int-min-0'
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-int-min-0
       offset:
-        if:
-          type: object
-        then:
-          properties:
-            cycles:
-              $ref: '#/definitions/opt-int-min-0'
-            seconds:
-              $ref: '#/definitions/opt-int-min-0'
-          additionalProperties: false
-        else:
-          type: 'null'
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-clock-type-offset-prop
       absolute:
-        $ref: '#/definitions/opt-bool'
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-bool
       return-ctype:
-        $ref: '#/definitions/opt-string'
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-string
       $return-ctype:
-        $ref: '#/definitions/opt-string'
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-string
     additionalProperties: false
   $default-stream:
     if:
@@ -191,24 +141,24 @@ definitions:
       pattern: '^[A-Za-z_][A-Za-z0-9_]*$'
     else:
       type: 'null'
-  packet-context-type-prop:
+  packet-context-ft-prop:
     allOf:
-      - $ref: https://barectf.org/schemas/2/config/field-type.json#/definitions/struct-field-type
+      - $ref: https://barectf.org/schemas/2/config/field-type.json#/definitions/struct-ft
       - properties:
           fields:
             properties:
               packet_size:
-                $ref: '#/definitions/unsigned-int-field-type'
+                $ref: '#/definitions/uint-ft'
               content_size:
-                $ref: '#/definitions/unsigned-int-field-type'
+                $ref: '#/definitions/uint-ft'
               events_discarded:
-                $ref: '#/definitions/unsigned-int-field-type'
+                $ref: '#/definitions/uint-ft'
               packet_seq_num:
-                $ref: '#/definitions/unsigned-int-field-type'
+                $ref: '#/definitions/uint-ft'
               timestamp_begin:
-                $ref: '#/definitions/unsigned-int-field-type-ts'
+                $ref: '#/definitions/uint-ft-ts'
               timestamp_end:
-                $ref: '#/definitions/unsigned-int-field-type-ts'
+                $ref: '#/definitions/uint-ft-ts'
             required:
               - packet_size
               - content_size
@@ -219,9 +169,9 @@ definitions:
                 - timestamp_begin
         required:
           - fields
-  event-header-type-prop:
+  event-header-ft-prop:
     allOf:
-      - $ref: '#/definitions/opt-struct-field-type'
+      - $ref: '#/definitions/opt-struct-ft'
       - if:
           type: object
           properties:
@@ -232,43 +182,50 @@ definitions:
             fields:
               properties:
                 id:
-                  $ref: '#/definitions/unsigned-int-field-type'
+                  $ref: '#/definitions/uint-ft'
                 timestamp:
-                  $ref: '#/definitions/unsigned-int-field-type-ts'
-  stream:
-    title: Stream object
+                  $ref: '#/definitions/uint-ft-ts'
+  stream-type:
+    title: Stream type object
     type: object
     properties:
       $default:
-        $ref: '#/definitions/opt-bool'
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-bool
       packet-context-type:
-        $ref: '#/definitions/packet-context-type-prop'
+        $ref: '#/definitions/packet-context-ft-prop'
       event-header-type:
-        $ref: '#/definitions/event-header-type-prop'
+        $ref: '#/definitions/event-header-ft-prop'
       event-context-type:
-        $ref: '#/definitions/opt-struct-field-type'
+        $ref: '#/definitions/opt-struct-ft'
       events:
-        title: Events object
+        title: Event types object
         type: object
         patternProperties:
           '^[A-Za-z_][A-Za-z0-9_]*$':
-            $ref: '#/definitions/event'
+            $ref: '#/definitions/event-type'
         additionalProperties: false
         minProperties: 1
     required:
       - packet-context-type
       - events
     additionalProperties: false
-  event:
-    title: Event object
+  event-type:
+    title: Event type object
     type: object
     properties:
       log-level:
-        $ref: '#/definitions/opt-int-min-0'
+        if:
+          type: integer
+        then:
+          minimum: 0
+        else:
+          oneOf:
+            - type: string
+            - type: 'null'
       context-type:
-        $ref: '#/definitions/opt-struct-field-type'
+        $ref: '#/definitions/opt-struct-ft'
       payload-type:
-        $ref: '#/definitions/opt-struct-field-type'
+        $ref: '#/definitions/opt-struct-ft'
     additionalProperties: false
 type: object
 properties:
@@ -279,26 +236,7 @@ properties:
       - '2.1'
       - '2.2'
   prefix:
-    type: string
-    allOf:
-      - pattern: '^[A-Za-z_][A-Za-z0-9_]*$'
-      - not:
-          enum:
-            - align
-            - callsite
-            - clock
-            - enum
-            - env
-            - event
-            - floating_point
-            - integer
-            - stream
-            - string
-            - struct
-            - trace
-            - typealias
-            - typedef
-            - variant
+    $ref: https://barectf.org/schemas/common/config/common.json#/definitions/config-prefix-prop
   options:
     title: Configuration options object
     type: object
@@ -311,37 +249,42 @@ properties:
   metadata:
     title: Metadata object
     type: object
+    oneOf:
+      - required:
+          - $log-levels
+      - required:
+          - log-levels
+      - allOf:
+          - not:
+              required:
+                - $log-levels
+          - not:
+              required:
+                - log-levels
     properties:
+      log-levels:
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-log-level-aliases-prop
+      $log-levels:
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-log-level-aliases-prop
       trace:
-        $ref: '#/definitions/trace'
+        $ref: '#/definitions/trace-type'
       env:
-        title: Environment variables
-        if:
-          type: object
-        then:
-          patternProperties:
-            '^[A-Za-z_][A-Za-z0-9_]*$':
-              oneOf:
-                - type: string
-                - type: integer
-          additionalProperties: false
-        else:
-          type: 'null'
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-env-prop
       clocks:
-        title: Clocks object
+        title: Clock types object
         type: object
         patternProperties:
           '^[A-Za-z_][A-Za-z0-9_]*$':
-            $ref: '#/definitions/clock'
+            $ref: '#/definitions/clock-type'
         additionalProperties: false
       $default-stream:
-        $ref: '#/definitions/opt-string'
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-string
       streams:
-        title: Streams object
+        title: Stream types object
         type: object
         patternProperties:
           '^[A-Za-z_][A-Za-z0-9_]*$':
-            $ref: '#/definitions/stream'
+            $ref: '#/definitions/stream-type'
         additionalProperties: false
         minProperties: 1
     required:
diff --git a/barectf/schemas/2/config/event-pre-include.yaml b/barectf/schemas/2/config/event-pre-include.yaml
deleted file mode 100644 (file)
index d4d76ca..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-$schema: http://json-schema.org/draft-07/schema#
-$id: https://barectf.org/schemas/2/config/event-pre-include.json
-title: Event object before inclusions
-type: object
-properties:
-  $include:
-    $ref: https://barectf.org/schemas/2/config/include-prop.json
diff --git a/barectf/schemas/2/config/event-type-pre-include.yaml b/barectf/schemas/2/config/event-type-pre-include.yaml
new file mode 100644 (file)
index 0000000..bf149b0
--- /dev/null
@@ -0,0 +1,30 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+$schema: http://json-schema.org/draft-07/schema#
+$id: https://barectf.org/schemas/2/config/event-type-pre-include.json
+title: Event type object before inclusions
+type: object
+properties:
+  $include:
+    $ref: https://barectf.org/schemas/2/config/include-prop.json
index c41aaf29de81535327a9765b8313ffb6ac65053e..d399ba13be58f6935a352a708ffc9d121953e858 100644 (file)
@@ -25,23 +25,7 @@ $schema: http://json-schema.org/draft-07/schema#
 $id: https://barectf.org/schemas/2/config/field-type.json
 title: Effective field type object
 definitions:
-  byte-order-prop:
-    title: Byte order property value
-    if:
-      type: object
-    then:
-      $ref: https://barectf.org/schemas/2/config/byte-order-prop.json
-    else:
-      type: 'null'
-  align-prop:
-    title: Alignment property value
-    if:
-      type: integer
-    then:
-      minimum: 1
-    else:
-      type: 'null'
-  encoding-prop:
+  opt-encoding-prop:
     title: Encoding property value
     if:
       type: string
@@ -60,42 +44,31 @@ definitions:
         - NONE
     else:
       type: 'null'
-  int-field-type-class-prop:
+  int-ft-class-prop:
     type: string
     enum:
       - int
       - integer
-  int-field-type:
+  int-ft:
     title: Integer field type object
     type: object
     properties:
       class:
-        $ref: '#/definitions/int-field-type-class-prop'
+        $ref: '#/definitions/int-ft-class-prop'
       size:
-        type: integer
-        minimum: 1
-        maximum: 64
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/int-ft-size-prop
       signed:
         oneOf:
           - type: boolean
           - type: 'null'
       align:
-        $ref: '#/definitions/align-prop'
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-int-min-1
       byte-order:
-        $ref: '#/definitions/byte-order-prop'
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-byte-order-prop
       base:
-        if:
-          type: string
-        then:
-          enum:
-            - bin
-            - oct
-            - dec
-            - hex
-        else:
-          type: 'null'
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-int-ft-preferred-display-base-prop
       encoding:
-        $ref: '#/definitions/encoding-prop'
+        $ref: '#/definitions/opt-encoding-prop'
       property-mappings:
         if:
           type: array
@@ -125,18 +98,18 @@ definitions:
       - class
       - size
     additionalProperties: false
-  float-field-type-class-prop:
+  real-ft-class-prop:
     type: string
     enum:
       - flt
       - float
       - floating-point
-  float-field-type:
-    title: Floating point number field type object
+  real-ft:
+    title: Real field type object
     type: object
     properties:
       class:
-        $ref: '#/definitions/float-field-type-class-prop'
+        $ref: '#/definitions/real-ft-class-prop'
       size:
         type: object
         properties:
@@ -160,26 +133,26 @@ definitions:
           - mant
         additionalProperties: false
       align:
-        $ref: '#/definitions/align-prop'
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-int-min-1
       byte-order:
-        $ref: '#/definitions/byte-order-prop'
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-byte-order-prop
     required:
       - class
       - size
     additionalProperties: false
-  enum-field-type-class-prop:
+  enum-ft-class-prop:
     type: string
     enum:
       - enum
       - enumeration
-  enum-field-type:
+  enum-ft:
     title: Enumeration field type object
     type: object
     properties:
       class:
-        $ref: '#/definitions/enum-field-type-class-prop'
+        $ref: '#/definitions/enum-ft-class-prop'
       value-type:
-        $ref: '#/definitions/int-field-type'
+        $ref: '#/definitions/int-ft'
       members:
         type: array
         items:
@@ -209,33 +182,33 @@ definitions:
       - class
       - value-type
     additionalProperties: false
-  string-field-type-class-prop:
+  string-ft-class-prop:
     type: string
     enum:
       - str
       - string
-  string-field-type:
+  string-ft:
     title: String field type object
     type: object
     properties:
       class:
-        $ref: '#/definitions/string-field-type-class-prop'
+        $ref: '#/definitions/string-ft-class-prop'
       encoding:
-        $ref: '#/definitions/encoding-prop'
+        $ref: '#/definitions/opt-encoding-prop'
     required:
       - class
     additionalProperties: false
-  array-field-type-class-prop:
+  static-array-ft-class-prop:
     type: string
     const: array
-  array-field-type:
-    title: Array field type object
+  static-array-ft:
+    title: Static array field type object
     type: object
     properties:
       class:
-        $ref: '#/definitions/array-field-type-class-prop'
+        $ref: '#/definitions/static-array-ft-class-prop'
       element-type:
-        $ref: '#/definitions/field-type'
+        $ref: '#/definitions/ft'
       length:
         type: integer
         minimum: 0
@@ -244,36 +217,46 @@ definitions:
       - element-type
       - length
     additionalProperties: false
-  struct-field-type-class-prop:
+  struct-ft-class-prop:
     type: string
     enum:
       - struct
       - structure
-  struct-field-type:
+  struct-ft:
     title: Structure field type object
     type: object
     properties:
       class:
-        $ref: '#/definitions/struct-field-type-class-prop'
+        $ref: '#/definitions/struct-ft-class-prop'
       min-align:
-        $ref: '#/definitions/align-prop'
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-int-min-1
       fields:
         if:
           type: object
         then:
           patternProperties:
             '^[A-Za-z_][A-Za-z0-9_]*$':
-              $ref: '#/definitions/field-type'
+              $ref: '#/definitions/ft'
           additionalProperties: false
         else:
           type: 'null'
     required:
       - class
     additionalProperties: false
-  field-type:
+  ft:
     type: object
     properties:
       class:
+        # This is used to make sure that the field type's class name is
+        # valid as any of the conditionals below can fail.
+        #
+        # Although we could use `oneOf` instead of this enumeration here
+        # and refer to each of the `*-ft-class-prop` definitions, it
+        # would be hard for the validator to show something useful for
+        # the user as all cases would fail.
+        #
+        # Using `enum` below makes the validator show a very clear
+        # validation failure message.
         enum:
           - int
           - integer
@@ -291,39 +274,39 @@ definitions:
       - if:
           properties:
             class:
-              $ref: '#/definitions/int-field-type-class-prop'
+              $ref: '#/definitions/int-ft-class-prop'
         then:
-          $ref: '#/definitions/int-field-type'
+          $ref: '#/definitions/int-ft'
       - if:
           properties:
             class:
-              $ref: '#/definitions/float-field-type-class-prop'
+              $ref: '#/definitions/real-ft-class-prop'
         then:
-          $ref: '#/definitions/float-field-type'
+          $ref: '#/definitions/real-ft'
       - if:
           properties:
             class:
-              $ref: '#/definitions/enum-field-type-class-prop'
+              $ref: '#/definitions/enum-ft-class-prop'
         then:
-          $ref: '#/definitions/enum-field-type'
+          $ref: '#/definitions/enum-ft'
       - if:
           properties:
             class:
-              $ref: '#/definitions/string-field-type-class-prop'
+              $ref: '#/definitions/string-ft-class-prop'
         then:
-          $ref: '#/definitions/string-field-type'
+          $ref: '#/definitions/string-ft'
       - if:
           properties:
             class:
-              $ref: '#/definitions/array-field-type-class-prop'
+              $ref: '#/definitions/static-array-ft-class-prop'
         then:
-          $ref: '#/definitions/array-field-type'
+          $ref: '#/definitions/static-array-ft'
       - if:
           properties:
             class:
-              $ref: '#/definitions/struct-field-type-class-prop'
+              $ref: '#/definitions/struct-ft-class-prop'
         then:
-          $ref: '#/definitions/struct-field-type'
+          $ref: '#/definitions/struct-ft'
     required:
       - class
-$ref: '#/definitions/field-type'
+$ref: '#/definitions/ft'
index 863f2bd2ce8cee2c0cf41c4b8b916e2e2dfb1b14..679973a66447e74e09a45d4f42fffe4ff63a8299 100644 (file)
@@ -29,16 +29,16 @@ properties:
   $include:
     $ref: https://barectf.org/schemas/2/config/include-prop.json
   clocks:
-    title: Clocks object before inclusions
+    title: Clock types object before inclusions
     type: object
     patternProperties:
-      '':
-        $ref: https://barectf.org/schemas/2/config/clock-pre-include.json
+      '.*':
+        $ref: https://barectf.org/schemas/2/config/clock-type-pre-include.json
   trace:
-    $ref: https://barectf.org/schemas/2/config/trace-pre-include.json
+    $ref: https://barectf.org/schemas/2/config/trace-type-pre-include.json
   streams:
-    title: Streams object before inclusions
+    title: Stream types object before inclusions
     type: object
     patternProperties:
-      '':
-        $ref: https://barectf.org/schemas/2/config/stream-pre-include.json
+      '.*':
+        $ref: https://barectf.org/schemas/2/config/stream-type-pre-include.json
diff --git a/barectf/schemas/2/config/stream-pre-include.yaml b/barectf/schemas/2/config/stream-pre-include.yaml
deleted file mode 100644 (file)
index b3c2c29..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-$schema: http://json-schema.org/draft-07/schema#
-$id: https://barectf.org/schemas/2/config/stream-pre-include.json
-title: Stream object before inclusions
-type: object
-properties:
-  $include:
-    $ref: https://barectf.org/schemas/2/config/include-prop.json
-  events:
-    title: Events object before inclusions
-    type: object
-    patternProperties:
-      '':
-        $ref: https://barectf.org/schemas/2/config/event-pre-include.json
diff --git a/barectf/schemas/2/config/stream-type-pre-include.yaml b/barectf/schemas/2/config/stream-type-pre-include.yaml
new file mode 100644 (file)
index 0000000..92be946
--- /dev/null
@@ -0,0 +1,36 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+$schema: http://json-schema.org/draft-07/schema#
+$id: https://barectf.org/schemas/2/config/stream-type-pre-include.json
+title: Stream type object before inclusions
+type: object
+properties:
+  $include:
+    $ref: https://barectf.org/schemas/2/config/include-prop.json
+  events:
+    title: Event types object before inclusions
+    type: object
+    patternProperties:
+      '.*':
+        $ref: https://barectf.org/schemas/2/config/event-type-pre-include.json
diff --git a/barectf/schemas/2/config/trace-pre-include.yaml b/barectf/schemas/2/config/trace-pre-include.yaml
deleted file mode 100644 (file)
index e77a96a..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-$schema: http://json-schema.org/draft-07/schema#
-$id: https://barectf.org/schemas/2/config/trace-pre-include.json
-title: Trace object before inclusions
-type: object
-properties:
-  $include:
-    $ref: https://barectf.org/schemas/2/config/include-prop.json
diff --git a/barectf/schemas/2/config/trace-type-pre-include.yaml b/barectf/schemas/2/config/trace-type-pre-include.yaml
new file mode 100644 (file)
index 0000000..136ad68
--- /dev/null
@@ -0,0 +1,30 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+$schema: http://json-schema.org/draft-07/schema#
+$id: https://barectf.org/schemas/2/config/trace-type-pre-include.json
+title: Trace type object before inclusions
+type: object
+properties:
+  $include:
+    $ref: https://barectf.org/schemas/2/config/include-prop.json
diff --git a/barectf/schemas/2/config/uuid-prop.yaml b/barectf/schemas/2/config/uuid-prop.yaml
deleted file mode 100644 (file)
index 25bbe21..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-$schema: http://json-schema.org/draft-07/schema#
-$id: https://barectf.org/schemas/2/config/uuid-prop.json
-title: UUID property value
-type: string
-pattern: '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$'
diff --git a/barectf/schemas/3/config/clock-type-pre-include.yaml b/barectf/schemas/3/config/clock-type-pre-include.yaml
new file mode 100644 (file)
index 0000000..4d400bf
--- /dev/null
@@ -0,0 +1,30 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+$schema: http://json-schema.org/draft-07/schema#
+$id: https://barectf.org/schemas/3/config/clock-type-pre-include.json
+title: Clock type object before inclusions
+type: object
+properties:
+  $include:
+    $ref: https://barectf.org/schemas/3/config/include-prop.json
diff --git a/barectf/schemas/3/config/config-pre-field-type-expansion.yaml b/barectf/schemas/3/config/config-pre-field-type-expansion.yaml
new file mode 100644 (file)
index 0000000..986570e
--- /dev/null
@@ -0,0 +1,182 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+$schema: http://json-schema.org/draft-07/schema#
+$id: https://barectf.org/schemas/3/config/config-pre-field-type-expansion.json
+title: Configuration object before field type expansions
+definitions:
+  partial-ft:
+    title: Partial field type object
+    if:
+      type: object
+    then:
+      oneOf:
+        - properties:
+            class:
+              type: string
+          required:
+            - class
+        - properties:
+            $inherit:
+              type: string
+          required:
+            - $inherit
+      properties:
+        element-field-type:
+          $ref: '#/definitions/partial-ft'
+        members:
+          if:
+            type: array
+          then:
+            items:
+              type: object
+              patternProperties:
+                '^[A-Za-z_][A-Za-z0-9_]*$':
+                  if:
+                    type: object
+                  then:
+                    properties:
+                      field-type:
+                        $ref: '#/definitions/partial-ft'
+                    required:
+                      - field-type
+                  else:
+                    type: string
+              minProperties: 1
+              maxProperties: 1
+          else:
+            type: 'null'
+    else:
+      oneOf:
+        - type: string
+        - type: boolean
+        - type: 'null'
+type: object
+properties:
+  trace:
+    title: Trace object before field type expansions
+    type: object
+    properties:
+      type:
+        title: Trace type object before field type expansions
+        type: object
+        properties:
+          $field-type-aliases:
+            title: Field type aliases object before field type expansions
+            if:
+              type: object
+            then:
+              patternProperties:
+                '.*':
+                  $ref: '#/definitions/partial-ft'
+            else:
+              type: 'null'
+          $features:
+            if:
+              type: object
+            then:
+              properties:
+                magic-field-type:
+                  $ref: '#/definitions/partial-ft'
+                uuid-field-type:
+                  $ref: '#/definitions/partial-ft'
+                stream-type-id-field-type:
+                  $ref: '#/definitions/partial-ft'
+            else:
+              type: 'null'
+          stream-types:
+            title: Stream types object before field type expansions
+            type: object
+            patternProperties:
+              '.*':
+                title: Stream type object before field type expansions
+                type: object
+                properties:
+                  $features:
+                    if:
+                      type: object
+                    then:
+                      properties:
+                        packet:
+                          if:
+                            type: object
+                          then:
+                            properties:
+                              total-size-field-type:
+                                $ref: '#/definitions/partial-ft'
+                              content-size-field-type:
+                                $ref: '#/definitions/partial-ft'
+                              beginning-time-field-type:
+                                $ref: '#/definitions/partial-ft'
+                              end-time-field-type:
+                                $ref: '#/definitions/partial-ft'
+                              discarded-events-counter-field-type:
+                                $ref: '#/definitions/partial-ft'
+                          else:
+                            type: 'null'
+                        event:
+                          if:
+                            type: object
+                          then:
+                            properties:
+                              type-id-field-type:
+                                $ref: '#/definitions/partial-ft'
+                              time-field-type:
+                                $ref: '#/definitions/partial-ft'
+                          else:
+                            type: 'null'
+                    else:
+                      type: 'null'
+                  packet-context-field-type-extra-members:
+                    if:
+                      type: array
+                    then:
+                      items:
+                        type: object
+                        properties:
+                          field-type:
+                            $ref: '#/definitions/partial-ft'
+                    else:
+                      type: 'null'
+                  event-common-context-field-type:
+                    $ref: '#/definitions/partial-ft'
+                  event-types:
+                    title: Event types object before field type expansions
+                    type: object
+                    patternProperties:
+                      '.*':
+                        title: Event type object before field type expansions
+                        type: object
+                        properties:
+                          specific-context-field-type:
+                            $ref: '#/definitions/partial-ft'
+                          payload-field-type:
+                            $ref: '#/definitions/partial-ft'
+                required:
+                  - event-types
+          required:
+            - stream-types
+  required:
+    - type
+required:
+  - trace
diff --git a/barectf/schemas/3/config/config-pre-include.yaml b/barectf/schemas/3/config/config-pre-include.yaml
new file mode 100644 (file)
index 0000000..4c07594
--- /dev/null
@@ -0,0 +1,32 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+$schema: http://json-schema.org/draft-07/schema#
+$id: https://barectf.org/schemas/3/config/config-pre-include.json
+title: Configuration object before inclusions
+type: object
+properties:
+  trace:
+    $ref: https://barectf.org/schemas/3/config/trace-pre-include.json
+required:
+  - trace
diff --git a/barectf/schemas/3/config/config-pre-log-level-alias-sub.yaml b/barectf/schemas/3/config/config-pre-log-level-alias-sub.yaml
new file mode 100644 (file)
index 0000000..00d99d6
--- /dev/null
@@ -0,0 +1,64 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+$schema: http://json-schema.org/draft-07/schema#
+$id: https://barectf.org/schemas/3/config/config-pre-log-level-alias-sub.json
+title: Configuration object before log level alias substitutions
+type: object
+properties:
+  trace:
+    title: Trace object before log level alias substitutions
+    type: object
+    properties:
+      type:
+        title: Trace type object before log level alias substitutions
+        type: object
+        properties:
+          $log-level-aliases:
+            $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-log-level-aliases-prop
+          stream-types:
+            title: Stream types object before log level alias substitutions
+            type: object
+            patternProperties:
+              '.*':
+                title: Stream type object before log level alias substitutions
+                type: object
+                properties:
+                  event-types:
+                    title: Event types object before log level alias substitutions
+                    type: object
+                    patternProperties:
+                      '.*':
+                        title: Event type object before log level alias substitutions
+                        type: object
+                        properties:
+                          log-level:
+                            $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-log-level-or-alias-prop
+                required:
+                  - event-types
+          required:
+            - stream-types
+    required:
+      - type
+required:
+  - trace
diff --git a/barectf/schemas/3/config/config.yaml b/barectf/schemas/3/config/config.yaml
new file mode 100644 (file)
index 0000000..b211810
--- /dev/null
@@ -0,0 +1,304 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+$schema: http://json-schema.org/draft-07/schema#
+$id: https://barectf.org/schemas/3/config/config.json
+title: Effective configuration object
+definitions:
+  feature-uint-ft:
+    type: object
+    allOf:
+      - properties:
+          class:
+            enum:
+              - uint
+              - unsigned-int
+              - unsigned-integer
+              - uenum
+              - unsigned-enum
+              - unsigned-enumeration
+      - if:
+          properties:
+            class:
+              $ref: https://barectf.org/schemas/3/config/field-type.json#/definitions/uint-ft-class-prop
+        then:
+          $ref: https://barectf.org/schemas/3/config/field-type.json#/definitions/uint-ft
+      - if:
+          properties:
+            class:
+              $ref: https://barectf.org/schemas/3/config/field-type.json#/definitions/uenum-ft-class-prop
+        then:
+          $ref: https://barectf.org/schemas/3/config/field-type.json#/definitions/uenum-ft
+  opt-or-def-feature-uint-ft:
+    if:
+      type: object
+    then:
+      $ref: '#/definitions/feature-uint-ft'
+    else:
+      oneOf:
+        - type: boolean
+        - type: 'null'
+  opt-feature-uint-ft:
+    if:
+      type: object
+    then:
+      $ref: '#/definitions/feature-uint-ft'
+    else:
+      if:
+        type: boolean
+      then:
+        const: True
+      else:
+        type: 'null'
+  opt-struct-ft:
+    if:
+      type: object
+    then:
+      $ref: https://barectf.org/schemas/3/config/field-type.json#/definitions/struct-ft
+    else:
+      type: 'null'
+  trace:
+    title: Trace object
+    type: object
+    properties:
+      type:
+        $ref: '#/definitions/trace-type'
+      environment:
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-env-prop
+    required:
+      - type
+  trace-type:
+    title: Trace type object
+    type: object
+    properties:
+      uuid:
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-trace-type-uuid-prop
+      $default-byte-order:
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-byte-order-prop
+      $features:
+        if:
+          type: object
+        then:
+          properties:
+            magic-field-type:
+              allOf:
+                - $ref: '#/definitions/opt-or-def-feature-uint-ft'
+                - if:
+                    type: object
+                  then:
+                    properties:
+                      size:
+                        const: 32
+            uuid-field-type:
+              if:
+                type: object
+              then:
+                allOf:
+                  - $ref: https://barectf.org/schemas/3/config/field-type.json#/definitions/static-array-ft
+                  - properties:
+                      length:
+                        const: 16
+                      element-field-type:
+                        allOf:
+                          - $ref: '#/definitions/feature-uint-ft'
+                          - properties:
+                              size:
+                                const: 8
+                              alignment:
+                                if:
+                                  type: integer
+                                then:
+                                  const: 8
+              else:
+                if:
+                  type: boolean
+                then:
+                  const: false
+                else:
+                  type: 'null'
+            stream-type-id-field-type:
+              $ref: '#/definitions/opt-or-def-feature-uint-ft'
+          additionalProperties: false
+        else:
+          type: 'null'
+      clock-types:
+        title: Clock types object
+        type: object
+        patternProperties:
+          '^[A-Za-z_][A-Za-z0-9_]*$':
+            $ref: '#/definitions/clock-type'
+        additionalProperties: false
+      stream-types:
+        title: Stream types object
+        type: object
+        patternProperties:
+          '^[A-Za-z_][A-Za-z0-9_]*$':
+            $ref: '#/definitions/stream-type'
+        additionalProperties: false
+        minProperties: 1
+    required:
+      - stream-types
+    additionalProperties: false
+  clock-type:
+    title: Clock type object
+    type: object
+    properties:
+      uuid:
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-uuid-prop
+      description:
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-string
+      frequency:
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-int-min-1
+      precision:
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-int-min-0
+      offset:
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-clock-type-offset-prop
+      origin-is-unix-epoch:
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-bool
+      $c-type:
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-string
+    additionalProperties: false
+  stream-type:
+    title: Stream type object
+    type: object
+    properties:
+      $is-default:
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-bool
+      $default-clock-type-name:
+        if:
+          type: string
+        then:
+          $ref: https://barectf.org/schemas/common/config/common.json#/definitions/iden-prop
+        else:
+          type: 'null'
+      $features:
+        if:
+          type: object
+        then:
+          properties:
+            packet:
+              if:
+                type: object
+              then:
+                properties:
+                  total-size-field-type:
+                    $ref: '#/definitions/opt-feature-uint-ft'
+                  content-size-field-type:
+                    $ref: '#/definitions/opt-feature-uint-ft'
+                  beginning-time-field-type:
+                    $ref: '#/definitions/opt-or-def-feature-uint-ft'
+                  end-time-field-type:
+                    $ref: '#/definitions/opt-or-def-feature-uint-ft'
+                  discarded-events-counter-field-type:
+                    $ref: '#/definitions/opt-or-def-feature-uint-ft'
+                additionalProperties: false
+              else:
+                type: 'null'
+            event:
+              if:
+                type: object
+              then:
+                properties:
+                  type-id-field-type:
+                    $ref: '#/definitions/opt-or-def-feature-uint-ft'
+                  time-field-type:
+                    $ref: '#/definitions/opt-or-def-feature-uint-ft'
+                additionalProperties: false
+              else:
+                type: 'null'
+          additionalProperties: false
+        else:
+          type: 'null'
+      packet-context-field-type-extra-members:
+        if:
+          type: array
+        then:
+          $ref: https://barectf.org/schemas/3/config/field-type.json#/definitions/struct-ft-members
+        else:
+          type: 'null'
+      event-common-context-field-type:
+        $ref: '#/definitions/opt-struct-ft'
+      event-types:
+        title: Event types object
+        type: object
+        patternProperties:
+          '^[A-Za-z_][A-Za-z0-9_]*$':
+            $ref: '#/definitions/event-type'
+        additionalProperties: false
+        minProperties: 1
+    required:
+      - event-types
+    additionalProperties: false
+  event-type:
+    title: Event type object
+    type: object
+    properties:
+      log-level:
+        $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-int-min-0
+      specific-context-field-type:
+        $ref: '#/definitions/opt-struct-ft'
+      payload-field-type:
+        $ref: '#/definitions/opt-struct-ft'
+    additionalProperties: false
+type: object
+properties:
+  options:
+    title: Configuration options object
+    type: object
+    properties:
+      code-generation:
+        title: Code generation configuration options object
+        type: object
+        properties:
+          prefix:
+            if:
+              type: string
+            then:
+              $ref: https://barectf.org/schemas/common/config/common.json#/definitions/config-prefix-prop
+            else:
+              type: object
+              properties:
+                identifier:
+                  $ref: https://barectf.org/schemas/common/config/common.json#/definitions/iden-prop
+                file-name:
+                  type: string
+              required:
+                - identifier
+                - file-name
+              additionalProperties: false
+          header:
+            title: Header code generation configuration options object
+            type: object
+            properties:
+              identifier-prefix-definition:
+                type: boolean
+              default-stream-type-name-definition:
+                type: boolean
+            additionalProperties: false
+        additionalProperties: false
+    additionalProperties: false
+  trace:
+    $ref: '#/definitions/trace'
+required:
+  - trace
+additionalProperties: false
diff --git a/barectf/schemas/3/config/event-type-pre-include.yaml b/barectf/schemas/3/config/event-type-pre-include.yaml
new file mode 100644 (file)
index 0000000..4d8909b
--- /dev/null
@@ -0,0 +1,30 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+$schema: http://json-schema.org/draft-07/schema#
+$id: https://barectf.org/schemas/3/config/event-type-pre-include.json
+title: Event type object before inclusions
+type: object
+properties:
+  $include:
+    $ref: https://barectf.org/schemas/3/config/include-prop.json
diff --git a/barectf/schemas/3/config/field-type.yaml b/barectf/schemas/3/config/field-type.yaml
new file mode 100644 (file)
index 0000000..767b83e
--- /dev/null
@@ -0,0 +1,339 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+$schema: http://json-schema.org/draft-07/schema#
+$id: https://barectf.org/schemas/3/config/field-type.json
+title: Effective field type object
+definitions:
+  ft-base:
+    type: object
+    required:
+      - class
+  bit-array-ft:
+    allOf:
+      - $ref: '#/definitions/ft-base'
+      - properties:
+          size:
+            $ref: https://barectf.org/schemas/common/config/common.json#/definitions/int-ft-size-prop
+          alignment:
+            $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-int-min-1
+          byte-order:
+            $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-byte-order-prop
+        required:
+          - size
+  int-ft-props:
+    properties:
+      class: true
+      size: true
+      alignment: true
+      byte-order: true
+      preferred-display-base: true
+    additionalProperties: false
+  int-ft:
+    allOf:
+      - $ref: '#/definitions/bit-array-ft'
+      - properties:
+          preferred-display-base:
+            $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-int-ft-preferred-display-base-prop
+  uint-ft-class-prop:
+    type: string
+    enum:
+      - uint
+      - unsigned-int
+      - unsigned-integer
+  uint-ft:
+    title: Unsigned integer field type object
+    allOf:
+      - $ref: '#/definitions/int-ft'
+      - $ref: '#/definitions/int-ft-props'
+      - properties:
+          class:
+            $ref: '#/definitions/uint-ft-class-prop'
+  sint-ft-class-prop:
+    type: string
+    enum:
+      - sint
+      - signed-int
+      - signed-integer
+  sint-ft:
+    title: Signed integer field type object
+    allOf:
+      - $ref: '#/definitions/int-ft'
+      - $ref: '#/definitions/int-ft-props'
+      - properties:
+          class:
+            $ref: '#/definitions/sint-ft-class-prop'
+  enum-ft-props:
+    properties:
+      class: true
+      size: true
+      alignment: true
+      byte-order: true
+      preferred-display-base: true
+      mappings: true
+    additionalProperties: false
+  enum-ft:
+    properties:
+      mappings:
+        if:
+          type: object
+        then:
+          patternProperties:
+            '.*':
+              type: array
+              items:
+                if:
+                  type: array
+                then:
+                  items:
+                    type: integer
+                  minItems: 2
+                  maxItems: 2
+                else:
+                  type: integer
+        else:
+          type: 'null'
+    properties:
+      class: true
+      size: true
+      alignment: true
+      byte-order: true
+      preferred-display-base: true
+      mappings: true
+    additionalProperties: false
+  uenum-ft-class-prop:
+    type: string
+    enum:
+      - uenum
+      - unsigned-enum
+      - unsigned-enumeration
+  uenum-ft:
+    title: Unsigned enumeration field type object
+    allOf:
+      - $ref: '#/definitions/int-ft'
+      - $ref: '#/definitions/enum-ft'
+      - $ref: '#/definitions/enum-ft-props'
+      - properties:
+          class:
+            $ref: '#/definitions/uenum-ft-class-prop'
+  senum-ft-class-prop:
+    type: string
+    enum:
+      - senum
+      - signed-enum
+      - signed-enumeration
+  senum-ft:
+    title: Signed enumeration field type object
+    allOf:
+      - $ref: '#/definitions/int-ft'
+      - $ref: '#/definitions/enum-ft'
+      - $ref: '#/definitions/enum-ft-props'
+      - properties:
+          class:
+            $ref: '#/definitions/senum-ft-class-prop'
+  real-ft-class-prop:
+    type: string
+    const: real
+  real-ft:
+    title: Real field type object
+    allOf:
+      - $ref: '#/definitions/bit-array-ft'
+      - properties:
+          class:
+            $ref: '#/definitions/real-ft-class-prop'
+          size:
+            enum:
+              - 32
+              - 64
+    properties:
+      class: true
+      size: true
+      alignment: true
+      byte-order: true
+    additionalProperties: false
+  string-ft-class-prop:
+    type: string
+    enum:
+      - str
+      - string
+  string-ft:
+    title: String field type object
+    allOf:
+      - $ref: '#/definitions/ft-base'
+      - properties:
+          class:
+            $ref: '#/definitions/string-ft-class-prop'
+    properties:
+      class: true
+    additionalProperties: false
+  static-array-ft-class-prop:
+    type: string
+    const: static-array
+  static-array-ft:
+    title: Static array field type object
+    allOf:
+      - $ref: '#/definitions/ft-base'
+      - properties:
+          class:
+            $ref: '#/definitions/static-array-ft-class-prop'
+          element-field-type:
+            $ref: '#/definitions/ft'
+          length:
+            type: integer
+            minimum: 0
+        required:
+          - element-field-type
+          - length
+    properties:
+      class: true
+      element-field-type: true
+      length: true
+    additionalProperties: false
+  struct-ft-class-prop:
+    type: string
+    enum:
+      - struct
+      - structure
+  struct-ft-member:
+    type: object
+    properties:
+      field-type:
+        $ref: '#/definitions/ft'
+    required:
+      - field-type
+    additionalProperties: false
+  struct-ft-members:
+    type: array
+    items:
+      type: object
+      patternProperties:
+        '^[A-Za-z_][A-Za-z0-9_]*$':
+          $ref: '#/definitions/struct-ft-member'
+      minProperties: 1
+      maxProperties: 1
+  struct-ft:
+    title: Structure field type object
+    allOf:
+      - $ref: '#/definitions/ft-base'
+      - properties:
+          class:
+            $ref: '#/definitions/struct-ft-class-prop'
+          minimum-alignment:
+            $ref: https://barectf.org/schemas/common/config/common.json#/definitions/opt-int-min-1
+          members:
+            if:
+              type: array
+            then:
+              $ref: '#/definitions/struct-ft-members'
+            else:
+              type: 'null'
+    properties:
+      class: true
+      minimum-alignment: true
+      members: true
+    additionalProperties: false
+  ft:
+    allOf:
+      - $ref: '#/definitions/ft-base'
+      - properties:
+          # This is used to make sure that the field type's class name
+          # is valid as any of the conditionals below can fail.
+          #
+          # Although we could use `oneOf` instead of this enumeration
+          # here and refer to each of the `*-ft-class-prop` definitions,
+          # it would be hard for the validator to show something useful
+          # for the user as all cases would fail.
+          #
+          # Using `enum` below makes the validator show a very clear
+          # validation failure message.
+          class:
+            enum:
+              - uint
+              - unsigned-int
+              - unsigned-integer
+              - sint
+              - signed-int
+              - signed-integer
+              - uenum
+              - unsigned-enum
+              - unsigned-enumeration
+              - senum
+              - signed-enum
+              - signed-enumeration
+              - real
+              - str
+              - string
+              - static-array
+              - struct
+              - structure
+      - if:
+          properties:
+            class:
+              $ref: '#/definitions/uint-ft-class-prop'
+        then:
+          $ref: '#/definitions/uint-ft'
+      - if:
+          properties:
+            class:
+              $ref: '#/definitions/sint-ft-class-prop'
+        then:
+          $ref: '#/definitions/sint-ft'
+      - if:
+          properties:
+            class:
+              $ref: '#/definitions/uenum-ft-class-prop'
+        then:
+          $ref: '#/definitions/uenum-ft'
+      - if:
+          properties:
+            class:
+              $ref: '#/definitions/senum-ft-class-prop'
+        then:
+          $ref: '#/definitions/senum-ft'
+      - if:
+          properties:
+            class:
+              $ref: '#/definitions/real-ft-class-prop'
+        then:
+          $ref: '#/definitions/real-ft'
+      - if:
+          properties:
+            class:
+              $ref: '#/definitions/string-ft-class-prop'
+        then:
+          $ref: '#/definitions/string-ft'
+      - if:
+          properties:
+            class:
+              $ref: '#/definitions/static-array-ft-class-prop'
+        then:
+          $ref: '#/definitions/static-array-ft'
+      - if:
+          properties:
+            class:
+              $ref: '#/definitions/struct-ft-class-prop'
+        then:
+          $ref: '#/definitions/struct-ft'
+    required:
+      - class
+$ref: '#/definitions/ft'
diff --git a/barectf/schemas/3/config/include-prop.yaml b/barectf/schemas/3/config/include-prop.yaml
new file mode 100644 (file)
index 0000000..9a4d6e5
--- /dev/null
@@ -0,0 +1,34 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+$schema: http://json-schema.org/draft-07/schema#
+$id: https://barectf.org/schemas/3/config/include-prop.json
+title: Inclusion property value
+if:
+  type: array
+then:
+  items:
+    type: string
+  minItems: 1
+else:
+  type: string
diff --git a/barectf/schemas/3/config/stream-type-pre-include.yaml b/barectf/schemas/3/config/stream-type-pre-include.yaml
new file mode 100644 (file)
index 0000000..b1c0a91
--- /dev/null
@@ -0,0 +1,36 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+$schema: http://json-schema.org/draft-07/schema#
+$id: https://barectf.org/schemas/3/config/stream-type-pre-include.json
+title: Stream type object before inclusions
+type: object
+properties:
+  $include:
+    $ref: https://barectf.org/schemas/3/config/include-prop.json
+  event-types:
+    title: Event types object before inclusions
+    type: object
+    patternProperties:
+      '.*':
+        $ref: https://barectf.org/schemas/3/config/event-type-pre-include.json
diff --git a/barectf/schemas/3/config/trace-pre-include.yaml b/barectf/schemas/3/config/trace-pre-include.yaml
new file mode 100644 (file)
index 0000000..bcb5e94
--- /dev/null
@@ -0,0 +1,32 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+$schema: http://json-schema.org/draft-07/schema#
+$id: https://barectf.org/schemas/3/config/trace-pre-include.json
+title: Trace object before inclusions
+type: object
+properties:
+  $include:
+    $ref: https://barectf.org/schemas/3/config/include-prop.json
+  type:
+    $ref: https://barectf.org/schemas/3/config/trace-type-pre-include.json
diff --git a/barectf/schemas/3/config/trace-type-pre-include.yaml b/barectf/schemas/3/config/trace-type-pre-include.yaml
new file mode 100644 (file)
index 0000000..ef9cb81
--- /dev/null
@@ -0,0 +1,42 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+$schema: http://json-schema.org/draft-07/schema#
+$id: https://barectf.org/schemas/3/config/trace-type-pre-include.json
+title: Trace type object before inclusions
+type: object
+properties:
+  $include:
+    $ref: https://barectf.org/schemas/3/config/include-prop.json
+  clock-types:
+    title: Clock types object before inclusions
+    type: object
+    patternProperties:
+      '.*':
+        $ref: https://barectf.org/schemas/3/config/clock-type-pre-include.json
+  stream-types:
+    title: Stream types object before inclusions
+    type: object
+    patternProperties:
+      '.*':
+        $ref: https://barectf.org/schemas/3/config/stream-type-pre-include.json
diff --git a/barectf/schemas/common/config/common.yaml b/barectf/schemas/common/config/common.yaml
new file mode 100644 (file)
index 0000000..0f7934b
--- /dev/null
@@ -0,0 +1,173 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+$schema: http://json-schema.org/draft-07/schema#
+$id: https://barectf.org/schemas/common/config/common.json
+definitions:
+  opt-bool:
+    oneOf:
+      - type: boolean
+      - type: 'null'
+  opt-string:
+    oneOf:
+      - type: string
+      - type: 'null'
+  opt-int-min-0:
+    if:
+      type: integer
+    then:
+      minimum: 0
+    else:
+      type: 'null'
+  opt-int-min-1:
+    if:
+      type: integer
+    then:
+      minimum: 1
+    else:
+      type: 'null'
+  opt-log-level-aliases-prop:
+    title: Optional log level aliases object
+    if:
+      type: object
+    then:
+      patternProperties:
+        '':
+          $ref: '#/definitions/opt-int-min-0'
+    else:
+      type: 'null'
+  byte-order-prop:
+    title: Byte order property value
+    type: string
+    enum:
+      - le
+      - little
+      - little-endian
+      - be
+      - big
+      - big-endian
+  opt-byte-order-prop:
+    title: Optional byte order property value
+    if:
+      type: string
+    then:
+      $ref: '#/definitions/byte-order-prop'
+    else:
+      type: 'null'
+  int-ft-size-prop:
+    title: Integer field type's size property
+    type: integer
+    minimum: 1
+    maximum: 64
+  opt-int-ft-preferred-display-base-prop:
+    if:
+      type: string
+    then:
+      enum:
+        - bin
+        - binary
+        - oct
+        - octal
+        - dec
+        - decimal
+        - hex
+        - hexadecimal
+    else:
+      type: 'null'
+  opt-uuid-prop:
+    title: Optional UUID property value
+    if:
+      type: string
+    then:
+      pattern: '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$'
+    else:
+      type: 'null'
+  opt-trace-type-uuid-prop:
+    title: Optional trace type UUID property value
+    if:
+      type: string
+    then:
+      oneOf:
+        - $ref: '#/definitions/opt-uuid-prop'
+        - type: string
+          const: auto
+    else:
+      type: 'null'
+  opt-clock-type-offset-prop:
+    if:
+      type: object
+    then:
+      properties:
+        cycles:
+          $ref: '#/definitions/opt-int-min-0'
+        seconds:
+          $ref: '#/definitions/opt-int-min-0'
+      additionalProperties: false
+    else:
+      type: 'null'
+  iden-prop:
+    type: string
+    allOf:
+      - pattern: '^[A-Za-z_][A-Za-z0-9_]*$'
+      - not:
+          enum:
+            - align
+            - callsite
+            - clock
+            - enum
+            - env
+            - event
+            - floating_point
+            - integer
+            - stream
+            - string
+            - struct
+            - trace
+            - typealias
+            - typedef
+            - variant
+  config-prefix-prop:
+    $ref: '#/definitions/iden-prop'
+  opt-env-prop:
+    title: Environment variables
+    if:
+      type: object
+    then:
+      patternProperties:
+        '^[A-Za-z_][A-Za-z0-9_]*$':
+          oneOf:
+            - type: string
+            - type: integer
+      additionalProperties: false
+    else:
+      type: 'null'
+  opt-log-level-or-alias-prop:
+    title: Optional log level (integral or alias) property
+    if:
+      type: integer
+    then:
+      minimum: 0
+    else:
+      oneOf:
+        - type: string
+        - type: 'null'
diff --git a/barectf/schemas/config/config-min.yaml b/barectf/schemas/config/config-min.yaml
deleted file mode 100644 (file)
index d06b327..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-$schema: http://json-schema.org/draft-07/schema#
-$id: https://barectf.org/schemas/config/config-min.json
-title: Minimal configuration object
-type: object
-properties:
-  version:
-    type: string
-    enum:
-      - '2.0'
-      - '2.1'
-      - '2.2'
-required:
-  - version
index ae83b719ec1893089b7b6215c61f629fd4ac6acf..99e3063b6bd650c023b26dac4986fc7f47c05728 100644 (file)
 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-from barectf import metadata
-from barectf import codegen
-import datetime
-import barectf
+import barectf.codegen as barectf_codegen
+import barectf.version as barectf_version
+import barectf.config as barectf_config
 
 
-_bo_to_string_map = {
-    metadata.ByteOrder.LE: 'le',
-    metadata.ByteOrder.BE: 'be',
-}
+def _bool_to_string(b):
+    return 'true' if b else 'false'
 
 
-_encoding_to_string_map = {
-    metadata.Encoding.NONE: 'none',
-    metadata.Encoding.ASCII: 'ASCII',
-    metadata.Encoding.UTF8: 'UTF8',
+_byte_order_to_string_map = {
+    barectf_config.ByteOrder.LITTLE_ENDIAN: 'le',
+    barectf_config.ByteOrder.BIG_ENDIAN: 'be',
 }
 
 
-def _bo_to_string(bo):
-    return _bo_to_string_map[bo]
+def _byte_order_to_string(byte_order):
+    return _byte_order_to_string_map[byte_order]
 
 
-def _encoding_to_string(encoding):
-    return _encoding_to_string_map[encoding]
+_display_base_to_int_map = {
+    barectf_config.DisplayBase.BINARY: 2,
+    barectf_config.DisplayBase.OCTAL: 8,
+    barectf_config.DisplayBase.DECIMAL: 10,
+    barectf_config.DisplayBase.HEXADECIMAL: 16,
+}
 
 
-def _bool_to_string(b):
-    return 'true' if b else 'false'
+def _display_base_to_int(disp_base):
+    return _display_base_to_int_map[disp_base]
 
 
-def _gen_integer(t, cg):
+def _gen_int_ft(ft, cg):
     cg.add_line('integer {')
     cg.indent()
-    cg.add_line('size = {};'.format(t.size))
-    cg.add_line('align = {};'.format(t.align))
-    cg.add_line('signed = {};'.format(_bool_to_string(t.signed)))
-    cg.add_line('byte_order = {};'.format(_bo_to_string(t.byte_order)))
-    cg.add_line('base = {};'.format(t.base))
-    cg.add_line('encoding = {};'.format(_encoding_to_string(t.encoding)))
-
-    if t.property_mappings:
-        clock_name = t.property_mappings[0].object.name
-        cg.add_line('map = clock.{}.value;'.format(clock_name))
-
-    cg.unindent()
-    cg.add_line('}')
+    cg.add_line(f'size = {ft.size};')
+    cg.add_line(f'align = {ft.alignment};')
+    is_signed = isinstance(ft, barectf_config.SignedIntegerFieldType)
+    cg.add_line(f'signed = {_bool_to_string(is_signed)};')
+    cg.add_line(f'byte_order = {_byte_order_to_string(ft.byte_order)};')
+    cg.add_line(f'base = {_display_base_to_int(ft.preferred_display_base)};')
 
+    if isinstance(ft, barectf_config.UnsignedIntegerFieldType) and ft._mapped_clk_type_name is not None:
+        cg.add_line(f'map = clock.{ft._mapped_clk_type_name}.value;')
 
-def _gen_float(t, cg):
-    cg.add_line('floating_point {')
-    cg.indent()
-    cg.add_line('exp_dig = {};'.format(t.exp_size))
-    cg.add_line('mant_dig = {};'.format(t.mant_size))
-    cg.add_line('align = {};'.format(t.align))
-    cg.add_line('byte_order = {};'.format(_bo_to_string(t.byte_order)))
     cg.unindent()
     cg.add_line('}')
 
 
-def _gen_enum(t, cg):
+def _gen_enum_ft(ft, cg):
     cg.add_line('enum : ')
     cg.add_glue()
-    _gen_type(t.value_type, cg)
+    _gen_int_ft(ft, cg)
     cg.append_to_last_line(' {')
     cg.indent()
 
-    for label, (mn, mx) in t.members.items():
-        if mn == mx:
-            rg = str(mn)
-        else:
-            rg = '{} ... {}'.format(mn, mx)
+    for label, mapping in ft.mappings.items():
+        for rg in mapping.ranges:
+            if rg.lower == rg.upper:
+                rg_str = str(rg.lower)
+            else:
+                rg_str = f'{rg.lower} ... {rg.upper}'
 
-        line = '"{}" = {},'.format(label, rg)
+        line = f'"{label}" = {rg_str},'
         cg.add_line(line)
 
     cg.unindent()
     cg.add_line('}')
 
 
-def _gen_string(t, cg):
+def _gen_real_ft(ft, cg):
+    cg.add_line('floating_point {')
+    cg.indent()
+
+    if ft.size == 32:
+        exp_dig = 8
+        mant_dig = 24
+    else:
+        assert ft.size == 64
+        exp_dig = 11
+        mant_dig = 53
+
+    cg.add_line(f'exp_dig = {exp_dig};')
+    cg.add_line(f'mant_dig = {mant_dig};')
+    cg.add_line(f'align = {ft.alignment};')
+    cg.add_line(f'byte_order = {_byte_order_to_string(ft.byte_order)};')
+    cg.unindent()
+    cg.add_line('}')
+
+
+def _gen_string_ft(ft, cg):
     cg.add_line('string {')
     cg.indent()
-    cg.add_line('encoding = {};'.format(_encoding_to_string(t.encoding)))
+    cg.add_line('encoding = UTF8;')
     cg.unindent()
     cg.add_line('}')
 
 
-def _find_deepest_array_element_type(t):
-    if type(t) is metadata.Array:
-        return _find_deepest_array_element_type(t.element_type)
+def _find_deepest_array_ft_element_ft(ft):
+    if isinstance(ft, barectf_config._ArrayFieldType):
+        return _find_deepest_array_ft_element_ft(ft.element_field_type)
 
-    return t
+    return ft
 
 
-def _fill_array_lengths(t, lengths):
-    if type(t) is metadata.Array:
-        lengths.append(t.length)
-        _fill_array_lengths(t.element_type, lengths)
+def _static_array_ft_lengths(ft, lengths):
+    if type(ft) is barectf_config.StaticArrayFieldType:
+        lengths.append(ft.length)
+        _static_array_ft_lengths(ft.element_field_type, lengths)
 
 
-def _gen_struct_entry(name, t, cg):
-    real_t = _find_deepest_array_element_type(t)
-    _gen_type(real_t, cg)
-    cg.append_to_last_line(' {}'.format(name))
+def _gen_struct_ft_entry(name, ft, cg):
+    elem_ft = _find_deepest_array_ft_element_ft(ft)
+    _gen_ft(elem_ft, cg)
+    cg.append_to_last_line(f' {name}')
 
     # array
     lengths = []
-    _fill_array_lengths(t, lengths)
+    _static_array_ft_lengths(ft, lengths)
 
     if lengths:
         for length in reversed(lengths):
-            cg.append_to_last_line('[{}]'.format(length))
+            cg.append_to_last_line(f'[{length}]')
 
     cg.append_to_last_line(';')
 
 
-def _gen_struct(t, cg):
+def _gen_struct_ft(ft, cg):
     cg.add_line('struct {')
     cg.indent()
 
-    for field_name, field_type in t.fields.items():
-        _gen_struct_entry(field_name, field_type, cg)
+    for name, member in ft.members.items():
+        _gen_struct_ft_entry(name, member.field_type, cg)
 
     cg.unindent()
 
-    if not t.fields:
+    if len(ft.members) == 0:
         cg.add_glue()
 
-    cg.add_line('}} align({})'.format(t.min_align))
+    cg.add_line(f'}} align({ft.minimum_alignment})')
 
 
-_type_to_gen_type_func = {
-    metadata.Integer: _gen_integer,
-    metadata.FloatingPoint: _gen_float,
-    metadata.Enum: _gen_enum,
-    metadata.String: _gen_string,
-    metadata.Struct: _gen_struct,
+_ft_to_gen_ft_func = {
+    barectf_config.UnsignedIntegerFieldType: _gen_int_ft,
+    barectf_config.SignedIntegerFieldType: _gen_int_ft,
+    barectf_config.UnsignedEnumerationFieldType: _gen_enum_ft,
+    barectf_config.SignedEnumerationFieldType: _gen_enum_ft,
+    barectf_config.RealFieldType: _gen_real_ft,
+    barectf_config.StringFieldType: _gen_string_ft,
+    barectf_config.StructureFieldType: _gen_struct_ft,
 }
 
 
-def _gen_type(t, cg):
-    _type_to_gen_type_func[type(t)](t, cg)
+def _gen_ft(ft, cg):
+    _ft_to_gen_ft_func[type(ft)](ft, cg)
 
 
-def _gen_entity(name, t, cg):
+def _gen_root_ft(name, ft, cg):
     cg.add_line('{} := '.format(name))
     cg.add_glue()
-    _gen_type(t, cg)
+    _gen_ft(ft, cg)
     cg.append_to_last_line(';')
 
 
+def _try_gen_root_ft(name, ft, cg):
+    if ft is None:
+        return
+
+    _gen_root_ft(name, ft, cg)
+
+
 def _gen_start_block(name, cg):
-    cg.add_line('{} {{'.format(name))
+    cg.add_line(f'{name} {{')
     cg.indent()
 
 
@@ -184,22 +202,22 @@ def _gen_end_block(cg):
     cg.add_empty_line()
 
 
-def _gen_trace_block(meta, cg):
-    trace = meta.trace
-
+def _gen_trace_type_block(config, cg):
+    trace_type = config.trace.type
     _gen_start_block('trace', cg)
     cg.add_line('major = 1;')
     cg.add_line('minor = 8;')
-    line = 'byte_order = {};'.format(_bo_to_string(trace.byte_order))
-    cg.add_line(line)
+    default_byte_order = trace_type.default_byte_order
 
-    if trace.uuid is not None:
-        line = 'uuid = "{}";'.format(trace.uuid)
-        cg.add_line(line)
+    if default_byte_order is None:
+        default_byte_order = barectf_config.ByteOrder.LITTLE_ENDIAN
+
+    cg.add_line(f'byte_order = {_byte_order_to_string(default_byte_order)};')
 
-    if trace.packet_header_type is not None:
-        _gen_entity('packet.header', trace.packet_header_type, cg)
+    if trace_type.uuid is not None:
+        cg.add_line(f'uuid = "{trace_type.uuid}";')
 
+    _try_gen_root_ft('packet.header', trace_type._pkt_header_ft, cg)
     _gen_end_block(cg)
 
 
@@ -209,118 +227,96 @@ def _escape_literal_string(s):
     esc = esc.replace('\r', '\\r')
     esc = esc.replace('\t', '\\t')
     esc = esc.replace('"', '\\"')
-
     return esc
 
 
-def _gen_env_block(meta, cg):
-    env = meta.env
-
-    if not env:
-        return
-
+def _gen_trace_env_block(config, cg):
+    env = config.trace.environment
+    assert env is not None
     _gen_start_block('env', cg)
 
     for name, value in env.items():
         if type(value) is int:
             value_string = str(value)
         else:
-            value_string = '"{}"'.format(_escape_literal_string(value))
+            value_string = f'"{_escape_literal_string(value)}"'
 
-        cg.add_line('{} = {};'.format(name, value_string))
+        cg.add_line(f'{name} = {value_string};')
 
     _gen_end_block(cg)
 
 
-def _gen_clock_block(clock, cg):
+def _gen_clk_type_block(clk_type, cg):
     _gen_start_block('clock', cg)
-    cg.add_line('name = {};'.format(clock.name))
+    cg.add_line(f'name = {clk_type.name};')
 
-    if clock.description is not None:
-        desc = _escape_literal_string(clock.description)
-        cg.add_line('description = "{}";'.format(desc))
+    if clk_type.description is not None:
+        cg.add_line(f'description = "{_escape_literal_string(clk_type.description)}";')
 
-    if clock.uuid is not None:
-        cg.add_line('uuid = "{}";'.format(clock.uuid))
+    if clk_type.uuid is not None:
+        cg.add_line(f'uuid = "{clk_type.uuid}";')
 
-    cg.add_line('freq = {};'.format(clock.freq))
-    cg.add_line('offset_s = {};'.format(clock.offset_seconds))
-    cg.add_line('offset = {};'.format(clock.offset_cycles))
-    cg.add_line('precision = {};'.format(clock.error_cycles))
-    cg.add_line('absolute = {};'.format(_bool_to_string(clock.absolute)))
+    cg.add_line(f'freq = {clk_type.frequency};')
+    cg.add_line(f'offset_s = {clk_type.offset.seconds};')
+    cg.add_line(f'offset = {clk_type.offset.cycles};')
+    cg.add_line(f'precision = {clk_type.precision};')
+    cg.add_line(f'absolute = {_bool_to_string(clk_type.origin_is_unix_epoch)};')
     _gen_end_block(cg)
 
 
-def _gen_clock_blocks(meta, cg):
-    clocks = meta.clocks
-
-    for clock in clocks.values():
-        _gen_clock_block(clock, cg)
+def _gen_clk_type_blocks(config, cg):
+    for stream_type in sorted(config.trace.type.stream_types):
+        if stream_type.default_clock_type is not None:
+            _gen_clk_type_block(stream_type.default_clock_type, cg)
 
 
-def _gen_stream_block(meta, stream, cg):
-    cg.add_cc_line(stream.name.replace('/', ''))
+def _gen_stream_type_block(config, stream_type, cg):
+    cg.add_cc_line(stream_type.name.replace('/', ''))
     _gen_start_block('stream', cg)
 
-    if meta.trace.packet_header_type is not None:
-        if 'stream_id' in meta.trace.packet_header_type.fields:
-            cg.add_line('id = {};'.format(stream.id))
-
-    if stream.packet_context_type is not None:
-        _gen_entity('packet.context', stream.packet_context_type, cg)
-
-    if stream.event_header_type is not None:
-        _gen_entity('event.header', stream.event_header_type, cg)
-
-    if stream.event_context_type is not None:
-        _gen_entity('event.context', stream.event_context_type, cg)
+    if config.trace.type.features.stream_type_id_field_type is not None:
+        cg.add_line(f'id = {stream_type.id};')
 
+    _try_gen_root_ft('packet.context', stream_type._pkt_ctx_ft, cg)
+    _try_gen_root_ft('event.header', stream_type._ev_header_ft, cg)
+    _try_gen_root_ft('event.context', stream_type.event_common_context_field_type, cg)
     _gen_end_block(cg)
 
 
-def _gen_event_block(meta, stream, ev, cg):
+def _gen_ev_type_block(config, stream_type, ev_type, cg):
     _gen_start_block('event', cg)
-    cg.add_line('name = "{}";'.format(ev.name))
-    cg.add_line('id = {};'.format(ev.id))
-
-    if meta.trace.packet_header_type is not None:
-        if 'stream_id' in meta.trace.packet_header_type.fields:
-            cg.add_line('stream_id = {};'.format(stream.id))
+    cg.add_line(f'name = "{ev_type.name}";')
 
-    cg.append_cc_to_last_line(stream.name.replace('/', ''))
+    if stream_type.features.event_features.type_id_field_type is not None:
+        cg.add_line(f'id = {ev_type.id};')
 
-    if ev.log_level is not None:
-        add_fmt = ''
+    if config.trace.type.features.stream_type_id_field_type is not None:
+        cg.add_line(f'stream_id = {stream_type.id};')
+        cg.append_cc_to_last_line(f'Stream type `{stream_type.name.replace("/", "")}`')
 
-        if ev.log_level.name is not None:
-            name = ev.log_level.name.replace('*/', '')
-            add_fmt = ' /* {} */'.format(name)
+    if ev_type.log_level is not None:
+        cg.add_line(f'loglevel = {ev_type.log_level};')
 
-        fmt = 'loglevel = {};' + add_fmt
-        cg.add_line(fmt.format(ev.log_level.value))
+    _try_gen_root_ft('context', ev_type.specific_context_field_type, cg)
+    payload_ft = ev_type.payload_field_type
 
-    if ev.context_type is not None:
-        _gen_entity('context', ev.context_type, cg)
-
-    if ev.payload_type is not None:
-        _gen_entity('fields', ev.payload_type, cg)
-    else:
-        fake_payload = metadata.Struct(8)
-        _gen_entity('fields', fake_payload, cg)
+    if payload_ft is None:
+        payload_ft = barectf_config.StructureFieldType(8)
 
+    _try_gen_root_ft('fields', ev_type.payload_field_type, cg)
     _gen_end_block(cg)
 
 
-def _gen_streams_events_blocks(meta, cg):
-    for stream in meta.streams.values():
-        _gen_stream_block(meta, stream, cg)
+def _gen_stream_type_ev_type_blocks(config, cg):
+    for stream_type in sorted(config.trace.type.stream_types):
+        _gen_stream_type_block(config, stream_type, cg)
 
-        for ev in stream.events.values():
-            _gen_event_block(meta, stream, ev, cg)
+        for ev_type in sorted(stream_type.event_types):
+            _gen_ev_type_block(config, stream_type, ev_type, cg)
 
 
-def from_metadata(meta):
-    cg = codegen.CodeGenerator('\t')
+def _from_config(config):
+    cg = barectf_codegen._CodeGenerator('\t')
 
     # version/magic
     cg.add_line('/* CTF 1.8 */')
@@ -350,27 +346,23 @@ def from_metadata(meta):
  *
  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  *''')
-    v = barectf.__version__
-    line = ' * The following TSDL code was generated by barectf v{}'.format(v)
-    cg.add_line(line)
-    now = datetime.datetime.now()
-    line = ' * on {}.'.format(now)
-    cg.add_line(line)
+    cg.add_line(f' * The following TSDL code was generated by barectf v{barectf_version.__version__}')
+    cg.add_line(f' * on {config.trace.environment["barectf_gen_date"]}.')
     cg.add_line(' *')
-    cg.add_line(' * For more details, see <http://barectf.org>.')
+    cg.add_line(' * For more details, see <https://barectf.org/>.')
     cg.add_line(' */')
     cg.add_empty_line()
 
-    # trace block
-    _gen_trace_block(meta, cg)
+    # trace type block
+    _gen_trace_type_block(config, cg)
 
-    # environment
-    _gen_env_block(meta, cg)
+    # trace environment block
+    _gen_trace_env_block(config, cg)
 
-    # clocks
-    _gen_clock_blocks(meta, cg)
+    # clock type blocks
+    _gen_clk_type_blocks(config, cg)
 
-    # streams and contained events
-    _gen_streams_events_blocks(meta, cg)
+    # stream and type blocks
+    _gen_stream_type_ev_type_blocks(config, cg)
 
     return cg.code
diff --git a/barectf/version.py b/barectf/version.py
new file mode 100644 (file)
index 0000000..f4bdd42
--- /dev/null
@@ -0,0 +1,27 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2014-2020 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+__major_version__ = 2
+__minor_version__ = 3
+__patch_version__ = 1
+__version__ = '{}.{}.{}'.format(__major_version__, __minor_version__, __patch_version__)
index 99e3c8035a3c2132233edf423db8bde55130ebff..d0a59d3e7fcfceb09d708e62944acaaa9503039f 100644 (file)
@@ -1,31 +1,4 @@
-fail/clock/barectf*.*
-fail/clock/metadata
-fail/config/barectf*.*
-fail/config/metadata
-fail/event/barectf*.*
-fail/event/metadata
-fail/include/barectf*.*
-fail/include/metadata
-fail/metadata/barectf*.*
-fail/metadata/metadata
-fail/stream/barectf*.*
-fail/stream/metadata
-fail/trace/barectf*.*
-fail/trace/metadata
-fail/type/barectf*.*
-fail/type/metadata
-fail/type-enum/barectf*.*
-fail/type-enum/metadata
-fail/type-float/barectf*.*
-fail/type-float/metadata
-fail/type-int/barectf*.*
-fail/type-int/metadata
-fail/type-string/barectf*.*
-fail/type-string/metadata
-fail/type-struct/barectf*.*
-fail/type-struct/metadata
-fail/yaml/barectf*.*
-fail/yaml/metadata
-pass/everything/*.c
-pass/everything/*.h
-pass/everything/metadata
+barectf*.*
+metadata
+*.c
+*.h
diff --git a/tests/config/2/fail/clock/absolute-invalid-type.yaml b/tests/config/2/fail/clock/absolute-invalid-type.yaml
new file mode 100644 (file)
index 0000000..50320f8
--- /dev/null
@@ -0,0 +1,48 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
+  clocks:
+    my_clock:
+      absolute: []
diff --git a/tests/config/2/fail/clock/description-invalid-type.yaml b/tests/config/2/fail/clock/description-invalid-type.yaml
new file mode 100644 (file)
index 0000000..6fd8990
--- /dev/null
@@ -0,0 +1,48 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
+  clocks:
+    my_clock:
+      description: 23
diff --git a/tests/config/2/fail/clock/ec-invalid-type.yaml b/tests/config/2/fail/clock/ec-invalid-type.yaml
new file mode 100644 (file)
index 0000000..ac46af9
--- /dev/null
@@ -0,0 +1,48 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
+  clocks:
+    my_clock:
+      error-cycles: string
diff --git a/tests/config/2/fail/clock/ec-invalid.yaml b/tests/config/2/fail/clock/ec-invalid.yaml
new file mode 100644 (file)
index 0000000..04bfd08
--- /dev/null
@@ -0,0 +1,48 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
+  clocks:
+    my_clock:
+      error-cycles: -17
diff --git a/tests/config/2/fail/clock/fail.bats b/tests/config/2/fail/clock/fail.bats
new file mode 100644 (file)
index 0000000..315fa53
--- /dev/null
@@ -0,0 +1,93 @@
+#!/usr/bin/env bats
+
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+load ../../../common
+
+@test 'unknown property in clock object makes barectf fail' {
+  barectf_config_check_fail unknown-prop.yaml
+}
+
+@test 'wrong "freq" property type in clock object makes barectf fail' {
+  barectf_config_check_fail freq-invalid-type.yaml
+}
+
+@test 'invalid "freq" property (0) in clock object makes barectf fail' {
+  barectf_config_check_fail freq-0.yaml
+}
+
+@test 'invalid "freq" property (negative) in clock object makes barectf fail' {
+  barectf_config_check_fail freq-neg.yaml
+}
+
+@test 'wrong "description" property type in clock object makes barectf fail' {
+  barectf_config_check_fail description-invalid-type.yaml
+}
+
+@test 'wrong "uuid" property type in clock object makes barectf fail' {
+  barectf_config_check_fail uuid-invalid-type.yaml
+}
+
+@test 'invalid "uuid" property in clock object makes barectf fail' {
+  barectf_config_check_fail uuid-invalid.yaml
+}
+
+@test 'wrong "error-cycles" property type in clock object makes barectf fail' {
+  barectf_config_check_fail ec-invalid-type.yaml
+}
+
+@test 'invalid "error-cycles" property in clock object makes barectf fail' {
+  barectf_config_check_fail ec-invalid.yaml
+}
+
+@test 'wrong "offset" property type in clock object makes barectf fail' {
+  barectf_config_check_fail offset-invalid-type.yaml
+}
+
+@test 'wrong "absolute" property type in clock object makes barectf fail' {
+  barectf_config_check_fail absolute-invalid-type.yaml
+}
+
+@test 'unknown property in clock offset object makes barectf fail' {
+  barectf_config_check_fail offset-unknown-prop.yaml
+}
+
+@test 'wrong "seconds" property type in clock offset object makes barectf fail' {
+  barectf_config_check_fail offset-seconds-invalid-type.yaml
+}
+
+@test 'invalid "seconds" property in clock offset object makes barectf fail' {
+  barectf_config_check_fail offset-seconds-neg.yaml
+}
+
+@test 'wrong "cycles" property type in clock offset object makes barectf fail' {
+  barectf_config_check_fail offset-cycles-invalid-type.yaml
+}
+
+@test 'invalid "cycles" property in clock offset object makes barectf fail' {
+  barectf_config_check_fail offset-cycles-neg.yaml
+}
+
+@test 'wrong "$return-ctype" property type in clock object makes barectf fail' {
+  barectf_config_check_fail rct-invalid-type.yaml
+}
diff --git a/tests/config/2/fail/clock/freq-0.yaml b/tests/config/2/fail/clock/freq-0.yaml
new file mode 100644 (file)
index 0000000..22ff073
--- /dev/null
@@ -0,0 +1,48 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
+  clocks:
+    my_clock:
+      freq: 0
diff --git a/tests/config/2/fail/clock/freq-invalid-type.yaml b/tests/config/2/fail/clock/freq-invalid-type.yaml
new file mode 100644 (file)
index 0000000..63255af
--- /dev/null
@@ -0,0 +1,48 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
+  clocks:
+    my_clock:
+      freq: string
diff --git a/tests/config/2/fail/clock/freq-neg.yaml b/tests/config/2/fail/clock/freq-neg.yaml
new file mode 100644 (file)
index 0000000..f2f0f70
--- /dev/null
@@ -0,0 +1,48 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
+  clocks:
+    my_clock:
+      freq: -12
diff --git a/tests/config/2/fail/clock/offset-cycles-invalid-type.yaml b/tests/config/2/fail/clock/offset-cycles-invalid-type.yaml
new file mode 100644 (file)
index 0000000..88fa94f
--- /dev/null
@@ -0,0 +1,49 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
+  clocks:
+    my_clock:
+      offset:
+        cycles: string
diff --git a/tests/config/2/fail/clock/offset-cycles-neg.yaml b/tests/config/2/fail/clock/offset-cycles-neg.yaml
new file mode 100644 (file)
index 0000000..7631d69
--- /dev/null
@@ -0,0 +1,49 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
+  clocks:
+    my_clock:
+      offset:
+        cycles: -17
diff --git a/tests/config/2/fail/clock/offset-invalid-type.yaml b/tests/config/2/fail/clock/offset-invalid-type.yaml
new file mode 100644 (file)
index 0000000..24dff48
--- /dev/null
@@ -0,0 +1,48 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
+  clocks:
+    my_clock:
+      offset: 23
diff --git a/tests/config/2/fail/clock/offset-seconds-invalid-type.yaml b/tests/config/2/fail/clock/offset-seconds-invalid-type.yaml
new file mode 100644 (file)
index 0000000..807ef40
--- /dev/null
@@ -0,0 +1,49 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
+  clocks:
+    my_clock:
+      offset:
+        seconds: string
diff --git a/tests/config/2/fail/clock/offset-seconds-neg.yaml b/tests/config/2/fail/clock/offset-seconds-neg.yaml
new file mode 100644 (file)
index 0000000..1a90977
--- /dev/null
@@ -0,0 +1,49 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
+  clocks:
+    my_clock:
+      offset:
+        seconds: -17
diff --git a/tests/config/2/fail/clock/offset-unknown-prop.yaml b/tests/config/2/fail/clock/offset-unknown-prop.yaml
new file mode 100644 (file)
index 0000000..34bbc3e
--- /dev/null
@@ -0,0 +1,49 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
+  clocks:
+    my_clock:
+      offset:
+        unknown: false
diff --git a/tests/config/2/fail/clock/rct-invalid-type.yaml b/tests/config/2/fail/clock/rct-invalid-type.yaml
new file mode 100644 (file)
index 0000000..cc8a909
--- /dev/null
@@ -0,0 +1,48 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
+  clocks:
+    my_clock:
+      $return-ctype: 23
diff --git a/tests/config/2/fail/clock/unknown-prop.yaml b/tests/config/2/fail/clock/unknown-prop.yaml
new file mode 100644 (file)
index 0000000..d866485
--- /dev/null
@@ -0,0 +1,49 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
+  clocks:
+    my_clock:
+      freq: 1000
+      unknown: false
diff --git a/tests/config/2/fail/clock/uuid-invalid-type.yaml b/tests/config/2/fail/clock/uuid-invalid-type.yaml
new file mode 100644 (file)
index 0000000..8eb0e66
--- /dev/null
@@ -0,0 +1,48 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
+  clocks:
+    my_clock:
+      uuid: -17
diff --git a/tests/config/2/fail/clock/uuid-invalid.yaml b/tests/config/2/fail/clock/uuid-invalid.yaml
new file mode 100644 (file)
index 0000000..2371ea1
--- /dev/null
@@ -0,0 +1,48 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
+  clocks:
+    my_clock:
+      uuid: zoom
diff --git a/tests/config/2/fail/config/fail.bats b/tests/config/2/fail/config/fail.bats
new file mode 100644 (file)
index 0000000..a0c5bf7
--- /dev/null
@@ -0,0 +1,73 @@
+#!/usr/bin/env bats
+
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+load ../../../common
+
+@test 'unknown property in config object makes barectf fail' {
+  barectf_config_check_fail unknown-prop.yaml
+}
+
+@test 'no "version" property in config object makes barectf fail' {
+  barectf_config_check_fail version-no.yaml
+}
+
+@test 'wrong "version" property type in config object makes barectf fail' {
+  barectf_config_check_fail version-invalid-type.yaml
+}
+
+@test 'invalid "version" property (1.9) in config object makes barectf fail' {
+  barectf_config_check_fail version-invalid-19.yaml
+}
+
+@test 'invalid "version" property (2.3) in config object makes barectf fail' {
+  barectf_config_check_fail version-invalid-23.yaml
+}
+
+@test 'wrong "prefix" property type in config object makes barectf fail' {
+  barectf_config_check_fail prefix-invalid-type.yaml
+}
+
+@test 'no valid C identifier in "prefix" property type in config object makes barectf fail' {
+  barectf_config_check_fail prefix-invalid-identifier.yaml
+}
+
+@test 'no "metadata" property in config object makes barectf fail' {
+  barectf_config_check_fail metadata-no.yaml
+}
+
+@test 'wrong "metadata" property type in config object makes barectf fail' {
+  barectf_config_check_fail metadata-invalid-type.yaml
+}
+
+@test 'wrong "options" property type in config object makes barectf fail' {
+  barectf_config_check_fail options-invalid-type.yaml
+}
+
+@test 'wrong "gen-prefix-def" property type in config options object makes barectf fail' {
+  barectf_config_check_fail options-gen-prefix-def-invalid-type.yaml
+}
+
+@test 'wrong "gen-default-stream-def" property type in config options object makes barectf fail' {
+  barectf_config_check_fail options-gen-default-stream-def-invalid-type.yaml
+}
diff --git a/tests/config/2/fail/config/metadata-invalid-type.yaml b/tests/config/2/fail/config/metadata-invalid-type.yaml
new file mode 100644 (file)
index 0000000..3291d6f
--- /dev/null
@@ -0,0 +1,25 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata: 23
+
diff --git a/tests/config/2/fail/config/metadata-no.yaml b/tests/config/2/fail/config/metadata-no.yaml
new file mode 100644 (file)
index 0000000..aba76ba
--- /dev/null
@@ -0,0 +1,23 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
diff --git a/tests/config/2/fail/config/options-gen-default-stream-def-invalid-type.yaml b/tests/config/2/fail/config/options-gen-default-stream-def-invalid-type.yaml
new file mode 100644 (file)
index 0000000..bfb36d2
--- /dev/null
@@ -0,0 +1,47 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.2'
+options:
+  gen-default-stream-def: 23
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/config/options-gen-prefix-def-invalid-type.yaml b/tests/config/2/fail/config/options-gen-prefix-def-invalid-type.yaml
new file mode 100644 (file)
index 0000000..74a2bc4
--- /dev/null
@@ -0,0 +1,47 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.2'
+options:
+  gen-prefix-def: do it
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/config/options-invalid-type.yaml b/tests/config/2/fail/config/options-invalid-type.yaml
new file mode 100644 (file)
index 0000000..921ec49
--- /dev/null
@@ -0,0 +1,46 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.2'
+options: false
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/config/options-unknown-prop.yaml b/tests/config/2/fail/config/options-unknown-prop.yaml
new file mode 100644 (file)
index 0000000..6327229
--- /dev/null
@@ -0,0 +1,47 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.2'
+options:
+  meow: mix
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/config/prefix-invalid-identifier.yaml b/tests/config/2/fail/config/prefix-invalid-identifier.yaml
new file mode 100644 (file)
index 0000000..1ae048c
--- /dev/null
@@ -0,0 +1,46 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+prefix: 'some prefix'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/config/prefix-invalid-type.yaml b/tests/config/2/fail/config/prefix-invalid-type.yaml
new file mode 100644 (file)
index 0000000..2960934
--- /dev/null
@@ -0,0 +1,46 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+prefix: -21
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/config/unknown-prop.yaml b/tests/config/2/fail/config/unknown-prop.yaml
new file mode 100644 (file)
index 0000000..b8b6f9e
--- /dev/null
@@ -0,0 +1,46 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
+unknown: false
diff --git a/tests/config/2/fail/config/version-invalid-19.yaml b/tests/config/2/fail/config/version-invalid-19.yaml
new file mode 100644 (file)
index 0000000..ceccd5c
--- /dev/null
@@ -0,0 +1,45 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '1.9'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/config/version-invalid-23.yaml b/tests/config/2/fail/config/version-invalid-23.yaml
new file mode 100644 (file)
index 0000000..cf73d04
--- /dev/null
@@ -0,0 +1,45 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.3'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/config/version-invalid-type.yaml b/tests/config/2/fail/config/version-invalid-type.yaml
new file mode 100644 (file)
index 0000000..a28f748
--- /dev/null
@@ -0,0 +1,45 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: 2.1
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/config/version-no.yaml b/tests/config/2/fail/config/version-no.yaml
new file mode 100644 (file)
index 0000000..d8e23a6
--- /dev/null
@@ -0,0 +1,44 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/event/ct-invalid-type.yaml b/tests/config/2/fail/event/ct-invalid-type.yaml
new file mode 100644 (file)
index 0000000..b696056
--- /dev/null
@@ -0,0 +1,46 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          context-type: 23
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/event/ct-not-struct.yaml b/tests/config/2/fail/event/ct-not-struct.yaml
new file mode 100644 (file)
index 0000000..c1991d0
--- /dev/null
@@ -0,0 +1,48 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          context-type:
+            class: int
+            size: 8
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/event/fail.bats b/tests/config/2/fail/event/fail.bats
new file mode 100644 (file)
index 0000000..eb515d5
--- /dev/null
@@ -0,0 +1,57 @@
+#!/usr/bin/env bats
+
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+load ../../../common
+
+@test 'unknown property in event object makes barectf fail' {
+  barectf_config_check_fail unknown-prop.yaml
+}
+
+@test 'wrong "log-level" property type in event object makes barectf fail' {
+  barectf_config_check_fail ll-invalid-type.yaml
+}
+
+@test 'non existing log level name as "log-level" property value in event object makes barectf fail' {
+  barectf_config_check_fail ll-non-existing.yaml
+}
+
+@test 'wrong "context-type" property type in event object makes barectf fail' {
+  barectf_config_check_fail ct-invalid-type.yaml
+}
+
+@test 'invalid "context-type" property field type (not a structure) in event object makes barectf fail' {
+  barectf_config_check_fail ct-not-struct.yaml
+}
+
+@test 'wrong "payload-type" property type in event object makes barectf fail' {
+  barectf_config_check_fail pt-invalid-type.yaml
+}
+
+@test 'invalid "payload-type" property field type (not a structure) in event object makes barectf fail' {
+  barectf_config_check_fail pt-not-struct.yaml
+}
+
+@test 'empty event object makes barectf fail' {
+  barectf_config_check_fail no-fields-at-all.yaml
+}
diff --git a/tests/config/2/fail/event/ll-invalid-type.yaml b/tests/config/2/fail/event/ll-invalid-type.yaml
new file mode 100644 (file)
index 0000000..a9fef25
--- /dev/null
@@ -0,0 +1,46 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          log-level: true
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/event/ll-non-existing.yaml b/tests/config/2/fail/event/ll-non-existing.yaml
new file mode 100644 (file)
index 0000000..b2c23d3
--- /dev/null
@@ -0,0 +1,49 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  $log-levels:
+    EMERG: 0
+    WARNING: 23
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          log-level: EME
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/event/no-fields-at-all.yaml b/tests/config/2/fail/event/no-fields-at-all.yaml
new file mode 100644 (file)
index 0000000..3a08827
--- /dev/null
@@ -0,0 +1,39 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event: {}
diff --git a/tests/config/2/fail/event/pt-invalid-type.yaml b/tests/config/2/fail/event/pt-invalid-type.yaml
new file mode 100644 (file)
index 0000000..6cbaba4
--- /dev/null
@@ -0,0 +1,40 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type: -17
diff --git a/tests/config/2/fail/event/pt-not-struct.yaml b/tests/config/2/fail/event/pt-not-struct.yaml
new file mode 100644 (file)
index 0000000..c1afa5a
--- /dev/null
@@ -0,0 +1,43 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: int
+            size: 8
+
diff --git a/tests/config/2/fail/event/unknown-prop.yaml b/tests/config/2/fail/event/unknown-prop.yaml
new file mode 100644 (file)
index 0000000..209f096
--- /dev/null
@@ -0,0 +1,46 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          unknown: false
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/include/cycle-sym.yaml b/tests/config/2/fail/include/cycle-sym.yaml
new file mode 100644 (file)
index 0000000..a389075
--- /dev/null
@@ -0,0 +1,46 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  $include: inc-recursive-sym1.yaml
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/include/cycle.yaml b/tests/config/2/fail/include/cycle.yaml
new file mode 100644 (file)
index 0000000..b6d3f6f
--- /dev/null
@@ -0,0 +1,46 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  $include: inc-recursive1.yaml
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/include/fail.bats b/tests/config/2/fail/include/fail.bats
new file mode 100644 (file)
index 0000000..7153911
--- /dev/null
@@ -0,0 +1,56 @@
+#!/usr/bin/env bats
+
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+load ../../../common
+
+@test 'wrong "$include" property type makes barectf fail' {
+  barectf_config_check_fail invalid-type.yaml
+}
+
+@test 'non-existing file in "$include" property (string) makes barectf fail' {
+  barectf_config_check_fail file-not-found.yaml
+}
+
+@test 'non-existing absolute file in "$include" property (string) makes barectf fail' {
+  barectf_config_check_fail file-not-found-abs.yaml
+}
+
+@test 'non-existing file in "$include" property (array) makes barectf fail' {
+  barectf_config_check_fail file-not-found-in-array.yaml
+}
+
+@test 'non-existing file in "$include" property (recursive) makes barectf fail' {
+  barectf_config_check_fail file-not-found-recursive.yaml
+}
+
+@test 'cycle in include graph makes barectf fail' {
+  barectf_config_check_fail cycle.yaml
+}
+
+@test 'cycle in include graph (with a symbolic link) makes barectf fail' {
+  local symlink="$BATS_TEST_DIRNAME/inc-recursive-sym3.yaml"
+  ln -fs inc-recursive-sym1.yaml "$symlink"
+  barectf_config_check_fail cycle-sym.yaml
+  rm -f "$symlink"
+}
diff --git a/tests/config/2/fail/include/file-not-found-abs.yaml b/tests/config/2/fail/include/file-not-found-abs.yaml
new file mode 100644 (file)
index 0000000..691fffa
--- /dev/null
@@ -0,0 +1,46 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  $include: /path/to/not/found
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/include/file-not-found-in-array.yaml b/tests/config/2/fail/include/file-not-found-in-array.yaml
new file mode 100644 (file)
index 0000000..eb91fa9
--- /dev/null
@@ -0,0 +1,48 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  $include:
+    - inc-empty.yaml
+    - yes.yaml
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/include/file-not-found-recursive.yaml b/tests/config/2/fail/include/file-not-found-recursive.yaml
new file mode 100644 (file)
index 0000000..2ce1212
--- /dev/null
@@ -0,0 +1,46 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  $include: inc-inc-not-found.yaml
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/include/file-not-found.yaml b/tests/config/2/fail/include/file-not-found.yaml
new file mode 100644 (file)
index 0000000..b801533
--- /dev/null
@@ -0,0 +1,46 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  $include: yes.yaml
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/include/inc-empty.yaml b/tests/config/2/fail/include/inc-empty.yaml
new file mode 100644 (file)
index 0000000..7d717c4
--- /dev/null
@@ -0,0 +1,23 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+{}
diff --git a/tests/config/2/fail/include/inc-inc-not-found.yaml b/tests/config/2/fail/include/inc-inc-not-found.yaml
new file mode 100644 (file)
index 0000000..1310824
--- /dev/null
@@ -0,0 +1,23 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+$include: yes.yaml
diff --git a/tests/config/2/fail/include/inc-recursive-sym1.yaml b/tests/config/2/fail/include/inc-recursive-sym1.yaml
new file mode 100644 (file)
index 0000000..31301d2
--- /dev/null
@@ -0,0 +1,23 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+$include: inc-recursive-sym2.yaml
diff --git a/tests/config/2/fail/include/inc-recursive-sym2.yaml b/tests/config/2/fail/include/inc-recursive-sym2.yaml
new file mode 100644 (file)
index 0000000..c024779
--- /dev/null
@@ -0,0 +1,23 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+$include: inc-recursive-sym3.yaml
diff --git a/tests/config/2/fail/include/inc-recursive1.yaml b/tests/config/2/fail/include/inc-recursive1.yaml
new file mode 100644 (file)
index 0000000..f23e504
--- /dev/null
@@ -0,0 +1,23 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+$include: inc-recursive2.yaml
diff --git a/tests/config/2/fail/include/inc-recursive2.yaml b/tests/config/2/fail/include/inc-recursive2.yaml
new file mode 100644 (file)
index 0000000..cd29ed0
--- /dev/null
@@ -0,0 +1,23 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+$include: inc-recursive3.yaml
diff --git a/tests/config/2/fail/include/inc-recursive3.yaml b/tests/config/2/fail/include/inc-recursive3.yaml
new file mode 100644 (file)
index 0000000..1f92c70
--- /dev/null
@@ -0,0 +1,23 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+$include: inc-recursive1.yaml
diff --git a/tests/config/2/fail/include/include-include-replace.yaml b/tests/config/2/fail/include/include-include-replace.yaml
new file mode 100644 (file)
index 0000000..8acb978
--- /dev/null
@@ -0,0 +1,47 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  $include: inc-empty.yaml
+  $include-replace: inc-empty.yaml
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/include/invalid-type.yaml b/tests/config/2/fail/include/invalid-type.yaml
new file mode 100644 (file)
index 0000000..155bf7b
--- /dev/null
@@ -0,0 +1,46 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  $include: 23
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/include/replace-file-not-found-in-array.yaml b/tests/config/2/fail/include/replace-file-not-found-in-array.yaml
new file mode 100644 (file)
index 0000000..caefd2b
--- /dev/null
@@ -0,0 +1,48 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  $include-replace:
+    - inc-empty.yaml
+    - yes.yaml
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/include/replace-file-not-found.yaml b/tests/config/2/fail/include/replace-file-not-found.yaml
new file mode 100644 (file)
index 0000000..c6e64eb
--- /dev/null
@@ -0,0 +1,46 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  $include-replace: yes.yaml
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/default-invalid-type.yaml b/tests/config/2/fail/stream/default-invalid-type.yaml
new file mode 100644 (file)
index 0000000..908eb79
--- /dev/null
@@ -0,0 +1,46 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.2'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      $default: 23
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/ect-invalid-type.yaml b/tests/config/2/fail/stream/ect-invalid-type.yaml
new file mode 100644 (file)
index 0000000..b56c582
--- /dev/null
@@ -0,0 +1,41 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      event-context-type: 23
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/ect-not-struct.yaml b/tests/config/2/fail/stream/ect-not-struct.yaml
new file mode 100644 (file)
index 0000000..4a9bbe9
--- /dev/null
@@ -0,0 +1,42 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      event-context-type:
+        class: string
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/eht-id-no-multiple-events.yaml b/tests/config/2/fail/stream/eht-id-no-multiple-events.yaml
new file mode 100644 (file)
index 0000000..cb7ced7
--- /dev/null
@@ -0,0 +1,54 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  clocks:
+    my_clock: {}
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          content_size: uint16
+          packet_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
+        my_other_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/eht-id-not-int.yaml b/tests/config/2/fail/stream/eht-id-not-int.yaml
new file mode 100644 (file)
index 0000000..1eeb868
--- /dev/null
@@ -0,0 +1,52 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  clocks:
+    my_clock: {}
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          content_size: uint16
+          packet_size: uint16
+      event-header-type:
+        class: struct
+        fields:
+          id:
+            class: string
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/eht-id-too-small.yaml b/tests/config/2/fail/stream/eht-id-too-small.yaml
new file mode 100644 (file)
index 0000000..a3a4b11
--- /dev/null
@@ -0,0 +1,72 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  clocks:
+    my_clock: {}
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          content_size: uint16
+          packet_size: uint16
+      event-header-type:
+        class: struct
+        min-align: 8
+        fields:
+          id:
+            class: int
+            size: 2
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field: uint16
+        my_event2:
+          payload-type:
+            class: struct
+            fields:
+              my_field: uint16
+        my_event3:
+          payload-type:
+            class: struct
+            fields:
+              my_field: uint16
+        my_event4:
+          payload-type:
+            class: struct
+            fields:
+              my_field: uint16
+        my_event5:
+          payload-type:
+            class: struct
+            fields:
+              my_field: uint16
diff --git a/tests/config/2/fail/stream/eht-id-wrong-signed.yaml b/tests/config/2/fail/stream/eht-id-wrong-signed.yaml
new file mode 100644 (file)
index 0000000..9485bd2
--- /dev/null
@@ -0,0 +1,54 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  clocks:
+    my_clock: {}
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          content_size: uint16
+          packet_size: uint16
+      event-header-type:
+        class: struct
+        fields:
+          id:
+            class: int
+            size: 16
+            signed: true
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/eht-invalid-type.yaml b/tests/config/2/fail/stream/eht-invalid-type.yaml
new file mode 100644 (file)
index 0000000..765c67e
--- /dev/null
@@ -0,0 +1,41 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      event-header-type: 23
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/eht-not-struct.yaml b/tests/config/2/fail/stream/eht-not-struct.yaml
new file mode 100644 (file)
index 0000000..048f62e
--- /dev/null
@@ -0,0 +1,42 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      event-header-type:
+        class: string
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/eht-timestamp-not-int.yaml b/tests/config/2/fail/stream/eht-timestamp-not-int.yaml
new file mode 100644 (file)
index 0000000..39a07ac
--- /dev/null
@@ -0,0 +1,52 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  clocks:
+    my_clock: {}
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          content_size: uint16
+          packet_size: uint16
+      event-header-type:
+        class: struct
+        fields:
+          timestamp:
+            class: string
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/eht-timestamp-wrong-pm.yaml b/tests/config/2/fail/stream/eht-timestamp-wrong-pm.yaml
new file mode 100644 (file)
index 0000000..064eafe
--- /dev/null
@@ -0,0 +1,53 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  clocks:
+    my_clock: {}
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          content_size: uint16
+          packet_size: uint16
+      event-header-type:
+        class: struct
+        fields:
+          timestamp:
+            class: int
+            size: 16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/eht-timestamp-wrong-signed.yaml b/tests/config/2/fail/stream/eht-timestamp-wrong-signed.yaml
new file mode 100644 (file)
index 0000000..2e65575
--- /dev/null
@@ -0,0 +1,58 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  clocks:
+    my_clock: {}
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          content_size: uint16
+          packet_size: uint16
+      event-header-type:
+        class: struct
+        fields:
+          timestamp:
+            class: int
+            size: 16
+            signed: true
+            property-mappings:
+              - type: clock
+                name: my_clock
+                property: value
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/events-empty.yaml b/tests/config/2/fail/stream/events-empty.yaml
new file mode 100644 (file)
index 0000000..b100d92
--- /dev/null
@@ -0,0 +1,29 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events: {}
diff --git a/tests/config/2/fail/stream/events-invalid-type.yaml b/tests/config/2/fail/stream/events-invalid-type.yaml
new file mode 100644 (file)
index 0000000..557d1b0
--- /dev/null
@@ -0,0 +1,38 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events: 23.5
diff --git a/tests/config/2/fail/stream/events-key-invalid-identifier.yaml b/tests/config/2/fail/stream/events-key-invalid-identifier.yaml
new file mode 100644 (file)
index 0000000..6c17ee1
--- /dev/null
@@ -0,0 +1,45 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    a_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        'my event':
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/events-no.yaml b/tests/config/2/fail/stream/events-no.yaml
new file mode 100644 (file)
index 0000000..eae4fbe
--- /dev/null
@@ -0,0 +1,37 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size:
+            class: int
+            size: 16
+          content_size:
+            class: int
+            size: 16
diff --git a/tests/config/2/fail/stream/fail.bats b/tests/config/2/fail/stream/fail.bats
new file mode 100644 (file)
index 0000000..f70eea0
--- /dev/null
@@ -0,0 +1,173 @@
+#!/usr/bin/env bats
+
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+load ../../../common
+
+@test 'unknown property in stream object makes barectf fail' {
+  barectf_config_check_fail unknown-prop.yaml
+}
+
+@test 'no "packet-context-type" property in stream object makes barectf fail' {
+  barectf_config_check_fail pct-no.yaml
+}
+
+@test 'wrong "packet-context-type" property type in stream object makes barectf fail' {
+  barectf_config_check_fail pct-invalid-type.yaml
+}
+
+@test 'invalid "packet-context-type" property field type (not a structure) in stream object makes barectf fail' {
+  barectf_config_check_fail pct-not-struct.yaml
+}
+
+@test 'invalid "timestamp_begin" field type (not an integer) in packet context type makes barectf fail' {
+  barectf_config_check_fail pct-tb-not-int.yaml
+}
+
+@test 'invalid "timestamp_begin" field type (signed) in packet context type makes barectf fail' {
+  barectf_config_check_fail pct-tb-wrong-signed.yaml
+}
+
+@test 'invalid "timestamp_begin" field type (not mapped to a clock) in packet context type makes barectf fail' {
+  barectf_config_check_fail pct-tb-wrong-pm.yaml
+}
+
+@test 'no "timestamp_begin" field with an existing "timestamp_end" field in packet context type makes barectf fail' {
+  barectf_config_check_fail pct-te-yes-tb-no.yaml
+}
+
+@test 'invalid "timestamp_end" field type (not an integer) in packet context type makes barectf fail' {
+  barectf_config_check_fail pct-te-not-int.yaml
+}
+
+@test 'invalid "timestamp_end" field type (signed) in packet context type makes barectf fail' {
+  barectf_config_check_fail pct-te-wrong-signed.yaml
+}
+
+@test 'invalid "timestamp_end" field type (not mapped to a clock) in packet context type makes barectf fail' {
+  barectf_config_check_fail pct-te-wrong-pm.yaml
+}
+
+@test 'no "timestamp_end" field with an existing "timestamp_begin" field in packet context type makes barectf fail' {
+  barectf_config_check_fail pct-tb-yes-te-no.yaml
+}
+
+@test '"timestamp_begin" field and "timestamp_end" field are not mapped to the same clock in packet context type makes barectf fail' {
+  barectf_config_check_fail pct-tb-te-different-clocks.yaml
+}
+
+@test 'invalid "packet_size" field type (not an integer) in packet context type makes barectf fail' {
+  barectf_config_check_fail pct-ps-not-int.yaml
+}
+
+@test 'invalid "packet_size" field type (signed) in packet context type makes barectf fail' {
+  barectf_config_check_fail pct-ps-wrong-signed.yaml
+}
+
+@test 'no "packet_size" field with an existing "content_size" field in packet context type makes barectf fail' {
+  barectf_config_check_fail pct-cs-yes-ps-no.yaml
+}
+
+@test 'invalid "content_size" field type (not an integer) in packet context type makes barectf fail' {
+  barectf_config_check_fail pct-cs-not-int.yaml
+}
+
+@test 'invalid "content_size" field type (signed) in packet context type makes barectf fail' {
+  barectf_config_check_fail pct-cs-wrong-signed.yaml
+}
+
+@test 'no "content_size" field with an existing "packet_size" field in packet context type makes barectf fail' {
+  barectf_config_check_fail pct-ps-yes-cs-no.yaml
+}
+
+@test 'invalid "events_discarded" field type (not an integer) in packet context type makes barectf fail' {
+  barectf_config_check_fail pct-ed-not-int.yaml
+}
+
+@test 'invalid "events_discarded" field type (signed) in packet context type makes barectf fail' {
+  barectf_config_check_fail pct-ed-wrong-signed.yaml
+}
+
+@test 'wrong "event-header-type" property type in stream object makes barectf fail' {
+  barectf_config_check_fail eht-invalid-type.yaml
+}
+
+@test 'invalid "event-header-type" property field type (not a structure) in stream object makes barectf fail' {
+  barectf_config_check_fail eht-not-struct.yaml
+}
+
+@test 'invalid "timestamp" field type (not an integer) in event header type makes barectf fail' {
+  barectf_config_check_fail eht-timestamp-not-int.yaml
+}
+
+@test 'invalid "timestamp" field type (signed) in event header type makes barectf fail' {
+  barectf_config_check_fail eht-timestamp-wrong-signed.yaml
+}
+
+@test 'invalid "timestamp" field type (not mapped to a clock) in event header type makes barectf fail' {
+  barectf_config_check_fail eht-timestamp-wrong-pm.yaml
+}
+
+@test 'invalid "id" field type (not an integer) in event header type makes barectf fail' {
+  barectf_config_check_fail eht-id-not-int.yaml
+}
+
+@test 'invalid "id" field type (signed) in event header type makes barectf fail' {
+  barectf_config_check_fail eht-id-wrong-signed.yaml
+}
+
+@test 'no event header type with multiple events in stream object makes barectf fail' {
+  barectf_config_check_fail eht-id-no-multiple-events.yaml
+}
+
+@test '"id" field type size too small for the number of stream events in event header type makes barectf fail' {
+  barectf_config_check_fail eht-id-too-small.yaml
+}
+
+@test 'wrong "event-context-type" property type in stream object makes barectf fail' {
+  barectf_config_check_fail ect-invalid-type.yaml
+}
+
+@test 'invalid "event-context-type" property field type (not a structure) in stream object makes barectf fail' {
+  barectf_config_check_fail ect-not-struct.yaml
+}
+
+@test 'no "events" property in stream object makes barectf fail' {
+  barectf_config_check_fail events-no.yaml
+}
+
+@test 'wrong "events" property type in stream object makes barectf fail' {
+  barectf_config_check_fail events-invalid-type.yaml
+}
+
+@test 'empty "events" property in stream object makes barectf fail' {
+  barectf_config_check_fail events-empty.yaml
+}
+
+@test 'invalid "events" key (invalid C identifier) in metadata object makes barectf fail' {
+  barectf_config_check_fail events-key-invalid-identifier.yaml
+}
+
+@test 'wrong "$default" property type in stream object makes barectf fail' {
+  barectf_config_check_fail default-invalid-type.yaml
+}
diff --git a/tests/config/2/fail/stream/pct-cs-not-int.yaml b/tests/config/2/fail/stream/pct-cs-not-int.yaml
new file mode 100644 (file)
index 0000000..9b7c053
--- /dev/null
@@ -0,0 +1,46 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          content_size:
+            class: string
+          packet_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/pct-cs-wrong-signed.yaml b/tests/config/2/fail/stream/pct-cs-wrong-signed.yaml
new file mode 100644 (file)
index 0000000..70127d7
--- /dev/null
@@ -0,0 +1,50 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  clocks:
+    my_clock: {}
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          content_size:
+            class: int
+            size: 16
+            signed: true
+          packet_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/pct-cs-yes-ps-no.yaml b/tests/config/2/fail/stream/pct-cs-yes-ps-no.yaml
new file mode 100644 (file)
index 0000000..5fb3a95
--- /dev/null
@@ -0,0 +1,44 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/pct-ed-not-int.yaml b/tests/config/2/fail/stream/pct-ed-not-int.yaml
new file mode 100644 (file)
index 0000000..a1bfffb
--- /dev/null
@@ -0,0 +1,45 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          events_discarded:
+            class: string
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/pct-ed-wrong-signed.yaml b/tests/config/2/fail/stream/pct-ed-wrong-signed.yaml
new file mode 100644 (file)
index 0000000..372c70d
--- /dev/null
@@ -0,0 +1,49 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  clocks:
+    my_clock: {}
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          events_discarded:
+            class: int
+            size: 16
+            signed: true
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/pct-invalid-type.yaml b/tests/config/2/fail/stream/pct-invalid-type.yaml
new file mode 100644 (file)
index 0000000..55bf135
--- /dev/null
@@ -0,0 +1,41 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type: 23
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/pct-no.yaml b/tests/config/2/fail/stream/pct-no.yaml
new file mode 100644 (file)
index 0000000..1f4beab
--- /dev/null
@@ -0,0 +1,42 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  clocks:
+    my_clock: {}
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/pct-not-struct.yaml b/tests/config/2/fail/stream/pct-not-struct.yaml
new file mode 100644 (file)
index 0000000..128f92e
--- /dev/null
@@ -0,0 +1,42 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: string
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/pct-ps-not-int.yaml b/tests/config/2/fail/stream/pct-ps-not-int.yaml
new file mode 100644 (file)
index 0000000..5d767aa
--- /dev/null
@@ -0,0 +1,46 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size:
+            class: string
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/pct-ps-wrong-signed.yaml b/tests/config/2/fail/stream/pct-ps-wrong-signed.yaml
new file mode 100644 (file)
index 0000000..2887e05
--- /dev/null
@@ -0,0 +1,50 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  clocks:
+    my_clock: {}
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size:
+            class: int
+            size: 16
+            signed: true
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/pct-ps-yes-cs-no.yaml b/tests/config/2/fail/stream/pct-ps-yes-cs-no.yaml
new file mode 100644 (file)
index 0000000..8f2ccd1
--- /dev/null
@@ -0,0 +1,44 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/pct-tb-not-int.yaml b/tests/config/2/fail/stream/pct-tb-not-int.yaml
new file mode 100644 (file)
index 0000000..a78c9cb
--- /dev/null
@@ -0,0 +1,47 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          content_size: uint16
+          packet_size: uint16
+          timestamp_begin:
+            class: string
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/pct-tb-te-different-clocks.yaml b/tests/config/2/fail/stream/pct-tb-te-different-clocks.yaml
new file mode 100644 (file)
index 0000000..1158c8d
--- /dev/null
@@ -0,0 +1,62 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  clocks:
+    my_clock: {}
+    my_other_clock: {}
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          content_size: uint16
+          packet_size: uint16
+          timestamp_begin:
+            class: int
+            size: 32
+            property-mappings:
+              - type: clock
+                name: my_clock
+                property: value
+          timestamp_end:
+            class: int
+            size: 32
+            property-mappings:
+              - type: clock
+                name: my_other_clock
+                property: value
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/pct-tb-wrong-pm.yaml b/tests/config/2/fail/stream/pct-tb-wrong-pm.yaml
new file mode 100644 (file)
index 0000000..c6ca9ae
--- /dev/null
@@ -0,0 +1,50 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  clocks:
+    my_clock: {}
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          content_size: uint16
+          packet_size: uint16
+          timestamp_begin:
+            class: int
+            size: 16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/pct-tb-wrong-signed.yaml b/tests/config/2/fail/stream/pct-tb-wrong-signed.yaml
new file mode 100644 (file)
index 0000000..f559bca
--- /dev/null
@@ -0,0 +1,55 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  clocks:
+    my_clock: {}
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          content_size: uint16
+          packet_size: uint16
+          timestamp_begin:
+            class: int
+            size: 16
+            signed: true
+            property-mappings:
+              - type: clock
+                name: my_clock
+                property: value
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/pct-tb-yes-te-no.yaml b/tests/config/2/fail/stream/pct-tb-yes-te-no.yaml
new file mode 100644 (file)
index 0000000..a3422a0
--- /dev/null
@@ -0,0 +1,54 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  clocks:
+    my_clock: {}
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          content_size: uint16
+          packet_size: uint16
+          timestamp_begin:
+            class: int
+            size: 32
+            property-mappings:
+              - type: clock
+                name: my_clock
+                property: value
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/pct-te-not-int.yaml b/tests/config/2/fail/stream/pct-te-not-int.yaml
new file mode 100644 (file)
index 0000000..9e286c4
--- /dev/null
@@ -0,0 +1,47 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          content_size: uint16
+          packet_size: uint16
+          timestamp_end:
+            class: string
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/pct-te-wrong-pm.yaml b/tests/config/2/fail/stream/pct-te-wrong-pm.yaml
new file mode 100644 (file)
index 0000000..0b8bfd9
--- /dev/null
@@ -0,0 +1,50 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  clocks:
+    my_clock: {}
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          content_size: uint16
+          packet_size: uint16
+          timestamp_end:
+            class: int
+            size: 16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/pct-te-wrong-signed.yaml b/tests/config/2/fail/stream/pct-te-wrong-signed.yaml
new file mode 100644 (file)
index 0000000..48507bf
--- /dev/null
@@ -0,0 +1,55 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  clocks:
+    my_clock: {}
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          content_size: uint16
+          packet_size: uint16
+          timestamp_end:
+            class: int
+            size: 16
+            signed: true
+            property-mappings:
+              - type: clock
+                name: my_clock
+                property: value
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/pct-te-yes-tb-no.yaml b/tests/config/2/fail/stream/pct-te-yes-tb-no.yaml
new file mode 100644 (file)
index 0000000..2fdd9b1
--- /dev/null
@@ -0,0 +1,54 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  clocks:
+    my_clock: {}
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          content_size: uint16
+          packet_size: uint16
+          timestamp_end:
+            class: int
+            size: 32
+            property-mappings:
+              - type: clock
+                name: my_clock
+                property: value
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/stream/unknown-prop.yaml b/tests/config/2/fail/stream/unknown-prop.yaml
new file mode 100644 (file)
index 0000000..0b370ba
--- /dev/null
@@ -0,0 +1,46 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      unknown: true
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/trace/bo-invalid-type.yaml b/tests/config/2/fail/trace/bo-invalid-type.yaml
new file mode 100644 (file)
index 0000000..fddf0ef
--- /dev/null
@@ -0,0 +1,45 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: 23
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/trace/bo-invalid.yaml b/tests/config/2/fail/trace/bo-invalid.yaml
new file mode 100644 (file)
index 0000000..01baca8
--- /dev/null
@@ -0,0 +1,45 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: ze
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/trace/bo-no.yaml b/tests/config/2/fail/trace/bo-no.yaml
new file mode 100644 (file)
index 0000000..359c74f
--- /dev/null
@@ -0,0 +1,44 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace: {}
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/trace/fail.bats b/tests/config/2/fail/trace/fail.bats
new file mode 100644 (file)
index 0000000..f8b6cb7
--- /dev/null
@@ -0,0 +1,101 @@
+#!/usr/bin/env bats
+
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+load ../../../common
+
+@test 'unknown property in trace object makes barectf fail' {
+  barectf_config_check_fail unknown-prop.yaml
+}
+
+@test 'wrong "byte-order" property type in trace object makes barectf fail' {
+  barectf_config_check_fail bo-invalid-type.yaml
+}
+
+@test 'no "byte-order" property in trace object makes barectf fail' {
+  barectf_config_check_fail bo-no.yaml
+}
+
+@test 'invalid "byte-order" property in trace object makes barectf fail' {
+  barectf_config_check_fail bo-invalid.yaml
+}
+
+@test 'invalid "packet-header-type" property field type (not a structure) in trace object makes barectf fail' {
+  barectf_config_check_fail ph-not-struct.yaml
+}
+
+@test 'wrong "uuid" property type in trace object makes barectf fail' {
+  barectf_config_check_fail uuid-invalid-type.yaml
+}
+
+@test 'invalid "uuid" property (invalid UUID format) in trace object makes barectf fail' {
+  barectf_config_check_fail uuid-invalid-uuid.yaml
+}
+
+@test 'invalid "magic" field type (not an integer) in packet header type makes barectf fail' {
+  barectf_config_check_fail ph-magic-not-int.yaml
+}
+
+@test 'invalid "magic" field type (wrong integer size) in packet header type makes barectf fail' {
+  barectf_config_check_fail ph-magic-wrong-size.yaml
+}
+
+@test 'invalid "magic" field type (signed) in packet header type makes barectf fail' {
+  barectf_config_check_fail ph-magic-wrong-signed.yaml
+}
+
+@test 'invalid "stream_id" field type (not an integer) in packet header type makes barectf fail' {
+  barectf_config_check_fail ph-streamid-not-int.yaml
+}
+
+@test 'invalid "stream_id" field type (signed) in packet header type makes barectf fail' {
+  barectf_config_check_fail ph-streamid-wrong-signed.yaml
+}
+
+@test '"stream_id" field type size too small for the number of trace streams in packet header type makes barectf fail' {
+  barectf_config_check_fail ph-streamid-too-small.yaml
+}
+
+@test 'invalid "uuid" field type (not an array) in packet header type makes barectf fail' {
+  barectf_config_check_fail ph-uuid-not-array.yaml
+}
+
+@test 'invalid "uuid" field type (wrong array length) in packet header type makes barectf fail' {
+  barectf_config_check_fail ph-uuid-wrong-length.yaml
+}
+
+@test 'invalid "uuid" field type (element type is not an integer) in packet header type makes barectf fail' {
+  barectf_config_check_fail ph-uuid-et-not-int.yaml
+}
+
+@test 'invalid "uuid" field type (wrong element type size) in packet header type makes barectf fail' {
+  barectf_config_check_fail ph-uuid-et-wrong-size.yaml
+}
+
+@test 'invalid "uuid" field type (element type is signed) in packet header type makes barectf fail' {
+  barectf_config_check_fail ph-uuid-et-wrong-signed.yaml
+}
+
+@test 'invalid "uuid" field type (wrong element type alignment) in packet header type makes barectf fail' {
+  barectf_config_check_fail ph-uuid-et-wrong-align.yaml
+}
diff --git a/tests/config/2/fail/trace/ph-magic-not-int.yaml b/tests/config/2/fail/trace/ph-magic-not-int.yaml
new file mode 100644 (file)
index 0000000..87911be
--- /dev/null
@@ -0,0 +1,50 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: be
+    packet-header-type:
+      class: struct
+      fields:
+        magic:
+          class: string
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/trace/ph-magic-wrong-signed.yaml b/tests/config/2/fail/trace/ph-magic-wrong-signed.yaml
new file mode 100644 (file)
index 0000000..604f0a0
--- /dev/null
@@ -0,0 +1,52 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: be
+    packet-header-type:
+      class: struct
+      fields:
+        magic:
+          class: int
+          size: 32
+          signed: true
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/trace/ph-magic-wrong-size.yaml b/tests/config/2/fail/trace/ph-magic-wrong-size.yaml
new file mode 100644 (file)
index 0000000..2a1eaf7
--- /dev/null
@@ -0,0 +1,51 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: be
+    packet-header-type:
+      class: struct
+      fields:
+        magic:
+          class: int
+          size: 16
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/trace/ph-not-struct.yaml b/tests/config/2/fail/trace/ph-not-struct.yaml
new file mode 100644 (file)
index 0000000..92a6d5e
--- /dev/null
@@ -0,0 +1,48 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: be
+    packet-header-type:
+      class: int
+      size: 32
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/trace/ph-streamid-not-int.yaml b/tests/config/2/fail/trace/ph-streamid-not-int.yaml
new file mode 100644 (file)
index 0000000..d457fd1
--- /dev/null
@@ -0,0 +1,50 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: be
+    packet-header-type:
+      class: struct
+      fields:
+        stream_id:
+          class: string
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/trace/ph-streamid-too-small.yaml b/tests/config/2/fail/trace/ph-streamid-too-small.yaml
new file mode 100644 (file)
index 0000000..946406a
--- /dev/null
@@ -0,0 +1,125 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  clocks:
+    my_clock: {}
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: le
+    packet-header-type:
+      class: struct
+      min-align: 8
+      fields:
+        stream_id:
+          class: int
+          size: 2
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          content_size: uint16
+          packet_size: uint16
+      event-header-type:
+        class: struct
+        min-align: 8
+        fields:
+          id: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field: uint16
+    my_stream2:
+      packet-context-type:
+        class: struct
+        fields:
+          content_size: uint16
+          packet_size: uint16
+      event-header-type:
+        class: struct
+        min-align: 8
+        fields:
+          id: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field: uint16
+    my_stream3:
+      packet-context-type:
+        class: struct
+        fields:
+          content_size: uint16
+          packet_size: uint16
+      event-header-type:
+        class: struct
+        min-align: 8
+        fields:
+          id: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field: uint16
+    my_stream4:
+      packet-context-type:
+        class: struct
+        fields:
+          content_size: uint16
+          packet_size: uint16
+      event-header-type:
+        class: struct
+        min-align: 8
+        fields:
+          id: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field: uint16
+    my_stream5:
+      packet-context-type:
+        class: struct
+        fields:
+          content_size: uint16
+          packet_size: uint16
+      event-header-type:
+        class: struct
+        min-align: 8
+        fields:
+          id: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field: uint16
diff --git a/tests/config/2/fail/trace/ph-streamid-wrong-signed.yaml b/tests/config/2/fail/trace/ph-streamid-wrong-signed.yaml
new file mode 100644 (file)
index 0000000..e232bbb
--- /dev/null
@@ -0,0 +1,52 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: be
+    packet-header-type:
+      class: struct
+      fields:
+        stream_id:
+          class: int
+          size: 16
+          signed: true
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/trace/ph-uuid-et-not-int.yaml b/tests/config/2/fail/trace/ph-uuid-et-not-int.yaml
new file mode 100644 (file)
index 0000000..cef76c8
--- /dev/null
@@ -0,0 +1,54 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    uuid: auto
+    byte-order: be
+    packet-header-type:
+      class: struct
+      fields:
+        uuid:
+          class: array
+          length: 16
+          element-type:
+            class: string
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/trace/ph-uuid-et-wrong-align.yaml b/tests/config/2/fail/trace/ph-uuid-et-wrong-align.yaml
new file mode 100644 (file)
index 0000000..319d986
--- /dev/null
@@ -0,0 +1,56 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    uuid: auto
+    byte-order: be
+    packet-header-type:
+      class: struct
+      fields:
+        uuid:
+          class: array
+          length: 16
+          element-type:
+            class: int
+            size: 8
+            align: 16
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/trace/ph-uuid-et-wrong-signed.yaml b/tests/config/2/fail/trace/ph-uuid-et-wrong-signed.yaml
new file mode 100644 (file)
index 0000000..04107bd
--- /dev/null
@@ -0,0 +1,56 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    uuid: auto
+    byte-order: be
+    packet-header-type:
+      class: struct
+      fields:
+        uuid:
+          class: array
+          length: 16
+          element-type:
+            class: int
+            size: 8
+            signed: true
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/trace/ph-uuid-et-wrong-size.yaml b/tests/config/2/fail/trace/ph-uuid-et-wrong-size.yaml
new file mode 100644 (file)
index 0000000..c2492a7
--- /dev/null
@@ -0,0 +1,55 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    uuid: auto
+    byte-order: be
+    packet-header-type:
+      class: struct
+      fields:
+        uuid:
+          class: array
+          length: 16
+          element-type:
+            class: int
+            size: 4
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/trace/ph-uuid-not-array.yaml b/tests/config/2/fail/trace/ph-uuid-not-array.yaml
new file mode 100644 (file)
index 0000000..d1aa05b
--- /dev/null
@@ -0,0 +1,50 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    uuid: auto
+    byte-order: be
+    packet-header-type:
+      class: struct
+      fields:
+        uuid: uint16
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/trace/ph-uuid-wrong-length.yaml b/tests/config/2/fail/trace/ph-uuid-wrong-length.yaml
new file mode 100644 (file)
index 0000000..4817248
--- /dev/null
@@ -0,0 +1,55 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    uuid: auto
+    byte-order: be
+    packet-header-type:
+      class: struct
+      fields:
+        uuid:
+          class: array
+          length: 17
+          element-type:
+            class: int
+            size: 8
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/trace/unknown-prop.yaml b/tests/config/2/fail/trace/unknown-prop.yaml
new file mode 100644 (file)
index 0000000..3ce7f0c
--- /dev/null
@@ -0,0 +1,46 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order: be
+    unknown: false
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/trace/uuid-invalid-type.yaml b/tests/config/2/fail/trace/uuid-invalid-type.yaml
new file mode 100644 (file)
index 0000000..83d95f0
--- /dev/null
@@ -0,0 +1,46 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    uuid: 12
+    byte-order: be
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/trace/uuid-invalid-uuid.yaml b/tests/config/2/fail/trace/uuid-invalid-uuid.yaml
new file mode 100644 (file)
index 0000000..92ba144
--- /dev/null
@@ -0,0 +1,46 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    uuid: something
+    byte-order: be
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/type-enum/fail.bats b/tests/config/2/fail/type-enum/fail.bats
new file mode 100644 (file)
index 0000000..79a11c4
--- /dev/null
@@ -0,0 +1,77 @@
+#!/usr/bin/env bats
+
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+load ../../../common
+
+@test 'unknown property in enum type object makes barectf fail' {
+  barectf_config_check_fail unknown-prop.yaml
+}
+
+@test 'no "value-type" property in enum type object makes barectf fail' {
+  barectf_config_check_fail vt-no.yaml
+}
+
+@test 'wrong "value-type" property type in enum type object makes barectf fail' {
+  barectf_config_check_fail vt-invalid-type.yaml
+}
+
+@test 'no "members" property in enum type object makes barectf fail' {
+  barectf_config_check_fail members-no.yaml
+}
+
+@test 'wrong "members" property type in enum type object makes barectf fail' {
+  barectf_config_check_fail members-invalid-type.yaml
+}
+
+@test 'empty "members" property in enum type object makes barectf fail' {
+  barectf_config_check_fail members-empty.yaml
+}
+
+@test 'wrong "members" property element type in enum type object makes barectf fail' {
+  barectf_config_check_fail members-el-invalid-type.yaml
+}
+
+@test 'unknown property in enum type member object makes barectf fail' {
+  barectf_config_check_fail members-el-member-unknown-prop.yaml
+}
+
+@test 'wrong "label" property type in enum type member object makes barectf fail' {
+  barectf_config_check_fail members-el-member-label-invalid-type.yaml
+}
+
+@test 'wrong "value" property type in enum type member object makes barectf fail' {
+  barectf_config_check_fail members-el-member-value-invalid-type.yaml
+}
+
+@test '"value" property outside the unsigned value type range in enum type member object makes barectf fail' {
+  barectf_config_check_fail members-el-member-value-outside-range-unsigned.yaml
+}
+
+@test '"value" property outside the signed value type range in enum type member object makes barectf fail' {
+  barectf_config_check_fail members-el-member-value-outside-range-signed.yaml
+}
+
+@test 'overlapping members in enum type object makes barectf fail' {
+  barectf_config_check_fail members-overlap.yaml
+}
diff --git a/tests/config/2/fail/type-enum/members-el-invalid-type.yaml b/tests/config/2/fail/type-enum/members-el-invalid-type.yaml
new file mode 100644 (file)
index 0000000..b5b4dec
--- /dev/null
@@ -0,0 +1,42 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: enum
+                value-type:
+                  class: int
+                  size: 8
+                members:
+                  - HELLO
+                  - 23
+                  - ZOOM
diff --git a/tests/config/2/fail/type-enum/members-el-member-label-invalid-type.yaml b/tests/config/2/fail/type-enum/members-el-member-label-invalid-type.yaml
new file mode 100644 (file)
index 0000000..8c9dac1
--- /dev/null
@@ -0,0 +1,43 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: enum
+                value-type:
+                  class: int
+                  size: 8
+                members:
+                  - HELLO
+                  - label: 65
+                    value: 6
+                  - ZOOM
diff --git a/tests/config/2/fail/type-enum/members-el-member-unknown-prop.yaml b/tests/config/2/fail/type-enum/members-el-member-unknown-prop.yaml
new file mode 100644 (file)
index 0000000..605ca47
--- /dev/null
@@ -0,0 +1,44 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: enum
+                value-type:
+                  class: int
+                  size: 8
+                members:
+                  - HELLO
+                  - label: six
+                    value: 6
+                    unknown: true
+                  - ZOOM
diff --git a/tests/config/2/fail/type-enum/members-el-member-value-invalid-type.yaml b/tests/config/2/fail/type-enum/members-el-member-value-invalid-type.yaml
new file mode 100644 (file)
index 0000000..bff7116
--- /dev/null
@@ -0,0 +1,43 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: enum
+                value-type:
+                  class: int
+                  size: 8
+                members:
+                  - HELLO
+                  - label: label
+                    value: meow
+                  - ZOOM
diff --git a/tests/config/2/fail/type-enum/members-el-member-value-outside-range-signed.yaml b/tests/config/2/fail/type-enum/members-el-member-value-outside-range-signed.yaml
new file mode 100644 (file)
index 0000000..295e4e5
--- /dev/null
@@ -0,0 +1,44 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: enum
+                value-type:
+                  class: int
+                  size: 8
+                  signed: true
+                members:
+                  - HELLO
+                  - label: label
+                    value: -129
+                  - ZOOM
diff --git a/tests/config/2/fail/type-enum/members-el-member-value-outside-range-unsigned.yaml b/tests/config/2/fail/type-enum/members-el-member-value-outside-range-unsigned.yaml
new file mode 100644 (file)
index 0000000..f36cf32
--- /dev/null
@@ -0,0 +1,43 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: enum
+                value-type:
+                  class: int
+                  size: 8
+                members:
+                  - HELLO
+                  - label: label
+                    value: 256
+                  - ZOOM
diff --git a/tests/config/2/fail/type-enum/members-empty.yaml b/tests/config/2/fail/type-enum/members-empty.yaml
new file mode 100644 (file)
index 0000000..0f93579
--- /dev/null
@@ -0,0 +1,39 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: enum
+                value-type:
+                  class: int
+                  size: 8
+                members: []
diff --git a/tests/config/2/fail/type-enum/members-invalid-type.yaml b/tests/config/2/fail/type-enum/members-invalid-type.yaml
new file mode 100644 (file)
index 0000000..ac4a6f1
--- /dev/null
@@ -0,0 +1,39 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: enum
+                value-type:
+                  class: int
+                  size: 8
+                members: string
diff --git a/tests/config/2/fail/type-enum/members-no.yaml b/tests/config/2/fail/type-enum/members-no.yaml
new file mode 100644 (file)
index 0000000..19227ca
--- /dev/null
@@ -0,0 +1,38 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: enum
+                value-type:
+                  class: int
+                  size: 8
diff --git a/tests/config/2/fail/type-enum/members-overlap.yaml b/tests/config/2/fail/type-enum/members-overlap.yaml
new file mode 100644 (file)
index 0000000..5b50aa2
--- /dev/null
@@ -0,0 +1,44 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: enum
+                value-type:
+                  class: int
+                  size: 8
+                  signed: true
+                members:
+                  - HELLO
+                  - ZOOM
+                  - label: MAGOG
+                    value: 0
diff --git a/tests/config/2/fail/type-enum/unknown-prop.yaml b/tests/config/2/fail/type-enum/unknown-prop.yaml
new file mode 100644 (file)
index 0000000..a845159
--- /dev/null
@@ -0,0 +1,41 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: enum
+                value-type:
+                  class: int
+                  size: 8
+                members:
+                  - HELLO
+                unknown: false
diff --git a/tests/config/2/fail/type-enum/vt-invalid-type.yaml b/tests/config/2/fail/type-enum/vt-invalid-type.yaml
new file mode 100644 (file)
index 0000000..4d2a184
--- /dev/null
@@ -0,0 +1,38 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: enum
+                value-type: 23
+                members:
+                  - HELLO
diff --git a/tests/config/2/fail/type-enum/vt-no.yaml b/tests/config/2/fail/type-enum/vt-no.yaml
new file mode 100644 (file)
index 0000000..374de4f
--- /dev/null
@@ -0,0 +1,37 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: enum
+                members:
+                  - HELLO
diff --git a/tests/config/2/fail/type-float/align-0.yaml b/tests/config/2/fail/type-float/align-0.yaml
new file mode 100644 (file)
index 0000000..6ac0410
--- /dev/null
@@ -0,0 +1,39 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: float
+                size:
+                  exp: 8
+                  mant: 24
+                align: 0
diff --git a/tests/config/2/fail/type-float/align-3.yaml b/tests/config/2/fail/type-float/align-3.yaml
new file mode 100644 (file)
index 0000000..87ab18c
--- /dev/null
@@ -0,0 +1,39 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: float
+                size:
+                  exp: 8
+                  mant: 24
+                align: 3
diff --git a/tests/config/2/fail/type-float/align-invalid-type.yaml b/tests/config/2/fail/type-float/align-invalid-type.yaml
new file mode 100644 (file)
index 0000000..9c06ae5
--- /dev/null
@@ -0,0 +1,39 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: float
+                size:
+                  exp: 8
+                  mant: 24
+                align: string
diff --git a/tests/config/2/fail/type-float/bo-invalid-type.yaml b/tests/config/2/fail/type-float/bo-invalid-type.yaml
new file mode 100644 (file)
index 0000000..b0db7a7
--- /dev/null
@@ -0,0 +1,39 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: float
+                size:
+                  exp: 8
+                  mant: 24
+                byte-order: 17
diff --git a/tests/config/2/fail/type-float/bo-invalid.yaml b/tests/config/2/fail/type-float/bo-invalid.yaml
new file mode 100644 (file)
index 0000000..418a20f
--- /dev/null
@@ -0,0 +1,39 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: float
+                size:
+                  exp: 8
+                  mant: 24
+                byte-order: ze
diff --git a/tests/config/2/fail/type-float/fail.bats b/tests/config/2/fail/type-float/fail.bats
new file mode 100644 (file)
index 0000000..a4778fb
--- /dev/null
@@ -0,0 +1,73 @@
+#!/usr/bin/env bats
+
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+load ../../../common
+
+@test 'unknown property in float type object makes barectf fail' {
+  barectf_config_check_fail unknown-prop.yaml
+}
+
+@test 'no "size" property in float type object makes barectf fail' {
+  barectf_config_check_fail size-no.yaml
+}
+
+@test 'wrong "size" property type in float type object makes barectf fail' {
+  barectf_config_check_fail size-invalid-type.yaml
+}
+
+@test 'unknown property in float type object "size" property makes barectf fail' {
+  barectf_config_check_fail size-unknown-prop.yaml
+}
+
+@test 'no "exp" property in float type object "size" property makes barectf fail' {
+  barectf_config_check_fail size-exp-no.yaml
+}
+
+@test 'no "mant" property in float type object "size" property makes barectf fail' {
+  barectf_config_check_fail size-mant-no.yaml
+}
+
+@test 'sum of "mant" and "exp" properties of float type size object not a multiple of 32 property makes barectf fail' {
+  barectf_config_check_fail size-exp-mant-wrong-sum.yaml
+}
+
+@test 'wrong "align" property type in float type object makes barectf fail' {
+  barectf_config_check_fail align-invalid-type.yaml
+}
+
+@test 'invalid "align" property (0) in float type object makes barectf fail' {
+  barectf_config_check_fail align-0.yaml
+}
+
+@test 'invalid "align" property (3) in float type object makes barectf fail' {
+  barectf_config_check_fail align-3.yaml
+}
+
+@test 'wrong "byte-order" property type in float type object makes barectf fail' {
+  barectf_config_check_fail bo-invalid-type.yaml
+}
+
+@test 'invalid "byte-order" property in float type object makes barectf fail' {
+  barectf_config_check_fail bo-invalid.yaml
+}
diff --git a/tests/config/2/fail/type-float/size-exp-mant-wrong-sum.yaml b/tests/config/2/fail/type-float/size-exp-mant-wrong-sum.yaml
new file mode 100644 (file)
index 0000000..f69f4cf
--- /dev/null
@@ -0,0 +1,38 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: float
+                size:
+                  exp: 5
+                  mant: 21
diff --git a/tests/config/2/fail/type-float/size-exp-no.yaml b/tests/config/2/fail/type-float/size-exp-no.yaml
new file mode 100644 (file)
index 0000000..f688daa
--- /dev/null
@@ -0,0 +1,37 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: float
+                size:
+                  mant: 24
diff --git a/tests/config/2/fail/type-float/size-invalid-type.yaml b/tests/config/2/fail/type-float/size-invalid-type.yaml
new file mode 100644 (file)
index 0000000..91cc996
--- /dev/null
@@ -0,0 +1,36 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: float
+                size: string
diff --git a/tests/config/2/fail/type-float/size-mant-no.yaml b/tests/config/2/fail/type-float/size-mant-no.yaml
new file mode 100644 (file)
index 0000000..753d7e0
--- /dev/null
@@ -0,0 +1,37 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: float
+                size:
+                  exp: 8
diff --git a/tests/config/2/fail/type-float/size-no.yaml b/tests/config/2/fail/type-float/size-no.yaml
new file mode 100644 (file)
index 0000000..9f99c58
--- /dev/null
@@ -0,0 +1,35 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: float
diff --git a/tests/config/2/fail/type-float/size-unknown-prop.yaml b/tests/config/2/fail/type-float/size-unknown-prop.yaml
new file mode 100644 (file)
index 0000000..9a9589c
--- /dev/null
@@ -0,0 +1,39 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: float
+                size:
+                  exp: 8
+                  mant: 24
+                  unknown: false
diff --git a/tests/config/2/fail/type-float/unknown-prop.yaml b/tests/config/2/fail/type-float/unknown-prop.yaml
new file mode 100644 (file)
index 0000000..9149ad2
--- /dev/null
@@ -0,0 +1,39 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: float
+                size:
+                  exp: 8
+                  mant: 24
+                unknown: false
diff --git a/tests/config/2/fail/type-int/align-0.yaml b/tests/config/2/fail/type-int/align-0.yaml
new file mode 100644 (file)
index 0000000..d32de2c
--- /dev/null
@@ -0,0 +1,37 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 32
+                align: 0
diff --git a/tests/config/2/fail/type-int/align-3.yaml b/tests/config/2/fail/type-int/align-3.yaml
new file mode 100644 (file)
index 0000000..26ac75e
--- /dev/null
@@ -0,0 +1,37 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 32
+                align: 3
diff --git a/tests/config/2/fail/type-int/align-invalid-type.yaml b/tests/config/2/fail/type-int/align-invalid-type.yaml
new file mode 100644 (file)
index 0000000..19cf4d4
--- /dev/null
@@ -0,0 +1,36 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                align: string
diff --git a/tests/config/2/fail/type-int/base-invalid-type.yaml b/tests/config/2/fail/type-int/base-invalid-type.yaml
new file mode 100644 (file)
index 0000000..0068800
--- /dev/null
@@ -0,0 +1,37 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
+                base: 17.34
diff --git a/tests/config/2/fail/type-int/base-invalid.yaml b/tests/config/2/fail/type-int/base-invalid.yaml
new file mode 100644 (file)
index 0000000..01c097c
--- /dev/null
@@ -0,0 +1,37 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 32
+                base: inval
diff --git a/tests/config/2/fail/type-int/bo-invalid-type.yaml b/tests/config/2/fail/type-int/bo-invalid-type.yaml
new file mode 100644 (file)
index 0000000..d54727b
--- /dev/null
@@ -0,0 +1,36 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                byte-order: 17.34
diff --git a/tests/config/2/fail/type-int/bo-invalid.yaml b/tests/config/2/fail/type-int/bo-invalid.yaml
new file mode 100644 (file)
index 0000000..fd6945c
--- /dev/null
@@ -0,0 +1,37 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 32
+                byte-order: ze
diff --git a/tests/config/2/fail/type-int/fail.bats b/tests/config/2/fail/type-int/fail.bats
new file mode 100644 (file)
index 0000000..fe0bbbe
--- /dev/null
@@ -0,0 +1,93 @@
+#!/usr/bin/env bats
+
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+load ../../../common
+
+@test 'unknown property in int type object makes barectf fail' {
+  barectf_config_check_fail unknown-prop.yaml
+}
+
+@test 'no "size" property in int type object makes barectf fail' {
+  barectf_config_check_fail size-no.yaml
+}
+
+@test 'wrong "size" property type in int type object makes barectf fail' {
+  barectf_config_check_fail size-invalid-type.yaml
+}
+
+@test 'invalid "size" property (0) in int type object makes barectf fail' {
+  barectf_config_check_fail size-0.yaml
+}
+
+@test 'invalid "size" property (65) in int type object makes barectf fail' {
+  barectf_config_check_fail size-65.yaml
+}
+
+@test 'wrong "signed" property type in int type object makes barectf fail' {
+  barectf_config_check_fail signed-invalid-type.yaml
+}
+
+@test 'wrong "align" property type in int type object makes barectf fail' {
+  barectf_config_check_fail align-invalid-type.yaml
+}
+
+@test 'invalid "align" property (0) in int type object makes barectf fail' {
+  barectf_config_check_fail align-0.yaml
+}
+
+@test 'invalid "align" property (3) in int type object makes barectf fail' {
+  barectf_config_check_fail align-3.yaml
+}
+
+@test 'wrong "base" property type in int type object makes barectf fail' {
+  barectf_config_check_fail base-invalid-type.yaml
+}
+
+@test 'invalid "base" property in int type object makes barectf fail' {
+  barectf_config_check_fail base-invalid.yaml
+}
+
+@test 'wrong "byte-order" property type in int type object makes barectf fail' {
+  barectf_config_check_fail bo-invalid-type.yaml
+}
+
+@test 'invalid "byte-order" property in int type object makes barectf fail' {
+  barectf_config_check_fail bo-invalid.yaml
+}
+
+@test 'wrong "property-mappings" property type in int type object makes barectf fail' {
+  barectf_config_check_fail pm-invalid-type.yaml
+}
+
+@test 'invalid "property-mappings" property in int type object makes barectf fail' {
+  barectf_config_check_fail pm-unknown-clock.yaml
+}
+
+@test 'invalid "property-mappings" property (invalid "type" property) in int type object makes barectf fail' {
+  barectf_config_check_fail pm-type-invalid.yaml
+}
+
+@test 'invalid "property-mappings" property (invalid "property" property) in int type object makes barectf fail' {
+  barectf_config_check_fail pm-property-invalid.yaml
+}
diff --git a/tests/config/2/fail/type-int/pm-invalid-type.yaml b/tests/config/2/fail/type-int/pm-invalid-type.yaml
new file mode 100644 (file)
index 0000000..676145a
--- /dev/null
@@ -0,0 +1,36 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                property-mappings: hello
diff --git a/tests/config/2/fail/type-int/pm-property-invalid.yaml b/tests/config/2/fail/type-int/pm-property-invalid.yaml
new file mode 100644 (file)
index 0000000..edd828b
--- /dev/null
@@ -0,0 +1,42 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  clocks:
+    my_clock: {}
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
+                property-mappings:
+                  - type: clock
+                    name: my_clock
+                    property: type
diff --git a/tests/config/2/fail/type-int/pm-type-invalid.yaml b/tests/config/2/fail/type-int/pm-type-invalid.yaml
new file mode 100644 (file)
index 0000000..3eda6f8
--- /dev/null
@@ -0,0 +1,42 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  clocks:
+    my_clock: {}
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
+                property-mappings:
+                  - type: stream
+                    name: zala
+                    property: value
diff --git a/tests/config/2/fail/type-int/pm-unknown-clock.yaml b/tests/config/2/fail/type-int/pm-unknown-clock.yaml
new file mode 100644 (file)
index 0000000..961c645
--- /dev/null
@@ -0,0 +1,42 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  clocks:
+    my_clock: {}
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
+                property-mappings:
+                  - type: clock
+                    name: zala
+                    property: value
diff --git a/tests/config/2/fail/type-int/signed-invalid-type.yaml b/tests/config/2/fail/type-int/signed-invalid-type.yaml
new file mode 100644 (file)
index 0000000..0877653
--- /dev/null
@@ -0,0 +1,36 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                signed: string
diff --git a/tests/config/2/fail/type-int/size-0.yaml b/tests/config/2/fail/type-int/size-0.yaml
new file mode 100644 (file)
index 0000000..b1e1da2
--- /dev/null
@@ -0,0 +1,36 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 0
diff --git a/tests/config/2/fail/type-int/size-65.yaml b/tests/config/2/fail/type-int/size-65.yaml
new file mode 100644 (file)
index 0000000..b8bbf41
--- /dev/null
@@ -0,0 +1,37 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 65
+                align: 8
diff --git a/tests/config/2/fail/type-int/size-invalid-type.yaml b/tests/config/2/fail/type-int/size-invalid-type.yaml
new file mode 100644 (file)
index 0000000..ebe09ec
--- /dev/null
@@ -0,0 +1,36 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: string
diff --git a/tests/config/2/fail/type-int/size-no.yaml b/tests/config/2/fail/type-int/size-no.yaml
new file mode 100644 (file)
index 0000000..a44afe4
--- /dev/null
@@ -0,0 +1,35 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
diff --git a/tests/config/2/fail/type-int/unknown-prop.yaml b/tests/config/2/fail/type-int/unknown-prop.yaml
new file mode 100644 (file)
index 0000000..f48a297
--- /dev/null
@@ -0,0 +1,37 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
+                unknown: false
diff --git a/tests/config/2/fail/type-string/fail.bats b/tests/config/2/fail/type-string/fail.bats
new file mode 100644 (file)
index 0000000..5936c52
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/env bats
+
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+load ../../../common
+
+@test 'unknown property in string type object makes barectf fail' {
+  barectf_config_check_fail unknown-prop.yaml
+}
diff --git a/tests/config/2/fail/type-string/unknown-prop.yaml b/tests/config/2/fail/type-string/unknown-prop.yaml
new file mode 100644 (file)
index 0000000..19443c5
--- /dev/null
@@ -0,0 +1,36 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: string
+                unknown: false
diff --git a/tests/config/2/fail/type-struct/fail.bats b/tests/config/2/fail/type-struct/fail.bats
new file mode 100644 (file)
index 0000000..175a1dd
--- /dev/null
@@ -0,0 +1,49 @@
+#!/usr/bin/env bats
+
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+load ../../../common
+
+@test 'unknown property in struct type object makes barectf fail' {
+  barectf_config_check_fail unknown-prop.yaml
+}
+
+@test 'wrong "fields" property type in struct type object makes barectf fail' {
+  barectf_config_check_fail fields-invalid-type.yaml
+}
+
+@test 'invalid field in "fields" property (invalid C identifier) in struct type object makes barectf fail' {
+  barectf_config_check_fail fields-field-invalid-identifier.yaml
+}
+
+@test 'wrong "min-align" property type in struct type object makes barectf fail' {
+  barectf_config_check_fail ma-invalid-type.yaml
+}
+
+@test 'invalid "min-align" property (0) in struct type object makes barectf fail' {
+  barectf_config_check_fail ma-0.yaml
+}
+
+@test 'invalid "min-align" property (3) in struct type object makes barectf fail' {
+  barectf_config_check_fail ma-3.yaml
+}
diff --git a/tests/config/2/fail/type-struct/fields-field-invalid-identifier.yaml b/tests/config/2/fail/type-struct/fields-field-invalid-identifier.yaml
new file mode 100644 (file)
index 0000000..8403de9
--- /dev/null
@@ -0,0 +1,36 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              'a field':
+                class: int
+                size: 1
diff --git a/tests/config/2/fail/type-struct/fields-invalid-type.yaml b/tests/config/2/fail/type-struct/fields-invalid-type.yaml
new file mode 100644 (file)
index 0000000..73972f3
--- /dev/null
@@ -0,0 +1,33 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields: 23
diff --git a/tests/config/2/fail/type-struct/ma-0.yaml b/tests/config/2/fail/type-struct/ma-0.yaml
new file mode 100644 (file)
index 0000000..f84974a
--- /dev/null
@@ -0,0 +1,33 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            min-align: 0
diff --git a/tests/config/2/fail/type-struct/ma-3.yaml b/tests/config/2/fail/type-struct/ma-3.yaml
new file mode 100644 (file)
index 0000000..a1af2f7
--- /dev/null
@@ -0,0 +1,33 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            min-align: 3
diff --git a/tests/config/2/fail/type-struct/ma-invalid-type.yaml b/tests/config/2/fail/type-struct/ma-invalid-type.yaml
new file mode 100644 (file)
index 0000000..edfd5e9
--- /dev/null
@@ -0,0 +1,33 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            min-align: yes
diff --git a/tests/config/2/fail/type-struct/unknown-prop.yaml b/tests/config/2/fail/type-struct/unknown-prop.yaml
new file mode 100644 (file)
index 0000000..f89d813
--- /dev/null
@@ -0,0 +1,37 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            unknown: true
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/type/fail.bats b/tests/config/2/fail/type/fail.bats
new file mode 100644 (file)
index 0000000..36151cb
--- /dev/null
@@ -0,0 +1,41 @@
+#!/usr/bin/env bats
+
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+load ../../../common
+
+@test 'type inheriting an unknown type alias makes barectf fail' {
+  barectf_config_check_fail inherit-unknown.yaml
+}
+
+@test 'type inheriting a type alias defined after makes barectf fail' {
+  barectf_config_check_fail inherit-forward.yaml
+}
+
+@test 'wrong type property type makes barectf fail' {
+  barectf_config_check_fail invalid-type.yaml
+}
+
+@test 'no "class" property in type object makes barectf fail' {
+  barectf_config_check_fail no-class.yaml
+}
diff --git a/tests/config/2/fail/type/inherit-forward.yaml b/tests/config/2/fail/type/inherit-forward.yaml
new file mode 100644 (file)
index 0000000..241ad64
--- /dev/null
@@ -0,0 +1,42 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      $inherit: meow
+      size: 16
+    meow:
+      class: int
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/type/inherit-unknown.yaml b/tests/config/2/fail/type/inherit-unknown.yaml
new file mode 100644 (file)
index 0000000..06aeaea
--- /dev/null
@@ -0,0 +1,40 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      $inherit: unknown
+      size: 16
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/type/invalid-type.yaml b/tests/config/2/fail/type/invalid-type.yaml
new file mode 100644 (file)
index 0000000..63208f3
--- /dev/null
@@ -0,0 +1,43 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    an-int: 23
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/fail/type/no-class.yaml b/tests/config/2/fail/type/no-class.yaml
new file mode 100644 (file)
index 0000000..2b3a63b
--- /dev/null
@@ -0,0 +1,35 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  trace:
+    byte-order: le
+  streams:
+    my_stream:
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                size: 8
diff --git a/tests/config/2/fail/yaml/fail.bats b/tests/config/2/fail/yaml/fail.bats
new file mode 100644 (file)
index 0000000..bf9559c
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/env bats
+
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+load ../../../common
+
+@test 'invalid YAML input makes barectf fail' {
+  barectf_config_check_fail invalid.yaml
+}
diff --git a/tests/config/2/fail/yaml/invalid.yaml b/tests/config/2/fail/yaml/invalid.yaml
new file mode 100644 (file)
index 0000000..d3804b9
--- /dev/null
@@ -0,0 +1,46 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.1'
+metadata:
+  type-aliases:
+    uint16:
+      class: int
+      size: 16
+  trace:
+    byte-order:
+      le: -23
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
diff --git a/tests/config/2/pass/everything/config.yaml b/tests/config/2/pass/everything/config.yaml
new file mode 100644 (file)
index 0000000..eb99189
--- /dev/null
@@ -0,0 +1,102 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+version: '2.2'
+prefix: bctf_
+options:
+  gen-prefix-def: true
+  gen-default-stream-def: true
+metadata:
+  $include:
+    - inc-metadata.yaml
+    - stdmisc.yaml
+    - lttng-ust-log-levels.yaml
+  type-aliases:
+    my-clock-int:
+      $inherit: uint32
+      property-mappings:
+        - type: clock
+          name: some_clock
+          property: value
+    my-special-int:
+      size: 19
+      base: hex
+  $log-levels:
+    couch: 0755
+  trace:
+    $include: inc-trace.yaml
+    byte-order: be
+  clocks:
+    some_clock:
+      $include: inc-clock.yaml
+      description: this is my favorite clock
+      offset:
+        cycles: 91827439187
+      absolute: null
+  streams:
+    my_stream:
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint16
+          content_size: uint16
+          timestamp_begin: my-clock-int
+          timestamp_end: my-clock-int
+      events:
+        my_event:
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
+    my_other_stream:
+      $include: inc-stream.yaml
+      packet-context-type:
+        class: struct
+        fields:
+          packet_size: uint32
+          content_size: uint32
+          events_discarded: uint16
+      event-header-type:
+        class: struct
+        fields:
+          id: uint8
+          timestamp: my-clock-int
+      events:
+        my_event:
+          $include: inc-event.yaml
+          context-type: null
+          payload-type:
+            class: struct
+            fields:
+              my_field:
+                class: int
+                size: 8
+        oh_henry_event:
+          payload-type:
+            class: struct
+            fields:
+              s1: string
+              s2: string
+              s3: string
+              s4: string
diff --git a/tests/config/2/pass/everything/inc-clock.yaml b/tests/config/2/pass/everything/inc-clock.yaml
new file mode 100644 (file)
index 0000000..dd6fdec
--- /dev/null
@@ -0,0 +1,27 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+freq: 123456789
+offset:
+  seconds: 18
+absolute: true
+$return-ctype: unsigned long
diff --git a/tests/config/2/pass/everything/inc-event.yaml b/tests/config/2/pass/everything/inc-event.yaml
new file mode 100644 (file)
index 0000000..5c77118
--- /dev/null
@@ -0,0 +1,27 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+log-level: WARNING
+context-type:
+  class: struct
+  fields:
+    fff: float
diff --git a/tests/config/2/pass/everything/inc-metadata.yaml b/tests/config/2/pass/everything/inc-metadata.yaml
new file mode 100644 (file)
index 0000000..83e0b7d
--- /dev/null
@@ -0,0 +1,58 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+$include:
+  - stdint.yaml
+  - stdfloat.yaml
+type-aliases:
+  my-special-int:
+    class: int
+    size: 23
+    align: 2
+  struct32:
+    class: struct
+    min-align: 32
+  def-payload-type:
+    $inherit: struct32
+    fields:
+      haha: float
+      hihi: uint32
+      huhu: uint16
+      hoho: double
+streams:
+  my_other_stream:
+    events:
+      this_event:
+        payload-type:
+          class: struct
+          fields:
+            special: my-special-int
+            more_special:
+              $inherit: my-special-int
+              align: 32
+$log-levels:
+  couch: 23
+  tv: 199
+  thread: 0x28aff
+env:
+  salut: lol
+  meow: mix
diff --git a/tests/config/2/pass/everything/inc-stream.yaml b/tests/config/2/pass/everything/inc-stream.yaml
new file mode 100644 (file)
index 0000000..56def30
--- /dev/null
@@ -0,0 +1,39 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+event-context-type:
+  class: struct
+  fields:
+    i: int32
+    f: float
+    d: double
+    s: string
+    m: ctf-magic
+events:
+  evev:
+    payload-type: def-payload-type
+  context_no_payload:
+    context-type:
+      class: struct
+      fields:
+        str: string
+  no_context_no_payload: {}
diff --git a/tests/config/2/pass/everything/inc-trace.yaml b/tests/config/2/pass/everything/inc-trace.yaml
new file mode 100644 (file)
index 0000000..d771be8
--- /dev/null
@@ -0,0 +1,26 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+$include: trace-basic.yaml
+packet-header-type:
+  fields:
+    soy_sauce: uint64
diff --git a/tests/config/2/pass/everything/pass.bats b/tests/config/2/pass/everything/pass.bats
new file mode 100644 (file)
index 0000000..a46bad4
--- /dev/null
@@ -0,0 +1,58 @@
+#!/usr/bin/env bats
+
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+load ../../../common
+
+@test 'config file using all features makes barectf pass' {
+  barectf_config_check_success config.yaml
+  pushd "$BATS_TEST_DIRNAME" >/dev/null
+  [ -f metadata ]
+  [ -f bctf.c ]
+  [ -f bctf.h ]
+  [ -f bctf-bitfield.h ]
+
+  # test should be more extensive than that, but it's a start
+  "$CC" -c bctf.c
+  nm bctf.o | grep bctf_init
+  nm bctf.o | grep bctf_my_other_stream_close_packet
+  nm bctf.o | grep bctf_my_other_stream_open_packet
+  nm bctf.o | grep bctf_my_other_stream_trace_context_no_payload
+  nm bctf.o | grep bctf_my_other_stream_trace_evev
+  nm bctf.o | grep bctf_my_other_stream_trace_my_event
+  nm bctf.o | grep bctf_my_other_stream_trace_no_context_no_payload
+  nm bctf.o | grep bctf_my_other_stream_trace_oh_henry_event
+  nm bctf.o | grep bctf_my_other_stream_trace_this_event
+  nm bctf.o | grep bctf_my_stream_close_packet
+  nm bctf.o | grep bctf_my_stream_open_packet
+  nm bctf.o | grep bctf_my_stream_trace_my_event
+  nm bctf.o | grep bctf_packet_buf
+  nm bctf.o | grep bctf_packet_buf_size
+  nm bctf.o | grep bctf_packet_events_discarded
+  nm bctf.o | grep bctf_packet_is_empty
+  nm bctf.o | grep bctf_packet_is_full
+  nm bctf.o | grep bctf_packet_is_open
+  nm bctf.o | grep bctf_packet_set_buf
+  nm bctf.o | grep bctf_packet_size
+  popd
+}
index 9e526e93fd52863779af6dae4a8baeebbd120a06..54e82afaf3e0072a410892bdf821591aa684dd91 100644 (file)
@@ -59,8 +59,10 @@ barectf_config_check_fail() {
 
   run barectf "$1"
 
-  if [[ $output != *'Configuration: Cannot create configuration'* ]]; then
+  if [[ $output != *'Cannot create configuration'* ]]; then
     echo "Fail: barectf does not print a configuration error" 1>&2
+    echo "Output:" 1>&2
+    echo "$output" 1>&2
     popd >/dev/null
     return 1
   fi
diff --git a/tests/config/fail/clock/absolute-invalid-type.yaml b/tests/config/fail/clock/absolute-invalid-type.yaml
deleted file mode 100644 (file)
index 50320f8..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-  clocks:
-    my_clock:
-      absolute: []
diff --git a/tests/config/fail/clock/description-invalid-type.yaml b/tests/config/fail/clock/description-invalid-type.yaml
deleted file mode 100644 (file)
index 6fd8990..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-  clocks:
-    my_clock:
-      description: 23
diff --git a/tests/config/fail/clock/ec-invalid-type.yaml b/tests/config/fail/clock/ec-invalid-type.yaml
deleted file mode 100644 (file)
index ac46af9..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-  clocks:
-    my_clock:
-      error-cycles: string
diff --git a/tests/config/fail/clock/ec-invalid.yaml b/tests/config/fail/clock/ec-invalid.yaml
deleted file mode 100644 (file)
index 04bfd08..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-  clocks:
-    my_clock:
-      error-cycles: -17
diff --git a/tests/config/fail/clock/fail.bats b/tests/config/fail/clock/fail.bats
deleted file mode 100644 (file)
index 46cfc54..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/usr/bin/env bats
-
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-load ../../common
-
-@test 'unknown property in clock object makes barectf fail' {
-  barectf_config_check_fail unknown-prop.yaml
-}
-
-@test 'wrong "freq" property type in clock object makes barectf fail' {
-  barectf_config_check_fail freq-invalid-type.yaml
-}
-
-@test 'invalid "freq" property (0) in clock object makes barectf fail' {
-  barectf_config_check_fail freq-0.yaml
-}
-
-@test 'invalid "freq" property (negative) in clock object makes barectf fail' {
-  barectf_config_check_fail freq-neg.yaml
-}
-
-@test 'wrong "description" property type in clock object makes barectf fail' {
-  barectf_config_check_fail description-invalid-type.yaml
-}
-
-@test 'wrong "uuid" property type in clock object makes barectf fail' {
-  barectf_config_check_fail uuid-invalid-type.yaml
-}
-
-@test 'invalid "uuid" property in clock object makes barectf fail' {
-  barectf_config_check_fail uuid-invalid.yaml
-}
-
-@test 'wrong "error-cycles" property type in clock object makes barectf fail' {
-  barectf_config_check_fail ec-invalid-type.yaml
-}
-
-@test 'invalid "error-cycles" property in clock object makes barectf fail' {
-  barectf_config_check_fail ec-invalid.yaml
-}
-
-@test 'wrong "offset" property type in clock object makes barectf fail' {
-  barectf_config_check_fail offset-invalid-type.yaml
-}
-
-@test 'wrong "absolute" property type in clock object makes barectf fail' {
-  barectf_config_check_fail absolute-invalid-type.yaml
-}
-
-@test 'unknown property in clock offset object makes barectf fail' {
-  barectf_config_check_fail offset-unknown-prop.yaml
-}
-
-@test 'wrong "seconds" property type in clock offset object makes barectf fail' {
-  barectf_config_check_fail offset-seconds-invalid-type.yaml
-}
-
-@test 'invalid "seconds" property in clock offset object makes barectf fail' {
-  barectf_config_check_fail offset-seconds-neg.yaml
-}
-
-@test 'wrong "cycles" property type in clock offset object makes barectf fail' {
-  barectf_config_check_fail offset-cycles-invalid-type.yaml
-}
-
-@test 'invalid "cycles" property in clock offset object makes barectf fail' {
-  barectf_config_check_fail offset-cycles-neg.yaml
-}
-
-@test 'wrong "$return-ctype" property type in clock object makes barectf fail' {
-  barectf_config_check_fail rct-invalid-type.yaml
-}
diff --git a/tests/config/fail/clock/freq-0.yaml b/tests/config/fail/clock/freq-0.yaml
deleted file mode 100644 (file)
index 22ff073..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-  clocks:
-    my_clock:
-      freq: 0
diff --git a/tests/config/fail/clock/freq-invalid-type.yaml b/tests/config/fail/clock/freq-invalid-type.yaml
deleted file mode 100644 (file)
index 63255af..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-  clocks:
-    my_clock:
-      freq: string
diff --git a/tests/config/fail/clock/freq-neg.yaml b/tests/config/fail/clock/freq-neg.yaml
deleted file mode 100644 (file)
index f2f0f70..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-  clocks:
-    my_clock:
-      freq: -12
diff --git a/tests/config/fail/clock/offset-cycles-invalid-type.yaml b/tests/config/fail/clock/offset-cycles-invalid-type.yaml
deleted file mode 100644 (file)
index 88fa94f..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-  clocks:
-    my_clock:
-      offset:
-        cycles: string
diff --git a/tests/config/fail/clock/offset-cycles-neg.yaml b/tests/config/fail/clock/offset-cycles-neg.yaml
deleted file mode 100644 (file)
index 7631d69..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-  clocks:
-    my_clock:
-      offset:
-        cycles: -17
diff --git a/tests/config/fail/clock/offset-invalid-type.yaml b/tests/config/fail/clock/offset-invalid-type.yaml
deleted file mode 100644 (file)
index 24dff48..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-  clocks:
-    my_clock:
-      offset: 23
diff --git a/tests/config/fail/clock/offset-seconds-invalid-type.yaml b/tests/config/fail/clock/offset-seconds-invalid-type.yaml
deleted file mode 100644 (file)
index 807ef40..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-  clocks:
-    my_clock:
-      offset:
-        seconds: string
diff --git a/tests/config/fail/clock/offset-seconds-neg.yaml b/tests/config/fail/clock/offset-seconds-neg.yaml
deleted file mode 100644 (file)
index 1a90977..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-  clocks:
-    my_clock:
-      offset:
-        seconds: -17
diff --git a/tests/config/fail/clock/offset-unknown-prop.yaml b/tests/config/fail/clock/offset-unknown-prop.yaml
deleted file mode 100644 (file)
index 34bbc3e..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-  clocks:
-    my_clock:
-      offset:
-        unknown: false
diff --git a/tests/config/fail/clock/rct-invalid-type.yaml b/tests/config/fail/clock/rct-invalid-type.yaml
deleted file mode 100644 (file)
index cc8a909..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-  clocks:
-    my_clock:
-      $return-ctype: 23
diff --git a/tests/config/fail/clock/unknown-prop.yaml b/tests/config/fail/clock/unknown-prop.yaml
deleted file mode 100644 (file)
index d866485..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-  clocks:
-    my_clock:
-      freq: 1000
-      unknown: false
diff --git a/tests/config/fail/clock/uuid-invalid-type.yaml b/tests/config/fail/clock/uuid-invalid-type.yaml
deleted file mode 100644 (file)
index 8eb0e66..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-  clocks:
-    my_clock:
-      uuid: -17
diff --git a/tests/config/fail/clock/uuid-invalid.yaml b/tests/config/fail/clock/uuid-invalid.yaml
deleted file mode 100644 (file)
index 2371ea1..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-  clocks:
-    my_clock:
-      uuid: zoom
diff --git a/tests/config/fail/config/fail.bats b/tests/config/fail/config/fail.bats
deleted file mode 100644 (file)
index ca422b1..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/env bats
-
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-load ../../common
-
-@test 'unknown property in config object makes barectf fail' {
-  barectf_config_check_fail unknown-prop.yaml
-}
-
-@test 'no "version" property in config object makes barectf fail' {
-  barectf_config_check_fail version-no.yaml
-}
-
-@test 'wrong "version" property type in config object makes barectf fail' {
-  barectf_config_check_fail version-invalid-type.yaml
-}
-
-@test 'invalid "version" property (1.9) in config object makes barectf fail' {
-  barectf_config_check_fail version-invalid-19.yaml
-}
-
-@test 'invalid "version" property (2.3) in config object makes barectf fail' {
-  barectf_config_check_fail version-invalid-23.yaml
-}
-
-@test 'wrong "prefix" property type in config object makes barectf fail' {
-  barectf_config_check_fail prefix-invalid-type.yaml
-}
-
-@test 'no valid C identifier in "prefix" property type in config object makes barectf fail' {
-  barectf_config_check_fail prefix-invalid-identifier.yaml
-}
-
-@test 'no "metadata" property in config object makes barectf fail' {
-  barectf_config_check_fail metadata-no.yaml
-}
-
-@test 'wrong "metadata" property type in config object makes barectf fail' {
-  barectf_config_check_fail metadata-invalid-type.yaml
-}
-
-@test 'wrong "options" property type in config object makes barectf fail' {
-  barectf_config_check_fail options-invalid-type.yaml
-}
-
-@test 'wrong "gen-prefix-def" property type in config options object makes barectf fail' {
-  barectf_config_check_fail options-gen-prefix-def-invalid-type.yaml
-}
-
-@test 'wrong "gen-default-stream-def" property type in config options object makes barectf fail' {
-  barectf_config_check_fail options-gen-default-stream-def-invalid-type.yaml
-}
diff --git a/tests/config/fail/config/metadata-invalid-type.yaml b/tests/config/fail/config/metadata-invalid-type.yaml
deleted file mode 100644 (file)
index 3291d6f..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata: 23
-
diff --git a/tests/config/fail/config/metadata-no.yaml b/tests/config/fail/config/metadata-no.yaml
deleted file mode 100644 (file)
index aba76ba..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
diff --git a/tests/config/fail/config/options-gen-default-stream-def-invalid-type.yaml b/tests/config/fail/config/options-gen-default-stream-def-invalid-type.yaml
deleted file mode 100644 (file)
index bfb36d2..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.2'
-options:
-  gen-default-stream-def: 23
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/config/options-gen-prefix-def-invalid-type.yaml b/tests/config/fail/config/options-gen-prefix-def-invalid-type.yaml
deleted file mode 100644 (file)
index 74a2bc4..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.2'
-options:
-  gen-prefix-def: do it
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/config/options-invalid-type.yaml b/tests/config/fail/config/options-invalid-type.yaml
deleted file mode 100644 (file)
index 921ec49..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.2'
-options: false
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/config/options-unknown-prop.yaml b/tests/config/fail/config/options-unknown-prop.yaml
deleted file mode 100644 (file)
index 6327229..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.2'
-options:
-  meow: mix
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/config/prefix-invalid-identifier.yaml b/tests/config/fail/config/prefix-invalid-identifier.yaml
deleted file mode 100644 (file)
index 1ae048c..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-prefix: 'some prefix'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/config/prefix-invalid-type.yaml b/tests/config/fail/config/prefix-invalid-type.yaml
deleted file mode 100644 (file)
index 2960934..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-prefix: -21
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/config/unknown-prop.yaml b/tests/config/fail/config/unknown-prop.yaml
deleted file mode 100644 (file)
index b8b6f9e..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-unknown: false
diff --git a/tests/config/fail/config/version-invalid-19.yaml b/tests/config/fail/config/version-invalid-19.yaml
deleted file mode 100644 (file)
index ceccd5c..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '1.9'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/config/version-invalid-23.yaml b/tests/config/fail/config/version-invalid-23.yaml
deleted file mode 100644 (file)
index cf73d04..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.3'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/config/version-invalid-type.yaml b/tests/config/fail/config/version-invalid-type.yaml
deleted file mode 100644 (file)
index a28f748..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: 2.1
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/config/version-no.yaml b/tests/config/fail/config/version-no.yaml
deleted file mode 100644 (file)
index d8e23a6..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/event/ct-invalid-type.yaml b/tests/config/fail/event/ct-invalid-type.yaml
deleted file mode 100644 (file)
index b696056..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          context-type: 23
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/event/ct-not-struct.yaml b/tests/config/fail/event/ct-not-struct.yaml
deleted file mode 100644 (file)
index c1991d0..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          context-type:
-            class: int
-            size: 8
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/event/fail.bats b/tests/config/fail/event/fail.bats
deleted file mode 100644 (file)
index f5a8ced..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/env bats
-
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-load ../../common
-
-@test 'unknown property in event object makes barectf fail' {
-  barectf_config_check_fail unknown-prop.yaml
-}
-
-@test 'wrong "log-level" property type in event object makes barectf fail' {
-  barectf_config_check_fail ll-invalid-type.yaml
-}
-
-@test 'non existing log level name as "log-level" property value in event object makes barectf fail' {
-  barectf_config_check_fail ll-non-existing.yaml
-}
-
-@test 'wrong "context-type" property type in event object makes barectf fail' {
-  barectf_config_check_fail ct-invalid-type.yaml
-}
-
-@test 'invalid "context-type" property field type (not a structure) in event object makes barectf fail' {
-  barectf_config_check_fail ct-not-struct.yaml
-}
-
-@test 'wrong "payload-type" property type in event object makes barectf fail' {
-  barectf_config_check_fail pt-invalid-type.yaml
-}
-
-@test 'invalid "payload-type" property field type (not a structure) in event object makes barectf fail' {
-  barectf_config_check_fail pt-not-struct.yaml
-}
-
-@test 'empty event object makes barectf fail' {
-  barectf_config_check_fail no-fields-at-all.yaml
-}
diff --git a/tests/config/fail/event/ll-invalid-type.yaml b/tests/config/fail/event/ll-invalid-type.yaml
deleted file mode 100644 (file)
index a9fef25..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          log-level: true
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/event/ll-non-existing.yaml b/tests/config/fail/event/ll-non-existing.yaml
deleted file mode 100644 (file)
index b2c23d3..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  $log-levels:
-    EMERG: 0
-    WARNING: 23
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          log-level: EME
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/event/no-fields-at-all.yaml b/tests/config/fail/event/no-fields-at-all.yaml
deleted file mode 100644 (file)
index 3a08827..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event: {}
diff --git a/tests/config/fail/event/pt-invalid-type.yaml b/tests/config/fail/event/pt-invalid-type.yaml
deleted file mode 100644 (file)
index 6cbaba4..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type: -17
diff --git a/tests/config/fail/event/pt-not-struct.yaml b/tests/config/fail/event/pt-not-struct.yaml
deleted file mode 100644 (file)
index 3673f83..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-
diff --git a/tests/config/fail/event/unknown-prop.yaml b/tests/config/fail/event/unknown-prop.yaml
deleted file mode 100644 (file)
index 209f096..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          unknown: false
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/include/cycle-sym.yaml b/tests/config/fail/include/cycle-sym.yaml
deleted file mode 100644 (file)
index a389075..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  $include: inc-recursive-sym1.yaml
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/include/cycle.yaml b/tests/config/fail/include/cycle.yaml
deleted file mode 100644 (file)
index b6d3f6f..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  $include: inc-recursive1.yaml
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/include/fail.bats b/tests/config/fail/include/fail.bats
deleted file mode 100644 (file)
index b3af31a..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/env bats
-
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-load ../../common
-
-@test 'wrong "$include" property type makes barectf fail' {
-  barectf_config_check_fail invalid-type.yaml
-}
-
-@test 'non-existing file in "$include" property (string) makes barectf fail' {
-  barectf_config_check_fail file-not-found.yaml
-}
-
-@test 'non-existing absolute file in "$include" property (string) makes barectf fail' {
-  barectf_config_check_fail file-not-found-abs.yaml
-}
-
-@test 'non-existing file in "$include" property (array) makes barectf fail' {
-  barectf_config_check_fail file-not-found-in-array.yaml
-}
-
-@test 'non-existing file in "$include" property (recursive) makes barectf fail' {
-  barectf_config_check_fail file-not-found-recursive.yaml
-}
-
-@test 'cycle in include graph makes barectf fail' {
-  barectf_config_check_fail cycle.yaml
-}
-
-@test 'cycle in include graph (with a symbolic link) makes barectf fail' {
-  local symlink="$BATS_TEST_DIRNAME/inc-recursive-sym3.yaml"
-  ln -fs inc-recursive-sym1.yaml "$symlink"
-  barectf_config_check_fail cycle-sym.yaml
-  rm -f "$symlink"
-}
diff --git a/tests/config/fail/include/file-not-found-abs.yaml b/tests/config/fail/include/file-not-found-abs.yaml
deleted file mode 100644 (file)
index 691fffa..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  $include: /path/to/not/found
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/include/file-not-found-in-array.yaml b/tests/config/fail/include/file-not-found-in-array.yaml
deleted file mode 100644 (file)
index eb91fa9..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  $include:
-    - inc-empty.yaml
-    - yes.yaml
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/include/file-not-found-recursive.yaml b/tests/config/fail/include/file-not-found-recursive.yaml
deleted file mode 100644 (file)
index 2ce1212..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  $include: inc-inc-not-found.yaml
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/include/file-not-found.yaml b/tests/config/fail/include/file-not-found.yaml
deleted file mode 100644 (file)
index b801533..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  $include: yes.yaml
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/include/inc-empty.yaml b/tests/config/fail/include/inc-empty.yaml
deleted file mode 100644 (file)
index 7d717c4..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-{}
diff --git a/tests/config/fail/include/inc-inc-not-found.yaml b/tests/config/fail/include/inc-inc-not-found.yaml
deleted file mode 100644 (file)
index 1310824..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-$include: yes.yaml
diff --git a/tests/config/fail/include/inc-recursive-sym1.yaml b/tests/config/fail/include/inc-recursive-sym1.yaml
deleted file mode 100644 (file)
index 31301d2..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-$include: inc-recursive-sym2.yaml
diff --git a/tests/config/fail/include/inc-recursive-sym2.yaml b/tests/config/fail/include/inc-recursive-sym2.yaml
deleted file mode 100644 (file)
index c024779..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-$include: inc-recursive-sym3.yaml
diff --git a/tests/config/fail/include/inc-recursive1.yaml b/tests/config/fail/include/inc-recursive1.yaml
deleted file mode 100644 (file)
index f23e504..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-$include: inc-recursive2.yaml
diff --git a/tests/config/fail/include/inc-recursive2.yaml b/tests/config/fail/include/inc-recursive2.yaml
deleted file mode 100644 (file)
index cd29ed0..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-$include: inc-recursive3.yaml
diff --git a/tests/config/fail/include/inc-recursive3.yaml b/tests/config/fail/include/inc-recursive3.yaml
deleted file mode 100644 (file)
index 1f92c70..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-$include: inc-recursive1.yaml
diff --git a/tests/config/fail/include/include-include-replace.yaml b/tests/config/fail/include/include-include-replace.yaml
deleted file mode 100644 (file)
index 8acb978..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  $include: inc-empty.yaml
-  $include-replace: inc-empty.yaml
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/include/invalid-type.yaml b/tests/config/fail/include/invalid-type.yaml
deleted file mode 100644 (file)
index 155bf7b..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  $include: 23
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/include/replace-file-not-found-in-array.yaml b/tests/config/fail/include/replace-file-not-found-in-array.yaml
deleted file mode 100644 (file)
index caefd2b..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  $include-replace:
-    - inc-empty.yaml
-    - yes.yaml
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/include/replace-file-not-found.yaml b/tests/config/fail/include/replace-file-not-found.yaml
deleted file mode 100644 (file)
index c6e64eb..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  $include-replace: yes.yaml
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/metadata/clocks-invalid-type.yaml b/tests/config/fail/metadata/clocks-invalid-type.yaml
deleted file mode 100644 (file)
index ef897e1..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-  clocks: 23
diff --git a/tests/config/fail/metadata/clocks-key-invalid-identifier.yaml b/tests/config/fail/metadata/clocks-key-invalid-identifier.yaml
deleted file mode 100644 (file)
index 1a33087..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-  clocks:
-    'some clock':
-      freq: 1000
diff --git a/tests/config/fail/metadata/default-stream-invalid-type.yaml b/tests/config/fail/metadata/default-stream-invalid-type.yaml
deleted file mode 100644 (file)
index d009ab9..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.2'
-metadata:
-  $default-stream: 23
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/metadata/default-stream-stream-default-duplicate.yaml b/tests/config/fail/metadata/default-stream-stream-default-duplicate.yaml
deleted file mode 100644 (file)
index c992213..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.2'
-metadata:
-  $default-stream: my_stream
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-    other_stream:
-      $default: true
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/metadata/default-stream-unknown-stream.yaml b/tests/config/fail/metadata/default-stream-unknown-stream.yaml
deleted file mode 100644 (file)
index 2ccec89..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.2'
-metadata:
-  $default-stream: some_stream
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/metadata/env-invalid-type.yaml b/tests/config/fail/metadata/env-invalid-type.yaml
deleted file mode 100644 (file)
index 1886d02..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-  env: 17
diff --git a/tests/config/fail/metadata/env-key-invalid-identifier.yaml b/tests/config/fail/metadata/env-key-invalid-identifier.yaml
deleted file mode 100644 (file)
index 24027df..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-  env:
-    'yes sir miller': bug
diff --git a/tests/config/fail/metadata/env-value-invalid-type.yaml b/tests/config/fail/metadata/env-value-invalid-type.yaml
deleted file mode 100644 (file)
index 1daeade..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-  env:
-    yes-sir-miller:
-      - a
-      - b
diff --git a/tests/config/fail/metadata/fail.bats b/tests/config/fail/metadata/fail.bats
deleted file mode 100644 (file)
index bea2c2e..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-#!/usr/bin/env bats
-
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-load ../../common
-
-@test 'unknown property in metadata object makes barectf fail' {
-  barectf_config_check_fail unknown-prop.yaml
-}
-
-@test 'wrong "env" property type in metadata object makes barectf fail' {
-  barectf_config_check_fail env-invalid-type.yaml
-}
-
-@test 'invalid "env" key (invalid C identifier) in metadata object makes barectf fail' {
-  barectf_config_check_fail env-key-invalid-identifier.yaml
-}
-
-@test 'invalid "env" value (not an int/string) in metadata object makes barectf fail' {
-  barectf_config_check_fail env-value-invalid-type.yaml
-}
-
-@test 'wrong "clocks" property type in metadata object makes barectf fail' {
-  barectf_config_check_fail clocks-invalid-type.yaml
-}
-
-@test 'invalid "clocks" key (invalid C identifier) in metadata object makes barectf fail' {
-  barectf_config_check_fail clocks-key-invalid-identifier.yaml
-}
-
-@test 'wrong "$log-levels" property type in metadata object makes barectf fail' {
-  barectf_config_check_fail ll-invalid-type.yaml
-}
-
-@test 'wrong "$log-levels" property value type in metadata object makes barectf fail' {
-  barectf_config_check_fail ll-value-invalid-type.yaml
-}
-
-@test 'wrong "type-aliases" property type in metadata object makes barectf fail' {
-  barectf_config_check_fail ta-invalid-type.yaml
-}
-
-@test 'no "trace" property in metadata object makes barectf fail' {
-  barectf_config_check_fail trace-no.yaml
-}
-
-@test 'wrong "trace" property type in metadata object makes barectf fail' {
-  barectf_config_check_fail trace-invalid-type.yaml
-}
-
-@test 'empty "trace" property in metadata object makes barectf fail' {
-  barectf_config_check_fail trace-empty.yaml
-}
-
-@test 'no "streams" property in metadata object makes barectf fail' {
-  barectf_config_check_fail streams-no.yaml
-}
-
-@test 'wrong "streams" property type in metadata object makes barectf fail' {
-  barectf_config_check_fail streams-invalid-type.yaml
-}
-
-@test 'empty "streams" property in metadata object makes barectf fail' {
-  barectf_config_check_fail streams-empty.yaml
-}
-
-@test 'invalid "streams" key (invalid C identifier) in metadata object makes barectf fail' {
-  barectf_config_check_fail streams-key-invalid-identifier.yaml
-}
-
-@test 'multiple streams in metadata object with missing "stream_id" packet header type field makes barectf fail' {
-  barectf_config_check_fail multiple-streams-trace-ph-no-stream-id.yaml
-}
-
-@test 'wrong "$default-stream" property type in metadata object makes barectf fail' {
-  barectf_config_check_fail default-stream-invalid-type.yaml
-}
-
-@test 'non-existing stream name in "$default-stream" property makes barectf fail' {
-  barectf_config_check_fail default-stream-unknown-stream.yaml
-}
-
-@test 'coexisting "$default-stream" property (metadata) and "$default: true" property (stream) with different names make barectf fail' {
-  barectf_config_check_fail default-stream-stream-default-duplicate.yaml
-}
diff --git a/tests/config/fail/metadata/ll-invalid-type.yaml b/tests/config/fail/metadata/ll-invalid-type.yaml
deleted file mode 100644 (file)
index cda3e9f..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-  $log-levels: hello
diff --git a/tests/config/fail/metadata/ll-value-invalid-type.yaml b/tests/config/fail/metadata/ll-value-invalid-type.yaml
deleted file mode 100644 (file)
index d9dce3c..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-  $log-levels:
-    'yes sir miller': meow
diff --git a/tests/config/fail/metadata/multiple-streams-trace-ph-no-stream-id.yaml b/tests/config/fail/metadata/multiple-streams-trace-ph-no-stream-id.yaml
deleted file mode 100644 (file)
index 71d7469..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  $include:
-    - stdint.yaml
-    - stdmisc.yaml
-  type-aliases:
-    pct:
-      class: struct
-      fields:
-        packet_size: uint32
-        content_size: uint32
-    pt:
-      class: struct
-      fields:
-        a: uint32
-  trace:
-    byte-order: le
-    packet-header-type:
-      class: struct
-      fields:
-        magic: ctf-magic
-  streams:
-    s1:
-      packet-context-type: pct
-      events:
-        ev1:
-          payload-type: pt
-    s2:
-      packet-context-type: pct
-      events:
-        ev2:
-          payload-type: pt
diff --git a/tests/config/fail/metadata/streams-empty.yaml b/tests/config/fail/metadata/streams-empty.yaml
deleted file mode 100644 (file)
index a911f0e..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams: {}
diff --git a/tests/config/fail/metadata/streams-invalid-type.yaml b/tests/config/fail/metadata/streams-invalid-type.yaml
deleted file mode 100644 (file)
index 76391ab..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams: -17
diff --git a/tests/config/fail/metadata/streams-key-invalid-identifier.yaml b/tests/config/fail/metadata/streams-key-invalid-identifier.yaml
deleted file mode 100644 (file)
index 4ca8111..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    'some stream':
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/metadata/streams-no.yaml b/tests/config/fail/metadata/streams-no.yaml
deleted file mode 100644 (file)
index 32894b4..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
diff --git a/tests/config/fail/metadata/ta-invalid-type.yaml b/tests/config/fail/metadata/ta-invalid-type.yaml
deleted file mode 100644 (file)
index 888210d..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    - uint16:
-        class: int
-        size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/metadata/trace-empty.yaml b/tests/config/fail/metadata/trace-empty.yaml
deleted file mode 100644 (file)
index 359c74f..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace: {}
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/metadata/trace-invalid-type.yaml b/tests/config/fail/metadata/trace-invalid-type.yaml
deleted file mode 100644 (file)
index 3f39bc5..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace: switch
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/metadata/trace-no.yaml b/tests/config/fail/metadata/trace-no.yaml
deleted file mode 100644 (file)
index 060b39b..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/metadata/unknown-prop.yaml b/tests/config/fail/metadata/unknown-prop.yaml
deleted file mode 100644 (file)
index 5ad61d3..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-  unknown: false
diff --git a/tests/config/fail/stream/default-invalid-type.yaml b/tests/config/fail/stream/default-invalid-type.yaml
deleted file mode 100644 (file)
index 908eb79..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.2'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      $default: 23
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/ect-invalid-type.yaml b/tests/config/fail/stream/ect-invalid-type.yaml
deleted file mode 100644 (file)
index b56c582..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      event-context-type: 23
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/ect-not-struct.yaml b/tests/config/fail/stream/ect-not-struct.yaml
deleted file mode 100644 (file)
index 4a9bbe9..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      event-context-type:
-        class: string
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/eht-id-no-multiple-events.yaml b/tests/config/fail/stream/eht-id-no-multiple-events.yaml
deleted file mode 100644 (file)
index cb7ced7..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  clocks:
-    my_clock: {}
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          content_size: uint16
-          packet_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-        my_other_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/eht-id-not-int.yaml b/tests/config/fail/stream/eht-id-not-int.yaml
deleted file mode 100644 (file)
index 1eeb868..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  clocks:
-    my_clock: {}
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          content_size: uint16
-          packet_size: uint16
-      event-header-type:
-        class: struct
-        fields:
-          id:
-            class: string
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/eht-id-too-small.yaml b/tests/config/fail/stream/eht-id-too-small.yaml
deleted file mode 100644 (file)
index a3a4b11..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  clocks:
-    my_clock: {}
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          content_size: uint16
-          packet_size: uint16
-      event-header-type:
-        class: struct
-        min-align: 8
-        fields:
-          id:
-            class: int
-            size: 2
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field: uint16
-        my_event2:
-          payload-type:
-            class: struct
-            fields:
-              my_field: uint16
-        my_event3:
-          payload-type:
-            class: struct
-            fields:
-              my_field: uint16
-        my_event4:
-          payload-type:
-            class: struct
-            fields:
-              my_field: uint16
-        my_event5:
-          payload-type:
-            class: struct
-            fields:
-              my_field: uint16
diff --git a/tests/config/fail/stream/eht-id-wrong-signed.yaml b/tests/config/fail/stream/eht-id-wrong-signed.yaml
deleted file mode 100644 (file)
index 9485bd2..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  clocks:
-    my_clock: {}
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          content_size: uint16
-          packet_size: uint16
-      event-header-type:
-        class: struct
-        fields:
-          id:
-            class: int
-            size: 16
-            signed: true
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/eht-invalid-type.yaml b/tests/config/fail/stream/eht-invalid-type.yaml
deleted file mode 100644 (file)
index 765c67e..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      event-header-type: 23
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/eht-not-struct.yaml b/tests/config/fail/stream/eht-not-struct.yaml
deleted file mode 100644 (file)
index 048f62e..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      event-header-type:
-        class: string
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/eht-timestamp-not-int.yaml b/tests/config/fail/stream/eht-timestamp-not-int.yaml
deleted file mode 100644 (file)
index 39a07ac..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  clocks:
-    my_clock: {}
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          content_size: uint16
-          packet_size: uint16
-      event-header-type:
-        class: struct
-        fields:
-          timestamp:
-            class: string
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/eht-timestamp-wrong-pm.yaml b/tests/config/fail/stream/eht-timestamp-wrong-pm.yaml
deleted file mode 100644 (file)
index 064eafe..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  clocks:
-    my_clock: {}
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          content_size: uint16
-          packet_size: uint16
-      event-header-type:
-        class: struct
-        fields:
-          timestamp:
-            class: int
-            size: 16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/eht-timestamp-wrong-signed.yaml b/tests/config/fail/stream/eht-timestamp-wrong-signed.yaml
deleted file mode 100644 (file)
index 2e65575..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  clocks:
-    my_clock: {}
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          content_size: uint16
-          packet_size: uint16
-      event-header-type:
-        class: struct
-        fields:
-          timestamp:
-            class: int
-            size: 16
-            signed: true
-            property-mappings:
-              - type: clock
-                name: my_clock
-                property: value
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/events-empty.yaml b/tests/config/fail/stream/events-empty.yaml
deleted file mode 100644 (file)
index b100d92..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events: {}
diff --git a/tests/config/fail/stream/events-invalid-type.yaml b/tests/config/fail/stream/events-invalid-type.yaml
deleted file mode 100644 (file)
index 557d1b0..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events: 23.5
diff --git a/tests/config/fail/stream/events-key-invalid-identifier.yaml b/tests/config/fail/stream/events-key-invalid-identifier.yaml
deleted file mode 100644 (file)
index 6c17ee1..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    a_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        'my event':
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/events-no.yaml b/tests/config/fail/stream/events-no.yaml
deleted file mode 100644 (file)
index eae4fbe..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size:
-            class: int
-            size: 16
-          content_size:
-            class: int
-            size: 16
diff --git a/tests/config/fail/stream/fail.bats b/tests/config/fail/stream/fail.bats
deleted file mode 100644 (file)
index 8f2490d..0000000
+++ /dev/null
@@ -1,177 +0,0 @@
-#!/usr/bin/env bats
-
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-load ../../common
-
-@test 'unknown property in stream object makes barectf fail' {
-  barectf_config_check_fail unknown-prop.yaml
-}
-
-@test 'no "packet-context-type" property in stream object makes barectf fail' {
-  barectf_config_check_fail pct-no.yaml
-}
-
-@test 'wrong "packet-context-type" property type in stream object makes barectf fail' {
-  barectf_config_check_fail pct-invalid-type.yaml
-}
-
-@test 'invalid "packet-context-type" property field type (not a structure) in stream object makes barectf fail' {
-  barectf_config_check_fail pct-not-struct.yaml
-}
-
-@test 'invalid "timestamp_begin" field type (not an integer) in packet context type makes barectf fail' {
-  barectf_config_check_fail pct-tb-not-int.yaml
-}
-
-@test 'invalid "timestamp_begin" field type (signed) in packet context type makes barectf fail' {
-  barectf_config_check_fail pct-tb-wrong-signed.yaml
-}
-
-@test 'invalid "timestamp_begin" field type (not mapped to a clock) in packet context type makes barectf fail' {
-  barectf_config_check_fail pct-tb-wrong-pm.yaml
-}
-
-@test 'no "timestamp_begin" field with an existing "timestamp_end" field in packet context type makes barectf fail' {
-  barectf_config_check_fail pct-te-yes-tb-no.yaml
-}
-
-@test 'invalid "timestamp_end" field type (not an integer) in packet context type makes barectf fail' {
-  barectf_config_check_fail pct-te-not-int.yaml
-}
-
-@test 'invalid "timestamp_end" field type (signed) in packet context type makes barectf fail' {
-  barectf_config_check_fail pct-te-wrong-signed.yaml
-}
-
-@test 'invalid "timestamp_end" field type (not mapped to a clock) in packet context type makes barectf fail' {
-  barectf_config_check_fail pct-te-wrong-pm.yaml
-}
-
-@test 'no "timestamp_end" field with an existing "timestamp_begin" field in packet context type makes barectf fail' {
-  barectf_config_check_fail pct-tb-yes-te-no.yaml
-}
-
-@test '"timestamp_begin" field and "timestamp_end" field are not mapped to the same clock in packet context type makes barectf fail' {
-  barectf_config_check_fail pct-tb-te-different-clocks.yaml
-}
-
-@test 'invalid "packet_size" field type (not an integer) in packet context type makes barectf fail' {
-  barectf_config_check_fail pct-ps-not-int.yaml
-}
-
-@test 'invalid "packet_size" field type (signed) in packet context type makes barectf fail' {
-  barectf_config_check_fail pct-ps-wrong-signed.yaml
-}
-
-@test 'no "packet_size" field with an existing "content_size" field in packet context type makes barectf fail' {
-  barectf_config_check_fail pct-cs-yes-ps-no.yaml
-}
-
-@test 'invalid "content_size" field type (not an integer) in packet context type makes barectf fail' {
-  barectf_config_check_fail pct-cs-not-int.yaml
-}
-
-@test 'invalid "content_size" field type (signed) in packet context type makes barectf fail' {
-  barectf_config_check_fail pct-cs-wrong-signed.yaml
-}
-
-@test 'no "content_size" field with an existing "packet_size" field in packet context type makes barectf fail' {
-  barectf_config_check_fail pct-ps-yes-cs-no.yaml
-}
-
-@test '"content_size" field size greater than "packet_size" field size in packet context type makes barectf fail' {
-  barectf_config_check_fail pct-cs-gt-ps.yaml
-}
-
-@test 'invalid "events_discarded" field type (not an integer) in packet context type makes barectf fail' {
-  barectf_config_check_fail pct-ed-not-int.yaml
-}
-
-@test 'invalid "events_discarded" field type (signed) in packet context type makes barectf fail' {
-  barectf_config_check_fail pct-ed-wrong-signed.yaml
-}
-
-@test 'wrong "event-header-type" property type in stream object makes barectf fail' {
-  barectf_config_check_fail eht-invalid-type.yaml
-}
-
-@test 'invalid "event-header-type" property field type (not a structure) in stream object makes barectf fail' {
-  barectf_config_check_fail eht-not-struct.yaml
-}
-
-@test 'invalid "timestamp" field type (not an integer) in event header type makes barectf fail' {
-  barectf_config_check_fail eht-timestamp-not-int.yaml
-}
-
-@test 'invalid "timestamp" field type (signed) in event header type makes barectf fail' {
-  barectf_config_check_fail eht-timestamp-wrong-signed.yaml
-}
-
-@test 'invalid "timestamp" field type (not mapped to a clock) in event header type makes barectf fail' {
-  barectf_config_check_fail eht-timestamp-wrong-pm.yaml
-}
-
-@test 'invalid "id" field type (not an integer) in event header type makes barectf fail' {
-  barectf_config_check_fail eht-id-not-int.yaml
-}
-
-@test 'invalid "id" field type (signed) in event header type makes barectf fail' {
-  barectf_config_check_fail eht-id-wrong-signed.yaml
-}
-
-@test 'no event header type with multiple events in stream object makes barectf fail' {
-  barectf_config_check_fail eht-id-no-multiple-events.yaml
-}
-
-@test '"id" field type size too small for the number of stream events in event header type makes barectf fail' {
-  barectf_config_check_fail eht-id-too-small.yaml
-}
-
-@test 'wrong "event-context-type" property type in stream object makes barectf fail' {
-  barectf_config_check_fail ect-invalid-type.yaml
-}
-
-@test 'invalid "event-context-type" property field type (not a structure) in stream object makes barectf fail' {
-  barectf_config_check_fail ect-not-struct.yaml
-}
-
-@test 'no "events" property in stream object makes barectf fail' {
-  barectf_config_check_fail events-no.yaml
-}
-
-@test 'wrong "events" property type in stream object makes barectf fail' {
-  barectf_config_check_fail events-invalid-type.yaml
-}
-
-@test 'empty "events" property in stream object makes barectf fail' {
-  barectf_config_check_fail events-empty.yaml
-}
-
-@test 'invalid "events" key (invalid C identifier) in metadata object makes barectf fail' {
-  barectf_config_check_fail events-key-invalid-identifier.yaml
-}
-
-@test 'wrong "$default" property type in stream object makes barectf fail' {
-  barectf_config_check_fail default-invalid-type.yaml
-}
diff --git a/tests/config/fail/stream/pct-cs-gt-ps.yaml b/tests/config/fail/stream/pct-cs-gt-ps.yaml
deleted file mode 100644 (file)
index 9630bf3..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  clocks:
-    my_clock: {}
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          content_size:
-            class: int
-            size: 16
-          packet_size:
-            class: int
-            size: 8
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/pct-cs-not-int.yaml b/tests/config/fail/stream/pct-cs-not-int.yaml
deleted file mode 100644 (file)
index 9b7c053..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          content_size:
-            class: string
-          packet_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/pct-cs-wrong-signed.yaml b/tests/config/fail/stream/pct-cs-wrong-signed.yaml
deleted file mode 100644 (file)
index 70127d7..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  clocks:
-    my_clock: {}
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          content_size:
-            class: int
-            size: 16
-            signed: true
-          packet_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/pct-cs-yes-ps-no.yaml b/tests/config/fail/stream/pct-cs-yes-ps-no.yaml
deleted file mode 100644 (file)
index 5fb3a95..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/pct-ed-not-int.yaml b/tests/config/fail/stream/pct-ed-not-int.yaml
deleted file mode 100644 (file)
index a1bfffb..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          events_discarded:
-            class: string
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/pct-ed-wrong-signed.yaml b/tests/config/fail/stream/pct-ed-wrong-signed.yaml
deleted file mode 100644 (file)
index 372c70d..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  clocks:
-    my_clock: {}
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          events_discarded:
-            class: int
-            size: 16
-            signed: true
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/pct-invalid-type.yaml b/tests/config/fail/stream/pct-invalid-type.yaml
deleted file mode 100644 (file)
index 55bf135..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type: 23
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/pct-no.yaml b/tests/config/fail/stream/pct-no.yaml
deleted file mode 100644 (file)
index 1f4beab..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  clocks:
-    my_clock: {}
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/pct-not-struct.yaml b/tests/config/fail/stream/pct-not-struct.yaml
deleted file mode 100644 (file)
index 128f92e..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: string
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/pct-ps-not-int.yaml b/tests/config/fail/stream/pct-ps-not-int.yaml
deleted file mode 100644 (file)
index 5d767aa..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size:
-            class: string
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/pct-ps-wrong-signed.yaml b/tests/config/fail/stream/pct-ps-wrong-signed.yaml
deleted file mode 100644 (file)
index 2887e05..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  clocks:
-    my_clock: {}
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size:
-            class: int
-            size: 16
-            signed: true
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/pct-ps-yes-cs-no.yaml b/tests/config/fail/stream/pct-ps-yes-cs-no.yaml
deleted file mode 100644 (file)
index 8f2ccd1..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/pct-tb-not-int.yaml b/tests/config/fail/stream/pct-tb-not-int.yaml
deleted file mode 100644 (file)
index a78c9cb..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          content_size: uint16
-          packet_size: uint16
-          timestamp_begin:
-            class: string
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/pct-tb-te-different-clocks.yaml b/tests/config/fail/stream/pct-tb-te-different-clocks.yaml
deleted file mode 100644 (file)
index 1158c8d..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  clocks:
-    my_clock: {}
-    my_other_clock: {}
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          content_size: uint16
-          packet_size: uint16
-          timestamp_begin:
-            class: int
-            size: 32
-            property-mappings:
-              - type: clock
-                name: my_clock
-                property: value
-          timestamp_end:
-            class: int
-            size: 32
-            property-mappings:
-              - type: clock
-                name: my_other_clock
-                property: value
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/pct-tb-wrong-pm.yaml b/tests/config/fail/stream/pct-tb-wrong-pm.yaml
deleted file mode 100644 (file)
index c6ca9ae..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  clocks:
-    my_clock: {}
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          content_size: uint16
-          packet_size: uint16
-          timestamp_begin:
-            class: int
-            size: 16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/pct-tb-wrong-signed.yaml b/tests/config/fail/stream/pct-tb-wrong-signed.yaml
deleted file mode 100644 (file)
index f559bca..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  clocks:
-    my_clock: {}
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          content_size: uint16
-          packet_size: uint16
-          timestamp_begin:
-            class: int
-            size: 16
-            signed: true
-            property-mappings:
-              - type: clock
-                name: my_clock
-                property: value
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/pct-tb-yes-te-no.yaml b/tests/config/fail/stream/pct-tb-yes-te-no.yaml
deleted file mode 100644 (file)
index a3422a0..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  clocks:
-    my_clock: {}
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          content_size: uint16
-          packet_size: uint16
-          timestamp_begin:
-            class: int
-            size: 32
-            property-mappings:
-              - type: clock
-                name: my_clock
-                property: value
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/pct-te-not-int.yaml b/tests/config/fail/stream/pct-te-not-int.yaml
deleted file mode 100644 (file)
index 9e286c4..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          content_size: uint16
-          packet_size: uint16
-          timestamp_end:
-            class: string
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/pct-te-wrong-pm.yaml b/tests/config/fail/stream/pct-te-wrong-pm.yaml
deleted file mode 100644 (file)
index 0b8bfd9..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  clocks:
-    my_clock: {}
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          content_size: uint16
-          packet_size: uint16
-          timestamp_end:
-            class: int
-            size: 16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/pct-te-wrong-signed.yaml b/tests/config/fail/stream/pct-te-wrong-signed.yaml
deleted file mode 100644 (file)
index 48507bf..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  clocks:
-    my_clock: {}
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          content_size: uint16
-          packet_size: uint16
-          timestamp_end:
-            class: int
-            size: 16
-            signed: true
-            property-mappings:
-              - type: clock
-                name: my_clock
-                property: value
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/pct-te-yes-tb-no.yaml b/tests/config/fail/stream/pct-te-yes-tb-no.yaml
deleted file mode 100644 (file)
index 2fdd9b1..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  clocks:
-    my_clock: {}
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          content_size: uint16
-          packet_size: uint16
-          timestamp_end:
-            class: int
-            size: 32
-            property-mappings:
-              - type: clock
-                name: my_clock
-                property: value
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/stream/unknown-prop.yaml b/tests/config/fail/stream/unknown-prop.yaml
deleted file mode 100644 (file)
index 0b370ba..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      unknown: true
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/trace/bo-invalid-type.yaml b/tests/config/fail/trace/bo-invalid-type.yaml
deleted file mode 100644 (file)
index fddf0ef..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: 23
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/trace/bo-invalid.yaml b/tests/config/fail/trace/bo-invalid.yaml
deleted file mode 100644 (file)
index 01baca8..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: ze
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/trace/bo-no.yaml b/tests/config/fail/trace/bo-no.yaml
deleted file mode 100644 (file)
index 359c74f..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace: {}
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/trace/fail.bats b/tests/config/fail/trace/fail.bats
deleted file mode 100644 (file)
index a47dcb5..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/usr/bin/env bats
-
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-load ../../common
-
-@test 'unknown property in trace object makes barectf fail' {
-  barectf_config_check_fail unknown-prop.yaml
-}
-
-@test 'wrong "byte-order" property type in trace object makes barectf fail' {
-  barectf_config_check_fail bo-invalid-type.yaml
-}
-
-@test 'no "byte-order" property in trace object makes barectf fail' {
-  barectf_config_check_fail bo-no.yaml
-}
-
-@test 'invalid "byte-order" property in trace object makes barectf fail' {
-  barectf_config_check_fail bo-invalid.yaml
-}
-
-@test 'invalid "packet-header-type" property field type (not a structure) in trace object makes barectf fail' {
-  barectf_config_check_fail ph-not-struct.yaml
-}
-
-@test 'wrong "uuid" property type in trace object makes barectf fail' {
-  barectf_config_check_fail uuid-invalid-type.yaml
-}
-
-@test 'invalid "uuid" property (invalid UUID format) in trace object makes barectf fail' {
-  barectf_config_check_fail uuid-invalid-uuid.yaml
-}
-
-@test 'invalid "magic" field type (not an integer) in packet header type makes barectf fail' {
-  barectf_config_check_fail ph-magic-not-int.yaml
-}
-
-@test 'invalid "magic" field type (wrong integer size) in packet header type makes barectf fail' {
-  barectf_config_check_fail ph-magic-wrong-size.yaml
-}
-
-@test 'invalid "magic" field type (signed) in packet header type makes barectf fail' {
-  barectf_config_check_fail ph-magic-wrong-signed.yaml
-}
-
-@test 'invalid "stream_id" field type (not an integer) in packet header type makes barectf fail' {
-  barectf_config_check_fail ph-streamid-not-int.yaml
-}
-
-@test 'invalid "stream_id" field type (signed) in packet header type makes barectf fail' {
-  barectf_config_check_fail ph-streamid-wrong-signed.yaml
-}
-
-@test '"stream_id" field type size too small for the number of trace streams in packet header type makes barectf fail' {
-  barectf_config_check_fail ph-streamid-too-small.yaml
-}
-
-@test 'invalid "uuid" field type (not an array) in packet header type makes barectf fail' {
-  barectf_config_check_fail ph-uuid-not-array.yaml
-}
-
-@test 'invalid "uuid" field type (wrong array length) in packet header type makes barectf fail' {
-  barectf_config_check_fail ph-uuid-wrong-length.yaml
-}
-
-@test 'invalid "uuid" field type (element type is not an integer) in packet header type makes barectf fail' {
-  barectf_config_check_fail ph-uuid-et-not-int.yaml
-}
-
-@test 'invalid "uuid" field type (wrong element type size) in packet header type makes barectf fail' {
-  barectf_config_check_fail ph-uuid-et-wrong-size.yaml
-}
-
-@test 'invalid "uuid" field type (element type is signed) in packet header type makes barectf fail' {
-  barectf_config_check_fail ph-uuid-et-wrong-signed.yaml
-}
-
-@test 'invalid "uuid" field type (wrong element type alignment) in packet header type makes barectf fail' {
-  barectf_config_check_fail ph-uuid-et-wrong-align.yaml
-}
diff --git a/tests/config/fail/trace/ph-magic-not-int.yaml b/tests/config/fail/trace/ph-magic-not-int.yaml
deleted file mode 100644 (file)
index 87911be..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: be
-    packet-header-type:
-      class: struct
-      fields:
-        magic:
-          class: string
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/trace/ph-magic-wrong-signed.yaml b/tests/config/fail/trace/ph-magic-wrong-signed.yaml
deleted file mode 100644 (file)
index 604f0a0..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: be
-    packet-header-type:
-      class: struct
-      fields:
-        magic:
-          class: int
-          size: 32
-          signed: true
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/trace/ph-magic-wrong-size.yaml b/tests/config/fail/trace/ph-magic-wrong-size.yaml
deleted file mode 100644 (file)
index 2a1eaf7..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: be
-    packet-header-type:
-      class: struct
-      fields:
-        magic:
-          class: int
-          size: 16
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/trace/ph-not-struct.yaml b/tests/config/fail/trace/ph-not-struct.yaml
deleted file mode 100644 (file)
index 92a6d5e..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: be
-    packet-header-type:
-      class: int
-      size: 32
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/trace/ph-streamid-not-int.yaml b/tests/config/fail/trace/ph-streamid-not-int.yaml
deleted file mode 100644 (file)
index d457fd1..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: be
-    packet-header-type:
-      class: struct
-      fields:
-        stream_id:
-          class: string
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/trace/ph-streamid-too-small.yaml b/tests/config/fail/trace/ph-streamid-too-small.yaml
deleted file mode 100644 (file)
index 946406a..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  clocks:
-    my_clock: {}
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: le
-    packet-header-type:
-      class: struct
-      min-align: 8
-      fields:
-        stream_id:
-          class: int
-          size: 2
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          content_size: uint16
-          packet_size: uint16
-      event-header-type:
-        class: struct
-        min-align: 8
-        fields:
-          id: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field: uint16
-    my_stream2:
-      packet-context-type:
-        class: struct
-        fields:
-          content_size: uint16
-          packet_size: uint16
-      event-header-type:
-        class: struct
-        min-align: 8
-        fields:
-          id: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field: uint16
-    my_stream3:
-      packet-context-type:
-        class: struct
-        fields:
-          content_size: uint16
-          packet_size: uint16
-      event-header-type:
-        class: struct
-        min-align: 8
-        fields:
-          id: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field: uint16
-    my_stream4:
-      packet-context-type:
-        class: struct
-        fields:
-          content_size: uint16
-          packet_size: uint16
-      event-header-type:
-        class: struct
-        min-align: 8
-        fields:
-          id: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field: uint16
-    my_stream5:
-      packet-context-type:
-        class: struct
-        fields:
-          content_size: uint16
-          packet_size: uint16
-      event-header-type:
-        class: struct
-        min-align: 8
-        fields:
-          id: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field: uint16
diff --git a/tests/config/fail/trace/ph-streamid-wrong-signed.yaml b/tests/config/fail/trace/ph-streamid-wrong-signed.yaml
deleted file mode 100644 (file)
index e232bbb..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: be
-    packet-header-type:
-      class: struct
-      fields:
-        stream_id:
-          class: int
-          size: 16
-          signed: true
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/trace/ph-uuid-et-not-int.yaml b/tests/config/fail/trace/ph-uuid-et-not-int.yaml
deleted file mode 100644 (file)
index cef76c8..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    uuid: auto
-    byte-order: be
-    packet-header-type:
-      class: struct
-      fields:
-        uuid:
-          class: array
-          length: 16
-          element-type:
-            class: string
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/trace/ph-uuid-et-wrong-align.yaml b/tests/config/fail/trace/ph-uuid-et-wrong-align.yaml
deleted file mode 100644 (file)
index 319d986..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    uuid: auto
-    byte-order: be
-    packet-header-type:
-      class: struct
-      fields:
-        uuid:
-          class: array
-          length: 16
-          element-type:
-            class: int
-            size: 8
-            align: 16
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/trace/ph-uuid-et-wrong-signed.yaml b/tests/config/fail/trace/ph-uuid-et-wrong-signed.yaml
deleted file mode 100644 (file)
index 04107bd..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    uuid: auto
-    byte-order: be
-    packet-header-type:
-      class: struct
-      fields:
-        uuid:
-          class: array
-          length: 16
-          element-type:
-            class: int
-            size: 8
-            signed: true
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/trace/ph-uuid-et-wrong-size.yaml b/tests/config/fail/trace/ph-uuid-et-wrong-size.yaml
deleted file mode 100644 (file)
index c2492a7..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    uuid: auto
-    byte-order: be
-    packet-header-type:
-      class: struct
-      fields:
-        uuid:
-          class: array
-          length: 16
-          element-type:
-            class: int
-            size: 4
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/trace/ph-uuid-not-array.yaml b/tests/config/fail/trace/ph-uuid-not-array.yaml
deleted file mode 100644 (file)
index d1aa05b..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    uuid: auto
-    byte-order: be
-    packet-header-type:
-      class: struct
-      fields:
-        uuid: uint16
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/trace/ph-uuid-wrong-length.yaml b/tests/config/fail/trace/ph-uuid-wrong-length.yaml
deleted file mode 100644 (file)
index 4817248..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    uuid: auto
-    byte-order: be
-    packet-header-type:
-      class: struct
-      fields:
-        uuid:
-          class: array
-          length: 17
-          element-type:
-            class: int
-            size: 8
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/trace/unknown-prop.yaml b/tests/config/fail/trace/unknown-prop.yaml
deleted file mode 100644 (file)
index 3ce7f0c..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order: be
-    unknown: false
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/trace/uuid-invalid-type.yaml b/tests/config/fail/trace/uuid-invalid-type.yaml
deleted file mode 100644 (file)
index 83d95f0..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    uuid: 12
-    byte-order: be
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/trace/uuid-invalid-uuid.yaml b/tests/config/fail/trace/uuid-invalid-uuid.yaml
deleted file mode 100644 (file)
index 92ba144..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    uuid: something
-    byte-order: be
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/type-enum/fail.bats b/tests/config/fail/type-enum/fail.bats
deleted file mode 100644 (file)
index 27c8e0e..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/usr/bin/env bats
-
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-load ../../common
-
-@test 'unknown property in enum type object makes barectf fail' {
-  barectf_config_check_fail unknown-prop.yaml
-}
-
-@test 'no "value-type" property in enum type object makes barectf fail' {
-  barectf_config_check_fail vt-no.yaml
-}
-
-@test 'wrong "value-type" property type in enum type object makes barectf fail' {
-  barectf_config_check_fail vt-invalid-type.yaml
-}
-
-@test 'no "members" property in enum type object makes barectf fail' {
-  barectf_config_check_fail members-no.yaml
-}
-
-@test 'wrong "members" property type in enum type object makes barectf fail' {
-  barectf_config_check_fail members-invalid-type.yaml
-}
-
-@test 'empty "members" property in enum type object makes barectf fail' {
-  barectf_config_check_fail members-empty.yaml
-}
-
-@test 'wrong "members" property element type in enum type object makes barectf fail' {
-  barectf_config_check_fail members-el-invalid-type.yaml
-}
-
-@test 'unknown property in enum type member object makes barectf fail' {
-  barectf_config_check_fail members-el-member-unknown-prop.yaml
-}
-
-@test 'wrong "label" property type in enum type member object makes barectf fail' {
-  barectf_config_check_fail members-el-member-label-invalid-type.yaml
-}
-
-@test 'wrong "value" property type in enum type member object makes barectf fail' {
-  barectf_config_check_fail members-el-member-value-invalid-type.yaml
-}
-
-@test '"value" property outside the unsigned value type range in enum type member object makes barectf fail' {
-  barectf_config_check_fail members-el-member-value-outside-range-unsigned.yaml
-}
-
-@test '"value" property outside the signed value type range in enum type member object makes barectf fail' {
-  barectf_config_check_fail members-el-member-value-outside-range-signed.yaml
-}
-
-@test 'overlapping members in enum type object makes barectf fail' {
-  barectf_config_check_fail members-overlap.yaml
-}
diff --git a/tests/config/fail/type-enum/members-el-invalid-type.yaml b/tests/config/fail/type-enum/members-el-invalid-type.yaml
deleted file mode 100644 (file)
index b5b4dec..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: enum
-                value-type:
-                  class: int
-                  size: 8
-                members:
-                  - HELLO
-                  - 23
-                  - ZOOM
diff --git a/tests/config/fail/type-enum/members-el-member-label-invalid-type.yaml b/tests/config/fail/type-enum/members-el-member-label-invalid-type.yaml
deleted file mode 100644 (file)
index 8c9dac1..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: enum
-                value-type:
-                  class: int
-                  size: 8
-                members:
-                  - HELLO
-                  - label: 65
-                    value: 6
-                  - ZOOM
diff --git a/tests/config/fail/type-enum/members-el-member-unknown-prop.yaml b/tests/config/fail/type-enum/members-el-member-unknown-prop.yaml
deleted file mode 100644 (file)
index 605ca47..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: enum
-                value-type:
-                  class: int
-                  size: 8
-                members:
-                  - HELLO
-                  - label: six
-                    value: 6
-                    unknown: true
-                  - ZOOM
diff --git a/tests/config/fail/type-enum/members-el-member-value-invalid-type.yaml b/tests/config/fail/type-enum/members-el-member-value-invalid-type.yaml
deleted file mode 100644 (file)
index bff7116..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: enum
-                value-type:
-                  class: int
-                  size: 8
-                members:
-                  - HELLO
-                  - label: label
-                    value: meow
-                  - ZOOM
diff --git a/tests/config/fail/type-enum/members-el-member-value-outside-range-signed.yaml b/tests/config/fail/type-enum/members-el-member-value-outside-range-signed.yaml
deleted file mode 100644 (file)
index 295e4e5..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: enum
-                value-type:
-                  class: int
-                  size: 8
-                  signed: true
-                members:
-                  - HELLO
-                  - label: label
-                    value: -129
-                  - ZOOM
diff --git a/tests/config/fail/type-enum/members-el-member-value-outside-range-unsigned.yaml b/tests/config/fail/type-enum/members-el-member-value-outside-range-unsigned.yaml
deleted file mode 100644 (file)
index f36cf32..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: enum
-                value-type:
-                  class: int
-                  size: 8
-                members:
-                  - HELLO
-                  - label: label
-                    value: 256
-                  - ZOOM
diff --git a/tests/config/fail/type-enum/members-empty.yaml b/tests/config/fail/type-enum/members-empty.yaml
deleted file mode 100644 (file)
index 0f93579..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: enum
-                value-type:
-                  class: int
-                  size: 8
-                members: []
diff --git a/tests/config/fail/type-enum/members-invalid-type.yaml b/tests/config/fail/type-enum/members-invalid-type.yaml
deleted file mode 100644 (file)
index ac4a6f1..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: enum
-                value-type:
-                  class: int
-                  size: 8
-                members: string
diff --git a/tests/config/fail/type-enum/members-no.yaml b/tests/config/fail/type-enum/members-no.yaml
deleted file mode 100644 (file)
index 19227ca..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: enum
-                value-type:
-                  class: int
-                  size: 8
diff --git a/tests/config/fail/type-enum/members-overlap.yaml b/tests/config/fail/type-enum/members-overlap.yaml
deleted file mode 100644 (file)
index 5b50aa2..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: enum
-                value-type:
-                  class: int
-                  size: 8
-                  signed: true
-                members:
-                  - HELLO
-                  - ZOOM
-                  - label: MAGOG
-                    value: 0
diff --git a/tests/config/fail/type-enum/unknown-prop.yaml b/tests/config/fail/type-enum/unknown-prop.yaml
deleted file mode 100644 (file)
index a845159..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: enum
-                value-type:
-                  class: int
-                  size: 8
-                members:
-                  - HELLO
-                unknown: false
diff --git a/tests/config/fail/type-enum/vt-invalid-type.yaml b/tests/config/fail/type-enum/vt-invalid-type.yaml
deleted file mode 100644 (file)
index 4d2a184..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: enum
-                value-type: 23
-                members:
-                  - HELLO
diff --git a/tests/config/fail/type-enum/vt-no.yaml b/tests/config/fail/type-enum/vt-no.yaml
deleted file mode 100644 (file)
index 374de4f..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: enum
-                members:
-                  - HELLO
diff --git a/tests/config/fail/type-float/align-0.yaml b/tests/config/fail/type-float/align-0.yaml
deleted file mode 100644 (file)
index 6ac0410..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: float
-                size:
-                  exp: 8
-                  mant: 24
-                align: 0
diff --git a/tests/config/fail/type-float/align-3.yaml b/tests/config/fail/type-float/align-3.yaml
deleted file mode 100644 (file)
index 87ab18c..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: float
-                size:
-                  exp: 8
-                  mant: 24
-                align: 3
diff --git a/tests/config/fail/type-float/align-invalid-type.yaml b/tests/config/fail/type-float/align-invalid-type.yaml
deleted file mode 100644 (file)
index 9c06ae5..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: float
-                size:
-                  exp: 8
-                  mant: 24
-                align: string
diff --git a/tests/config/fail/type-float/bo-invalid-type.yaml b/tests/config/fail/type-float/bo-invalid-type.yaml
deleted file mode 100644 (file)
index b0db7a7..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: float
-                size:
-                  exp: 8
-                  mant: 24
-                byte-order: 17
diff --git a/tests/config/fail/type-float/bo-invalid.yaml b/tests/config/fail/type-float/bo-invalid.yaml
deleted file mode 100644 (file)
index 418a20f..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: float
-                size:
-                  exp: 8
-                  mant: 24
-                byte-order: ze
diff --git a/tests/config/fail/type-float/fail.bats b/tests/config/fail/type-float/fail.bats
deleted file mode 100644 (file)
index 1a9e116..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/env bats
-
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-load ../../common
-
-@test 'unknown property in float type object makes barectf fail' {
-  barectf_config_check_fail unknown-prop.yaml
-}
-
-@test 'no "size" property in float type object makes barectf fail' {
-  barectf_config_check_fail size-no.yaml
-}
-
-@test 'wrong "size" property type in float type object makes barectf fail' {
-  barectf_config_check_fail size-invalid-type.yaml
-}
-
-@test 'unknown property in float type object "size" property makes barectf fail' {
-  barectf_config_check_fail size-unknown-prop.yaml
-}
-
-@test 'no "exp" property in float type object "size" property makes barectf fail' {
-  barectf_config_check_fail size-exp-no.yaml
-}
-
-@test 'no "mant" property in float type object "size" property makes barectf fail' {
-  barectf_config_check_fail size-mant-no.yaml
-}
-
-@test 'sum of "mant" and "exp" properties of float type size object not a multiple of 32 property makes barectf fail' {
-  barectf_config_check_fail size-exp-mant-wrong-sum.yaml
-}
-
-@test 'wrong "align" property type in float type object makes barectf fail' {
-  barectf_config_check_fail align-invalid-type.yaml
-}
-
-@test 'invalid "align" property (0) in float type object makes barectf fail' {
-  barectf_config_check_fail align-0.yaml
-}
-
-@test 'invalid "align" property (3) in float type object makes barectf fail' {
-  barectf_config_check_fail align-3.yaml
-}
-
-@test 'wrong "byte-order" property type in float type object makes barectf fail' {
-  barectf_config_check_fail bo-invalid-type.yaml
-}
-
-@test 'invalid "byte-order" property in float type object makes barectf fail' {
-  barectf_config_check_fail bo-invalid.yaml
-}
diff --git a/tests/config/fail/type-float/size-exp-mant-wrong-sum.yaml b/tests/config/fail/type-float/size-exp-mant-wrong-sum.yaml
deleted file mode 100644 (file)
index f69f4cf..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: float
-                size:
-                  exp: 5
-                  mant: 21
diff --git a/tests/config/fail/type-float/size-exp-no.yaml b/tests/config/fail/type-float/size-exp-no.yaml
deleted file mode 100644 (file)
index f688daa..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: float
-                size:
-                  mant: 24
diff --git a/tests/config/fail/type-float/size-invalid-type.yaml b/tests/config/fail/type-float/size-invalid-type.yaml
deleted file mode 100644 (file)
index 91cc996..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: float
-                size: string
diff --git a/tests/config/fail/type-float/size-mant-no.yaml b/tests/config/fail/type-float/size-mant-no.yaml
deleted file mode 100644 (file)
index 753d7e0..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: float
-                size:
-                  exp: 8
diff --git a/tests/config/fail/type-float/size-no.yaml b/tests/config/fail/type-float/size-no.yaml
deleted file mode 100644 (file)
index 9f99c58..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: float
diff --git a/tests/config/fail/type-float/size-unknown-prop.yaml b/tests/config/fail/type-float/size-unknown-prop.yaml
deleted file mode 100644 (file)
index 9a9589c..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: float
-                size:
-                  exp: 8
-                  mant: 24
-                  unknown: false
diff --git a/tests/config/fail/type-float/unknown-prop.yaml b/tests/config/fail/type-float/unknown-prop.yaml
deleted file mode 100644 (file)
index 9149ad2..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: float
-                size:
-                  exp: 8
-                  mant: 24
-                unknown: false
diff --git a/tests/config/fail/type-int/align-0.yaml b/tests/config/fail/type-int/align-0.yaml
deleted file mode 100644 (file)
index d32de2c..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 32
-                align: 0
diff --git a/tests/config/fail/type-int/align-3.yaml b/tests/config/fail/type-int/align-3.yaml
deleted file mode 100644 (file)
index 26ac75e..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 32
-                align: 3
diff --git a/tests/config/fail/type-int/align-invalid-type.yaml b/tests/config/fail/type-int/align-invalid-type.yaml
deleted file mode 100644 (file)
index 19cf4d4..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                align: string
diff --git a/tests/config/fail/type-int/base-invalid-type.yaml b/tests/config/fail/type-int/base-invalid-type.yaml
deleted file mode 100644 (file)
index 0068800..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-                base: 17.34
diff --git a/tests/config/fail/type-int/base-invalid.yaml b/tests/config/fail/type-int/base-invalid.yaml
deleted file mode 100644 (file)
index 01c097c..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 32
-                base: inval
diff --git a/tests/config/fail/type-int/bo-invalid-type.yaml b/tests/config/fail/type-int/bo-invalid-type.yaml
deleted file mode 100644 (file)
index d54727b..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                byte-order: 17.34
diff --git a/tests/config/fail/type-int/bo-invalid.yaml b/tests/config/fail/type-int/bo-invalid.yaml
deleted file mode 100644 (file)
index fd6945c..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 32
-                byte-order: ze
diff --git a/tests/config/fail/type-int/fail.bats b/tests/config/fail/type-int/fail.bats
deleted file mode 100644 (file)
index 4e1d637..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/usr/bin/env bats
-
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-load ../../common
-
-@test 'unknown property in int type object makes barectf fail' {
-  barectf_config_check_fail unknown-prop.yaml
-}
-
-@test 'no "size" property in int type object makes barectf fail' {
-  barectf_config_check_fail size-no.yaml
-}
-
-@test 'wrong "size" property type in int type object makes barectf fail' {
-  barectf_config_check_fail size-invalid-type.yaml
-}
-
-@test 'invalid "size" property (0) in int type object makes barectf fail' {
-  barectf_config_check_fail size-0.yaml
-}
-
-@test 'invalid "size" property (65) in int type object makes barectf fail' {
-  barectf_config_check_fail size-65.yaml
-}
-
-@test 'wrong "signed" property type in int type object makes barectf fail' {
-  barectf_config_check_fail signed-invalid-type.yaml
-}
-
-@test 'wrong "align" property type in int type object makes barectf fail' {
-  barectf_config_check_fail align-invalid-type.yaml
-}
-
-@test 'invalid "align" property (0) in int type object makes barectf fail' {
-  barectf_config_check_fail align-0.yaml
-}
-
-@test 'invalid "align" property (3) in int type object makes barectf fail' {
-  barectf_config_check_fail align-3.yaml
-}
-
-@test 'wrong "base" property type in int type object makes barectf fail' {
-  barectf_config_check_fail base-invalid-type.yaml
-}
-
-@test 'invalid "base" property in int type object makes barectf fail' {
-  barectf_config_check_fail base-invalid.yaml
-}
-
-@test 'wrong "byte-order" property type in int type object makes barectf fail' {
-  barectf_config_check_fail bo-invalid-type.yaml
-}
-
-@test 'invalid "byte-order" property in int type object makes barectf fail' {
-  barectf_config_check_fail bo-invalid.yaml
-}
-
-@test 'wrong "property-mappings" property type in int type object makes barectf fail' {
-  barectf_config_check_fail pm-invalid-type.yaml
-}
-
-@test 'invalid "property-mappings" property in int type object makes barectf fail' {
-  barectf_config_check_fail pm-unknown-clock.yaml
-}
-
-@test 'invalid "property-mappings" property (invalid "type" property) in int type object makes barectf fail' {
-  barectf_config_check_fail pm-type-invalid.yaml
-}
-
-@test 'invalid "property-mappings" property (invalid "property" property) in int type object makes barectf fail' {
-  barectf_config_check_fail pm-property-invalid.yaml
-}
diff --git a/tests/config/fail/type-int/pm-invalid-type.yaml b/tests/config/fail/type-int/pm-invalid-type.yaml
deleted file mode 100644 (file)
index 676145a..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                property-mappings: hello
diff --git a/tests/config/fail/type-int/pm-property-invalid.yaml b/tests/config/fail/type-int/pm-property-invalid.yaml
deleted file mode 100644 (file)
index edd828b..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  clocks:
-    my_clock: {}
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-                property-mappings:
-                  - type: clock
-                    name: my_clock
-                    property: type
diff --git a/tests/config/fail/type-int/pm-type-invalid.yaml b/tests/config/fail/type-int/pm-type-invalid.yaml
deleted file mode 100644 (file)
index 3eda6f8..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  clocks:
-    my_clock: {}
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-                property-mappings:
-                  - type: stream
-                    name: zala
-                    property: value
diff --git a/tests/config/fail/type-int/pm-unknown-clock.yaml b/tests/config/fail/type-int/pm-unknown-clock.yaml
deleted file mode 100644 (file)
index 961c645..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  clocks:
-    my_clock: {}
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-                property-mappings:
-                  - type: clock
-                    name: zala
-                    property: value
diff --git a/tests/config/fail/type-int/signed-invalid-type.yaml b/tests/config/fail/type-int/signed-invalid-type.yaml
deleted file mode 100644 (file)
index 0877653..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                signed: string
diff --git a/tests/config/fail/type-int/size-0.yaml b/tests/config/fail/type-int/size-0.yaml
deleted file mode 100644 (file)
index b1e1da2..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 0
diff --git a/tests/config/fail/type-int/size-65.yaml b/tests/config/fail/type-int/size-65.yaml
deleted file mode 100644 (file)
index b8bbf41..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 65
-                align: 8
diff --git a/tests/config/fail/type-int/size-invalid-type.yaml b/tests/config/fail/type-int/size-invalid-type.yaml
deleted file mode 100644 (file)
index ebe09ec..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: string
diff --git a/tests/config/fail/type-int/size-no.yaml b/tests/config/fail/type-int/size-no.yaml
deleted file mode 100644 (file)
index a44afe4..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
diff --git a/tests/config/fail/type-int/unknown-prop.yaml b/tests/config/fail/type-int/unknown-prop.yaml
deleted file mode 100644 (file)
index f48a297..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-                unknown: false
diff --git a/tests/config/fail/type-string/fail.bats b/tests/config/fail/type-string/fail.bats
deleted file mode 100644 (file)
index 9685685..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env bats
-
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-load ../../common
-
-@test 'unknown property in string type object makes barectf fail' {
-  barectf_config_check_fail unknown-prop.yaml
-}
diff --git a/tests/config/fail/type-string/unknown-prop.yaml b/tests/config/fail/type-string/unknown-prop.yaml
deleted file mode 100644 (file)
index 19443c5..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: string
-                unknown: false
diff --git a/tests/config/fail/type-struct/fail.bats b/tests/config/fail/type-struct/fail.bats
deleted file mode 100644 (file)
index e98ba0f..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/env bats
-
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-load ../../common
-
-@test 'unknown property in struct type object makes barectf fail' {
-  barectf_config_check_fail unknown-prop.yaml
-}
-
-@test 'wrong "fields" property type in struct type object makes barectf fail' {
-  barectf_config_check_fail fields-invalid-type.yaml
-}
-
-@test 'invalid field in "fields" property (invalid C identifier) in struct type object makes barectf fail' {
-  barectf_config_check_fail fields-field-invalid-identifier.yaml
-}
-
-@test 'wrong "min-align" property type in struct type object makes barectf fail' {
-  barectf_config_check_fail ma-invalid-type.yaml
-}
-
-@test 'invalid "min-align" property (0) in struct type object makes barectf fail' {
-  barectf_config_check_fail ma-0.yaml
-}
-
-@test 'invalid "min-align" property (3) in struct type object makes barectf fail' {
-  barectf_config_check_fail ma-3.yaml
-}
diff --git a/tests/config/fail/type-struct/fields-field-invalid-identifier.yaml b/tests/config/fail/type-struct/fields-field-invalid-identifier.yaml
deleted file mode 100644 (file)
index 8403de9..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              'a field':
-                class: int
-                size: 1
diff --git a/tests/config/fail/type-struct/fields-invalid-type.yaml b/tests/config/fail/type-struct/fields-invalid-type.yaml
deleted file mode 100644 (file)
index 73972f3..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields: 23
diff --git a/tests/config/fail/type-struct/ma-0.yaml b/tests/config/fail/type-struct/ma-0.yaml
deleted file mode 100644 (file)
index f84974a..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            min-align: 0
diff --git a/tests/config/fail/type-struct/ma-3.yaml b/tests/config/fail/type-struct/ma-3.yaml
deleted file mode 100644 (file)
index a1af2f7..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            min-align: 3
diff --git a/tests/config/fail/type-struct/ma-invalid-type.yaml b/tests/config/fail/type-struct/ma-invalid-type.yaml
deleted file mode 100644 (file)
index edfd5e9..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            min-align: yes
diff --git a/tests/config/fail/type-struct/unknown-prop.yaml b/tests/config/fail/type-struct/unknown-prop.yaml
deleted file mode 100644 (file)
index f89d813..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            unknown: true
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/type/fail.bats b/tests/config/fail/type/fail.bats
deleted file mode 100644 (file)
index d9002f4..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env bats
-
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-load ../../common
-
-@test 'type inheriting an unknown type alias makes barectf fail' {
-  barectf_config_check_fail inherit-unknown.yaml
-}
-
-@test 'type inheriting a type alias defined after makes barectf fail' {
-  barectf_config_check_fail inherit-forward.yaml
-}
-
-@test 'wrong type property type makes barectf fail' {
-  barectf_config_check_fail invalid-type.yaml
-}
-
-@test 'no "class" property in type object makes barectf fail' {
-  barectf_config_check_fail no-class.yaml
-}
diff --git a/tests/config/fail/type/inherit-forward.yaml b/tests/config/fail/type/inherit-forward.yaml
deleted file mode 100644 (file)
index 241ad64..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      $inherit: meow
-      size: 16
-    meow:
-      class: int
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/type/inherit-unknown.yaml b/tests/config/fail/type/inherit-unknown.yaml
deleted file mode 100644 (file)
index 06aeaea..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      $inherit: unknown
-      size: 16
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/type/invalid-type.yaml b/tests/config/fail/type/invalid-type.yaml
deleted file mode 100644 (file)
index 63208f3..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    an-int: 23
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/fail/type/no-class.yaml b/tests/config/fail/type/no-class.yaml
deleted file mode 100644 (file)
index 2b3a63b..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  trace:
-    byte-order: le
-  streams:
-    my_stream:
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                size: 8
diff --git a/tests/config/fail/yaml/fail.bats b/tests/config/fail/yaml/fail.bats
deleted file mode 100644 (file)
index cd77939..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env bats
-
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-load ../../common
-
-@test 'invalid YAML input makes barectf fail' {
-  barectf_config_check_fail invalid.yaml
-}
diff --git a/tests/config/fail/yaml/invalid.yaml b/tests/config/fail/yaml/invalid.yaml
deleted file mode 100644 (file)
index d3804b9..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  type-aliases:
-    uint16:
-      class: int
-      size: 16
-  trace:
-    byte-order:
-      le: -23
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
diff --git a/tests/config/pass/everything/config.yaml b/tests/config/pass/everything/config.yaml
deleted file mode 100644 (file)
index eb99189..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.2'
-prefix: bctf_
-options:
-  gen-prefix-def: true
-  gen-default-stream-def: true
-metadata:
-  $include:
-    - inc-metadata.yaml
-    - stdmisc.yaml
-    - lttng-ust-log-levels.yaml
-  type-aliases:
-    my-clock-int:
-      $inherit: uint32
-      property-mappings:
-        - type: clock
-          name: some_clock
-          property: value
-    my-special-int:
-      size: 19
-      base: hex
-  $log-levels:
-    couch: 0755
-  trace:
-    $include: inc-trace.yaml
-    byte-order: be
-  clocks:
-    some_clock:
-      $include: inc-clock.yaml
-      description: this is my favorite clock
-      offset:
-        cycles: 91827439187
-      absolute: null
-  streams:
-    my_stream:
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint16
-          content_size: uint16
-          timestamp_begin: my-clock-int
-          timestamp_end: my-clock-int
-      events:
-        my_event:
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-    my_other_stream:
-      $include: inc-stream.yaml
-      packet-context-type:
-        class: struct
-        fields:
-          packet_size: uint32
-          content_size: uint32
-          events_discarded: uint16
-      event-header-type:
-        class: struct
-        fields:
-          id: uint8
-          timestamp: my-clock-int
-      events:
-        my_event:
-          $include: inc-event.yaml
-          context-type: null
-          payload-type:
-            class: struct
-            fields:
-              my_field:
-                class: int
-                size: 8
-        oh_henry_event:
-          payload-type:
-            class: struct
-            fields:
-              s1: string
-              s2: string
-              s3: string
-              s4: string
diff --git a/tests/config/pass/everything/inc-clock.yaml b/tests/config/pass/everything/inc-clock.yaml
deleted file mode 100644 (file)
index dd6fdec..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-freq: 123456789
-offset:
-  seconds: 18
-absolute: true
-$return-ctype: unsigned long
diff --git a/tests/config/pass/everything/inc-event.yaml b/tests/config/pass/everything/inc-event.yaml
deleted file mode 100644 (file)
index 5c77118..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-log-level: WARNING
-context-type:
-  class: struct
-  fields:
-    fff: float
diff --git a/tests/config/pass/everything/inc-metadata.yaml b/tests/config/pass/everything/inc-metadata.yaml
deleted file mode 100644 (file)
index 90e56ea..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-$include:
-  - stdint.yaml
-  - stdfloat.yaml
-type-aliases:
-  my-special-int:
-    class: int
-    size: 23
-    align: 2
-  struct32:
-    class: struct
-    min-align: 32
-  def-payload-type:
-    $inherit: struct32
-    fields:
-      haha: float
-      hihi: uint32
-      huhu: uint16
-      hoho: double
-streams:
-  my_other_stream:
-    events:
-      this_event:
-        payload-type:
-          class: struct
-          fields:
-            special: my-special-int
-            more_special:
-              $inherit: my-special-int
-              align: 32
-$log-levels:
-  couch: 23
-  tv: 199
-  thread: 0x28aff
diff --git a/tests/config/pass/everything/inc-stream.yaml b/tests/config/pass/everything/inc-stream.yaml
deleted file mode 100644 (file)
index 56def30..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-event-context-type:
-  class: struct
-  fields:
-    i: int32
-    f: float
-    d: double
-    s: string
-    m: ctf-magic
-events:
-  evev:
-    payload-type: def-payload-type
-  context_no_payload:
-    context-type:
-      class: struct
-      fields:
-        str: string
-  no_context_no_payload: {}
diff --git a/tests/config/pass/everything/inc-trace.yaml b/tests/config/pass/everything/inc-trace.yaml
deleted file mode 100644 (file)
index d771be8..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-$include: trace-basic.yaml
-packet-header-type:
-  fields:
-    soy_sauce: uint64
diff --git a/tests/config/pass/everything/pass.bats b/tests/config/pass/everything/pass.bats
deleted file mode 100644 (file)
index 4330bb6..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/env bats
-
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-load ../../common
-
-@test 'config file using all features makes barectf pass' {
-  barectf_config_check_success config.yaml
-  pushd "$BATS_TEST_DIRNAME" >/dev/null
-  [ -f metadata ]
-  [ -f bctf.c ]
-  [ -f bctf.h ]
-  [ -f bctf-bitfield.h ]
-
-  # test should be more extensive than that, but it's a start
-  "$CC" -c bctf.c
-  nm bctf.o | grep bctf_init
-  nm bctf.o | grep bctf_my_other_stream_close_packet
-  nm bctf.o | grep bctf_my_other_stream_open_packet
-  nm bctf.o | grep bctf_my_other_stream_trace_context_no_payload
-  nm bctf.o | grep bctf_my_other_stream_trace_evev
-  nm bctf.o | grep bctf_my_other_stream_trace_my_event
-  nm bctf.o | grep bctf_my_other_stream_trace_no_context_no_payload
-  nm bctf.o | grep bctf_my_other_stream_trace_oh_henry_event
-  nm bctf.o | grep bctf_my_other_stream_trace_this_event
-  nm bctf.o | grep bctf_my_stream_close_packet
-  nm bctf.o | grep bctf_my_stream_open_packet
-  nm bctf.o | grep bctf_my_stream_trace_my_event
-  nm bctf.o | grep bctf_packet_buf
-  nm bctf.o | grep bctf_packet_buf_size
-  nm bctf.o | grep bctf_packet_events_discarded
-  nm bctf.o | grep bctf_packet_is_empty
-  nm bctf.o | grep bctf_packet_is_full
-  nm bctf.o | grep bctf_packet_is_open
-  nm bctf.o | grep bctf_packet_set_buf
-  nm bctf.o | grep bctf_packet_size
-  popd
-}
index aabce21c2d57d3761ef60cebceb64db7fa78b9cd..509f5e1d8547bbb14766a5e7aa3bb025a3f7246b 100755 (executable)
 # THE SOFTWARE.
 
 test_dirs=(
-  "config/fail/clock"
-  "config/fail/config"
-  "config/fail/event"
-  "config/fail/include"
-  "config/fail/metadata"
-  "config/fail/stream"
-  "config/fail/trace"
-  "config/fail/type"
-  "config/fail/type-enum"
-  "config/fail/type-float"
-  "config/fail/type-int"
-  "config/fail/type-string"
-  "config/fail/type-struct"
-  "config/fail/yaml"
-  "config/pass/everything"
+  "config/2/fail/clock"
+  "config/2/fail/config"
+  "config/2/fail/event"
+  "config/2/fail/include"
+  "config/2/fail/metadata"
+  "config/2/fail/stream"
+  "config/2/fail/trace"
+  "config/2/fail/type"
+  "config/2/fail/type-enum"
+  "config/2/fail/type-float"
+  "config/2/fail/type-int"
+  "config/2/fail/type-string"
+  "config/2/fail/type-struct"
+  "config/2/fail/yaml"
+  "config/2/pass/everything"
 )
 bats_bin="$(pwd)/bats/bin/bats"
 
This page took 0.461365 seconds and 4 git commands to generate.