Fix: bt_ctfser_write_float64(): use `double` in union, not `float`
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 5 Jul 2019 22:28:56 +0000 (18:28 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 18 Jul 2019 15:53:34 +0000 (11:53 -0400)
commite19f607d1343411622dea16eddfac3dafd413473
treefe6e1ce87360db1d253afcdeda527ca2f1425749
parent1ec8b5b54448c9cdeb430463a81ea0242d280ebf
Fix: bt_ctfser_write_float64(): use `double` in union, not `float`

This bug made both CTF writer and `sink.ctf.fs` write wrong 64-bit
floating point fields.

This patch also adds two `sink.ctf.fs` tests to catch this. Both tests
run a CTF generator which uses CTF writer, then run

    babeltrace2 /path/to/generated/trace -o ctf -w /path/to/converted/trace

and then pass the converted trace into a `sink.text.details` sink to
verify that the content is expected.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: If69ee9a0e1d4038dd28a72860ecc11f18bb6b50e
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1645
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
12 files changed:
.gitignore
configure.ac
src/ctfser/ctfser.h
tests/Makefile.am
tests/data/plugins/sink.ctf.fs/succeed/trace-double.expect [new file with mode: 0644]
tests/data/plugins/sink.ctf.fs/succeed/trace-float.expect [new file with mode: 0644]
tests/plugins/Makefile.am
tests/plugins/sink.ctf.fs/Makefile.am [new file with mode: 0644]
tests/plugins/sink.ctf.fs/succeed/Makefile.am [new file with mode: 0644]
tests/plugins/sink.ctf.fs/succeed/gen-trace-double.c [new file with mode: 0644]
tests/plugins/sink.ctf.fs/succeed/gen-trace-float.c [new file with mode: 0644]
tests/plugins/sink.ctf.fs/succeed/test_succeed [new file with mode: 0755]
This page took 0.024848 seconds and 4 git commands to generate.