]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - t/t0002-oggdec-performance.sh
First draft of a test-suite.
[paraslash.git] / t / t0002-oggdec-performance.sh
diff --git a/t/t0002-oggdec-performance.sh b/t/t0002-oggdec-performance.sh
new file mode 100755 (executable)
index 0000000..d496a3e
--- /dev/null
@@ -0,0 +1,39 @@
+#!/usr/bin/env bash
+
+test_description='Measure time to decode ogg/vorbis files.
+
+Executes para_filter -f oggdec on the test files provided by the
+test suite and fails if it takes much longer than the reference
+implementation.'
+
+. ${0%/*}/test-lib.sh
+
+test_require_objects "oggdec_filter"
+missing_objects="$result"
+
+get_audio_file_paths ogg
+oggs="$result"
+
+test_require_executables "oggdec"
+missing_executables="$result"
+
+for ogg in $oggs; do
+       if [[ -n "$missing_objects" ]]; then
+               test_skip "${ogg##*/}" "missing object(s): $missing_objects"
+               continue
+       fi
+       if [[ -n "$missing_executables" ]]; then
+               test_skip "${ogg##*/}" \
+                       "missing executables(s): $missing_executables"
+               continue
+       fi
+       test_expect_success "${ogg##*/}" '
+               test_duration oggdec --quiet --raw --output - - < $ogg &&
+               t1=$result &&
+               test_duration $PARA_FILTER -f oggdec < $ogg &&
+               t2=$result &&
+               echo "oggdec: $t1, para_filter: $t2"
+               (($t2 <= $t1 * 3 / 2 + 100))
+       '
+done
+test_done