summaryrefslogtreecommitdiffstats
path: root/drivers/iio/test/iio-test-format.c
Commit message (Collapse)AuthorAgeFilesLines
* iio: test: format: add MODULE_* informationLiam Beguin2022-07-161-0/+4
| | | | | | | | In preparation for module support, add missing MODULE_* information. Signed-off-by: Liam Beguin <liambeguin@gmail.com> Link: https://lore.kernel.org/r/20220710013109.3349104-3-liambeguin@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: test: Add test for IIO_VAL_INT_64.Andriy Tryshnivskyy2021-11-271-0/+54
| | | | | | | | | | Add test for newly introduced type IIO_VAL_INT_64. Signed-off-by: Andriy Tryshnivskyy <andriy.tryshnivskyy@opensynergy.com> Reported-by: kernel test robot <lkp@intel.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20211105100501.1904-3-andriy.tryshnivskyy@opensynergy.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: test: Add check against NULL for buffer in tests.Andriy Tryshnivskyy2021-11-271-27/+42
| | | | | | | | | | Add KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buf) for every test. Also use ARRAY_SIZE(values) where it is possible. Signed-off-by: Andriy Tryshnivskyy <andriy.tryshnivskyy@opensynergy.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20211105100501.1904-2-andriy.tryshnivskyy@opensynergy.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: Remove a cast in iio-test-format which is no longer requiredDavid Gow2021-06-231-1/+1
| | | | | | | | | | KUnit's EXPECT macros no longer typecheck as stringently, so casting the result of strcmp() is now unnecessary. Signed-off-by: David Gow <davidgow@google.com> Reviewed-by: Brendan Higgins <brendanhiggins@google.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
* iio: Add basic unit test for iio_format_value()Lars-Peter Clausen2021-03-111-0/+198
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>