diff options
Diffstat (limited to 'test/cmd/pwm.c')
-rw-r--r-- | test/cmd/pwm.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/test/cmd/pwm.c b/test/cmd/pwm.c index 5343af8..2fc0b5e 100644 --- a/test/cmd/pwm.c +++ b/test/cmd/pwm.c @@ -18,16 +18,20 @@ static int dm_test_pwm_cmd(struct unit_test_state *uts) { struct udevice *dev; + /* cros-ec-pwm */ ut_assertok(uclass_get_device(UCLASS_PWM, 0, &dev)); ut_assertnonnull(dev); ut_assertok(console_record_reset_enable()); /* pwm <invert> <pwm_dev_num> <channel> <polarity> */ - ut_assertok(run_command("pwm invert 0 0 1", 0)); + /* cros-ec-pwm doesn't support invert */ + ut_asserteq(1, run_command("pwm invert 0 0 1", 0)); + ut_assert_nextline("error(-38)") ut_assert_console_end(); - ut_assertok(run_command("pwm invert 0 0 0", 0)); + ut_asserteq(1, run_command("pwm invert 0 0 0", 0)); + ut_assert_nextline("error(-38)") ut_assert_console_end(); /* pwm <config> <pwm_dev_num> <channel> <period_ns> <duty_ns> */ @@ -41,6 +45,30 @@ static int dm_test_pwm_cmd(struct unit_test_state *uts) ut_assertok(run_command("pwm disable 0 0", 0)); ut_assert_console_end(); + /* sandbox-pwm */ + ut_assertok(uclass_get_device(UCLASS_PWM, 1, &dev)); + ut_assertnonnull(dev); + + ut_assertok(console_record_reset_enable()); + + /* pwm <invert> <pwm_dev_num> <channel> <polarity> */ + ut_assertok(run_command("pwm invert 1 0 1", 0)); + ut_assert_console_end(); + + ut_assertok(run_command("pwm invert 1 0 0", 0)); + ut_assert_console_end(); + + /* pwm <config> <pwm_dev_num> <channel> <period_ns> <duty_ns> */ + ut_assertok(run_command("pwm config 1 0 10 50", 0)); + ut_assert_console_end(); + + /* pwm <enable/disable> <pwm_dev_num> <channel> */ + ut_assertok(run_command("pwm enable 1 0", 0)); + ut_assert_console_end(); + + ut_assertok(run_command("pwm disable 1 0", 0)); + ut_assert_console_end(); + return 0; } |