From: Przemyslaw Marczak <p.marczak@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V3 4/4] dm: test: Add tests for get/find uclass devices
Date: Thu, 09 Apr 2015 08:54:18 +0200 [thread overview]
Message-ID: <5526221A.509@samsung.com> (raw)
In-Reply-To: <CAPnjgZ0AzoN6vM6Ue4TP-P5Qsn40ndGtjAkm2EMwHrZZd_HXEA@mail.gmail.com>
Hello Simon,
On 04/09/2015 03:47 AM, Simon Glass wrote:
> On 8 April 2015 at 11:06, Przemyslaw Marczak <p.marczak@samsung.com> wrote:
>> This commit introduces simple tests for functions:
>> - uclass_find_first_device()
>> - uclass_find_next_device()
>> - uclass_first_device()
>> - uclass_next_device()
>>
>> Tests added by this commit:
>> - Test: dm_test_uclass_devices_find:
>> * call uclass_find_first_device(), then check if: (dev != NULL), (ret == 0)
>> * for the rest devices, call uclass_find_next_device() and do the same check
>>
>> - Test: dm_test_uclass_devices_get:
>> * call uclass_first_device(), then check if:
>> -- (dev != NULL), (ret == 0), device_active()
>> * for the rest devices, call uclass_next_device() and do the same check
>>
>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>> Cc: Simon Glass <sjg@chromium.org>
>>
>> Changes V3:
>> - new commit
>> ---
>> test/dm/core.c | 34 +++++++++++++++++++++++++++++++++-
>> 1 file changed, 33 insertions(+), 1 deletion(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>
>
> See below.
>
>>
>> diff --git a/test/dm/core.c b/test/dm/core.c
>> index 009ad36..3a8dd1d 100644
>> --- a/test/dm/core.c
>> +++ b/test/dm/core.c
>> @@ -656,9 +656,41 @@ static int dm_test_uclass_before_ready(struct dm_test_state *dms)
>>
>> return 0;
>> }
>> -
>> DM_TEST(dm_test_uclass_before_ready, 0);
>>
>> +static int dm_test_uclass_devices_find(struct dm_test_state *dms)
>> +{
>> + struct udevice *dev;
>> + int ret;
>> +
>> + for (ret = uclass_find_first_device(UCLASS_TEST, &dev);
>> + dev;
>> + ret = uclass_find_next_device(&dev)) {
>> + ut_assert(!ret);
>> + ut_assert(dev);
>
> ut_assert(!device_active(dev));
>
> If you like I can add that when I apply.
>
I don't think it's a good idea. Those calls above, don't probe the
device, but also don't guarantee that, the returned device was not
probed, before the call.
>> + }
>> +
>> + return 0;
>> +}
>> +DM_TEST(dm_test_uclass_devices_find, DM_TESTF_SCAN_PDATA);
>> +
>> +static int dm_test_uclass_devices_get(struct dm_test_state *dms)
>> +{
>> + struct udevice *dev;
>> + int ret;
>> +
>> + for (ret = uclass_first_device(UCLASS_TEST, &dev);
>> + dev;
>> + ret = uclass_next_device(&dev)) {
>> + ut_assert(!ret);
>> + ut_assert(dev);
>> + ut_assert(device_active(dev));
>> + }
>> +
>> + return 0;
>> +}
>> +DM_TEST(dm_test_uclass_devices_get, DM_TESTF_SCAN_PDATA);
>> +
>> static int dm_test_device_get_uclass_id(struct dm_test_state *dms)
>> {
>> struct udevice *dev;
>> --
>> 1.9.1
>>
>
> Regards,
> Simon
>
Best regards,
--
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
next prev parent reply other threads:[~2015-04-09 6:54 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-08 13:01 [U-Boot] [PATCH 0/2] dm: core: add device's uclass platform data and tests Przemyslaw Marczak
2015-04-08 13:01 ` [U-Boot] [PATCH 1/2] dm: core: Extend struct udevice by '.uclass_platdata' field Przemyslaw Marczak
2015-04-08 13:47 ` Simon Glass
2015-04-08 13:56 ` Przemyslaw Marczak
2015-04-08 13:01 ` [U-Boot] [PATCH 2/2] dm: test: Add tests for device's uclass platform data Przemyslaw Marczak
2015-04-08 13:47 ` Simon Glass
2015-04-08 13:58 ` Przemyslaw Marczak
2015-04-08 15:32 ` [U-Boot] [PATCH V2 0/3] dm: core: add device's uclass platform data and tests Przemyslaw Marczak
2015-04-08 15:32 ` [U-Boot] [PATCH V2 1/3] dm: core: add internal functions for getting the device without probe Przemyslaw Marczak
2015-04-08 15:39 ` Simon Glass
2015-04-08 15:47 ` Przemyslaw Marczak
2015-04-08 15:32 ` [U-Boot] [PATCH V2 2/3] dm: core: Extend struct udevice by '.uclass_platdata' field Przemyslaw Marczak
2015-04-08 15:32 ` [U-Boot] [PATCH V2 3/3] dm: test: Add tests for device's uclass platform data Przemyslaw Marczak
2015-04-08 17:06 ` [U-Boot] [PATCH V3 0/4] dm: core: add device's uclass platform data and tests Przemyslaw Marczak
2015-04-08 17:06 ` [U-Boot] [PATCH V3 1/4] dm: core: add internal functions for getting the device without probe Przemyslaw Marczak
2015-04-09 1:47 ` Simon Glass
2015-04-08 17:06 ` [U-Boot] [PATCH V3 2/4] dm: core: Extend struct udevice by '.uclass_platdata' field Przemyslaw Marczak
2015-04-09 1:47 ` Simon Glass
2015-04-08 17:06 ` [U-Boot] [PATCH V3 3/4] dm: test: Add tests for device's uclass platform data Przemyslaw Marczak
2015-04-09 1:47 ` Simon Glass
2015-04-08 17:06 ` [U-Boot] [PATCH V3 4/4] dm: test: Add tests for get/find uclass devices Przemyslaw Marczak
2015-04-09 1:47 ` Simon Glass
2015-04-09 6:54 ` Przemyslaw Marczak [this message]
2015-04-09 12:11 ` [U-Boot] [PATCH] dm: core: remove type 'static' of function uclass_get_device_tail() Przemyslaw Marczak
2015-04-09 12:16 ` Przemyslaw Marczak
2015-04-15 11:07 ` [U-Boot] [PATCH V4 00/10] dm: core: extend API by useful functions with tests Przemyslaw Marczak
2015-04-15 11:07 ` [U-Boot] [PATCH V4 01/10] dm: core: add internal functions for getting the device without probe Przemyslaw Marczak
2015-04-20 3:22 ` Simon Glass
2015-04-15 11:07 ` [U-Boot] [PATCH V4 02/10] dm: core: Extend struct udevice by '.uclass_platdata' field Przemyslaw Marczak
2015-04-20 3:22 ` Simon Glass
2015-04-15 11:07 ` [U-Boot] [PATCH V4 03/10] dm: test: Add tests for device's uclass platform data Przemyslaw Marczak
2015-04-20 3:22 ` Simon Glass
2015-04-15 11:07 ` [U-Boot] [PATCH V4 04/10] dm: test: Add tests for get/find uclass devices Przemyslaw Marczak
2015-04-20 3:22 ` Simon Glass
2015-04-15 11:07 ` [U-Boot] [PATCH V4 05/10] dm: core: remove type 'static' of function uclass_get_device_tail() Przemyslaw Marczak
2015-04-20 2:03 ` Simon Glass
2015-04-15 11:07 ` [U-Boot] [PATCH V4 06/10] dm: core: uclass: add function: uclass_find_device_by_name() Przemyslaw Marczak
2015-04-19 13:23 ` Simon Glass
2015-04-20 3:22 ` Simon Glass
2015-04-15 11:07 ` [U-Boot] [PATCH V4 07/10] dm: core: uclass: add function: uclass_get_device_by_name() Przemyslaw Marczak
2015-04-19 13:23 ` Simon Glass
2015-04-20 3:22 ` Simon Glass
2015-04-15 11:07 ` [U-Boot] [PATCH V4 08/10] dm: core: device: add function: dev_get_driver_ops() Przemyslaw Marczak
2015-04-19 13:24 ` Simon Glass
2015-04-20 3:23 ` Simon Glass
2015-04-15 11:07 ` [U-Boot] [PATCH V4 09/10] dm: core: device: add function: dev_get_uclass_name() Przemyslaw Marczak
2015-04-19 13:24 ` Simon Glass
2015-04-20 3:23 ` Simon Glass
2015-04-15 11:07 ` [U-Boot] [PATCH V4 10/10] dm: test: Add tests for get/find uclass's device by name Przemyslaw Marczak
2015-04-19 13:25 ` Simon Glass
2015-04-20 3:22 ` [U-Boot] [PATCH V4 00/10] dm: core: extend API by useful functions with tests Simon Glass
2015-04-20 10:55 ` Przemyslaw Marczak
2015-04-20 11:32 ` [U-Boot] [PATCH V5 1/3] dm: core: remove type 'static' of function uclass_get_device_tail() Przemyslaw Marczak
2015-04-20 11:32 ` [U-Boot] [PATCH V5 2/3] dm: test: Add tests for get/find uclass's device by name Przemyslaw Marczak
2015-04-20 21:24 ` Simon Glass
2015-04-22 16:52 ` Simon Glass
2015-04-20 11:32 ` [U-Boot] [PATCH V5 3/3] dm: core: precise comments for get/find " Przemyslaw Marczak
2015-04-20 21:24 ` Simon Glass
2015-04-22 16:52 ` Simon Glass
2015-04-20 21:24 ` [U-Boot] [PATCH V5 1/3] dm: core: remove type 'static' of function uclass_get_device_tail() Simon Glass
2015-04-22 16:52 ` Simon Glass
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5526221A.509@samsung.com \
--to=p.marczak@samsung.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox