Message ID | 20230224-alsa-mixer-test-restore-invalid-v1-1-454f0f1f2c4b@kernel.org |
---|---|
State | Accepted |
Commit | 7c79b10bea7a9dc1b74e2dbf4a35c19455371662 |
Headers | show |
Series | kselftest/alsa - mixer-test: Don't fail tests if we can't restore default | expand |
On Mon, 06 Mar 2023 15:20:03 +0100, Mark Brown wrote: > > If a control has an invalid default value then we might fail to set it > when restoring the default value after our write tests, for example due to > correctly implemented range checks in put() operations. Currently this > causes us to report the tests we were running as failed even when the > operation we were trying to test is successful, making it look like there > are problems where none really exist. Stop doing this, only reporting any > issues during the actual test. > > We already have validation for the initial readback being in spec and for > writing the default value back so failed tests will be reported for these > controls, and we log an error on the operation that failed when we write so > there will be a diagnostic warning the user that there is a problem. > > Signed-off-by: Mark Brown <broonie@kernel.org> Applied to for-next branch. Thanks. Takashi
diff --git a/tools/testing/selftests/alsa/mixer-test.c b/tools/testing/selftests/alsa/mixer-test.c index 05f1749ae19d..ac5efa42d488 100644 --- a/tools/testing/selftests/alsa/mixer-test.c +++ b/tools/testing/selftests/alsa/mixer-test.c @@ -755,7 +755,6 @@ static bool test_ctl_write_valid_enumerated(struct ctl_data *ctl) static void test_ctl_write_valid(struct ctl_data *ctl) { bool pass; - int err; /* If the control is turned off let's be polite */ if (snd_ctl_elem_info_is_inactive(ctl->info)) { @@ -797,9 +796,7 @@ static void test_ctl_write_valid(struct ctl_data *ctl) } /* Restore the default value to minimise disruption */ - err = write_and_verify(ctl, ctl->def_val, NULL); - if (err < 0) - pass = false; + write_and_verify(ctl, ctl->def_val, NULL); ksft_test_result(pass, "write_valid.%d.%d\n", ctl->card->card, ctl->elem); @@ -1015,9 +1012,7 @@ static void test_ctl_write_invalid(struct ctl_data *ctl) } /* Restore the default value to minimise disruption */ - err = write_and_verify(ctl, ctl->def_val, NULL); - if (err < 0) - pass = false; + write_and_verify(ctl, ctl->def_val, NULL); ksft_test_result(pass, "write_invalid.%d.%d\n", ctl->card->card, ctl->elem);
If a control has an invalid default value then we might fail to set it when restoring the default value after our write tests, for example due to correctly implemented range checks in put() operations. Currently this causes us to report the tests we were running as failed even when the operation we were trying to test is successful, making it look like there are problems where none really exist. Stop doing this, only reporting any issues during the actual test. We already have validation for the initial readback being in spec and for writing the default value back so failed tests will be reported for these controls, and we log an error on the operation that failed when we write so there will be a diagnostic warning the user that there is a problem. Signed-off-by: Mark Brown <broonie@kernel.org> --- tools/testing/selftests/alsa/mixer-test.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) --- base-commit: fe15c26ee26efa11741a7b632e9f23b01aca4cc6 change-id: 20230224-alsa-mixer-test-restore-invalid-2a57b98aeb7f Best regards,