Chris@103
|
1 #!/bin/bash
|
Chris@103
|
2
|
Chris@119
|
3 . ../include.sh
|
Chris@103
|
4
|
Chris@103
|
5 tmpfile=$mypath/tmp_1_$$
|
Chris@103
|
6
|
Chris@103
|
7 trap "rm -f $tmpfile" 0
|
Chris@103
|
8
|
Chris@119
|
9 transform=$mypath/transforms/detectionfunction.n3
|
Chris@103
|
10
|
Chris@117
|
11 urlbase=http://vamp-plugins.org/sonic-annotator/testfiles
|
Chris@117
|
12
|
Chris@117
|
13
|
Chris@117
|
14 # 1. Recursive local directory
|
Chris@117
|
15
|
Chris@103
|
16 # Note, the output here depends on all the audio files present -- we
|
Chris@111
|
17 # would have to regenerate it if we added more test audio files. Note
|
Chris@111
|
18 # that the -r flag is not supposed to pick up playlist files, only
|
Chris@111
|
19 # audio files
|
Chris@119
|
20 $r -t $transform -w csv --csv-stdout -r --summary-only $audiopath > $tmpfile 2>/dev/null || \
|
Chris@103
|
21 fail "Fails to run transform $transform with recursive dir option"
|
Chris@103
|
22
|
Chris@119
|
23 expected=$mypath/expected/all-files
|
Chris@103
|
24 csvcompare $tmpfile $expected.csv || \
|
Chris@111
|
25 faildiff "Output mismatch for transform $transform with summaries and recursive dir option" $tmpfile $expected.csv
|
Chris@103
|
26
|
Chris@117
|
27
|
Chris@117
|
28 # 2. Local playlist file referring to local audio files
|
Chris@117
|
29
|
Chris@117
|
30 # Here we strip any leading path from the audio file in the output,
|
Chris@103
|
31 # because the playlist reader will have resolved files to absolute
|
Chris@103
|
32 # paths and those will differ between systems
|
Chris@119
|
33 $r -t $transform -w csv --csv-stdout $audiopath/playlist.m3u --summary-only 2>/dev/null | sed 's,^"[^"]*/,",' > $tmpfile || \
|
Chris@103
|
34 fail "Fails to run transform $transform with playlist input"
|
Chris@103
|
35
|
Chris@119
|
36 expected=$mypath/expected/playlist
|
Chris@103
|
37 csvcompare $tmpfile $expected.csv || \
|
Chris@111
|
38 faildiff "Output mismatch for transform $transform with summaries and playlist input" $tmpfile $expected.csv
|
Chris@103
|
39
|
Chris@117
|
40
|
Chris@117
|
41 # 3. Multiple files supplied directly on command line
|
Chris@117
|
42
|
Chris@117
|
43 # Strip paths again, just so we can use the same output comparison
|
Chris@117
|
44 # file as above
|
Chris@119
|
45 $r -t $transform -w csv --csv-stdout $audiopath/3clicks.mp3 $audiopath/6clicks.ogg --summary-only 2>/dev/null | sed 's,^"[^"]*/,",' > $tmpfile || \
|
Chris@104
|
46 fail "Fails to run transform $transform with 2-file input"
|
Chris@103
|
47
|
Chris@119
|
48 expected=$mypath/expected/playlist
|
Chris@104
|
49 csvcompare $tmpfile $expected.csv || \
|
Chris@111
|
50 faildiff "Output mismatch for transform $transform with summaries and 2-file input" $tmpfile $expected.csv
|
Chris@103
|
51
|
Chris@104
|
52
|
Chris@117
|
53 # 4. Remote playlist file referring to remote audio files
|
Chris@104
|
54
|
Chris@117
|
55 $r -t $transform -w csv --csv-stdout $urlbase/playlist.m3u --summary-only 2>/dev/null | sed 's,^"[^"]*/,",' > $tmpfile || \
|
Chris@117
|
56 fail "Fails to run transform $transform with remote playlist input"
|
Chris@117
|
57
|
Chris@119
|
58 expected=$mypath/expected/playlist
|
Chris@117
|
59 csvcompare $tmpfile $expected.csv || \
|
Chris@117
|
60 faildiff "Output mismatch for transform $transform with summaries and remote playlist input" $tmpfile $expected.csv
|
Chris@117
|
61
|
Chris@117
|
62
|
Chris@117
|
63 # 5. Local playlist file referring to mixture of remote and local audio files
|
Chris@117
|
64
|
Chris@119
|
65 $r -t $transform -w csv --csv-stdout $audiopath/remote-playlist.m3u --summary-only 2>/dev/null | sed 's,^"[^"]*/,",' > $tmpfile || \
|
Chris@117
|
66 fail "Fails to run transform $transform with playlist of remote files"
|
Chris@117
|
67
|
Chris@119
|
68 expected=$mypath/expected/playlist
|
Chris@117
|
69 csvcompare $tmpfile $expected.csv || \
|
Chris@117
|
70 faildiff "Output mismatch for transform $transform with summaries and remote playlist input" $tmpfile $expected.csv
|
Chris@117
|
71
|
Chris@117
|
72
|
Chris@117
|
73 # 6. Multiple remote files supplied directly on command line
|
Chris@117
|
74
|
Chris@117
|
75 $r -t $transform -w csv --csv-stdout $urlbase/3clicks.mp3 $urlbase/6clicks.ogg --summary-only 2>/dev/null | sed 's,^"[^"]*/,",' > $tmpfile || \
|
Chris@117
|
76 fail "Fails to run transform $transform with 2-file remote input"
|
Chris@117
|
77
|
Chris@119
|
78 expected=$mypath/expected/playlist
|
Chris@117
|
79 csvcompare $tmpfile $expected.csv || \
|
Chris@117
|
80 faildiff "Output mismatch for transform $transform with summaries and 2-file input" $tmpfile $expected.csv
|
Chris@117
|
81
|
Chris@117
|
82
|
Chris@117
|
83 # 7. Mixture of remote and local files supplied on command line
|
Chris@117
|
84
|
Chris@119
|
85 $r -t $transform -w csv --csv-stdout $audiopath/3clicks.mp3 $urlbase/6clicks.ogg --summary-only 2>/dev/null | sed 's,^"[^"]*/,",' > $tmpfile || \
|
Chris@117
|
86 fail "Fails to run transform $transform with 2-file remote input"
|
Chris@117
|
87
|
Chris@119
|
88 expected=$mypath/expected/playlist
|
Chris@117
|
89 csvcompare $tmpfile $expected.csv || \
|
Chris@117
|
90 faildiff "Output mismatch for transform $transform with summaries and mixed local/remote 2-file input" $tmpfile $expected.csv
|
Chris@117
|
91
|