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 tests from Charlotte Koch



details:   https://anonhg.NetBSD.org/src/rev/98a1f52dd141
branches:  trunk
changeset: 820170:98a1f52dd141
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Jan 02 15:40:09 2017 +0000

description:
mixerctl tests from Charlotte Koch

diffstat:

 tests/usr.bin/Makefile               |   4 +-
 tests/usr.bin/mixerctl/Makefile      |   8 +++++
 tests/usr.bin/mixerctl/t_mixerctl.sh |  51 ++++++++++++++++++++++++++++++++++++
 3 files changed, 61 insertions(+), 2 deletions(-)

diffs (85 lines):

diff -r 05df3ffd302f -r 98a1f52dd141 tests/usr.bin/Makefile
--- a/tests/usr.bin/Makefile    Mon Jan 02 14:28:29 2017 +0000
+++ b/tests/usr.bin/Makefile    Mon Jan 02 15:40:09 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.22 2016/10/22 14:13:39 abhinav Exp $
+#      $NetBSD: Makefile,v 1.23 2017/01/02 15:40:09 christos Exp $
 #
 
 .include <bsd.own.mk>
@@ -7,7 +7,7 @@
 
 TESTS_SUBDIRS= awk basename bzip2 cc cmp config cut \
                diff dirname find gdb grep gzip id \
-               infocmp jot ld m4 make mkdep \
+               infocmp jot ld m4 make mixerctl mkdep \
                nbperf netpgpverify pr rump_server shmif_dumpbus sdiff \
                sed sort tmux tr unifdef uniq vmstat xlint
 
diff -r 05df3ffd302f -r 98a1f52dd141 tests/usr.bin/mixerctl/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/mixerctl/Makefile   Mon Jan 02 15:40:09 2017 +0000
@@ -0,0 +1,8 @@
+# $NetBSD: Makefile,v 1.1 2017/01/02 15:40:09 christos Exp $
+
+.include <bsd.own.mk>
+
+TESTSDIR=      ${TESTSBASE}/usr.bin/mixerctl
+TESTS_SH=      t_mixerctl
+
+.include <bsd.test.mk>
diff -r 05df3ffd302f -r 98a1f52dd141 tests/usr.bin/mixerctl/t_mixerctl.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/mixerctl/t_mixerctl.sh      Mon Jan 02 15:40:09 2017 +0000
@@ -0,0 +1,51 @@
+# $NetBSD: t_mixerctl.sh,v 1.1 2017/01/02 15:40:09 christos 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() {
+       atf_check -s exit:0 -o not-empty -e ignore \
+               mixerctl
+}
+
+atf_test_case showvalue
+showvalue_head() {
+       atf_set "descr" "Ensure mixerctl(1) can print the value for all variables"
+}
+showvalue_body() {
+       for var in $(mixerctl -a | awk -F= '{print $1}'); do
+               atf_check -s exit:0 -e ignore -o match:"^${var}=" \
+                       mixerctl ${var}
+       done
+}
+
+atf_test_case nflag
+nflag_head() {
+       atf_set "descr" "Ensure 'mixerctl -n' actually suppresses some output"
+}
+nflag_body() {
+       varname="$(mixerctl -a | head -1 | awk -F= '{print $1}')"
+
+       atf_check -s exit:0 -o match:"${varname}" -e ignore \
+               mixerctl ${varname}
+
+       atf_check -s exit:0 -o not-match:"${varname}" -e ignore \
+               mixerctl -n ${varname}
+}
+
+atf_test_case nonexistant_device
+nonexistant_device_head() {
+       atf_set "descr" "Ensure mixerctl(1) complains if provided a nonexistant mixer device"
+}
+nonexistant_device_body() {
+       atf_check -s not-exit:0  -o ignore -e match:"No such file" \
+               mixerctl -d /a/b/c/d/e
+}
+
+atf_init_test_cases() {
+       atf_add_test_case noargs_usage
+       atf_add_test_case showvalue
+       atf_add_test_case nflag
+       atf_add_test_case nonexistant_device
+}



Home | Main Index | Thread Index | Old Index