If we are using the pad audio device, there must be a process with

the corresponding pad device open, or we get EIO from audio accesses

Explained and fix provided by Nathanial Sloss <nat@n.o>

Note: if we are testing and using real audio hardware, the open
of /dev/pad0 is irrelevant (but harmless, so we don't attempt to
check) and what's more it doesn't matter if it succeeds or fails.

If we're testing under qemu (or any other situation where the only
audio "hardware" is pad) then the open will work, and there should be
no more EIO.

If there is no audio hardware of any kind on the system being tested,
the attempt top open /dev/mixer should fail, and the test will be
skipped.
This commit is contained in:
kre 2017-04-20 00:17:11 +00:00
parent 6a14b8a272
commit dfcb546256

View File

@ -1,4 +1,4 @@
# $NetBSD: t_mixerctl.sh,v 1.4 2017/02/23 14:01:37 kre Exp $
# $NetBSD: t_mixerctl.sh,v 1.5 2017/04/20 00:17:11 kre Exp $
atf_test_case noargs_usage
noargs_usage_head() {
@ -14,6 +14,9 @@ showvalue_head() {
atf_set "descr" "Ensure mixerctl(1) can print the value for all variables"
}
showvalue_body() {
cat /dev/pad0 > /dev/null 2>&1 &
padpid=$!
(</dev/mixer) >/dev/null 2>&1 ||
atf_skip "no audio mixer available in kernel"
@ -21,6 +24,8 @@ showvalue_body() {
atf_check -s exit:0 -e ignore -o match:"^${var}=" \
mixerctl ${var}
done
kill -HUP ${padpid} 2>/dev/null # may have exited already
}
atf_test_case nflag
@ -28,6 +33,9 @@ nflag_head() {
atf_set "descr" "Ensure 'mixerctl -n' actually suppresses some output"
}
nflag_body() {
cat /dev/pad0 > /dev/null 2>&1 &
padpid=$!
(</dev/mixer) >/dev/null 2>&1 ||
atf_skip "no audio mixer available in kernel"
@ -38,6 +46,8 @@ nflag_body() {
atf_check -s exit:0 -o not-match:"${varname}" -e ignore \
mixerctl -n ${varname}
kill -HUP ${padpid} 2>/dev/null
}
atf_test_case nonexistant_device