Mercurial > hg > sonic-annotator
comparison tests/test-multiple-audio/test-multiple-audio.sh @ 233:9a10c3ffff47
Update summary code and tests -- fix multiple outputs when requesting both summary and non-summary for the same output; and values have been changed because of the coded file cache bit depth change. Also skip network-dependent tests if there is no network.
author | Chris Cannam |
---|---|
date | Thu, 25 Feb 2016 18:19:27 +0000 |
parents | dc82579c9a26 |
children | cee5cab9c85d |
comparison
equal
deleted
inserted
replaced
232:e2519bd033e7 | 233:9a10c3ffff47 |
---|---|
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 . ../include.sh | 3 . ../include.sh |
4 | 4 |
5 tmpfile=$mypath/tmp_1_$$ | 5 tmpfile1=$mypath/tmp_1_$$ |
6 tmpfile2=$mypath/tmp_2_$$ | |
6 | 7 |
7 trap "rm -f $tmpfile" 0 | 8 trap "rm -f $tmpfile1 $tmpfile2" 0 |
8 | 9 |
9 transform=$mypath/transforms/detectionfunction.n3 | 10 transform=$mypath/transforms/detectionfunction.n3 |
10 | 11 |
11 urlbase=http://vamp-plugins.org/sonic-annotator/testfiles | 12 urlbase=http://vamp-plugins.org/sonic-annotator/testfiles |
13 | |
14 have_network=yes | |
15 if ! ping -c 1 8.8.8.8 2>/dev/null ; then | |
16 echo "(network appears unavailable, skipping networking tests)" | |
17 have_network=no | |
18 fi | |
12 | 19 |
13 | 20 |
14 # 1. Recursive local directory | 21 # 1. Recursive local directory |
15 | 22 |
16 # 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 |
17 # 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 |
18 # 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 |
19 # audio files | 26 # audio files |
20 $r -t $transform -w csv --csv-stdout -r --summary-only $audiopath > $tmpfile 2>/dev/null || \ | 27 $r -t $transform -w csv --csv-stdout -r --summary-only $audiopath > $tmpfile1 2>/dev/null || \ |
21 fail "Fails to run transform $transform with recursive dir option" | 28 fail "Fails to run transform $transform with recursive dir option" |
22 | 29 |
23 expected=$mypath/expected/all-files | 30 expected=$mypath/expected/all-files |
24 csvcompare $tmpfile $expected.csv || \ | 31 csvcompare $tmpfile1 $expected.csv || \ |
25 faildiff "Output mismatch for transform $transform with summaries and recursive dir option" $tmpfile $expected.csv | 32 faildiff "Output mismatch for transform $transform with summaries and recursive dir option" $tmpfile $expected.csv |
26 | 33 |
27 | 34 |
28 # 2. Local playlist file referring to local audio files | 35 # 2. Local playlist file referring to local audio files |
29 | 36 |
30 # 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, |
31 # because the playlist reader will have resolved files to absolute | 38 # because the playlist reader will have resolved files to absolute |
32 # paths and those will differ between systems | 39 # paths and those will differ between systems |
33 $r -t $transform -w csv --csv-stdout $audiopath/playlist.m3u --summary-only 2>/dev/null | sed 's,^"[^"]*/,",' > $tmpfile || \ | 40 $r -t $transform -w csv --csv-stdout $audiopath/playlist.m3u --summary-only 2>/dev/null > "$tmpfile2" || \ |
34 fail "Fails to run transform $transform with playlist input" | 41 fail "Fails to run transform $transform with playlist input" |
35 | 42 |
43 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1" | |
44 | |
36 expected=$mypath/expected/playlist | 45 expected=$mypath/expected/playlist |
37 csvcompare $tmpfile $expected.csv || \ | 46 csvcompare $tmpfile1 $expected.csv || \ |
38 faildiff "Output mismatch for transform $transform with summaries and playlist input" $tmpfile $expected.csv | 47 faildiff "Output mismatch for transform $transform with summaries and playlist input" $tmpfile1 $expected.csv |
39 | 48 |
40 | 49 |
41 # 3. Multiple files supplied directly on command line | 50 # 3. Multiple files supplied directly on command line |
42 | 51 |
43 # 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 |
44 # file as above | 53 # file as above |
45 $r -t $transform -w csv --csv-stdout $audiopath/3clicks.mp3 $audiopath/6clicks.ogg --summary-only 2>/dev/null | sed 's,^"[^"]*/,",' > $tmpfile || \ | 54 $r -t $transform -w csv --csv-stdout $audiopath/3clicks.mp3 $audiopath/6clicks.ogg --summary-only 2>/dev/null > $tmpfile2 || \ |
46 fail "Fails to run transform $transform with 2-file input" | 55 fail "Fails to run transform $transform with 2-file input" |
47 | 56 |
57 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1" | |
58 | |
48 expected=$mypath/expected/playlist | 59 expected=$mypath/expected/playlist |
49 csvcompare $tmpfile $expected.csv || \ | 60 csvcompare $tmpfile1 $expected.csv || \ |
50 faildiff "Output mismatch for transform $transform with summaries and 2-file input" $tmpfile $expected.csv | 61 faildiff "Output mismatch for transform $transform with summaries and 2-file input" $tmpfile1 $expected.csv |
51 | 62 |
52 | 63 |
53 # 4. Multiple files supplied directly on command line, with file: URL | 64 # 4. Multiple files supplied directly on command line, with file: URL |
54 | 65 |
55 $r -t $transform -w csv --csv-stdout $audiopath/3clicks.mp3 file://`pwd`/$audiopath/6clicks.ogg --summary-only 2>/dev/null | sed 's,^"[^"]*/,",' > $tmpfile || \ | 66 $r -t $transform -w csv --csv-stdout $audiopath/3clicks.mp3 file://`pwd`/$audiopath/6clicks.ogg --summary-only 2>/dev/null > $tmpfile2 || \ |
56 fail "Fails to run transform $transform with 2-file input" | 67 fail "Fails to run transform $transform with 2-file input" |
57 | 68 |
69 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1" | |
70 | |
58 expected=$mypath/expected/playlist | 71 expected=$mypath/expected/playlist |
59 csvcompare $tmpfile $expected.csv || \ | 72 csvcompare $tmpfile1 $expected.csv || \ |
60 faildiff "Output mismatch for transform $transform with summaries and 2-file input using file:// URL" $tmpfile $expected.csv | 73 faildiff "Output mismatch for transform $transform with summaries and 2-file input using file:// URL" $tmpfile1 $expected.csv |
61 | 74 |
62 | 75 |
63 # 5. Remote playlist file referring to remote audio files | 76 if [ "$have_network" = "yes" ]; then |
64 | 77 |
65 $r -t $transform -w csv --csv-stdout $urlbase/playlist.m3u --summary-only 2>/dev/null | sed 's,^"[^"]*/,",' > $tmpfile || \ | 78 # 5. Remote playlist file referring to remote audio files |
66 fail "Fails to run transform $transform with remote playlist input" | |
67 | 79 |
68 expected=$mypath/expected/playlist | 80 $r -t $transform -w csv --csv-stdout $urlbase/playlist.m3u --summary-only 2>/dev/null > $tmpfile2 || \ |
69 csvcompare $tmpfile $expected.csv || \ | 81 fail "Fails to run transform $transform with remote playlist input" |
70 faildiff "Output mismatch for transform $transform with summaries and remote playlist input" $tmpfile $expected.csv | 82 |
83 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1" | |
84 | |
85 expected=$mypath/expected/playlist | |
86 csvcompare $tmpfile1 $expected.csv || \ | |
87 faildiff "Output mismatch for transform $transform with summaries and remote playlist input" $tmpfile1 $expected.csv | |
71 | 88 |
72 | 89 |
73 # 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 |
74 | 91 |
75 $r -t $transform -w csv --csv-stdout $audiopath/remote-playlist.m3u --summary-only 2>/dev/null | sed 's,^"[^"]*/,",' > $tmpfile || \ | 92 $r -t $transform -w csv --csv-stdout $audiopath/remote-playlist.m3u --summary-only 2>/dev/null > $tmpfile2 || \ |
76 fail "Fails to run transform $transform with playlist of remote files" | 93 fail "Fails to run transform $transform with playlist of remote files" |
77 | 94 |
78 expected=$mypath/expected/playlist | 95 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1" |
79 csvcompare $tmpfile $expected.csv || \ | 96 |
80 faildiff "Output mismatch for transform $transform with summaries and remote playlist input" $tmpfile $expected.csv | 97 expected=$mypath/expected/playlist |
98 csvcompare $tmpfile1 $expected.csv || \ | |
99 faildiff "Output mismatch for transform $transform with summaries and remote playlist input" $tmpfile1 $expected.csv | |
81 | 100 |
82 | 101 |
83 # 7. Multiple remote files supplied directly on command line | 102 # 7. Multiple remote files supplied directly on command line |
84 | 103 |
85 $r -t $transform -w csv --csv-stdout $urlbase/3clicks.mp3 $urlbase/6clicks.ogg --summary-only 2>/dev/null | sed 's,^"[^"]*/,",' > $tmpfile || \ | 104 $r -t $transform -w csv --csv-stdout $urlbase/3clicks.mp3 $urlbase/6clicks.ogg --summary-only 2>/dev/null > $tmpfile2 || \ |
86 fail "Fails to run transform $transform with 2-file remote input" | 105 fail "Fails to run transform $transform with 2-file remote input" |
87 | 106 |
88 expected=$mypath/expected/playlist | 107 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1" |
89 csvcompare $tmpfile $expected.csv || \ | 108 |
90 faildiff "Output mismatch for transform $transform with summaries and 2-file input" $tmpfile $expected.csv | 109 expected=$mypath/expected/playlist |
110 csvcompare $tmpfile1 $expected.csv || \ | |
111 faildiff "Output mismatch for transform $transform with summaries and 2-file input" $tmpfile1 $expected.csv | |
91 | 112 |
92 | 113 |
93 # 8. Mixture of remote and local files supplied on command line | 114 # 8. Mixture of remote and local files supplied on command line |
94 | 115 |
95 $r -t $transform -w csv --csv-stdout $audiopath/3clicks.mp3 $urlbase/6clicks.ogg --summary-only 2>/dev/null | sed 's,^"[^"]*/,",' > $tmpfile || \ | 116 $r -t $transform -w csv --csv-stdout $audiopath/3clicks.mp3 $urlbase/6clicks.ogg --summary-only 2>/dev/null > $tmpfile2 || \ |
96 fail "Fails to run transform $transform with 2-file remote input" | 117 fail "Fails to run transform $transform with 2-file remote input" |
97 | 118 |
98 expected=$mypath/expected/playlist | 119 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1" |
99 csvcompare $tmpfile $expected.csv || \ | |
100 faildiff "Output mismatch for transform $transform with summaries and mixed local/remote 2-file input" $tmpfile $expected.csv | |
101 | 120 |
121 expected=$mypath/expected/playlist | |
122 csvcompare $tmpfile1 $expected.csv || \ | |
123 faildiff "Output mismatch for transform $transform with summaries and mixed local/remote 2-file input" $tmpfile1 $expected.csv | |
124 | |
125 fi | |
102 | 126 |
103 # 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 |
104 | 128 |
105 $r -t $transform --multiplex -w csv --csv-stdout $audiopath/3clicks.mp3 $audiopath/6clicks.ogg --summary-only 2>/dev/null | sed 's,^"[^"]*/,",' > $tmpfile || \ | 129 $r -t $transform --multiplex -w csv --csv-stdout $audiopath/3clicks.mp3 $audiopath/6clicks.ogg --summary-only 2>/dev/null > $tmpfile2 || \ |
106 fail "Fails to run transform $transform with 2-file input" | 130 fail "Fails to run transform $transform with 2-file input" |
107 | 131 |
132 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1" | |
133 | |
108 expected=$mypath/expected/multiplexed | 134 expected=$mypath/expected/multiplexed |
109 csvcompare $tmpfile $expected.csv || \ | 135 csvcompare $tmpfile1 $expected.csv || \ |
110 faildiff "Output mismatch for transform $transform with summaries and 2-file multiplexed input" $tmpfile $expected.csv | 136 faildiff "Output mismatch for transform $transform with summaries and 2-file multiplexed input" $tmpfile1 $expected.csv |
111 | 137 |