mas01mc@339: #! /bin/bash mas01mc@339: mas01mc@339: . ../test-utils.sh mas01mc@339: mas01mc@339: if [ -f testdb ]; then rm -f testdb; fi mas01mc@339: mas01mc@339: # Directories to store database / features mas01mc@339: DBDIR=dbdir mas01mc@339: FDIR=fdir mas01mc@339: mkdir ${DBDIR} mas01mc@339: mkdir ${FDIR} mas01mc@339: mas01mc@339: # Make LARGE_ADB mas01mc@339: ${AUDIODB} -d testdb -N --ntracks 50000 --adb_root ${DBDIR} mas01mc@339: ${AUDIODB} -d testdb -P --adb_root ${DBDIR} mas01mc@339: ${AUDIODB} -d testdb -L --adb_root ${DBDIR} mas01mc@339: mas01mc@339: ${AUDIODB} -d testdb -S --adb_root ${DBDIR} | grep "flags:" > testoutput mas01mc@339: echo "flags: l2norm[on] minmax[off] power[on] times[off] largeADB[on]" > test-expected-output mas01mc@339: cmp testoutput test-expected-output mas01mc@339: mas01mc@339: intstring 2 > ${FDIR}/testfeature mas01mc@339: floatstring 0 1 >> ${FDIR}/testfeature mas01mc@339: floatstring 1 0 >> ${FDIR}/testfeature mas01mc@339: floatstring 1 0 >> ${FDIR}/testfeature mas01mc@339: floatstring 0 1 >> ${FDIR}/testfeature mas01mc@339: mas01mc@339: intstring 1 > ${FDIR}/testpower mas01mc@339: floatstring -0.5 >> ${FDIR}/testpower mas01mc@339: floatstring -1 >> ${FDIR}/testpower mas01mc@339: floatstring -1 >> ${FDIR}/testpower mas01mc@339: floatstring -0.5 >> ${FDIR}/testpower mas01mc@339: mas01mc@339: echo testfeature > ${FDIR}/testList.txt mas01mc@339: echo testpower > ${FDIR}/pwrList.txt mas01mc@339: echo key1 > ${FDIR}/keyList.txt mas01mc@339: mas01mc@339: echo testfeature >> ${FDIR}/testList.txt mas01mc@339: echo testpower >> ${FDIR}/pwrList.txt mas01mc@339: echo key2 >> ${FDIR}/keyList.txt mas01mc@339: mas01mc@339: pushd ${FDIR} mas01mc@339: ../${AUDIODB} -d testdb -B -F testList.txt -W pwrList.txt -K keyList.txt --adb_root ../${DBDIR} mas01mc@339: rm testList.txt pwrList.txt keyList.txt mas01mc@339: popd mas01mc@339: # Cleanup mas01mc@339: mas01mc@339: mas01mc@339: echo "query points (0.0,0.5),(0.0,0.5),(0.5,0.0)" mas01mc@339: intstring 2 > testquery mas01mc@339: floatstring 0 0.5 >> testquery mas01mc@339: floatstring 0 0.5 >> testquery mas01mc@339: floatstring 0.5 0 >> testquery mas01mc@339: mas01mc@339: cp ${FDIR}/testpower . mas01mc@339: mas01mc@339: # LARGE_ADB requires an INDEX mas01mc@339: ${AUDIODB} -d testdb -X -R 1 -l 1 --adb_root ${DBDIR} --adb_feature_root ${FDIR} mas01mc@339: mas01mc@339: # LARGE_ADB query from key mas01mc@339: ${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: echo key2 1 > test-expected-output mas01mc@339: cmp testoutput test-expected-output mas01mc@339: mas01mc@339: # LARGE_ADB query from feature file and power file mas01mc@339: ${AUDIODB} -d testdb -Q sequence -l 1 -f testquery -w testpower -R 1 --absolute-threshold -4.5 \ mas01mc@339: --adb_root ${DBDIR} --adb_feature_root ${FDIR} > testoutput mas01mc@339: echo key1 1 > test-expected-output mas01mc@339: echo key2 1 >> test-expected-output mas01mc@339: cmp testoutput test-expected-output mas01mc@339: mas01mc@339: # WS mas01mc@339: WSPORT=10020 mas01mc@339: ${AUDIODB} -s ${WSPORT} --adb_root ${DBDIR} --adb_feature_root ${FDIR} & mas01mc@339: # HACK: deal with race on process creation mas01mc@339: sleep 1 mas01mc@339: trap 'kill $!; exit 1' ERR mas01mc@339: mas01mc@339: # LARGE_ADB WS query from key mas01mc@339: ${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: echo key2 0 0 0 > test-expected-output mas01mc@339: cmp testoutput test-expected-output mas01mc@339: mas01mc@339: # LARGE_ADB WS query from feature file and power file tests mas01mc@339: ${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: echo key1 1 > test-expected-output mas01mc@339: echo key2 1 >> test-expected-output mas01mc@339: cmp testoutput test-expected-output mas01mc@339: mas01mc@339: stop_server $! mas01mc@339: mas01mc@339: # TEST LARGE_ADB WS WITH PRELOADED INDEX mas01mc@339: WSPORT=10020 mas01mc@339: ${AUDIODB} -s ${WSPORT} --load_index -d testdb -R 1 -l 1 --adb_root ${DBDIR} --adb_feature_root ${FDIR} & mas01mc@339: # HACK: deal with race on process creation mas01mc@339: sleep 1 mas01mc@339: trap 'kill $!; exit 1' ERR mas01mc@339: mas01mc@339: # LARGE_ADB WS query from key mas01mc@339: ${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: echo key2 0 0 0 > test-expected-output mas01mc@339: cmp testoutput test-expected-output mas01mc@339: mas01mc@339: # LARGE_ADB WS query from feature file and power file tests mas01mc@339: ${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: echo key1 1 > test-expected-output mas01mc@339: echo key2 1 >> test-expected-output mas01mc@339: cmp testoutput test-expected-output mas01mc@339: mas01mc@339: stop_server $! mas01mc@339: mas01mc@339: # Clean up mas01mc@339: . clean.sh mas01mc@339: mas01mc@339: exit 104