On 5/15/23 05:28, Mark Brown wrote:
On Sun, May 14, 2023 at 12:20:37AM +0400, Ivan Orlov wrote:
+uid=$(id -u)
+if [ $uid -ne 0 ]; then
+ echo "$0: Must be run as root"
+ exit 1
+fi
It is not an error to run the selftest as a non-root user, the test
should be skipped.
Alright, thanks!
+modprobe snd-valsa
We don't check if the module was already loaded.
+if [ ! -e /sys/kernel/debug/valsa/pc_test ]; then
+ mount -t debugfs none /sys/kernel/debug
+
+ if [ ! -e /sys/kernel/debug/valsa/pc_test ]; then
+ echo "$0: Error mounting debugfs"
+ exit 4
+ fi
+fi
This will unconditionally attempt to mount debugfs in a standard
location and won't clean up after itself, if the system didn't have
debugfs mounted for some reason then this will leave it sitting there.
Yes, I agree... I'll remove this in the future versions, I think the
approach with skipping in case of missing debugfs would be better.
By the way, I used the 'fpa' test as an example, and it looks like it
should be fixed as well...
Would it not be better to have a C program that actually calls the ioctl
rather than a custom debugfs thing that may or may not be wired up to do
the same thing as an ioctl would? It seems like other than whatever
this ioctl test actually does this is all just a simplified version of
the existing pcm-test.
Well, the idea was to test the playback buffer consistency - the driver
has the functionality of testing the playback buffer for containing the
looped pattern (and if the buffer doesn't contain the looped pattern the
test fails). So, firstly we get the capture buffer with this pattern
(via arecord), and then send it to the driver for the test (via aplay).
The pcm-test (as I understand) performs only time checks, not the checks
of the data played/captured, and I think it is pointless to test the
time again. But I agree, that C test implementation would be better -
using this approach I can perform additional buffer checks and cover
more functionality of the driver.
Thank you very much for the review!
Kind regards,
Ivan Orlov.