From 54d2cfe6ee11dc5bcce55d41b91d92f9a53e6485 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 5 Dec 2018 18:42:52 -0700 Subject: dm: Tidy up 'dm tree' output when there are many devices At present the 'Index' column assumes there is only one digit. But on some devices (e.g. snow) there are a lot of regulators and GPIO banks. Adjust the output to allow for two digits without messing up the display. Also capatalise the heading to match. Fixes: 5197dafc42 (dm: core: Widen the dump tree to show more of the driver's name.) Signed-off-by: Simon Glass Reviewed-by: Liviu Dudau --- test/py/tests/test_bind.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/py/tests/test_bind.py b/test/py/tests/test_bind.py index dee3fee566..917839f628 100644 --- a/test/py/tests/test_bind.py +++ b/test/py/tests/test_bind.py @@ -13,7 +13,8 @@ def in_tree(response, name, uclass, drv, depth, last_child): else: leaf = leaf + '`' leaf = leaf + '-- ' + name - line = ' *{:10.10} [0-9]* \[ [ +] \] {:20.20} {}$'.format(uclass, drv, leaf) + line = (' *{:10.10} [0-9]* \[ [ +] \] {:20.20} {}$' + .format(uclass, drv, leaf)) prog = re.compile(line) for l in lines: if prog.match(l): -- cgit v1.2.3 From df9cf1cc08d73af765f0f434909295ac6fed2c4b Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 9 Dec 2018 17:11:10 -0700 Subject: test: dm: regmap: Fix the long test delay At present one of the regmap tests takes 5 seconds to run since it waits for a timeout. This should be handled using sandbox_timer_add_offset() which advances time for test purposes. This requires a little change to make the regmap_read_poll_timeout() testable. Update the macro and the test. Fixes: ebe3497c9c ("test: regmap: add regmap_read_poll_timeout test") Signed-off-by: Simon Glass --- test/dm/regmap.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/dm/regmap.c b/test/dm/regmap.c index 9a70c159dd..82de295cb8 100644 --- a/test/dm/regmap.c +++ b/test/dm/regmap.c @@ -160,9 +160,10 @@ static int dm_test_regmap_poll(struct unit_test_state *uts) start = get_timer(0); ut_asserteq(-ETIMEDOUT, - regmap_read_poll_timeout(map, 0, reg, - (reg == 0xcacafafa), - 1, 5 * CONFIG_SYS_HZ)); + regmap_read_poll_timeout_test(map, 0, reg, + (reg == 0xcacafafa), + 1, 5 * CONFIG_SYS_HZ, + 5 * CONFIG_SYS_HZ)); ut_assert(get_timer(start) > (5 * CONFIG_SYS_HZ)); -- cgit v1.2.3 From 67d1b0513079049baa3e0e38603eb33a3857af5d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 28 Dec 2018 14:23:08 -0700 Subject: dm: serial: Adjust serial_getconfig() to use proper API All driver-model functions should have a device as the first parameter. Update this function accordingly. Signed-off-by: Simon Glass Reviewed-by: Andy Shevchenko --- test/dm/serial.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/dm/serial.c b/test/dm/serial.c index 19a15d5d95..972755face 100644 --- a/test/dm/serial.c +++ b/test/dm/serial.c @@ -24,7 +24,7 @@ static int dm_test_serial(struct unit_test_state *uts) * sandbox_serial driver */ ut_assertok(serial_setconfig(SERIAL_DEFAULT_CONFIG)); - ut_assertok(serial_getconfig(&value_serial)); + ut_assertok(serial_getconfig(dev_serial, &value_serial)); ut_assert(value_serial == SERIAL_DEFAULT_CONFIG); ut_assertok(serial_getinfo(&info_serial)); ut_assert(info_serial.type == SERIAL_CHIP_UNKNOWN); @@ -32,7 +32,7 @@ static int dm_test_serial(struct unit_test_state *uts) /* * test with a parameter which is NULL pointer */ - ut_asserteq(-EINVAL, serial_getconfig(NULL)); + ut_asserteq(-EINVAL, serial_getconfig(dev_serial, NULL)); ut_asserteq(-EINVAL, serial_getinfo(NULL)); /* * test with a serial config which is not supported by -- cgit v1.2.3 From 3de04e771c4b230ad08c7b22871dedf5f69032b9 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 28 Dec 2018 14:23:09 -0700 Subject: dm: serial: Adjust serial_setconfig() to use proper API All driver-model functions should have a device as the first parameter. Update this function accordingly. Signed-off-by: Simon Glass Reviewed-by: Andy Shevchenko --- test/dm/serial.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/dm/serial.c b/test/dm/serial.c index 972755face..f82b4a19e8 100644 --- a/test/dm/serial.c +++ b/test/dm/serial.c @@ -23,7 +23,7 @@ static int dm_test_serial(struct unit_test_state *uts) * test with default config which is the only one supported by * sandbox_serial driver */ - ut_assertok(serial_setconfig(SERIAL_DEFAULT_CONFIG)); + ut_assertok(serial_setconfig(dev_serial, SERIAL_DEFAULT_CONFIG)); ut_assertok(serial_getconfig(dev_serial, &value_serial)); ut_assert(value_serial == SERIAL_DEFAULT_CONFIG); ut_assertok(serial_getinfo(&info_serial)); @@ -39,7 +39,8 @@ static int dm_test_serial(struct unit_test_state *uts) * sandbox_serial driver: test with wrong parity */ ut_asserteq(-ENOTSUPP, - serial_setconfig(SERIAL_CONFIG(SERIAL_PAR_ODD, + serial_setconfig(dev_serial, + SERIAL_CONFIG(SERIAL_PAR_ODD, SERIAL_8_BITS, SERIAL_ONE_STOP))); /* @@ -47,7 +48,8 @@ static int dm_test_serial(struct unit_test_state *uts) * sandbox_serial driver: test with wrong bits number */ ut_asserteq(-ENOTSUPP, - serial_setconfig(SERIAL_CONFIG(SERIAL_PAR_NONE, + serial_setconfig(dev_serial, + SERIAL_CONFIG(SERIAL_PAR_NONE, SERIAL_6_BITS, SERIAL_ONE_STOP))); @@ -56,7 +58,8 @@ static int dm_test_serial(struct unit_test_state *uts) * sandbox_serial driver: test with wrong stop bits number */ ut_asserteq(-ENOTSUPP, - serial_setconfig(SERIAL_CONFIG(SERIAL_PAR_NONE, + serial_setconfig(dev_serial, + SERIAL_CONFIG(SERIAL_PAR_NONE, SERIAL_8_BITS, SERIAL_TWO_STOP))); -- cgit v1.2.3 From a61cbad78e67963944e7d719f0aee27b8aef6c02 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 28 Dec 2018 14:23:10 -0700 Subject: dm: serial: Adjust serial_getinfo() to use proper API All driver-model functions should have a device as the first parameter. Update this function accordingly. Signed-off-by: Simon Glass Reviewed-by: Andy Shevchenko --- test/dm/serial.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/dm/serial.c b/test/dm/serial.c index f82b4a19e8..3d741a8c36 100644 --- a/test/dm/serial.c +++ b/test/dm/serial.c @@ -26,14 +26,14 @@ static int dm_test_serial(struct unit_test_state *uts) ut_assertok(serial_setconfig(dev_serial, SERIAL_DEFAULT_CONFIG)); ut_assertok(serial_getconfig(dev_serial, &value_serial)); ut_assert(value_serial == SERIAL_DEFAULT_CONFIG); - ut_assertok(serial_getinfo(&info_serial)); + ut_assertok(serial_getinfo(dev_serial, &info_serial)); ut_assert(info_serial.type == SERIAL_CHIP_UNKNOWN); ut_assert(info_serial.addr == SERIAL_DEFAULT_ADDRESS); /* * test with a parameter which is NULL pointer */ ut_asserteq(-EINVAL, serial_getconfig(dev_serial, NULL)); - ut_asserteq(-EINVAL, serial_getinfo(NULL)); + ut_asserteq(-EINVAL, serial_getinfo(dev_serial, NULL)); /* * test with a serial config which is not supported by * sandbox_serial driver: test with wrong parity -- cgit v1.2.3