summaryrefslogtreecommitdiff
path: root/drivers/iio/Kconfig
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2020-12-15 22:17:43 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2021-03-11 23:47:00 +0300
commit0bf49ffbfe949df21e95b8f95b5f308db379ac74 (patch)
tree61a2f9f13c0354190dc0d720a21089164affd721 /drivers/iio/Kconfig
parent38a52cdef5b3ba2e4ac6b24a073a231e04d2c552 (diff)
downloadlinux-0bf49ffbfe949df21e95b8f95b5f308db379ac74.tar.xz
iio: Add basic unit test for iio_format_value()
The IIO core provides a function to do formatting of fixedpoint numbers. In the past there have been some issues with the implementation of the function where for example negative numbers were not handled correctly. Introduce a basic unit test based on kunit that tests the function and ensures that the generated output matches the expected output. This gives us some confidence that future modifications to the function implementation will not break ABI compatibility. To run the unit tests follow the kunit documentation and add CONFIG_IIO=y CONFIG_IIO_TEST_FORMAT=y to the .kunitconfig and run > ./tools/testing/kunit/kunit.py run Configuring KUnit Kernel ... Building KUnit Kernel ... Starting KUnit Kernel ... ============================================================ ======== [PASSED] iio-format ======== [PASSED] iio_test_iio_format_value_integer [PASSED] iio_test_iio_format_value_fixedpoint [PASSED] iio_test_iio_format_value_fractional [PASSED] iio_test_iio_format_value_fractional_log2 [PASSED] iio_test_iio_format_value_multiple ============================================================ Testing complete. 21 tests run. 0 failed. 0 crashed. Elapsed time: 8.242s total, 0.001s configuring, 3.865s building, 0.000s running Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20201215191743.2725-3-lars@metafoo.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/Kconfig')
-rw-r--r--drivers/iio/Kconfig1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/iio/Kconfig b/drivers/iio/Kconfig
index 267553386c71..b35e0c33b5e2 100644
--- a/drivers/iio/Kconfig
+++ b/drivers/iio/Kconfig
@@ -85,6 +85,7 @@ source "drivers/iio/light/Kconfig"
source "drivers/iio/magnetometer/Kconfig"
source "drivers/iio/multiplexer/Kconfig"
source "drivers/iio/orientation/Kconfig"
+source "drivers/iio/test/Kconfig"
if IIO_TRIGGER
source "drivers/iio/trigger/Kconfig"
endif #IIO_TRIGGER