Add t0003-writer-init-error-path.sh.
[paraslash.git] / t / t0003-writer-init-error-path.sh
diff --git a/t/t0003-writer-init-error-path.sh b/t/t0003-writer-init-error-path.sh
new file mode 100755 (executable)
index 0000000..15f1dd8
--- /dev/null
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+test_description='Check if alsa_init() failures are handled gracefully.
+
+Older parasslash versions contained a bug which caused para_write and para_audiod
+to abort if the alsa/oss device could not be opened. This test makes sure we
+will not introduce the same bug again.'
+
+. ${0%/*}/test-lib.sh
+
+for i in alsa oss; do
+       test_require_objects "${i}_write"
+       missing_objects="$result"
+       if [[ -n "$missing_objects" ]]; then
+               test_skip "$i" "missing object(s): $missing_objects"
+               continue
+       fi
+       test_expect_failure "$i" "
+               head -c 100 /dev/zero | $PARA_WRITE -w '$i -d /dev/non_existent'
+               "
+done
+test_done