Module Name:    src
Committed By:   kre
Date:           Thu Feb 23 14:01:37 UTC 2017

Modified Files:
        src/tests/usr.bin/mixerctl: t_mixerctl.sh

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 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.3 src/tests/usr.bin/mixerctl/t_mixerctl.sh:1.4
--- src/tests/usr.bin/mixerctl/t_mixerctl.sh:1.3	Thu Feb 23 02:28:10 2017
+++ src/tests/usr.bin/mixerctl/t_mixerctl.sh	Thu Feb 23 14:01:37 2017
@@ -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 @@ showvalue_head() {
 	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 @@ nflag_head() {
 	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_head() {
 }
 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() {

Reply via email to