Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/usr.bin/mixerctl If we are using the pad audio device, ...



details:   https://anonhg.NetBSD.org/src/rev/522c57cc27a4
branches:  trunk
changeset: 823341:522c57cc27a4
user:      kre <kre%NetBSD.org@localhost>
date:      Thu Apr 20 00:17:11 2017 +0000

description:
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.

diffstat:

 tests/usr.bin/mixerctl/t_mixerctl.sh |  12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diffs (47 lines):

diff -r 382fa7e9f145 -r 522c57cc27a4 tests/usr.bin/mixerctl/t_mixerctl.sh
--- a/tests/usr.bin/mixerctl/t_mixerctl.sh      Wed Apr 19 23:41:00 2017 +0000
+++ b/tests/usr.bin/mixerctl/t_mixerctl.sh      Thu Apr 20 00:17:11 2017 +0000
@@ -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 @@
        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 @@
                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 @@
        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 @@
 
        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



Home | Main Index | Thread Index | Old Index