annotate tests/0043/run-test.sh @ 770:c54bc2ffbf92 tip

update tags
author convert-repo
date Fri, 16 Dec 2011 11:34:01 +0000
parents da901c62e569
children
rev   line source
mas01mc@339 1 #! /bin/bash
mas01mc@339 2
mas01mc@339 3 . ../test-utils.sh
mas01mc@339 4
mas01mc@339 5 if [ -f testdb ]; then rm -f testdb; fi
mas01mc@339 6
mas01mc@339 7 # Directories to store database / features
mas01mc@339 8 DBDIR=dbdir
mas01mc@339 9 FDIR=fdir
mas01mc@339 10 mkdir ${DBDIR}
mas01mc@339 11 mkdir ${FDIR}
mas01mc@339 12
mas01mc@339 13 # Make LARGE_ADB
mas01mc@339 14 ${AUDIODB} -d testdb -N --ntracks 50000 --adb_root ${DBDIR}
mas01mc@339 15 ${AUDIODB} -d testdb -P --adb_root ${DBDIR}
mas01mc@339 16 ${AUDIODB} -d testdb -L --adb_root ${DBDIR}
mas01mc@339 17
mas01mc@339 18 ${AUDIODB} -d testdb -S --adb_root ${DBDIR} | grep "flags:" > testoutput
mas01mc@339 19 echo "flags: l2norm[on] minmax[off] power[on] times[off] largeADB[on]" > test-expected-output
mas01mc@339 20 cmp testoutput test-expected-output
mas01mc@339 21
mas01mc@339 22 intstring 2 > ${FDIR}/testfeature
mas01mc@339 23 floatstring 0 1 >> ${FDIR}/testfeature
mas01mc@339 24 floatstring 1 0 >> ${FDIR}/testfeature
mas01mc@339 25 floatstring 1 0 >> ${FDIR}/testfeature
mas01mc@339 26 floatstring 0 1 >> ${FDIR}/testfeature
mas01mc@339 27
mas01mc@339 28 intstring 1 > ${FDIR}/testpower
mas01mc@339 29 floatstring -0.5 >> ${FDIR}/testpower
mas01mc@339 30 floatstring -1 >> ${FDIR}/testpower
mas01mc@339 31 floatstring -1 >> ${FDIR}/testpower
mas01mc@339 32 floatstring -0.5 >> ${FDIR}/testpower
mas01mc@339 33
mas01mc@339 34 echo testfeature > ${FDIR}/testList.txt
mas01mc@339 35 echo testpower > ${FDIR}/pwrList.txt
mas01mc@339 36 echo key1 > ${FDIR}/keyList.txt
mas01mc@339 37
mas01mc@339 38 echo testfeature >> ${FDIR}/testList.txt
mas01mc@339 39 echo testpower >> ${FDIR}/pwrList.txt
mas01mc@339 40 echo key2 >> ${FDIR}/keyList.txt
mas01mc@339 41
mas01mc@339 42 pushd ${FDIR}
mas01mc@339 43 ../${AUDIODB} -d testdb -B -F testList.txt -W pwrList.txt -K keyList.txt --adb_root ../${DBDIR}
mas01mc@339 44 rm testList.txt pwrList.txt keyList.txt
mas01mc@339 45 popd
mas01mc@339 46 # Cleanup
mas01mc@339 47
mas01mc@339 48
mas01mc@339 49 echo "query points (0.0,0.5),(0.0,0.5),(0.5,0.0)"
mas01mc@339 50 intstring 2 > testquery
mas01mc@339 51 floatstring 0 0.5 >> testquery
mas01mc@339 52 floatstring 0 0.5 >> testquery
mas01mc@339 53 floatstring 0.5 0 >> testquery
mas01mc@339 54
mas01mc@339 55 cp ${FDIR}/testpower .
mas01mc@339 56
mas01mc@339 57 # LARGE_ADB requires an INDEX
mas01mc@339 58 ${AUDIODB} -d testdb -X -R 1 -l 1 --adb_root ${DBDIR} --adb_feature_root ${FDIR}
mas01mc@339 59
mas01mc@339 60 # LARGE_ADB query from key
mas01mc@339 61 ${AUDIODB} -d testdb -Q sequence -l 1 -k key1 -R 1 --absolute-threshold -4.5 --adb_root ${DBDIR} --adb_feature_root ${FDIR} > testoutput
mas01mc@339 62 echo key2 1 > test-expected-output
mas01mc@339 63 cmp testoutput test-expected-output
mas01mc@339 64
mas01mc@339 65 # LARGE_ADB query from feature file and power file
mas01mc@339 66 ${AUDIODB} -d testdb -Q sequence -l 1 -f testquery -w testpower -R 1 --absolute-threshold -4.5 \
mas01mc@339 67 --adb_root ${DBDIR} --adb_feature_root ${FDIR} > testoutput
mas01mc@339 68 echo key1 1 > test-expected-output
mas01mc@339 69 echo key2 1 >> test-expected-output
mas01mc@339 70 cmp testoutput test-expected-output
mas01mc@339 71
mas01mc@339 72 # WS
mas01mc@339 73 WSPORT=10020
mas01mc@339 74 ${AUDIODB} -s ${WSPORT} --adb_root ${DBDIR} --adb_feature_root ${FDIR} &
mas01mc@339 75 # HACK: deal with race on process creation
mas01mc@339 76 sleep 1
mas01mc@339 77 trap 'kill $!; exit 1' ERR
mas01mc@339 78
mas01mc@339 79 # LARGE_ADB WS query from key
mas01mc@339 80 ${AUDIODB} -c localhost:${WSPORT} -d testdb -Q sequence -l 1 -k key1 -R 1 --absolute-threshold -4.5 -n 1 --lsh_exact > testoutput
mas01mc@339 81 echo key2 0 0 0 > test-expected-output
mas01mc@339 82 cmp testoutput test-expected-output
mas01mc@339 83
mas01mc@339 84 # LARGE_ADB WS query from feature file and power file tests
mas01mc@339 85 ${AUDIODB} -c localhost:${WSPORT} -d testdb -Q sequence -l 1 -f testquery -w testpower -R 1 --absolute-threshold -4.5 -n 1 > testoutput
mas01mc@339 86 echo key1 1 > test-expected-output
mas01mc@339 87 echo key2 1 >> test-expected-output
mas01mc@339 88 cmp testoutput test-expected-output
mas01mc@339 89
mas01mc@339 90 stop_server $!
mas01mc@339 91
mas01mc@339 92 # TEST LARGE_ADB WS WITH PRELOADED INDEX
mas01mc@339 93 WSPORT=10020
mas01mc@339 94 ${AUDIODB} -s ${WSPORT} --load_index -d testdb -R 1 -l 1 --adb_root ${DBDIR} --adb_feature_root ${FDIR} &
mas01mc@339 95 # HACK: deal with race on process creation
mas01mc@339 96 sleep 1
mas01mc@339 97 trap 'kill $!; exit 1' ERR
mas01mc@339 98
mas01mc@339 99 # LARGE_ADB WS query from key
mas01mc@339 100 ${AUDIODB} -c localhost:${WSPORT} -d testdb -Q sequence -l 1 -k key1 -R 1 --absolute-threshold -4.5 -n 1 --lsh_exact > testoutput
mas01mc@339 101 echo key2 0 0 0 > test-expected-output
mas01mc@339 102 cmp testoutput test-expected-output
mas01mc@339 103
mas01mc@339 104 # LARGE_ADB WS query from feature file and power file tests
mas01mc@339 105 ${AUDIODB} -c localhost:${WSPORT} -d testdb -Q sequence -l 1 -f testquery -w testpower -R 1 --absolute-threshold -4.5 -n 1 > testoutput
mas01mc@339 106 echo key1 1 > test-expected-output
mas01mc@339 107 echo key2 1 >> test-expected-output
mas01mc@339 108 cmp testoutput test-expected-output
mas01mc@339 109
mas01mc@339 110 stop_server $!
mas01mc@339 111
mas01mc@339 112 # Clean up
mas01mc@339 113 . clean.sh
mas01mc@339 114
mas01mc@339 115 exit 104