annotate tests/test-csv-writer/test-csv-writer.sh @ 302:1e6cee321cc0

Added tag sonic-annotator-1.5 for changeset 929e37acf0d9
author Chris Cannam
date Thu, 25 May 2017 15:01:41 +0100
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@156 6 tmpcsv=$mypath/tmp_1_$$.csv
Chris@155 7
Chris@156 8 trap "rm -f $tmpcsv" 0
Chris@155 9
Chris@207 10 for output in notes-regions curve-vsr grid-oss; do
Chris@155 11
Chris@155 12 flag=""
Chris@155 13
Chris@156 14 $r -d "$testplug:$output" -w csv --csv-stdout "$infile" 2>/dev/null > "$tmpcsv" || \
Chris@155 15 fail "Failed to run for plugin $testplug with output $output and no additional flags"
Chris@155 16
Chris@156 17 csvcompare "$tmpcsv" "$mypath/expected/$output-no-flags.csv" || \
Chris@156 18 faildiff "Output differs from expected for output $output and no additional flags" "$tmpcsv" "$mypath/expected/$output-no-flags.csv"
Chris@155 19
Chris@156 20 flag=sample-timing
Chris@155 21
Chris@156 22 $r -d "$testplug:$output" -w csv --csv-$flag --csv-stdout "$infile" 2>/dev/null > "$tmpcsv" || \
Chris@155 23 fail "Failed to run for plugin $testplug with output $output and $flag flag"
Chris@155 24
Chris@156 25 csvcompare "$tmpcsv" "$mypath/expected/$output-$flag.csv" || \
Chris@156 26 faildiff "Output differs from expected for output $output and $flag flag" "$tmpcsv" "$mypath/expected/$output-$flag.csv"
Chris@156 27
Chris@158 28 flag=fill-ends
Chris@158 29
Chris@158 30 $r -d "$testplug:$output" -w csv --csv-$flag --csv-stdout "$infile" 2>/dev/null > "$tmpcsv" || \
Chris@158 31 fail "Failed to run for plugin $testplug with output $output and $flag flag"
Chris@158 32
Chris@158 33 csvcompare "$tmpcsv" "$mypath/expected/$output-$flag.csv" || \
Chris@158 34 faildiff "Output differs from expected for output $output and $flag flag" "$tmpcsv" "$mypath/expected/$output-$flag.csv"
Chris@158 35
Chris@156 36 flag=end-times
Chris@156 37
Chris@156 38 $r -d "$testplug:$output" -w csv --csv-$flag --csv-stdout "$infile" 2>/dev/null > "$tmpcsv" || \
Chris@156 39 fail "Failed to run for plugin $testplug with output $output and $flag flag"
Chris@156 40
Chris@156 41 csvcompare "$tmpcsv" "$mypath/expected/$output-$flag.csv" || \
Chris@156 42 faildiff "Output differs from expected for output $output and $flag flag" "$tmpcsv" "$mypath/expected/$output-$flag.csv"
Chris@156 43
Chris@156 44 flag=separator
Chris@156 45
Chris@156 46 $r -d "$testplug:$output" -w csv --csv-$flag '@' --csv-stdout "$infile" 2>/dev/null > "$tmpcsv" || \
Chris@156 47 fail "Failed to run for plugin $testplug with output $output and $flag flag"
Chris@156 48
Chris@156 49 csvcompare "$tmpcsv" "$mypath/expected/$output-$flag.csv" || \
Chris@156 50 faildiff "Output differs from expected for output $output and $flag flag" "$tmpcsv" "$mypath/expected/$output-$flag.csv"
Chris@156 51
Chris@158 52 flag=all
Chris@158 53
Chris@158 54 $r -d "$testplug:$output" -w csv --csv-sample-timing --csv-fill-ends --csv-end-times --csv-separator '@' --csv-stdout "$infile" 2>/dev/null > "$tmpcsv" || \
Chris@158 55 fail "Failed to run for plugin $testplug with output $output and all flags"
Chris@158 56
Chris@158 57 csvcompare "$tmpcsv" "$mypath/expected/$output-$flag.csv" || \
Chris@158 58 faildiff "Output differs from expected for output $output and all flags" "$tmpcsv" "$mypath/expected/$output-$flag.csv"
Chris@158 59
Chris@155 60 done
Chris@155 61
Chris@207 62 for output in grid-oss; do
Chris@207 63 for digits in 0 6 2; do
Chris@207 64
Chris@207 65 $r -d "$testplug:$output" -w csv --csv-stdout --csv-digits "$digits" "$infile" 2>/dev/null > "$tmpcsv" || \
Chris@207 66 fail "Failed to run for plugin $testplug with output $output and digits $digits"
Chris@207 67
Chris@207 68 # no fuzz here
Chris@207 69 cmp -s "$tmpcsv" "$mypath/expected/$output-$digits.csv" || \
Chris@207 70 faildiff "Output differs from expected for CSV writer with output $output and digits $digits" "$tmpcsv" "$mypath/expected/$output-$digits.csv"
Chris@207 71
Chris@207 72 done
Chris@207 73 done
Chris@207 74
Chris@155 75 exit 0
Chris@155 76