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. > +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. > +success="1" > +arecord -D hw:CARD=valsa,DEV=0 -c 1 --buffer-size=8192 -f S16_LE -r 8000 --duration=4 out.wav > + > +if [[ $(< /sys/kernel/debug/valsa/ioctl_test) == "$success" ]]; then > + echo "$0: ioctl test: success" > +else > + echo "$0: ioctl test: fail" > +fi 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.
Attachment:
signature.asc
Description: PGP signature