aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/README.txt28
-rw-r--r--tests/msgfile/reentrant.pd41
-rwxr-xr-xtests/runtests.sh42
-rw-r--r--tests/runtests.txt6
4 files changed, 99 insertions, 18 deletions
diff --git a/tests/README.txt b/tests/README.txt
index 532fd50..f9cf45b 100644
--- a/tests/README.txt
+++ b/tests/README.txt
@@ -8,12 +8,15 @@ HOW TESTS WORK:
each test is a patch with one (1) inlet and one (1) outlet.
a bang is sent to the inlet to start the test.
the test has to send "1" to the outlet if the test succeeded.
-any other result (be it !=1 or no result at all will be
-considered a failure of the test.
+any other result will be considered a failure of the test.
+the test MUST return a result, else it will halt the entire
+testrun. (this is needed to allow objects that do not return
+in zero-time (signal-objects or other timed objects) to be
+tested with this framework too)
example tests of [==]:
-test1:
+GOOD test:
[inlet]
|
[10 10(
@@ -22,7 +25,7 @@ test1:
|
[outlet]
-test2:
+BAD test (will hang forever):
[inlet]
|
[10 10.1(
@@ -38,10 +41,11 @@ test2:
HOW THE FRAMEWORK WORKS
-----------------------
-only .pd-files in one-level-subdirectories are considered tests.
-(e.g. ./subdir/patch1.pd is tested, while ./patch2.pd and
-./sub/dir/patch3.pd are not taken into account)
-see directory layout below
+all .pd-files in one-level-subdirectories are considered tests.
+e.g. ./subdir/patch1.pd is tested, while ./patch2.pd and
+./sub/dir/patch3.pd are not taken into account
+this is important if you need abstractions for your test
+
at the beginning of the testrun a file "runtests.txt" is generated
which contains all test-patches, one per line and each line
terminated by semicolon.
@@ -57,8 +61,12 @@ this logfile is printed to the stdout after pd quit.
CAVEATS
=======
- no testing of signal objects
- no testing of timed objects
+ pd-0.40 has problems creating an path-prefixed abstraction when a
+ library of the same name is already loaded.
+ e.g. if the library "zexy" is loaded, then the abstraction ./path/zexy.pd
+ CANNOT be instantiated as object [./path/zexy];
+ this seems to be fixed in newer versions of pd
+
diff --git a/tests/msgfile/reentrant.pd b/tests/msgfile/reentrant.pd
new file mode 100644
index 0000000..b9b49a7
--- /dev/null
+++ b/tests/msgfile/reentrant.pd
@@ -0,0 +1,41 @@
+#N canvas 400 106 550 495 10;
+#X obj 91 117 inlet bang;
+#X obj 91 410 outlet result;
+#X obj 91 138 t b b b;
+#X obj 91 380 i;
+#X text 57 56 when the outlet of [msgfile] is used to trigger the object
+\, the same line will be output again and again instead of advancing
+to the next line.;
+#X obj 109 252 msgfile;
+#X obj 79 270 t b l;
+#X msg 109 186 bang;
+#X msg 157 183 clear \, add line #1 \, add line #2 \, add end-of-the-world
+\, rewind;
+#X obj 104 287 route symbol;
+#X obj 104 304 symbol;
+#X obj 104 324 select end-of-the-world;
+#X msg 104 344 1;
+#X msg 133 344 0;
+#X obj 171 305 t b;
+#X obj 104 360 t f;
+#X obj 109 157 t b b;
+#X connect 0 0 2 0;
+#X connect 2 0 3 0;
+#X connect 2 1 16 0;
+#X connect 2 2 13 0;
+#X connect 3 0 1 0;
+#X connect 5 0 6 0;
+#X connect 6 0 5 0;
+#X connect 6 1 9 0;
+#X connect 7 0 5 0;
+#X connect 8 0 5 0;
+#X connect 9 0 10 0;
+#X connect 9 1 14 0;
+#X connect 10 0 11 0;
+#X connect 11 0 12 0;
+#X connect 12 0 15 0;
+#X connect 13 0 15 0;
+#X connect 14 0 13 0;
+#X connect 15 0 3 1;
+#X connect 16 0 7 0;
+#X connect 16 1 8 0;
diff --git a/tests/runtests.sh b/tests/runtests.sh
index e8ce302..fa2128b 100755
--- a/tests/runtests.sh
+++ b/tests/runtests.sh
@@ -16,23 +16,53 @@ SUFFIX=$(date +%y%m%d-%H%M%S)
RUNTESTS_TXT=runtests.txt
RUNTESTS_LOG=log-runtests.${SUFFIX}
-ls -1 */*.pd | sed 's/\.pd/;/' > ${RUNTESTS_TXT}
+LIBFLAGS="-path ../src:../ -lib zexy -path ../abs/"
+function list_tests() {
+# find . -mindepth 2 -name "*.pd" | sed 's|\.pd$|;|'
+ ls -1 */*.pd | sed 's|\.pd$|;|'
+}
+
+function debug() {
+ :
+# echo $@
+}
+
+
+function evaluate_tests() {
+ local logfile
+ local testfile
+ local numtests
+
+ testfile=$1
+ logfile=$2
+
+ debug "now evaluating results in ${logfile} (${testfile}"
+
+ numtests=$(grep -c . ${testfile})
+ debug "number of tests = ${numtests}"
+ echo "regression-test: ${numtests} tests total" >> ${logfile}
+ debug "show results"
+ cat ${logfile} | egrep "^regression-test: " | sed -e 's/^regression-test: //'
+}
-LIBFLAGS="-path ../src:../ -lib zexy -path ../abs/"
function run_nogui() {
+ debug "running test without gui"
${PD} ${LIBFLAGS} -nogui runtests_nogui.pd > ${RUNTESTS_LOG} 2>&1
- NUMTESTS=`grep -c . ${RUNTESTS_TXT}`
- echo "regression-test: ${NUMTESTS} tests total" >> ${RUNTESTS_LOG}
-
- cat ${RUNTESTS_LOG} | egrep "^regression-test: " | sed -e 's/^regression-test: //'
+ debug "testing done"
+ evaluate_tests ${RUNTESTS_TXT} ${RUNTESTS_LOG}
+ debug "testing finished"
}
function run_withgui() {
+ debug "running test with gui"
${PD} ${LIBFLAGS} -stderr runtests.pd > ${RUNTESTS_LOG} 2>&1
+ debug "testing completed, no evaluation will be done; see ${RUNTESTS_LOG} for results"
}
+list_tests > ${RUNTESTS_TXT}
+
if test "x$1" = "x-gui"; then
run_withgui
else
diff --git a/tests/runtests.txt b/tests/runtests.txt
index f20bd01..d67531d 100644
--- a/tests/runtests.txt
+++ b/tests/runtests.txt
@@ -12,8 +12,8 @@ help-msg/avg~;
help-msg/blockmirror~;
help-msg/blockswap~;
help-msg/date;
-help-msg/demultiplex;
help-msg/demultiplex~;
+help-msg/demultiplex;
help-msg/dfreq~;
help-msg/dirac~;
help-msg/drip;
@@ -33,8 +33,8 @@ help-msg/mavg;
help-msg/minmax;
help-msg/msgfile;
help-msg/multiline~;
-help-msg/multiplex;
help-msg/multiplex~;
+help-msg/multiplex;
help-msg/niagara;
help-msg/noish~;
help-msg/noisi~;
@@ -66,8 +66,10 @@ help-msg/time;
help-msg/unpack~;
help-msg/urn;
help-msg/wrap;
+help-msg/zexy;
help-msg/z~;
l2s/argument;
l2s/delimiter;
+msgfile/reentrant;
repeat/noargs;
s2l/numsymbols;