summaryrefslogtreecommitdiff
path: root/drivers/base/test/property-entry-test.c
AgeCommit message (Collapse)AuthorFilesLines
2023-01-17software node: Switch property entry test to a new APIAndy Shevchenko1-16/+14
Switch property entry test to use software_node_register_node_group() API. The current one is going to be removed soon. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Tested-by: Daniel Scally <dan.scally@ideasonboard.com> Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20221228094922.84119-4-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-24device property: Remove some casts in property-entry-testDavid Gow1-28/+28
With some of the stricter type checking in KUnit's EXPECT macros removed, several casts in property-entry-test are no longer required. Remove the unnecessary casts, making the conditions clearer. Signed-off-by: David Gow <davidgow@google.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Brendan Higgins <brendanhiggins@google.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2021-04-05software node: Introduce SOFTWARE_NODE_REFERENCE() helper macroAndy Shevchenko1-9/+2
This is useful to assign software node reference with arguments in a common way. Moreover, we have already couple of users that may be converted. And by the fact, one of them is moved right here to use the helper. Tested-by: Daniel Scally <djrscally@gmail.com> Reviewed-by: Daniel Scally <djrscally@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20210329151207.36619-5-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-23device property: Add test cases for fwnode_property_count_*() APIsAndy Shevchenko1-4/+46
Add test cases for fwnode_property_count_*() APIs. While at it, modify the arrays of integers to be size of non-power-of-2 for better test coverage and decreasing stack usage. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20210212162539.86850-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-07drivers/base/test: fix global-out-of-bounds errorQian Cai1-0/+1
Commit c032ace71c29 ("software node: add basic tests for property entries") introduced a global-out-of-bounds error because it forgot to add a terminator of "nodes "for software_node_register_nodes() to process. # Subtest: property-entry 1..7 ok 1 - pe_test_uints ok 2 - pe_test_uint_arrays ok 3 - pe_test_strings ok 4 - pe_test_bool ok 5 - pe_test_move_inline_u8 ok 6 - pe_test_move_inline_str ================================================================== BUG: KASAN: global-out-of-bounds in software_node_register_nodes+0x41/0x80 Read of size 8 at addr ffffffff989ef250 by task kunit_try_catch/316 CPU: 17 PID: 316 Comm: kunit_try_catch Not tainted 5.5.0-rc4-next-20200106+ #1 Hardware name: HPE ProLiant DL385 Gen10/ProLiant DL385 Gen10, BIOS A40 03/09/2018 Call Trace: dump_stack+0xa0/0xea print_address_description.constprop.5.cold.7+0x64/0x384 __kasan_report.cold.8+0x7a/0xc0 kasan_report+0x12/0x20 __asan_load8+0x71/0xa0 software_node_register_nodes+0x41/0x80 pe_test_reference+0x1eb/0x1200 kunit_try_run_case+0x6b/0xd1 kunit_generic_run_threadfn_adapter+0x29/0x50 kthread+0x1e6/0x210 ret_from_fork+0x27/0x50 The buggy address belongs to the variable: nodes.21544+0x30/0x920 Memory state around the buggy address: ffffffff989ef100: fa fa fa fa 00 04 fa fa fa fa fa fa 00 00 00 00 ffffffff989ef180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffffffff989ef200: fa fa fa fa 00 00 00 00 00 00 fa fa fa fa fa fa ^ ffffffff989ef280: 00 06 fa fa fa fa fa fa 00 00 04 fa fa fa fa fa ffffffff989ef300: 00 00 fa fa fa fa fa fa 00 05 fa fa fa fa fa fa ================================================================== Disabling lock debugging due to kernel taint ok 7 - pe_test_reference ok 8 - property-entry Fixes: c032ace71c29 ("software node: add basic tests for property entries") Signed-off-by: Qian Cai <cai@lca.pw> Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-12-19software node: add basic tests for property entriesDmitry Torokhov1-0/+474
This adds tests for creating software nodes with properties supplied by PROPERTY_ENTRY_XXX() macros and fetching and validating data from said nodes/properties. We are using KUnit framework for the tests. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>