Philippe Proulx [Tue, 8 Mar 2022 12:48:27 +0000 (07:48 -0500)]
barectf v3.1.0
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I3256dc44f7280489dc521e558828b61105691b55
Philippe Proulx [Tue, 15 Mar 2022 00:09:59 +0000 (20:09 -0400)]
pyproject.toml: require Jinja2 3.0+
This removes Jinja2 deprecation warnings at testing time (about
MarkupSafe).
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I5652c21dc624a64d9aaee5c0b0f64744150562d9
Jon Lamb [Fri, 4 Mar 2022 15:19:12 +0000 (07:19 -0800)]
barectf: add support for packet sequence number
Adds a new optional packet features object `sequence-number-field-type`,
which generates the metadata field type name `packet_seq_num` when
defined (defaults to false).
Currently this is conditionally maintained in `struct barectf_ctx` as a
`uint32_t` type like `events_discarded`.
In the future this could be improved to use the config type defined by
the stream in `struct barectf_default_ctx` so that the types are
aligned.
[Philippe Proulx: add documentation to Jon's patch.]
Refs: https://github.com/efficios/barectf/pull/24
Closes: https://github.com/efficios/barectf/issues/23
Signed-off-by: Jon Lamb <jon@auxon.io>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ibfa9e4ab73a7c338e41377aae01d498dee62086b
Philippe Proulx [Tue, 8 Mar 2022 04:22:56 +0000 (23:22 -0500)]
poetry.lock: update
This is needed to support Mypy on Python 3.10 as it uses
`typing_extensions` instead of `typed_ast` for Python ≥ 3.9 (`typed_ast`
seems broken on Python 3.10.2).
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Michael Jeanson [Fri, 1 Oct 2021 15:49:23 +0000 (11:49 -0400)]
Use poetry-core build system
This allows building the project on a system without installing the full
poetry tooling and all its dependencies but only the minimal poetry-core
package while maintaining the current workflow for developers.
Introduced in poetry '1.1.0'.
Change-Id: I5be7e8d962f385cabb583666aeda8543f592ba66
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Philippe Proulx [Fri, 22 Jan 2021 17:03:20 +0000 (12:03 -0500)]
docs: yaml: dyn-array-ft-obj.adoc: fix wrong static array FT copy
Reported-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Tue, 6 Oct 2020 18:20:12 +0000 (14:20 -0400)]
Fix: barectf_packet_set_buf(): keep full packet state
The condition of barectf_packet_is_full() is:
ctx->at == ctx->packet_size
So we're reusing `ctx->at` to know whether or not a packet is full.
A full packet is always (already) closed.
The problem is that barectf_packet_set_buf() changes `ctx->packet_size`
without touching `ctx->at`. Therefore if the value of `ctx->packet_size`
changes, and if the packet was considered to be full, it's not the case
anymore, but it must be.
In barectf_packet_set_buf(), set `ctx->at` to `ctx->packet_size` if it
was already the case to keep any full packet state.
Adding a test with a custom platform calling barectf_packet_set_buf()
with a `NULL` buffer after closing a completely full packet. Without
this patch (in `barectf.c.j2`), this test leads to a segmentation fault.
Fixes: https://github.com/efficios/barectf/issues/18
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Tue, 29 Sep 2020 01:38:55 +0000 (21:38 -0400)]
docs: {dst,trace-type}-obj.adoc: specify "default FT", not just "true"
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Tue, 29 Sep 2020 01:11:28 +0000 (21:11 -0400)]
docs: build: index.adoc: add custom `stdint.h` example
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Tue, 29 Sep 2020 01:10:49 +0000 (21:10 -0400)]
docs: platform: api.adoc: fix mistake
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Fri, 25 Sep 2020 19:29:18 +0000 (15:29 -0400)]
Prepare for barectf v3.1.0
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 14:36:26 +0000 (10:36 -0400)]
barectf v3.0.0
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Fri, 25 Sep 2020 18:48:31 +0000 (14:48 -0400)]
docs: how-barectf-works: update CTF trace structure images
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Fri, 25 Sep 2020 14:15:57 +0000 (10:15 -0400)]
test_pass_everything.py: check two new symbols
ed4a69c ("barectf.h.j2: add barectf_discarded_event_records_count()")
and
3bf37cb ("barectf.h.j2: add barectf_packet_buf_addr()") introduced
new API symbols to check here.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Fri, 25 Sep 2020 14:15:39 +0000 (10:15 -0400)]
test_pass_everything.py: use `cc` by default (like Make), not `gcc`
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Fri, 25 Sep 2020 14:15:25 +0000 (10:15 -0400)]
test_pass_everything.py: reformat
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Fri, 25 Sep 2020 14:03:52 +0000 (10:03 -0400)]
docs: whats-new.adoc: use headings for main topics
This is more readable than a single long list.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Fri, 25 Sep 2020 14:02:02 +0000 (10:02 -0400)]
docs: cli: usage.adoc: improve page
Changes:
* Add link to <https://git-scm.com/>.
* Use the third person for the command descriptions in the
General description section.
* Add and fix many internal links.
* Specify that `PREFIX` must be a valid C identifier.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Fri, 25 Sep 2020 02:02:45 +0000 (22:02 -0400)]
tests/tracing/conftest.py: add valid `basic-extra-pc-ft-members` cat.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Fri, 25 Sep 2020 00:12:17 +0000 (20:12 -0400)]
tests/tracing: add DST extra packet context FT members test
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Fri, 25 Sep 2020 00:00:25 +0000 (20:00 -0400)]
tests/tracing: add event record type tests
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 23:54:07 +0000 (19:54 -0400)]
tests/tracing: add data stream type tests
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 23:36:22 +0000 (19:36 -0400)]
tests/tracing/support/basic/test-platform.h: `ctx` -> `platform_ctx`
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 23:35:55 +0000 (19:35 -0400)]
tests/tracing: add data stream type event record feature tests
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 23:31:42 +0000 (19:31 -0400)]
tests/tracing: add data stream type packet feature tests
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 23:28:43 +0000 (19:28 -0400)]
tests/tracing: `int main()` -> `int main(void)`
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 23:15:59 +0000 (19:15 -0400)]
tests/tracing: add trace type feature tests
This patch adds a new tracing test category named `counter-clock`.
This is because the `counter-clock` platform (in
`tests/tracing/support/counter-clock`) has a data stream clock which is
a simpler counter starting at 0.
The platform's base YAML trace type object,
`tests/tracing/support/counter-clock/base.yaml`, specifies a single
event record type `dummy` so that test-specific configurations which do
not need event record types are lighter.
The C files in `tests/tracing/src/counter-clock/trace-type-features`
do not call any tracing function: they only initialize and finalize
the test platform, which effectively opens and closes a single packet.
In the new `test-platform.c` file, test_platform_fini() closes the
current packet whether or not it's empty.
`tests/tracing/support/counter-clock/base-no-features.yaml` is a YAML
trace type object file which disables all the trace type and data stream
type features except the data stream type ID and event record type ID
features.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 23:13:43 +0000 (19:13 -0400)]
tests: reflow licence headers for 72 columns
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 21:45:21 +0000 (17:45 -0400)]
Fix: schemas/config/3/config.yaml: allow `uuid-field-type` to be `true`
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 21:44:41 +0000 (17:44 -0400)]
barectf/schemas/config/3/config.yaml: `True` -> `true`
It works, but this is not Python.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 21:28:15 +0000 (17:28 -0400)]
barectf.c.j2: only declare `ts` variable when needed
This patch changes the `barectf.c.j2` template so that, for the
packet opening, packet closing, and event record header serialization
functions, the `ts` variable is only declared when it's used.
Without this patch, the C compiler can report such a warning:
warning: unused variable ‘ts’ [-Wunused-variable]
In `barectf.c-macros.j2`, the open_close_func_preamble() macro is
changed to accept the timestamp packet feature in order to check either
the packet beginning or end timestamp field type feature.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 20:35:48 +0000 (16:35 -0400)]
tests/tracing: use test categories
This patch renames all `succeed` directories under `tests/tracing`
to `basic`. All tracing tests must succeed anyway.
In `basic/dynamic-array/of-double.yaml`:
* `basic` is the category.
* `dynamic-array` is the subcategory.
* `of-double.yaml` is the test file.
Support files are now per category: `tests/tracing/support` is moved
to `tests/tracing/support/basic`.
This makes it possible to add tracing test categories which have their
own platform and base YAML trace type object.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 20:01:25 +0000 (16:01 -0400)]
barectf: add pre-release version information (`barectf.__pre_version__`)
This makes it possible to make a `-dev` or `-pre` version for example.
`barectf.__version__` contains the pre-release information.
The generated metadata stream gets a new `tracer_pre` environment entry
set to this value (empty string as of this patch).
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 18:13:08 +0000 (14:13 -0400)]
tests/tracing: add basic structure data field tests
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 17:55:58 +0000 (13:55 -0400)]
tests/tracing: add data stream test (two packets)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 17:47:51 +0000 (13:47 -0400)]
tests/tracing: add basic int., enum., real, and string data field tests
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 17:46:47 +0000 (13:46 -0400)]
configs/succeed/**/*.yaml: remove useless YAML document end
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 17:33:51 +0000 (13:33 -0400)]
docs: yaml: put static/dynamic array FT obj. C types example in partial
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 17:31:33 +0000 (13:31 -0400)]
docs: {static,dyn}-array-ft-obj.adoc: use example block
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 17:23:34 +0000 (13:23 -0400)]
Fix: YAML: force enumeration FT objects to have at least one mapping
As per CTF 1.8.3:
> Enumerations need to contain at least one entry.
Before this patch, ythose were legal:
class: uenum
size: 8
class: uenum
size: 8
mappings: {}
class: uenum
size: 8
mappings:
A: []
CTF consumers would not like the resulting metadata stream. For
example, Babeltrace 2.1.0-rc1 [
v1.2.0-3520-g73f74ae1f]:
09-24 13:26:41.740 80492 80492 E PLUGIN/CTF/META/PARSER yyerror@parser.y:925 At line 109 in metadata stream: syntax error, unexpected CTF_RBRAC: token="}"
09-24 13:26:41.740 80492 80492 E PLUGIN/CTF/META/DECODER ctf_metadata_decoder_append_content@decoder.c:280 [N/A] Cannot create the metadata AST out of the metadata text: mdec-addr=0x559dd9546a10
09-24 13:26:41.740 80492 80492 W PLUGIN/SRC.CTF.FS/QUERY support_info_query@query.c:459 cannot append metadata content: metadata-decoder-status=-2
09-24 13:26:41.741 80492 80492 W LIB/QUERY-EXECUTOR bt_query_executor_query@query-executor.c:231 Component class's "query" method failed: query-exec-addr=0x559dd9548070, cc-addr=0x559dd95233e0, cc-type=SOURCE, cc-name="fs", cc-partial-descr="Read CTF traces from the file sy", cc-is-frozen=0, cc-so-handle-addr=0x559dd9522770, cc-so-handle-path="lib/babeltrace2/plugins/babeltrace-plugin-ctf.so", object="babeltrace.support-info", params-addr=0x559dd9545f10, params-type=MAP, params-element-count=2, log-level=WARNING
09-24 13:26:41.741 80492 80492 E CLI-CFG-SRC-AUTO-DISC support_info_query_all_sources@autodisc.c:493 babeltrace.support-info query failed.
09-24 13:26:41.741 80492 80492 E CLI main@babeltrace2.c:2644 Command-line error: retcode=1
ERROR: [Babeltrace CLI] (babeltrace2.c:2644)
Command-line error: retcode=1
CAUSED BY [Source auto-discovery] (autodisc.c:493)
babeltrace.support-info query failed.
CAUSED BY [libbabeltrace2] (query-executor.c:231)
Component class's "query" method failed: query-exec-addr=0x559dd9548070, cc-addr=0x559dd95233e0, cc-type=SOURCE, cc-name="fs", cc-partial-descr="Read CTF traces from
the file sy", cc-is-frozen=0, cc-so-handle-addr=0x559dd9522770, cc-so-handle-path="babeltrace2/plugins/babeltrace-plugin-ctf.so",
object="babeltrace.support-info", params-addr=0x559dd9545f10, params-type=MAP, params-element-count=2, log-level=WARNING
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 16:11:08 +0000 (12:11 -0400)]
barectf/templates: use `loop.last` instead of hack in `barectf/cgen.py`
This patch removes the raw text replacement at the end of
_CodeGen.gen_src() (`barectf/cgen.py`).
Instead, to avoid empty lines before `}`, Jinja 2 templates only
output an empty line it's not the loop's last iteration:
{% if not loop.last %}{{ '\n' }}{% endif %}
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 16:09:28 +0000 (12:09 -0400)]
test-platform.h: do not include `barectf.h`: forward-declare context
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 15:41:40 +0000 (11:41 -0400)]
YAML files: remove empty line after `%YAML 1.2` directive
It's more common not to have one. At least the specification's
examples [1] do not have any.
[1]: https://yaml.org/spec/1.2/spec.html
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 15:33:07 +0000 (11:33 -0400)]
tests/tracing: use a base trace type YAML file
This patch adds `tests/tracing/support/base.yaml` as a base YAML trace
type object for test configuration files to include.
`tests/tracing/conftest.py` is changed to add `tests/tracing/support` to
the barectf inclusion search directories and to only consider YAML files
in `tests/tracing/configs/succeed` (`tests/tracing/support/base.yaml` is
not a test).
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 14:14:35 +0000 (10:14 -0400)]
docs: example.adoc: use file names as heading titles
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 13:59:23 +0000 (09:59 -0400)]
modules/platform/pages/example.adoc: add a list of other examples
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 14:02:20 +0000 (10:02 -0400)]
docs: add missing `build` module
This was not added because the root `.gitignore` file contained `build/`
(fixed by
4dd70d0 (".gitignore: simplify")).
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 14:08:37 +0000 (10:08 -0400)]
.gitignore: simplify
This patch removes lines from the root `.gitignore` file which were
useless for the barectf project.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 11:32:13 +0000 (07:32 -0400)]
test-platform.c: write_packet(): use `const size_t`
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 11:19:04 +0000 (07:19 -0400)]
docs/modules/ROOT/pages/index.adoc: add internal links
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 00:01:30 +0000 (20:01 -0400)]
Document barectf 3
This patch adds the complete documentation of barectf 3 (upcoming major
release of the project).
The new `docs` directory is an Antora [1] documentation component
version. You can include it in an Antora site.
All the pages are written in AsciiDoc (Asciidoctor version).
Some contents were copied (and adapted) from the barectf wiki [2], but
most of the pages feature brand new text. The logo and diagrams are also
refreshed.
I'm removing the `barectf` CLI tool's manual page (`doc/man`) as it's
now documented in `docs/modules/cli/pages/usage.adoc`. Having the CLI
documented within the whole project's documentation makes it possible to
have critical links to and from other parts of it. This is to the
advantage of the reader.
[1]: https://antora.org/
[2]: https://github.com/efficios/barectf/wiki
Philippe Proulx [Thu, 24 Sep 2020 02:45:24 +0000 (22:45 -0400)]
barectf_platform_linux_fs_init(): accept DS file path, not trace dir.
This patch changes the Linux FS platform's
barectf_platform_linux_fs_init() function so that it accepts the data
stream file path instead of its trace directory.
This makes it possible to initialize many Linux FS platform contexts for
the same trace, each one targeting a distinct data stream file.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 02:37:13 +0000 (22:37 -0400)]
barectf-platform-linux-fs.c: write_packet(): use `const size_t`
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 02:36:38 +0000 (22:36 -0400)]
barectf-platform-linux-fs.c: rename missing `ctx` -> `platform_ctx`
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 02:25:23 +0000 (22:25 -0400)]
poetry.lock: update
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 24 Sep 2020 02:24:21 +0000 (22:24 -0400)]
pyproject.toml: update description
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Wed, 23 Sep 2020 23:59:49 +0000 (19:59 -0400)]
barectf/templates/c: name `void *` context parameters `vctx`
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Wed, 23 Sep 2020 22:20:07 +0000 (18:20 -0400)]
barectf.h.j2: add barectf_packet_buf_addr()
barectf_packet_buf_addr() is an alias of barectf_packet_buf().
This is more in line with the barectf_packet_set_buf() function which
sets both the buffer's address and size.
This change helps document the platform API.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Wed, 23 Sep 2020 22:18:08 +0000 (18:18 -0400)]
barectf.h.j2: add barectf_discarded_event_records_count()
barectf_discarded_event_records_count() is an alias of
barectf_packet_events_discarded().
The count of discarded event records is not related to the current
packet; it's a data stream variable.
This change helps document the platform API.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Wed, 23 Sep 2020 22:17:28 +0000 (18:17 -0400)]
barectf.h.j2: rename "clock callbacks" -> "clock source callbacks"
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Wed, 23 Sep 2020 22:17:07 +0000 (18:17 -0400)]
barectf/templates/c: rename "back-end" -> "back end"
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Wed, 23 Sep 2020 14:51:05 +0000 (10:51 -0400)]
Standardize root field type prefixes
This patch changes `cgen.py` and what depends on it so that:
* `_RootFtPrefixes` attribute names always begin with `P` (packet) or
`ER` (event record).
* `_RootFtPrefixes` attribute values for event record prefixes do not
begin with `er`.
The C source context where this is used indicates that it's an event
record field, so `er` is redundant.
This also makes the documentation easier to understand.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Mon, 21 Sep 2020 23:29:14 +0000 (19:29 -0400)]
Add missing `serialize-write-timestamp-statements.j2` file
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Mon, 21 Sep 2020 23:26:49 +0000 (19:26 -0400)]
Enable discarded event records snapshot FT DST feature by default
This patch changes `config.py` (API) and the v3 YAML parser to make
the discarded event records snapshot field type (data stream type)
feature enabled by default.
This feature is nice to have, only adds an integer field to each packet,
and doesn't require anything from the user.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Mon, 21 Sep 2020 21:04:36 +0000 (17:04 -0400)]
Rename "time" -> "timestamp" (terminology)
This patch renames the "time" concept to "timestamp" throughout.
The term "timestamp" is better to describe what used to be named "time",
for example a packet's beginning and end timestamps, and an event
record's timestamp.
"Time" has many definitions, one of which is duration, whereas the
only definition of "timestamp" in Antidote 10 is:
> a printed or stamped mark indicating a time or date of an event
which is pretty accurate.
Which is also why the timestamp members are named `timestamp_begin`,
`timestamp_end`, and `timestamp` in CTF 1.8.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Fri, 18 Sep 2020 19:32:20 +0000 (15:32 -0400)]
Rename "target byte order" -> "native byte order"
Going back to the CTF terminology.
From the trace type's perspective, I believe this term is better. I
think it's also easier to understand when reading the documentation.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Fri, 18 Sep 2020 19:27:12 +0000 (15:27 -0400)]
config.py: move target byte order property from config. to trace type
This property is part of the trace type, as it's related to the byte
order of bit array field types which are all part of the trace type.
Also it's a CTF concept, not a barectf concept.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Fri, 18 Sep 2020 17:01:11 +0000 (13:01 -0400)]
poetry.lock: update
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Fri, 18 Sep 2020 17:00:44 +0000 (13:00 -0400)]
.gitignore: ignore generated HTML READMEs
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Fri, 18 Sep 2020 16:56:41 +0000 (12:56 -0400)]
Use YAML 1.2 throughout
The `yes` and `no` boolean values do not exist in YAML 1.2 [1].
Change all of them for `true` and `false`.
Also, in `tests/tracing/configs` and in
`examples/linux-fs-simple/config.yaml`, add the explicit `%YAML 1.2`
directive to indicate that it's a YAML 1.2 document.
[1]: https://yaml.org/spec/1.2/spec.html#id2805071
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 17 Sep 2020 14:42:10 +0000 (10:42 -0400)]
Remove `CHANGELOG.md`
This is the change log of barectf 2.
For barectf 3, the change log will be part of the documentation.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 17 Sep 2020 13:13:18 +0000 (09:13 -0400)]
barectf-tracepoint.h: improve quality
Changes:
* Reflow header comment to fit 72 columns.
* Capitalize comments.
* Use updated `barectf.h` definition names (`_BARECTF_IDENTIFIER_PREFIX`
and `_BARECTF_DEFAULT_DATA_STREAM_TYPE_NAME`).
* Check for `BARECTF_TRACEPOINT_DATA_STREAM_TYPE_NAME` as an alternative
to `BARECTF_TRACEPOINT_STREAM` (for consistency).
* Rework error messages.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 17 Sep 2020 13:12:06 +0000 (09:12 -0400)]
barectf.h.j2: use more accurate definition names
Leaving the old definitions to avoid breaking anything.
The updated names are:
`_BARECTF_PREFIX`:
`_BARECTF_IDENTIFIER_PREFIX`
`_BARECTF_DEFAULT_STREAM`:
`_BARECTF_DEFAULT_DATA_STREAM_TYPE_NAME`
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 17 Sep 2020 04:09:02 +0000 (00:09 -0400)]
examples/linux-fs-simple: use `trace` as trace directory, not `ctf`
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 17 Sep 2020 04:05:44 +0000 (00:05 -0400)]
examples/linux-fs-simple: convert README to Asciidoctor and improve it
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 17 Sep 2020 03:59:58 +0000 (23:59 -0400)]
linux-fs-simple/config.yaml: convert to v3 format
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 17 Sep 2020 03:58:27 +0000 (23:58 -0400)]
linux-fs-simple.c: improve quality
Changes:
* Remove unneeded included headers.
* Remove unneeded TO_VOID_PTR() macro.
* Use `const` where possible.
* Use single return points.
* Capitalize comments.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 17 Sep 2020 03:57:22 +0000 (23:57 -0400)]
linux-fs-simple/Makefile: remove nonexistent `view` from `.PHONY`
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 17 Sep 2020 01:19:39 +0000 (21:19 -0400)]
barectf-platform-linux-fs.c: improve quality
Changes:
* Remove unneeded included headers.
* Remove unneeded TO_VOID_PTR() macro.
* Use `const` where possible.
* Use single return points.
* Rename platform context variables to `platform_ctx`.
* Capitalize comments.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 17 Sep 2020 01:08:36 +0000 (21:08 -0400)]
barectf-platform-linux-fs.*: remove header titles
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 17 Sep 2020 01:05:32 +0000 (21:05 -0400)]
examples/linux-fs-simple, platforms/linux-fs: use double quotes to include
#include "barectf.h"
is more permissive than
#include <barectf.h>
You don't need to add `-I.` to search the same directory.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 17 Sep 2020 01:00:44 +0000 (21:00 -0400)]
barectf-platform-linux-fs.*: update copyright years
Also reflow the license headers to fit 72 columns.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 17 Sep 2020 01:00:12 +0000 (21:00 -0400)]
barectf-platform-linux-fs.h: remove function documentation
This is now in the local `README.adoc` file.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 17 Sep 2020 00:57:52 +0000 (20:57 -0400)]
barectf-platform-linux-fs.c: use `CLOCK_REALTIME`
Although this clock source can go back, the result is more friendly than
using `CLOCK_MONOTONIC` and having to set the clock type's offset
manually or getting invalid event record times.
I believe this is acceptable considering the demonstration purpose of
this platform.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 17 Sep 2020 00:57:16 +0000 (20:57 -0400)]
platforms/linux-fs: remove `README.md`, write a better `README.adoc`
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 17 Sep 2020 00:09:49 +0000 (20:09 -0400)]
Move `doc/examples` to `examples`
I'm planning to remove the `doc` directory, writing the documentation
within the `docs` directory.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 17 Sep 2020 00:05:49 +0000 (20:05 -0400)]
Remove Parallella platform and examples
It's very hard to test and to integrate in a CI.
Also, the Epiphany repositories are not updated since 3-4 years [1].
[1]: https://github.com/adapteva
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Wed, 16 Sep 2020 23:36:59 +0000 (19:36 -0400)]
Rename "event type" -> "event record type", "stream type" -> "data stream type"
This matches an eventual CTF 2 terminology and makes writing the barectf
documentation easier, as a data stream type describes data streams and
an event record type describes event records. An event record is what
the tracer records for an occurring event.
Throughout the code, for names, variables, and file names:
* `dst` means "data stream type".
* `ds` means "data stream".
* `ert` means "event record type".
* `er` means "event record".
The v3 YAML schemas are modified accordingly.
This patch also renames "discarded events counter" to "discarded event
records counter snapshot", as this field is a snapshot of the per-data
stream counter.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 10 Sep 2020 21:32:50 +0000 (17:32 -0400)]
Add dynamic array tracing tests
The new tests are modified copies of static array tracing tests as a
dynamic array field can contain the same fields as a static array field.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 10 Sep 2020 20:54:58 +0000 (16:54 -0400)]
Removed unused `tests/conftest.py`
Used to contain the yaml_cfg_path() fixture; not needed anymore since
b1c5cbc ("tests/config/yaml: use pytest_collect_file() hook for YAML
files") and
816fefd ("tests/tracing: use pytest_collect_file() hook for
YAML files").
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 10 Sep 2020 19:01:56 +0000 (15:01 -0400)]
tests/tracing/support/test-platform.c: clear buffer at every packet opening
This ensures that there's no garbage data left in the buffer between
packets.
It's not triggering any failure currently because all the tests in
`tests/tracing` produce a single packet.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 10 Sep 2020 19:01:36 +0000 (15:01 -0400)]
tracing/src/succeed/static-array: update copyright notice's year
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 10 Sep 2020 18:58:14 +0000 (14:58 -0400)]
src/succeed/static-array: add missing `const` qualifiers
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 10 Sep 2020 18:41:12 +0000 (14:41 -0400)]
tests/tracing: use pytest_collect_file() hook for YAML files
This patch applies the same strategy as
b1c5cbc ("tests/config/yaml: use
pytest_collect_file() hook for YAML files") to `tests/tracing`.
This patch changes `tests/tracing/conftest.py` so that it implements a
pytest_collect_file() Pytest hook to create Pytest file and item objects
for each barectf YAML configuration file found in the `configs`
directory. Thanks to the base name of this YAML file,
pytest_collect_file() automatically finds the corresponding
test-specific C source and expectation files.
This makes is possible to remove `test_succeed_static_array.py` and
avoid duplication and mismatches between existing YAML files and
available test functions.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 10 Sep 2020 04:06:41 +0000 (00:06 -0400)]
tests/config/yaml: use pytest_collect_file() hook for YAML files
This patch changes `tests/config/yaml/conftest.py` so that it implements
a pytest_collect_file() Pytest hook to create Pytest file and item
objects for each failing barectf YAML configuration file found.
This makes is possible to remove all `test_fail_*.py` files and avoid
duplication and mismatches between existing YAML files and available
test functions.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 10 Sep 2020 01:36:54 +0000 (21:36 -0400)]
config.py, tsdl182gen.py: fix Mypy/Pylint errors
Philippe Proulx [Wed, 9 Sep 2020 23:35:11 +0000 (19:35 -0400)]
Add static array tracing tests
This patch adds static array tracing tests, also adding the testing
infrastructure for other such tests.
In `tests/tracing`, the test functions of `test_succeed_static_array.py`
use the tracing_succeed_test() fixture as found in
`tests/tracing/conftest.py`.
tracing_succeed_test() does the following:
1. Creates a temporary directory with the tmpdir() fixture.
2. Automatically finds the paths, based on the test's module and
function names, of:
* A YAML configuration file.
* A test-specific C source file.
* Two expectation files (one for the metadata stream and one for the
data stream).
3. Creates a barectf configuration from the YAML file found in 2.
4. Generates the C code files using the barectf configuration of 3.,
writing the files to the temporary directory of 1.
5. Generates the metadata stream using the barectf configuration of 3.,
stripping some variable version and generation date lines.
This step does not write any file to the file system.
6. Copies the files in the `tests/tracing/support` directory to the
temporary directory of 1.
`test-platform.c` and `test-platform.h` form the barectf platform
for all the tracing tests.
7. Copies the test-specific C source file found in 2. as `test.c` to
the temporary directory of 1.
8. Executes `make` in the temporary directory of 1.
9. Executes `./test` in the temporary directory of 1.
10. Reads the produced data stream file (`stream` in the temporary
directory of 1.) and compares it with the data stream expectation
file found in 2.
11. Compares the metadata stream contents of 5. with the metadata stream
expectation file found in 2.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Wed, 9 Sep 2020 22:02:17 +0000 (18:02 -0400)]
Simplify current tests
This patch:
* Adds the global yaml_cfg_path() fixture which returns the path to an
hypothetical barectf YAML configuration file based on the test's
module file and function names.
* Updates the config_fail_test() fixture to only use yaml_cfg_path()
* Updates all the test functions to only use config_fail_test() and call
it without parameters.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 10 Sep 2020 01:14:22 +0000 (21:14 -0400)]
Fix: include/3/stdreal.yaml: `align` -> `alignment`
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Wed, 9 Sep 2020 20:50:51 +0000 (16:50 -0400)]
Add user dynamic array field support
This patch adds support for user dynamic array fields.
The element field type of a user dynamic array field type can be any of
the following:
* Bit array field type.
* String field type.
* Static array field type.
Note that it _cannot_ be another dynamic array field type.
The new `barectf.DynamicArrayFieldType` represents a dynamic array field
type. Its constructor accepts a length field type. As of this version,
this length field type must be within the same immediate structure field
type and before it.
The YAML ways to specify a dynamic array field type are:
barectf 2 configuration:
class: array
length: dynamic
element-type:
...
barectf 3 configuration:
class: dynamic-array
element-field-type:
...
Note that in YAML, you don't specify the length field type: the parser
automatically creates a 32-bit, byte-aligned unsigned integer field type
before which, for a dynamic array field type named `a`, has the name
`__a_len`. This also becomes part of the corresponding tracing function
parameter's name.
In the future, I can add a `length-field-type` property to a barectf 3
YAML dynamic array field type to point to an anterior unsigned integer
field type using some kind of reference, for example:
class: structure
members:
- my_length: uint16
- my_array:
field-type:
class: dynamic-array
length-field-type-name: my_length
element-field-type:
...
This would make it possible for more than one dynamic array fields
to use the same length field, for example:
class: structure
members:
- my_length: uint16
- my_uint_array:
field-type:
class: dynamic-array
length-field-type-name: my_length
element-field-type: uint8
- my_string_array:
field-type:
class: dynamic-array
length-field-type-name: my_length
element-field-type: string
The constructor of `barectf.StructureFieldType` calls
_set_dyn_array_ft_length_ft_member_names() which, for each member having
a dynamic array field type:
* Sets its `_length_ft_member_name` attribute to the name of the
structure field type member having its length field type.
* Sets its length field type's `_is_len` attribute to `True`.
I consider those as hacks, but considering the current constraints, it
makes parts of the (barectf) code easier to implement and maintain.
The C code generation approach is similar to the static array field
case. The `*-write-static-array-statements.j2` templates are renamed to
`*-write-array-statements.j2` and use the `length_src` variable as the
loop's length's value. `*-write-static-array-statements.j2` and the new
`*-write-dynamic-array-statements.j2` set `length_src` before including
`*-write-array-statements.j2`.
To make things easier, barectf now systematically generates alignment
statements if the alignment is greater than one. This could be optimized
again in the future, considering arrays this time. The
`_WriteOp.offset_in_byte` optimization still exists, although as soon as
it's not statically known, it's now `None` and
`serialize-write-bit-array-statements.j2` uses the safe, dynamic
`ctx->at % 8` expression. try_create_align_op() does this, more or less:
If `self._offset_in_byte` is not currently known and the requested
alignment is 8:
Set `self._offset_in_byte` to 0.
Else:
If we're currently within an array operation:
Reset `self._offset_in_byte`.
Else:
If `self._offset_in_byte` is currently known:
Align `self._offset_in_byte` with the requested alignment.
This ensures that each array field's element is aligned before being
written.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
This page took 0.043211 seconds and 4 git commands to generate.