Page MenuHomeFreeBSD

mixer(8): Add tests
ClosedPublic

Authored by christos on Jul 14 2024, 5:18 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 28, 11:33 PM
Unknown Object (File)
Sun, Oct 27, 9:25 AM
Unknown Object (File)
Sun, Oct 20, 10:55 PM
Unknown Object (File)
Oct 20 2024, 12:12 AM
Unknown Object (File)
Oct 18 2024, 8:55 AM
Unknown Object (File)
Oct 15 2024, 8:58 AM
Unknown Object (File)
Oct 14 2024, 6:21 AM
Unknown Object (File)
Oct 11 2024, 12:27 AM
Subscribers

Details

Summary

Sponsored by: The FreeBSD Foundation
MFC after: 2 days

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 58638
Build 55526: arc lint + arc unit

Event Timeline

@markj I am thinking of loading snd_dummy.ko (see D45967) to use as a test device, however I am not really sure what is the suggested way of loading and unloading a kernel module in ATF script. I can (un-)load it for every test case, but I am not sure if that the correct way to do it.

however I am not really sure what is the suggested way of loading and unloading a kernel module in ATF script.

It's ok to simply load it at the beginning of each test. Something like if ! kldload -n snd_dummy; then atf_skip ...

usr.sbin/mixer/tests/mixer_test.sh
32
if ! mixer >/dev/null 2>&1; then
    atf_skip ...
fi
42

What is this atf_pass doing?

159

What does it mean to "test muting"? Does this verify that the kernel driver received some command to mute a device?

222

mixer exits with status 0 in these cases?

usr.sbin/mixer/tests/mixer_test.sh
42

It fails in case the mixer does not exist (could also call mixer_exists()), so that we do not execute the command right after it.

159

It checks both if the driver actually responds to (un-)mute commands, and also whether mixer(8)'s argument parsing is correct.

222

Yes.

Any comments?

christos marked an inline comment as done.

Load snd_dummy in each test.

Shouldn't we select the snd_dummy device for our mixer tests?
Current default could be set to any device, with not all features available that we want to test. Or am I missing something?

Shouldn't we select the snd_dummy device for our mixer tests?
Current default could be set to any device, with not all features available that we want to test. Or am I missing something?

Yes, it would be more robust in case there is more than 1 card attached. I will update the diff shortly.

Introduce set_default() and restore_default() to set the dummy device as the
default one during tests, and restore the default device on cleanup.

This revision is now accepted and ready to land.Jul 26 2024, 2:10 PM
This revision was automatically updated to reflect the committed changes.
lwhsu added inline comments.
usr.sbin/mixer/Makefile
10

FYI since the tests are newly (re)added, we also need to modify etc/mtree/BSD.tests.dist to create /usr/tests/usr.sbin/mixer

I added it in rG21e98f6d195a5db63b17025f339684048834e1aa