History log of /linux-master/drivers/base/test/property-entry-test.c
Revision Date Author Comments
# 98ad1dd0 27-Sep-2023 Geert Uytterhoeven <geert+renesas@glider.be>

drivers: base: test: Make property entry API test modular

There is no reason why the KUnit Tests for the property entry API can
only be built-in. Add support for building these tests as a loadable
module, like is supported by most other tests.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/98388154383df9d4ced73946efd18318aeea50e2.1695820382.git.geert+renesas@glider.be
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d903bca1 28-Dec-2022 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

software node: Switch property entry test to a new API

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>


# 6d2e9789 13-May-2021 David Gow <davidgow@google.com>

device property: Remove some casts in property-entry-test

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>


# e588fead 29-Mar-2021 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

software node: Introduce SOFTWARE_NODE_REFERENCE() helper macro

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>


# 7f2fac70 12-Feb-2021 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

device property: Add test cases for fwnode_property_count_*() APIs

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>


# eabd5e7d 06-Jan-2020 Qian Cai <cai@lca.pw>

drivers/base/test: fix global-out-of-bounds error

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>


# c032ace7 04-Dec-2019 Dmitry Torokhov <dmitry.torokhov@gmail.com>

software node: add basic tests for property entries

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>