NetworkManager/src/core/platform
Thomas Haller ce9211500e
platform/tests: work around rounding errors for bridge values in unit tests
For certain options, kernel stores the numeric values in jiffies scale,
while the user space value is in USER_HZ (1/100th of a second) scale.

Jiffies scale depends on HZ setting (CONFIG_HZ), and depending on kernel
configuration its 100, 250, 300, or 1000.

That means, the round trip of clock_t_to_jiffies()/jiffies_to_clock_t()
has different rounding errors, depending on CONFIG_HZ and it maybe be
+/- 1 of the requested value.

Since the rounding error depends on CONFIG_HZ, we cannot find "good"
values for testing, that always behave the same. So we need to
workaround that.

Normalize the bridge values, if they look as if the value was mangled
due to rounding.

Related: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/665
2021-04-16 11:34:58 +02:00
..
tests platform/tests: work around rounding errors for bridge values in unit tests 2021-04-16 11:34:58 +02:00
nm-fake-platform.c platform: move more platform code to src/libnm-platform/ 2021-03-05 11:27:16 +01:00
nm-fake-platform.h platform: move more platform code to src/libnm-platform/ 2021-03-05 11:27:16 +01:00