Page MenuHomeFreeBSD

mixer(8): Add tests
ClosedPublic

Authored by christos on Jul 14 2024, 5:18 PM.
Tags
None
Referenced Files
F98096361: D45974.diff
Wed, Oct 2, 8:15 AM
F98060725: D45974.id141311.diff
Wed, Oct 2, 5:01 AM
Unknown Object (File)
Wed, Sep 25, 4:48 PM
Unknown Object (File)
Tue, Sep 24, 5:42 AM
Unknown Object (File)
Tue, Sep 24, 5:42 AM
Unknown Object (File)
Fri, Sep 13, 4:04 AM
Unknown Object (File)
Thu, Sep 12, 3:16 AM
Unknown Object (File)
Sun, Sep 8, 3:17 AM
Subscribers

Details

Summary

Sponsored by: The FreeBSD Foundation
MFC after: 2 days

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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
33
if ! mixer >/dev/null 2>&1; then
    atf_skip ...
fi
43

What is this atf_pass doing?

160

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

223

mixer exits with status 0 in these cases?

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

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.

160

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

223

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
9

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