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 Correct oversight in previous ... red...



details:   https://anonhg.NetBSD.org/src/rev/ab69e655e988
branches:  trunk
changeset: 355322:ab69e655e988
user:      kre <kre%NetBSD.org@localhost>
date:      Tue Jul 25 21:25:03 2017 +0000

description:
Correct oversight in previous ... redirecting into a compound statement
causes the shell to exit if the redirect fails (posix says "may exit"
and /bin/sh does - maybe should give that more thought) - which will
happen if /dev/pad0 does not exist, causing a very messy test abort
(the shell running the test is not supposed to just go away).  So
check tha the device exista and is readable before attempting to open it.

Problem brought to my attention by nat@ - thanks...

diffstat:

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

diffs (19 lines):

diff -r 13804d889140 -r ab69e655e988 tests/usr.bin/mixerctl/t_mixerctl.sh
--- a/tests/usr.bin/mixerctl/t_mixerctl.sh      Tue Jul 25 19:44:25 2017 +0000
+++ b/tests/usr.bin/mixerctl/t_mixerctl.sh      Tue Jul 25 21:25:03 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_mixerctl.sh,v 1.8 2017/07/18 13:17:37 kre Exp $
+# $NetBSD: t_mixerctl.sh,v 1.9 2017/07/25 21:25:03 kre Exp $
 
 audio_setup() {
        # Open /dev/pad0 so we have a configured audio device.
@@ -21,7 +21,8 @@
        # variables, we would need to put $padpid in a file.)
 
        unset padpid
-       { { cat >/dev/null & } < /dev/pad0 ; } 2>/dev/null && padpid=$!
+       test -r /dev/pad0 && 
+           { { cat >/dev/null & } < /dev/pad0 ; } 2>/dev/null && padpid=$!
 
        (</dev/mixer) >/dev/null 2>&1 ||
            atf_skip "no audio mixer available in kernel"



Home | Main Index | Thread Index | Old Index