Mercurial > hg > sonic-annotator
annotate tests/test-lab-writer/test-lab-writer.sh @ 197:3b7ec45abd1c
Add mandatory option --json-format to JSON feature writer, in preparation for supporting multiple JSON formats (perhaps) in future
author | Chris Cannam |
---|---|
date | Tue, 01 Sep 2015 17:05:32 +0100 |
parents | 237ccacbb85e |
children | 704a8b27f3ed |
rev | line source |
---|---|
Chris@155 | 1 #!/bin/bash |
Chris@155 | 2 |
Chris@155 | 3 . ../include.sh |
Chris@155 | 4 |
Chris@155 | 5 infile=$audiopath/20sec-silence.wav |
Chris@155 | 6 tmplab=$mypath/tmp_1_$$.lab |
Chris@155 | 7 |
Chris@155 | 8 trap "rm -f $tmplab" 0 |
Chris@155 | 9 |
Chris@155 | 10 for output in notes-regions curve-vsr; do |
Chris@155 | 11 |
Chris@155 | 12 flag="" |
Chris@155 | 13 |
Chris@155 | 14 $r -d "$testplug:$output" -w lab --lab-stdout "$infile" 2>/dev/null > "$tmplab" || \ |
Chris@155 | 15 fail "Failed to run for plugin $testplug with output $output and no additional flags" |
Chris@155 | 16 |
Chris@155 | 17 csvcompare "$tmplab" "$mypath/expected/$output-no-flags.lab" || \ |
Chris@155 | 18 faildiff "Output differs from expected for output $output and no additional flags" "$tmplab" "$mypath/expected/$output-no-flags.lab" |
Chris@155 | 19 |
Chris@155 | 20 flag=fill-ends |
Chris@155 | 21 |
Chris@155 | 22 $r -d "$testplug:$output" -w lab --lab-$flag --lab-stdout "$infile" 2>/dev/null > "$tmplab" || \ |
Chris@155 | 23 fail "Failed to run for plugin $testplug with output $output and $flag flag" |
Chris@155 | 24 |
Chris@155 | 25 csvcompare "$tmplab" "$mypath/expected/$output-$flag.lab" || \ |
Chris@155 | 26 faildiff "Output differs from expected for output $output and $flag flag" "$tmplab" "$mypath/expected/$output-$flag.lab" |
Chris@155 | 27 done |
Chris@155 | 28 |
Chris@159 | 29 # Do it all over again, but using the CSV writer. The Lab writer is |
Chris@159 | 30 # actually redundant, it's equivalent to -w csv --csv-separator '\t' |
Chris@159 | 31 # --csv-end-times --csv-omit-filename |
Chris@159 | 32 |
Chris@159 | 33 for output in notes-regions curve-vsr; do |
Chris@159 | 34 |
Chris@159 | 35 flag="" |
Chris@159 | 36 |
Chris@159 | 37 $r -d "$testplug:$output" -w csv --csv-separator '\t' --csv-end-times --csv-omit-filename --csv-stdout "$infile" 2>/dev/null > "$tmplab" || \ |
Chris@159 | 38 fail "Failed to run for plugin $testplug and CSV writer with output $output and no additional flags" |
Chris@159 | 39 |
Chris@159 | 40 csvcompare "$tmplab" "$mypath/expected/$output-no-flags.lab" || \ |
Chris@159 | 41 faildiff "Output differs from expected for CSV writer with output $output and no additional flags" "$tmplab" "$mypath/expected/$output-no-flags.lab" |
Chris@159 | 42 |
Chris@159 | 43 flag=fill-ends |
Chris@159 | 44 |
Chris@159 | 45 $r -d "$testplug:$output" -w csv --csv-separator '\t' --csv-end-times --csv-omit-filename --csv-$flag --csv-stdout "$infile" 2>/dev/null > "$tmplab" || \ |
Chris@159 | 46 fail "Failed to run for plugin $testplug and CSV writer with output $output and $flag flag" |
Chris@159 | 47 |
Chris@159 | 48 csvcompare "$tmplab" "$mypath/expected/$output-$flag.lab" || \ |
Chris@159 | 49 faildiff "Output differs from expected for CSV writer with output $output and $flag flag" "$tmplab" "$mypath/expected/$output-$flag.lab" |
Chris@159 | 50 done |
Chris@159 | 51 |
Chris@155 | 52 exit 0 |
Chris@155 | 53 |