annotate tests/test-lab-writer/test-lab-writer.sh @ 258:857ce6ecb163 piper-nopiper

Align Sonic Annotator with the new Piper-ified subrepos (bearing in mind we want neither Piper nor the plugin load checker in Sonic Annotator itself)
author Chris Cannam
date Fri, 04 Nov 2016 14:16:01 +0000
parents e8f2f530c091
children
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@206 10 for output in notes-regions curve-vsr grid-oss; 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@206 33 for output in notes-regions curve-vsr grid-oss; 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@206 52 for output in grid-oss; do
Chris@206 53 for digits in 0 6 2; do
Chris@206 54
Chris@206 55 $r -d "$testplug:$output" -w lab --lab-stdout --lab-digits "$digits" "$infile" 2>/dev/null > "$tmplab" || \
Chris@206 56 fail "Failed to run for plugin $testplug with output $output and digits $digits"
Chris@206 57
Chris@207 58 # no fuzz here
Chris@207 59 cmp -s "$tmplab" "$mypath/expected/$output-$digits.lab" || \
Chris@206 60 faildiff "Output differs from expected for CSV writer with output $output and digits $digits" "$tmplab" "$mypath/expected/$output-$digits.lab"
Chris@206 61
Chris@206 62 done
Chris@206 63 done
Chris@206 64
Chris@155 65 exit 0
Chris@155 66