comparison tests/test-transforms-basic/test-transforms-basic.sh @ 122:eb0f3a2029b8

Merge from test-reorg branch
author Chris Cannam
date Wed, 08 Oct 2014 15:38:48 +0100
parents 5200446bbc6b
children
comparison
equal deleted inserted replaced
117:5be4995f4029 122:eb0f3a2029b8
1 #!/bin/bash
2
3 . ../include.sh
4
5 infile=$audiopath/3clicks8.wav
6 tmpfile1=$mypath/tmp_1_$$
7 tmpfile2=$mypath/tmp_2_$$
8
9 trap "rm -f $tmpfile1 $tmpfile2" 0
10
11 $r --skeleton $percplug > $tmpfile1 2>/dev/null || \
12 fail "Fails to run with --skeleton $percplug"
13
14 $r -t $tmpfile1 -w csv --csv-stdout $infile > $tmpfile2 2>/dev/null || \
15 fail "Fails to run with -t $tmpfile1 -w csv --csv-stdout $infile"
16
17 csvcompare $tmpfile2 $mypath/expected/skeleton-1.csv || \
18 faildiff "Output mismatch for skeleton-1.csv" $tmpfile2 $mypath/expected/skeleton-1.csv
19
20 for suffix in \
21 -no-parameters-default-output \
22 -no-parameters \
23 "" \
24 -start-and-duration \
25 -set-parameters \
26 -set-step-and-block-size \
27 -set-sample-rate \
28 -df-windowtype-default \
29 -df-windowtype-hanning \
30 -df-windowtype-hamming \
31 -df-start-and-duration \
32 -multiple-outputs \
33 -multiple-outputs-start-and-duration \
34 ; do
35
36 for type in xml n3 ; do
37
38 transform=$mypath/transforms/percussiononsets$suffix.$type
39 expected=$mypath/expected/percussiononsets$suffix.csv
40
41 if [ ! -f $transform ]; then
42 if [ $type = "xml" ]; then
43 continue # not everything can be expressed in the XML
44 # format, e.g. the multiple output test can't
45 fi
46 fi
47
48 test -f $transform || \
49 fail "Internal error: no transforms file for suffix $suffix (looking for $transform)"
50
51 test -f $expected || \
52 fail "Internal error: no expected output file for suffix $suffix (looking for $expected)"
53
54 $r -t $transform -w csv --csv-stdout $infile > $tmpfile2 2>/dev/null || \
55 fail "Fails to run transform $transform"
56
57 csvcompare $tmpfile2 $expected || \
58 faildiff "Output mismatch for transform $transform" $tmpfile2 $expected
59 done
60 done
61
62 # Check we can't run with multiple transforms if one or more is missing!
63
64 $r -t $mypath/transforms/percussiononsets-set-step-and-block-size.n3 \
65 -t $mypath/transforms/squiggly.n3 \
66 -t $mypath/transforms/percussiononsets-start-and-duration.n3 \
67 -w csv --csv-stdout $infile > $tmpfile2 2>/dev/null && \
68 fail "Incorrectly seems to succeed in running with a missing transform file"
69
70
71 # Check we can run with multiple transforms if they're all present
72
73 $r -t $mypath/transforms/percussiononsets-set-step-and-block-size.n3 \
74 -t $mypath/transforms/percussiononsets-set-parameters.xml \
75 -t $mypath/transforms/percussiononsets-start-and-duration.n3 \
76 -w csv --csv-stdout $infile > $tmpfile2 2>/dev/null || \
77 fail "Fails to run with multiple transforms"
78
79 csvcompare $tmpfile2 $mypath/expected/multiple.csv || \
80 faildiff "Output mismatch for multiple transforms" $tmpfile2 $mypath/expected/multiple.csv
81
82 exit 0
83