comparison tests/test-as-advertised/test-as-advertised.sh @ 325:d5caf5e91a86 default-writer-writes-to-files

If the default writer were to be able to write to files (but this is backward-incompatible so probably unwise)
author Chris Cannam
date Fri, 18 May 2018 12:36:48 +0100
parents f35bbb3e4d41
children
comparison
equal deleted inserted replaced
324:ef03350baec7 325:d5caf5e91a86
20 for type in $types; do 20 for type in $types; do
21 21
22 mkdir -p $tmpdir 22 mkdir -p $tmpdir
23 cp $infile $tmpwav 23 cp $infile $tmpwav
24 24
25 # Some of these are special cases: 25 # Special cases:
26 #
27 # * The "default" writer type always prints to stdout instead of
28 # to a file.
29 # 26 #
30 # * The "audiodb" writer will not print any output for features 27 # * The "audiodb" writer will not print any output for features
31 # that have no values (but are only point events). I don't know 28 # that have no values (but are only point events). I don't know
32 # how reasonable that is, but it's clearly intentional. It also 29 # how reasonable that is, but it's clearly intentional. It also
33 # writes to a subdirectory $basedir/$catid/$trackid.$output 30 # writes to a subdirectory $basedir/$catid/$trackid.$output
34 31
35 case $type in 32 case $type in
36 audiodb) 33 audiodb)
37 mkdir -p $adbdir 34 mkdir -p $adbdir
38 $r -t $df -w $type $tmpwav --audiodb-basedir $tmpdir --audiodb-catid `basename $adbdir` 2>/dev/null || \ 35 $r -t $df -w $type $tmpwav --audiodb-basedir $tmpdir --audiodb-catid `basename $adbdir` 2>/dev/null || \
39 fail "Fails to run with reader type \"$type\" and default options" 36 fail "Fails to run with writer type \"$type\" and default options"
40 ;;
41 default)
42 $r -t $onsets -w $type $tmpwav > $tmpdir/test.out 2>/dev/null || \
43 fail "Fails to run with reader type \"$type\" and default options"
44 ;; 37 ;;
45 *) 38 *)
46 $r -t $onsets -w $type $tmpwav 2>/dev/null || \ 39 $r -t $onsets -w $type $tmpwav 2>/dev/null || \
47 fail "Fails to run with reader type \"$type\" and default options" 40 fail "Fails to run with writer type \"$type\" and default options"
48 ;; 41 ;;
49 esac 42 esac
50 newfiles=`ls $tmpdir | fgrep -v .wav` 43 newfiles=`ls $tmpdir | fgrep -v .wav`
51 if [ "$type" = audiodb ]; then newfiles=`ls $adbdir`; fi 44 if [ "$type" = audiodb ]; then newfiles=`ls $adbdir`; fi
52 45
53 [ -n "$newfiles" ] || \ 46 [ -n "$newfiles" ] || \
54 fail "Fails to create output file for reader \"$type\" with default options" 47 fail "Fails to create output file for writer \"$type\" with default options"
55 48
56 case `echo $newfiles | wc -w` in 49 case `echo $newfiles | wc -w` in
57 [2-9]) 50 [2-9])
58 if [ "$type" != audiodb ]; then 51 if [ "$type" != audiodb ]; then
59 fail "Produces more than one output file for reader \"$type\" with default options" 52 fail "Produces more than one output file for writer \"$type\" with default options"
60 fi 53 fi
61 ;; 54 ;;
62 1) 55 1)
63 if [ "$type" = audiodb ]; then 56 if [ "$type" = audiodb ]; then
64 fail "Produces only one output file for reader \"$type\" with default options (expected two)" 57 fail "Produces only one output file for writer \"$type\" with default options (expected two)"
65 fi 58 fi
66 ;; 59 ;;
67 esac 60 esac
68 61
69 rm -r $tmpdir 62 rm -r $tmpdir