comparison tests/test-multiple-audio/test-multiple-audio.sh @ 119:7a31201dc42d test-reorg

Split out tests into individual directories, with simpler naming therein
author Chris Cannam
date Wed, 08 Oct 2014 15:08:57 +0100
parents tests/test-multiple-audio.sh@0fe5abb56a6e
children 685e5cf3cb1d
comparison
equal deleted inserted replaced
118:0fe5abb56a6e 119:7a31201dc42d
1 #!/bin/bash
2
3 . ../include.sh
4
5 tmpfile=$mypath/tmp_1_$$
6
7 trap "rm -f $tmpfile" 0
8
9 transform=$mypath/transforms/detectionfunction.n3
10
11 urlbase=http://vamp-plugins.org/sonic-annotator/testfiles
12
13
14 # 1. Recursive local directory
15
16 # 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
18 # that the -r flag is not supposed to pick up playlist files, only
19 # audio files
20 $r -t $transform -w csv --csv-stdout -r --summary-only $audiopath > $tmpfile 2>/dev/null || \
21 fail "Fails to run transform $transform with recursive dir option"
22
23 expected=$mypath/expected/all-files
24 csvcompare $tmpfile $expected.csv || \
25 faildiff "Output mismatch for transform $transform with summaries and recursive dir option" $tmpfile $expected.csv
26
27
28 # 2. Local playlist file referring to local audio files
29
30 # Here we strip any leading path from the audio file in the output,
31 # because the playlist reader will have resolved files to absolute
32 # 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 || \
34 fail "Fails to run transform $transform with playlist input"
35
36 expected=$mypath/expected/playlist
37 csvcompare $tmpfile $expected.csv || \
38 faildiff "Output mismatch for transform $transform with summaries and playlist input" $tmpfile $expected.csv
39
40
41 # 3. Multiple files supplied directly on command line
42
43 # Strip paths again, just so we can use the same output comparison
44 # 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 || \
46 fail "Fails to run transform $transform with 2-file input"
47
48 expected=$mypath/expected/playlist
49 csvcompare $tmpfile $expected.csv || \
50 faildiff "Output mismatch for transform $transform with summaries and 2-file input" $tmpfile $expected.csv
51
52
53 # 4. Remote playlist file referring to remote audio files
54
55 $r -t $transform -w csv --csv-stdout $urlbase/playlist.m3u --summary-only 2>/dev/null | sed 's,^"[^"]*/,",' > $tmpfile || \
56 fail "Fails to run transform $transform with remote playlist input"
57
58 expected=$mypath/expected/playlist
59 csvcompare $tmpfile $expected.csv || \
60 faildiff "Output mismatch for transform $transform with summaries and remote playlist input" $tmpfile $expected.csv
61
62
63 # 5. Local playlist file referring to mixture of remote and local audio files
64
65 $r -t $transform -w csv --csv-stdout $audiopath/remote-playlist.m3u --summary-only 2>/dev/null | sed 's,^"[^"]*/,",' > $tmpfile || \
66 fail "Fails to run transform $transform with playlist of remote files"
67
68 expected=$mypath/expected/playlist
69 csvcompare $tmpfile $expected.csv || \
70 faildiff "Output mismatch for transform $transform with summaries and remote playlist input" $tmpfile $expected.csv
71
72
73 # 6. Multiple remote files supplied directly on command line
74
75 $r -t $transform -w csv --csv-stdout $urlbase/3clicks.mp3 $urlbase/6clicks.ogg --summary-only 2>/dev/null | sed 's,^"[^"]*/,",' > $tmpfile || \
76 fail "Fails to run transform $transform with 2-file remote input"
77
78 expected=$mypath/expected/playlist
79 csvcompare $tmpfile $expected.csv || \
80 faildiff "Output mismatch for transform $transform with summaries and 2-file input" $tmpfile $expected.csv
81
82
83 # 7. Mixture of remote and local files supplied on command line
84
85 $r -t $transform -w csv --csv-stdout $audiopath/3clicks.mp3 $urlbase/6clicks.ogg --summary-only 2>/dev/null | sed 's,^"[^"]*/,",' > $tmpfile || \
86 fail "Fails to run transform $transform with 2-file remote input"
87
88 expected=$mypath/expected/playlist
89 csvcompare $tmpfile $expected.csv || \
90 faildiff "Output mismatch for transform $transform with summaries and mixed local/remote 2-file input" $tmpfile $expected.csv
91