annotate tests/test-lab-destinations/test-lab-destinations.sh @ 298:9e98a1a8ebbd

Exclude mode from this test
author Chris Cannam
date Thu, 25 May 2017 10:52:03 +0100
parents 6ff4da31db8b
children
rev   line source
Chris@50 1 #!/bin/bash
Chris@50 2
Chris@119 3 . ../include.sh
Chris@50 4
Chris@119 5 infile1=$audiopath/3clicks8.wav
Chris@119 6 infile2=$audiopath/6clicks8.wav
Chris@50 7
Chris@154 8 outfile1=$audiopath/3clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.lab
Chris@154 9 outfile2=$audiopath/6clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.lab
Chris@50 10
Chris@119 11 infile1dot=$audiopath/3.clicks.8.wav
Chris@154 12 outfile1dot=$audiopath/3.clicks.8_vamp_vamp-example-plugins_percussiononsets_onsets.lab
Chris@50 13
Chris@154 14 outfile3=$audiopath/3clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.lab
Chris@154 15 outfile4=$audiopath/3clicks8_vamp_vamp-example-plugins_percussiononsets_detectionfunction.lab
Chris@50 16
Chris@154 17 tmplab=$mypath/tmp_1_$$.lab
Chris@50 18
Chris@154 19 trap "rm -f $tmplab $outfile1 $outfile2 $outfile3 $outfile4 $infile1dot $outfile1dot" 0
Chris@50 20
Chris@119 21 transformdir=$mypath/transforms
Chris@50 22
Chris@154 23 check_lab() {
Chris@50 24 test -f $1 || \
Chris@50 25 fail "Fails to write output to expected location $1 for $2"
Chris@154 26 # every line must contain the same number of tabs
Chris@154 27 formats=`awk -F'\t' '{ print NF; }' $1 | sort | uniq | wc | awk '{ print $1 }'`
Chris@50 28 if [ "$formats" != "1" ]; then
Chris@154 29 fail "Output is not consistently formatted tab-separated file for $2"
Chris@50 30 fi
Chris@50 31 rm -f $1
Chris@50 32 }
Chris@50 33
Chris@50 34
Chris@154 35 ctx="onsets transform, one audio file, default LAB writer destination"
Chris@50 36
Chris@50 37 rm -f $outfile1
Chris@50 38
Chris@154 39 $r -t $transformdir/onsets.n3 -w lab $infile1 2>/dev/null || \
Chris@50 40 fail "Fails to run with $ctx"
Chris@50 41
Chris@154 42 check_lab $outfile1 "$ctx"
Chris@50 43
Chris@50 44
Chris@154 45 ctx="onsets transform, one audio file with dots in filename, default LAB writer destination"
Chris@50 46
Chris@50 47 rm -f $outfile1
Chris@50 48
Chris@50 49 cp $infile1 $infile1dot
Chris@50 50
Chris@154 51 $r -t $transformdir/onsets.n3 -w lab $infile1dot 2>/dev/null || \
Chris@50 52 fail "Fails to run with $ctx"
Chris@50 53
Chris@154 54 check_lab $outfile1dot "$ctx"
Chris@50 55
Chris@50 56 rm -f $infile1dot $outfile1dot
Chris@50 57
Chris@50 58
Chris@154 59 ctx="onsets and df transforms, one audio file, default LAB writer destination"
Chris@50 60
Chris@50 61 rm -f $outfile1
Chris@50 62
Chris@154 63 $r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 -w lab $infile1 2>/dev/null || \
Chris@50 64 fail "Fails to run with $ctx"
Chris@50 65
Chris@154 66 check_lab $outfile1 "$ctx"
Chris@50 67
Chris@50 68
Chris@154 69 ctx="onsets transform, two audio files, default LAB writer destination"
Chris@50 70
Chris@50 71 rm -f $outfile1
Chris@50 72 rm -f $outfile2
Chris@50 73
Chris@154 74 $r -t $transformdir/onsets.n3 -w lab $infile1 $infile2 2>/dev/null || \
Chris@50 75 fail "Fails to run with $ctx"
Chris@50 76
Chris@154 77 check_lab $outfile1 "$ctx"
Chris@154 78 check_lab $outfile2 "$ctx"
Chris@50 79
Chris@50 80
Chris@154 81 ctx="onsets transform, two audio files, one-file LAB writer"
Chris@50 82
Chris@154 83 # Writer should refuse to write results from more than one audio file
Chris@154 84 # together (as the audio file is not identified)
Chris@154 85
Chris@154 86 $r -t $transformdir/onsets.n3 -w lab --lab-one-file $tmplab $infile1 $infile2 2>/dev/null && \
Chris@154 87 fail "Fails by completing successfully with $ctx"
Chris@154 88
Chris@154 89
Chris@154 90 ctx="onsets transform, two audio files, stdout LAB writer"
Chris@154 91
Chris@154 92 $r -t $transformdir/onsets.n3 -w lab --lab-stdout $infile1 $infile2 2>/dev/null >$tmplab || \
Chris@50 93 fail "Fails to run with $ctx"
Chris@50 94
Chris@154 95 check_lab $tmplab "$ctx"
Chris@50 96
Chris@50 97
Chris@154 98 ctx="existing output file and no --lab-force"
Chris@50 99
Chris@50 100 touch $outfile1
Chris@50 101
Chris@154 102 $r -t $transformdir/onsets.n3 -w lab $infile1 2>/dev/null && \
Chris@50 103 fail "Fails by completing successfully when output file already exists (should refuse and bail out)"
Chris@50 104
Chris@50 105
Chris@154 106 ctx="existing output file and --lab-force"
Chris@50 107
Chris@50 108 touch $outfile1
Chris@50 109
Chris@154 110 $r -t $transformdir/onsets.n3 -w lab --lab-force $infile1 2>/dev/null || \
Chris@50 111 fail "Fails to run with $ctx"
Chris@50 112
Chris@154 113 check_lab $outfile1 "$ctx"
Chris@50 114
Chris@50 115 exit 0