Module Name: src Committed By: kre Date: Thu Apr 20 00:17:11 UTC 2017
Modified Files: src/tests/usr.bin/mixerctl: t_mixerctl.sh Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/mixerctl/t_mixerctl.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/usr.bin/mixerctl/t_mixerctl.sh diff -u src/tests/usr.bin/mixerctl/t_mixerctl.sh:1.4 src/tests/usr.bin/mixerctl/t_mixerctl.sh:1.5 --- src/tests/usr.bin/mixerctl/t_mixerctl.sh:1.4 Thu Feb 23 14:01:37 2017 +++ src/tests/usr.bin/mixerctl/t_mixerctl.sh Thu Apr 20 00:17:11 2017 @@ -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