# $NetBSD: t_mixerctl.sh,v 1.1 2017/01/02 15:40:09 christos Exp $ atf_test_case noargs_usage proc noargs_usage_head { atf_set "descr" "Ensure mixerctl(1) with no args prints a usage message" } proc noargs_usage_body { atf_check -s exit:0 -o not-empty -e ignore \ mixerctl } atf_test_case showvalue proc showvalue_head { atf_set "descr" "Ensure mixerctl(1) can print the value for all variables" } proc showvalue_body { for var in [$[mixerctl -a | awk -F= '{print $1}]] { atf_check -s exit:0 -e ignore -o match:"^$(var)=" \ mixerctl $(var) } } atf_test_case nflag proc nflag_head { atf_set "descr" "Ensure 'mixerctl -n' actually suppresses some output" } proc nflag_body { setglobal 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 proc nonexistant_device_head { atf_set "descr" "Ensure mixerctl(1) complains if provided a nonexistant mixer device" } proc nonexistant_device_body { atf_check -s not-exit:0 -o ignore -e match:"No such file" \ mixerctl -d /a/b/c/d/e } proc 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 }