comparison tests/test-multiple-audio/test-multiple-audio.sh @ 288:fd4a6183482f kapoor_1202

Merge from branch piper-nopiper. The next release will be based on this.
author Chris Cannam
date Fri, 02 Dec 2016 10:04:44 +0000
parents c8162c2992f8
children
comparison
equal deleted inserted replaced
259:9e7d180be225 288:fd4a6183482f
5 tmpfile1=$mypath/tmp_1_$$ 5 tmpfile1=$mypath/tmp_1_$$
6 tmpfile2=$mypath/tmp_2_$$ 6 tmpfile2=$mypath/tmp_2_$$
7 7
8 trap "rm -f $tmpfile1 $tmpfile2" 0 8 trap "rm -f $tmpfile1 $tmpfile2" 0
9 9
10 transform=$mypath/transforms/detectionfunction.n3 10 transform=$mypath/transforms/af.n3
11 11
12 urlbase=http://vamp-plugins.org/sonic-annotator/testfiles 12 urlbase=http://vamp-plugins.org/sonic-annotator/testfiles
13 13
14 have_network=yes 14 have_network=yes
15 if ! ping -c 1 8.8.8.8 2>/dev/null 1>&2 ; then 15 if ! ping -c 1 8.8.8.8 2>/dev/null 1>&2 ; then
22 22
23 # Note, the output here depends on all the audio files present -- we 23 # Note, the output here depends on all the audio files present -- we
24 # would have to regenerate it if we added more test audio files. Note 24 # would have to regenerate it if we added more test audio files. Note
25 # that the -r flag is not supposed to pick up playlist files, only 25 # that the -r flag is not supposed to pick up playlist files, only
26 # audio files 26 # audio files
27 $r -t $transform -w csv --csv-stdout -r --summary-only $audiopath > $tmpfile1 2>/dev/null || \ 27 $r -t $transform -w csv --csv-digits 3 --csv-stdout -r --summary-only $audiopath > $tmpfile1 2>/dev/null || \
28 fail "Fails to run transform $transform with recursive dir option" 28 fail "Fails to run transform $transform with recursive dir option"
29 29
30 expected=$mypath/expected/all-files 30 expected=$mypath/expected/all-files
31 csvcompare $tmpfile1 $expected.csv || \ 31 csvcompare $tmpfile1 $expected.csv || \
32 faildiff "Output mismatch for transform $transform with summaries and recursive dir option" $tmpfile1 $expected.csv 32 faildiff "Output mismatch for transform $transform with summaries and recursive dir option" $tmpfile1 $expected.csv
35 # 2. Local playlist file referring to local audio files 35 # 2. Local playlist file referring to local audio files
36 36
37 # Here we strip any leading path from the audio file in the output, 37 # Here we strip any leading path from the audio file in the output,
38 # because the playlist reader will have resolved files to absolute 38 # because the playlist reader will have resolved files to absolute
39 # paths and those will differ between systems 39 # paths and those will differ between systems
40 $r -t $transform -w csv --csv-stdout $audiopath/playlist.m3u --summary-only 2>/dev/null > "$tmpfile2" || \ 40 $r -t $transform -w csv --csv-digits 3 --csv-stdout $audiopath/playlist.m3u --summary-only 2>/dev/null > "$tmpfile2" || \
41 fail "Fails to run transform $transform with playlist input" 41 fail "Fails to run transform $transform with playlist input"
42 42
43 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1" 43 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1"
44 44
45 expected=$mypath/expected/playlist 45 expected=$mypath/expected/playlist
49 49
50 # 3. Multiple files supplied directly on command line 50 # 3. Multiple files supplied directly on command line
51 51
52 # Strip paths again, just so we can use the same output comparison 52 # Strip paths again, just so we can use the same output comparison
53 # file as above 53 # file as above
54 $r -t $transform -w csv --csv-stdout $audiopath/3clicks.mp3 $audiopath/6clicks.ogg --summary-only 2>/dev/null > $tmpfile2 || \ 54 $r -t $transform -w csv --csv-digits 3 --csv-stdout $audiopath/3clicks.mp3 $audiopath/6clicks.ogg --summary-only 2>/dev/null > $tmpfile2 || \
55 fail "Fails to run transform $transform with 2-file input" 55 fail "Fails to run transform $transform with 2-file input"
56 56
57 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1" 57 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1"
58 58
59 expected=$mypath/expected/playlist 59 expected=$mypath/expected/playlist
61 faildiff "Output mismatch for transform $transform with summaries and 2-file input" $tmpfile1 $expected.csv 61 faildiff "Output mismatch for transform $transform with summaries and 2-file input" $tmpfile1 $expected.csv
62 62
63 63
64 # 4. Multiple files supplied directly on command line, with file: URL 64 # 4. Multiple files supplied directly on command line, with file: URL
65 65
66 $r -t $transform -w csv --csv-stdout $audiopath/3clicks.mp3 file://`pwd`/$audiopath/6clicks.ogg --summary-only 2>/dev/null > $tmpfile2 || \ 66 $r -t $transform -w csv --csv-digits 3 --csv-stdout $audiopath/3clicks.mp3 file://`pwd`/$audiopath/6clicks.ogg --summary-only 2>/dev/null > $tmpfile2 || \
67 fail "Fails to run transform $transform with 2-file input" 67 fail "Fails to run transform $transform with 2-file input"
68 68
69 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1" 69 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1"
70 70
71 expected=$mypath/expected/playlist 71 expected=$mypath/expected/playlist
75 75
76 if [ "$have_network" = "yes" ]; then 76 if [ "$have_network" = "yes" ]; then
77 77
78 # 5. Remote playlist file referring to remote audio files 78 # 5. Remote playlist file referring to remote audio files
79 79
80 $r -t $transform -w csv --csv-stdout $urlbase/playlist.m3u --summary-only 2>/dev/null > $tmpfile2 || \ 80 $r -t $transform -w csv --csv-digits 3 --csv-stdout $urlbase/playlist.m3u --summary-only 2>/dev/null > $tmpfile2 || \
81 fail "Fails to run transform $transform with remote playlist input" 81 fail "Fails to run transform $transform with remote playlist input"
82 82
83 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1" 83 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1"
84 84
85 expected=$mypath/expected/playlist 85 expected=$mypath/expected/playlist
87 faildiff "Output mismatch for transform $transform with summaries and remote playlist input" $tmpfile1 $expected.csv 87 faildiff "Output mismatch for transform $transform with summaries and remote playlist input" $tmpfile1 $expected.csv
88 88
89 89
90 # 6. Local playlist file referring to mixture of remote and local audio files 90 # 6. Local playlist file referring to mixture of remote and local audio files
91 91
92 $r -t $transform -w csv --csv-stdout $audiopath/remote-playlist.m3u --summary-only 2>/dev/null > $tmpfile2 || \ 92 $r -t $transform -w csv --csv-digits 3 --csv-stdout $audiopath/remote-playlist.m3u --summary-only 2>/dev/null > $tmpfile2 || \
93 fail "Fails to run transform $transform with playlist of remote files" 93 fail "Fails to run transform $transform with playlist of remote files"
94 94
95 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1" 95 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1"
96 96
97 expected=$mypath/expected/playlist 97 expected=$mypath/expected/playlist
99 faildiff "Output mismatch for transform $transform with summaries and remote playlist input" $tmpfile1 $expected.csv 99 faildiff "Output mismatch for transform $transform with summaries and remote playlist input" $tmpfile1 $expected.csv
100 100
101 101
102 # 7. Multiple remote files supplied directly on command line 102 # 7. Multiple remote files supplied directly on command line
103 103
104 $r -t $transform -w csv --csv-stdout $urlbase/3clicks.mp3 $urlbase/6clicks.ogg --summary-only 2>/dev/null > $tmpfile2 || \ 104 $r -t $transform -w csv --csv-digits 3 --csv-stdout $urlbase/3clicks.mp3 $urlbase/6clicks.ogg --summary-only 2>/dev/null > $tmpfile2 || \
105 fail "Fails to run transform $transform with 2-file remote input" 105 fail "Fails to run transform $transform with 2-file remote input"
106 106
107 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1" 107 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1"
108 108
109 expected=$mypath/expected/playlist 109 expected=$mypath/expected/playlist
111 faildiff "Output mismatch for transform $transform with summaries and 2-file input" $tmpfile1 $expected.csv 111 faildiff "Output mismatch for transform $transform with summaries and 2-file input" $tmpfile1 $expected.csv
112 112
113 113
114 # 8. Mixture of remote and local files supplied on command line 114 # 8. Mixture of remote and local files supplied on command line
115 115
116 $r -t $transform -w csv --csv-stdout $audiopath/3clicks.mp3 $urlbase/6clicks.ogg --summary-only 2>/dev/null > $tmpfile2 || \ 116 $r -t $transform -w csv --csv-digits 3 --csv-stdout $audiopath/3clicks.mp3 $urlbase/6clicks.ogg --summary-only 2>/dev/null > $tmpfile2 || \
117 fail "Fails to run transform $transform with 2-file remote input" 117 fail "Fails to run transform $transform with 2-file remote input"
118 118
119 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1" 119 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1"
120 120
121 expected=$mypath/expected/playlist 121 expected=$mypath/expected/playlist
124 124
125 fi 125 fi
126 126
127 # 9. As 3, but multiplexing rather than extracting separately from each file 127 # 9. As 3, but multiplexing rather than extracting separately from each file
128 128
129 $r -t $transform --multiplex -w csv --csv-stdout $audiopath/3clicks.mp3 $audiopath/6clicks.ogg --summary-only 2>/dev/null > $tmpfile2 || \ 129 $r -t $transform --multiplex --csv-digits 3 -w csv --csv-stdout $audiopath/3clicks.mp3 $audiopath/6clicks.ogg --summary-only 2>/dev/null > $tmpfile2 || \
130 fail "Fails to run transform $transform with 2-file input" 130 fail "Fails to run transform $transform with 2-file input"
131 131
132 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1" 132 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1"
133 133
134 expected=$mypath/expected/multiplexed 134 expected=$mypath/expected/multiplexed