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 Skip most of the mixerctl tests when ...



details:   https://anonhg.NetBSD.org/src/rev/274b660eb9e2
branches:  trunk
changeset: 351700:274b660eb9e2
user:      kre <kre%NetBSD.org@localhost>
date:      Thu Feb 23 02:09:24 2017 +0000

description:
Skip most of the mixerctl tests when running under QEMU (assumed to be for ATF)
as the kernel that runs them has no audio (and no mixers) configured.

The usage message test might be returned some day if /usr/bin/mixerctl
gets modified so it doesn't attempt to open the device (and error out)
in cases where the device isn't actually going to be used (and -d wasn't
given to set the device name explicitly).

diffstat:

 tests/usr.bin/mixerctl/t_mixerctl.sh |  18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diffs (45 lines):

diff -r cd3183fb8068 -r 274b660eb9e2 tests/usr.bin/mixerctl/t_mixerctl.sh
--- a/tests/usr.bin/mixerctl/t_mixerctl.sh      Thu Feb 23 02:05:30 2017 +0000
+++ b/tests/usr.bin/mixerctl/t_mixerctl.sh      Thu Feb 23 02:09:24 2017 +0000
@@ -1,10 +1,16 @@
-# $NetBSD: t_mixerctl.sh,v 1.1 2017/01/02 15:40:09 christos Exp $
+# $NetBSD: t_mixerctl.sh,v 1.2 2017/02/23 02:09:24 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
+       then
+           # better would be for mixerctl to not open the device...
+           # but for now, it does.
+           atf_skip "ATF qemu kernel has no audio"
+       fi
        atf_check -s exit:0 -o not-empty -e ignore \
                mixerctl
 }
@@ -14,6 +20,10 @@
        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
+       then
+           atf_skip "ATF qemu kernel has no audio"
+       fi
        for var in $(mixerctl -a | awk -F= '{print $1}'); do
                atf_check -s exit:0 -e ignore -o match:"^${var}=" \
                        mixerctl ${var}
@@ -25,7 +35,11 @@
        atf_set "descr" "Ensure 'mixerctl -n' actually suppresses some output"
 }
 nflag_body() {
-       varname="$(mixerctl -a | head -1 | awk -F= '{print $1}')"
+        if sysctl machdep.cpu_brand 2>/dev/null | grep QEMU >/dev/null 2>&1
+       then
+           atf_skip "ATF qemu kernel has no audio"
+       fi
+       varname="$(mixerctl -a | sed -e 's/=.*//' -e q)"
 
        atf_check -s exit:0 -o match:"${varname}" -e ignore \
                mixerctl ${varname}



Home | Main Index | Thread Index | Old Index