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 Drop the test for QEMU and instead sk...



details:   https://anonhg.NetBSD.org/src/rev/f0648bc3f0de
branches:  trunk
changeset: 821969:f0648bc3f0de
user:      kre <kre%NetBSD.org@localhost>
date:      Thu Feb 23 14:01:37 2017 +0000

description:
Drop the test for QEMU and instead skip relevant tests when /dev/mixer
can't be opened (which more accurately reflects when mixerctl is going
to fail...)

Based upon an idea from Andreas Gustafsson (gson@) - except that using
/dev/audio0 for this purpose doesn't work, if the only audio device
configured is pad0 an open of audio fails with EIO (???)

While here, perpare for the updated mixerctl coming soon to a repository
near you...
        Use correct usage in the test of a bogus -d arg (otherwise the
                new mixerctl will complain about usage, and never even
                attempt to open the bogus device)
        Don't require /dev/mixer for the noargs -> generate usage msg
                test ... this will now generate a failing test with the
                old mixerctl if there is no working /dev/mixer, but
                that mixerctl won't be around much longer.

diffstat:

 tests/usr.bin/mixerctl/t_mixerctl.sh |  27 ++++++++-------------------
 1 files changed, 8 insertions(+), 19 deletions(-)

diffs (61 lines):

diff -r 63ea5837e1fb -r f0648bc3f0de tests/usr.bin/mixerctl/t_mixerctl.sh
--- a/tests/usr.bin/mixerctl/t_mixerctl.sh      Thu Feb 23 13:22:53 2017 +0000
+++ b/tests/usr.bin/mixerctl/t_mixerctl.sh      Thu Feb 23 14:01:37 2017 +0000
@@ -1,17 +1,10 @@
-# $NetBSD: t_mixerctl.sh,v 1.3 2017/02/23 02:28:10 kre Exp $
+# $NetBSD: t_mixerctl.sh,v 1.4 2017/02/23 14:01:37 kre Exp $
 
 atf_test_case noargs_usage
 noargs_usage_head() {
        atf_set "descr" "Ensure mixerctl(1) with no args prints a usage message"
 }
 noargs_usage_body() {
-        if sysctl machdep.cpu_brand 2>/dev/null | grep QEMU >/dev/null 2>&1 &&
-           test $(uname -m) = i386
-       then
-           # better would be for mixerctl to not open the device...
-           # but for now, it does.
-           atf_skip "i386 ATF qemu kernel has no audio"
-       fi
        atf_check -s exit:0 -o not-empty -e ignore \
                mixerctl
 }
@@ -21,11 +14,9 @@
        atf_set "descr" "Ensure mixerctl(1) can print the value for all variables"
 }
 showvalue_body() {
-        if sysctl machdep.cpu_brand 2>/dev/null | grep QEMU >/dev/null 2>&1 &&
-           test $(uname -m) = i386
-       then
-           atf_skip "i386 ATF qemu kernel has no audio"
-       fi
+       (</dev/mixer) >/dev/null 2>&1 ||
+           atf_skip "no audio mixer available in kernel"
+
        for var in $(mixerctl -a | awk -F= '{print $1}'); do
                atf_check -s exit:0 -e ignore -o match:"^${var}=" \
                        mixerctl ${var}
@@ -37,11 +28,9 @@
        atf_set "descr" "Ensure 'mixerctl -n' actually suppresses some output"
 }
 nflag_body() {
-        if sysctl machdep.cpu_brand 2>/dev/null | grep QEMU >/dev/null 2>&1 &&
-           test $(uname -m) = i386
-       then
-           atf_skip "i386 ATF qemu kernel has no audio"
-       fi
+       (</dev/mixer) >/dev/null 2>&1 ||
+           atf_skip "no audio mixer available in kernel"
+
        varname="$(mixerctl -a | sed -e 's/=.*//' -e q)"
 
        atf_check -s exit:0 -o match:"${varname}" -e ignore \
@@ -57,7 +46,7 @@
 }
 nonexistant_device_body() {
        atf_check -s not-exit:0  -o ignore -e match:"No such file" \
-               mixerctl -d /a/b/c/d/e
+               mixerctl -a -d /a/b/c/d/e
 }
 
 atf_init_test_cases() {



Home | Main Index | Thread Index | Old Index