[med-svn] [praat] 01/05: Run the unit tests provided in the upstream sources

Rafael Laboissiere rafael at debian.org
Fri Oct 6 03:55:13 UTC 2017


This is an automated email from the git hooks/post-receive script.

rafael pushed a commit to branch master
in repository praat.

commit d0fcf810d15267acb1180284fafdf373a24fae43
Author: Rafael Laboissiere <rafael at debian.org>
Date:   Thu Oct 5 05:44:29 2017 -0300

    Run the unit tests provided in the upstream sources
---
 debian/rules                        |   5 +---
 debian/tests/control                |   4 ++-
 debian/tests/data/test.wav          | Bin 84 -> 0 bytes
 debian/tests/run-tests              |  48 ++++++++++++++++++++++++++++++++++++
 debian/tests/script/read-sound-file |   1 -
 5 files changed, 52 insertions(+), 6 deletions(-)

diff --git a/debian/rules b/debian/rules
index 56ca3ea..ca6c927 100755
--- a/debian/rules
+++ b/debian/rules
@@ -81,10 +81,7 @@ override_dh_auto_install:
 	dh_auto_install -- INSTALL=
 
 override_dh_auto_test:
-	@for i in $$(find debian/tests/script/ -type f) ; do	\
-		echo -n "Checking $$i... " ;			\
-		./praat_nogui --run $$i && echo done ;		\
-	done
+	PRAAT=../praat debian/tests/run-tests
 
 get-orig-source:
 	uscan --verbose --force-download --repack-compression xz
diff --git a/debian/tests/control b/debian/tests/control
index 1968509..1e1e9d9 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -1 +1,3 @@
-Test-Command: praat_nogui --run debian/tests/script/read-sound-file
+Tests: run-tests
+Depends: @, xauth, xvfb
+Restrictions: allow-stderr
diff --git a/debian/tests/data/test.wav b/debian/tests/data/test.wav
deleted file mode 100644
index fa64a89..0000000
Binary files a/debian/tests/data/test.wav and /dev/null differ
diff --git a/debian/tests/run-tests b/debian/tests/run-tests
new file mode 100755
index 0000000..9ce0b8a
--- /dev/null
+++ b/debian/tests/run-tests
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+### Exercice the "unit tests" contained in the Praat scritps
+### distributed in the upstream sources.  For now, just the *.praat
+### scripts in the test/* directories are executed.
+
+### Allow specification of the Praat executable
+PRAAT=${PRAAT:-praat}
+
+### Take care of spaces in file names
+IFS='
+'
+
+### Initialize counters
+test_count=0
+test_ok=0
+
+### Loop over the directories in test/
+cd test
+for d in $(ls -d */) ; do
+
+    ## Skip directory manually/
+    if [ ${d%%/} != manually ] ; then
+
+        ## Loop over the file in the selected directory
+        for f in $(ls ${d%%/}/*.praat) ; do
+
+            ## Skip scripts that cannot be run from the command line
+	    if [ $f != sys/script2.praat		\
+	         -a $f != "fon ExperimentMFC/experimentMFC.praat" ] ; then
+		## Progress display
+                echo "===== $f"
+		## Increment test counter
+                test_count=$(($test_count + 1))
+		## Execute the test and increment ok counter if it succeeds
+                xvfb-run -a $PRAAT --run $f			\
+                    && test_ok=$(($test_ok + 1))	\
+	            || true
+            fi
+        done
+    fi
+done
+
+### Display test statistics
+echo "$test_count tests passed, $test_ok ok"
+
+### Exit with error in case of unit test failures
+[ $test_count = $test_ok ] || exit 1
diff --git a/debian/tests/script/read-sound-file b/debian/tests/script/read-sound-file
deleted file mode 100644
index b256534..0000000
--- a/debian/tests/script/read-sound-file
+++ /dev/null
@@ -1 +0,0 @@
-Read from file... ../data/test.wav

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/praat.git



More information about the debian-med-commit mailing list