Test whether the SNDSTIOC_ADD_USER_DEVS IOCTL (registers a userland
device to /dev/sndstat) works properly.
Sponsored by: The FreeBSD Foundation
MFC after: 2 days
Differential D46228
sound tests: Add SNDSTIOC_ADD_USER_DEVS test christos on Aug 5 2024, 12:45 PM. Authored by Tags None Referenced Files
Subscribers
Details Test whether the SNDSTIOC_ADD_USER_DEVS IOCTL (registers a userland Sponsored by: The FreeBSD Foundation
Diff Detail
Event TimelineComment Actions Can we somehow read these values back out, for checking them? Or where does this ioctl have any effect? Comment Actions So the device will get destroyed once we call close(fd). Even though the sndstat_nv test case does the reading checks already, we could try and read the values back after we issue SNDSTIOC_ADD_USER_DEVS, I just didn't do this because I found it redundant to do what the other test case does already. The IOCTL won't succeed if the device is not registered properly. Comment Actions For my understanding of how this ioctl works: This means that virtual_oss has to keep /dev/sndstat open as long as its userland pcm device is present, right?
Sure, we can just test that the ioctl doesn't return an error for given data. But a test of this kind can go trivially wrong if the ioctl returns a false positive, for whatever reason. It may give a false level of confidence to someone not reading the test code. I'd suggest to at least check whether the device was added to the list. Comment Actions I think we still don't test whether the userland device was in fact added to the list - am I missing something? Comment Actions Indeed. I modified the diff a few hours ago to search for the userland device and read back all the values we registered, and compare them to what we passed to make sure all values match, but haven't had time to clean it up and submit it. I will submit the diff once I am on my computer soon. Comment Actions (Was AFK and couldn't submit earlier). Read back registered values and make
|