Fix: tests: print real values in a fixed format
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 15 Mar 2023 19:44:02 +0000 (15:44 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Fri, 17 Mar 2023 15:28:57 +0000 (11:28 -0400)
commitd8e04f4ad9384bf3501392f5f4452dad18546a0d
treebedf8c954dedf40bf58a00e56abfd742b007f905
parenta25d8f4c51832f21047201c587d99fd41e68f3ee
Fix: tests: print real values in a fixed format

The cli_params_to_string.to_string function converts float values
(bt2._RealValueConst) to string using the str function.  The format of
that seems to differ across platform.  On a 32-bit powerpcspe platform,
we see this failure in the cli/params/test_params test:

  -{a=10500000.0, b=10500000.0, c=1.05e-05, d=1.05e-05}
  +{a=10500000.0, b=10500000.0, c=1.0499999999999999e-05, d=1.0499999999999999e-05}

Fix that by doing an explicit string conversion for _RealValueConst objects,
with a constant 7 decimal places after the decimal point.  The 7 is chosen so
that the numbers in tests in cli/params/test_params are not truncated.

Change-Id: Ie4fcb8eb422c3d44eeec1201169dc8a995536d4a
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/9651
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
(cherry picked from commit 5b616db96266d25cb0749e472cfc78c4944675e2)
Reviewed-on: https://review.lttng.org/c/babeltrace/+/9660
tests/cli/params/test_params
tests/utils/python/cli_params_to_string.py
This page took 0.025279 seconds and 4 git commands to generate.