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)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 8 Jul 2019 14:46:53 +0000 (10:46 -0400)
commit1fba7c7b9ff8f36fde916dfb2317855549f0eb5b
treeab1e818b665eaaa9b067aeb4608c1dc3e08e300b
parent91f8c1ecde4e08fa53126f6fa1a6018599f98b26
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.024973 seconds and 4 git commands to generate.