diff options
author | Mario Six <mario.six@gdsys.cc> | 2018-08-06 11:23:33 +0300 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2018-09-18 09:01:18 +0300 |
commit | cda4688c5eec7ccd3a978092fbed9bd0b9f941e1 (patch) | |
tree | aea7f4533ce994dcce1cda2b2a228d62fb3e2caa /test/dm | |
parent | 245f5cda69a1332585c2a22a48420f4ca1ab67ad (diff) | |
download | u-boot-cda4688c5eec7ccd3a978092fbed9bd0b9f941e1.tar.xz |
test: Add tests for sysreset_get_status
Add some tests for sysreset_get_status.
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Diffstat (limited to 'test/dm')
-rw-r--r-- | test/dm/sysreset.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/dm/sysreset.c b/test/dm/sysreset.c index 33a8bfb33c..04d4621d9e 100644 --- a/test/dm/sysreset.c +++ b/test/dm/sysreset.c @@ -45,6 +45,26 @@ static int dm_test_sysreset_base(struct unit_test_state *uts) } DM_TEST(dm_test_sysreset_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +static int dm_test_sysreset_get_status(struct unit_test_state *uts) +{ + struct udevice *dev; + char msg[64]; + + /* Device 1 is the warm sysreset device */ + ut_assertok(uclass_get_device(UCLASS_SYSRESET, 1, &dev)); + ut_assertok(sysreset_get_status(dev, msg, sizeof(msg))); + ut_asserteq_str("Reset Status: WARM", msg); + + /* Device 2 is the cold sysreset device */ + ut_assertok(uclass_get_device(UCLASS_SYSRESET, 2, &dev)); + ut_assertok(sysreset_get_status(dev, msg, sizeof(msg))); + ut_asserteq_str("Reset Status: COLD", msg); + + return 0; +} + +DM_TEST(dm_test_sysreset_get_status, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + /* Test that we can walk through the sysreset devices */ static int dm_test_sysreset_walk(struct unit_test_state *uts) { |