Mercurial > hg > audiodb
changeset 339:da901c62e569
Added new INDEX tests: LARGE_ADB, PATH PREFIX, cmdline and WS. Removed redundant feature PREFIX in audioDB.cpp. Moved tests/0050 to tests/0041 so INDEX tests are all in 0040-0049 range.
author | mas01mc |
---|---|
date | Fri, 05 Sep 2008 20:01:58 +0000 |
parents | cdb31e8b94e3 |
children | a6edbe97fddf |
files | audioDB.cpp tests/0041/run-test.sh tests/0041/short-description tests/0042/run-test.sh tests/0042/short-description tests/0043/clean.sh tests/0043/run-test.sh tests/0043/short-description tests/0050/run-test.sh tests/0050/short-description |
diffstat | 10 files changed, 292 insertions(+), 95 deletions(-) [+] |
line wrap: on
line diff
--- a/audioDB.cpp Fri Sep 05 16:40:41 2008 +0000 +++ b/audioDB.cpp Fri Sep 05 20:01:58 2008 +0000 @@ -40,9 +40,6 @@ if(dbName && adb_root) prefix_name((char** const)&dbName, adb_root); - if(inFile && adb_feature_root) - prefix_name((char** const)&inFile, adb_feature_root); - if(O2_ACTION(COM_SERVER)) startServer(); @@ -108,8 +105,6 @@ // Perform database prefix substitution if(dbName && adb_root) prefix_name((char** const)&dbName, adb_root); - if(inFile && adb_feature_root) - prefix_name((char** const)&inFile, adb_feature_root); assert(O2_ACTION(COM_QUERY)); query(dbName, inFile, adbQueryResponse); } catch(char *err) { @@ -126,8 +121,6 @@ // Perform database prefix substitution if(dbName && adb_root) prefix_name((char** const)&dbName, adb_root); - if(inFile && adb_feature_root) - prefix_name((char** const)&inFile, adb_feature_root); assert(O2_ACTION(COM_STATUS)); status(dbName, adbStatusResponse); } catch(char *err) { @@ -301,7 +294,7 @@ adb_root = SERVER_ADB_ROOT; if(SERVER_ADB_FEATURE_ROOT && !adb_feature_root) adb_feature_root = SERVER_ADB_FEATURE_ROOT; - + if(args_info.SERVER_given){ command=COM_SERVER; port=args_info.SERVER_arg;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/0041/run-test.sh Fri Sep 05 20:01:58 2008 +0000 @@ -0,0 +1,86 @@ +#! /bin/bash + +. ../test-utils.sh + +if [ -f testdb ]; then rm -f testdb; fi + +${AUDIODB} -d testdb -N + +intstring 2 > testfeature +floatstring 0 1 >> testfeature +floatstring 1 0 >> testfeature +floatstring 1 0 >> testfeature +floatstring 0 1 >> testfeature + +intstring 1 > testpower +floatstring -0.5 >> testpower +floatstring -1 >> testpower +floatstring -1 >> testpower +floatstring -0.5 >> testpower + +expect_clean_error_exit ${AUDIODB} -d testdb -I -f testfeature -w testpower +${AUDIODB} -d testdb -P +expect_clean_error_exit ${AUDIODB} -d testdb -I -f testfeature +${AUDIODB} -d testdb -I -f testfeature -w testpower + +# sequence queries require L2NORM +${AUDIODB} -d testdb -L + +echo "query points (0.0,0.5),(0.0,0.5),(0.5,0.0)" +intstring 2 > testquery +floatstring 0 0.5 >> testquery +floatstring 0 0.5 >> testquery +floatstring 0.5 0 >> testquery + +# LSH Indexing tests + +# Indexing requires a radius (-R) +expect_clean_error_exit ${AUDIODB} -d testdb -X -l 1 + +# Index with default LSH params +${AUDIODB} -d testdb -X -l 1 -R 1 + +WSPORT=10020 +start_server ${AUDIODB} ${WSPORT} + +# WS Query using the index + +${AUDIODB} -c localhost:${WSPORT} -d testdb -Q sequence -l 1 -f testquery -w testpower -R 1 > testoutput +echo testfeature 1 > test-expected-output +cmp testoutput test-expected-output + +${AUDIODB} -c localhost:${WSPORT} -d testdb -Q sequence -l 1 -f testquery -w testpower -p 0 -R 1 > testoutput +echo testfeature 1 > test-expected-output +cmp testoutput test-expected-output + +${AUDIODB} -c localhost:${WSPORT} -d testdb -Q sequence -l 1 -f testquery -w testpower -p 1 -R 1 > testoutput +echo testfeature 1 > test-expected-output +cmp testoutput test-expected-output + +${AUDIODB} -c localhost:${WSPORT} -d testdb -Q sequence -l 1 -f testquery -w testpower -e -R 1 > testoutput +echo testfeature 3 > test-expected-output +cmp testoutput test-expected-output + +${AUDIODB} -c localhost:${WSPORT} -d testdb -Q sequence -l 1 -f testquery -w testpower -e -R 1 --lsh_exact > testoutput +echo testfeature 3 > test-expected-output +cmp testoutput test-expected-output + +# make index, sequenceLength=2 +${AUDIODB} -d testdb -X -l 2 -R 1 + +# query, sequenceLength=2 +${AUDIODB} -c localhost:${WSPORT} -d testdb -Q sequence -l 2 -f testquery -w testpower -p 0 -R 1 > testoutput +echo testfeature 1 > test-expected-output +cmp testoutput test-expected-output + +${AUDIODB} -c localhost:${WSPORT} -d testdb -Q sequence -l 2 -f testquery -w testpower -p 1 -R 1 > testoutput +echo testfeature 1 > test-expected-output +cmp testoutput test-expected-output + +${AUDIODB} -c localhost:${WSPORT} -d testdb -Q sequence -l 2 -f testquery -w testpower -p 0 -R 1 --lsh_exact > testoutput +echo testfeature 1 > test-expected-output +cmp testoutput test-expected-output + +stop_server $! + +exit 104
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/0041/short-description Fri Sep 05 20:01:58 2008 +0000 @@ -0,0 +1,1 @@ +0040 using WS
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/0042/run-test.sh Fri Sep 05 20:01:58 2008 +0000 @@ -0,0 +1,77 @@ +#! /bin/bash + +. ../test-utils.sh + +if [ -f testdb ]; then rm -f testdb; fi + +# Make LARGE_ADB +${AUDIODB} -d testdb -N --ntracks 50000 +${AUDIODB} -d testdb -P +${AUDIODB} -d testdb -L + +${AUDIODB} -d testdb -S | grep "flags:" > testoutput +echo "flags: l2norm[on] minmax[off] power[on] times[off] largeADB[on]" > test-expected-output +cmp testoutput test-expected-output + +intstring 2 > testfeature +floatstring 0 1 >> testfeature +floatstring 1 0 >> testfeature +floatstring 1 0 >> testfeature +floatstring 0 1 >> testfeature + +intstring 1 > testpower +floatstring -0.5 >> testpower +floatstring -1 >> testpower +floatstring -1 >> testpower +floatstring -0.5 >> testpower + +echo testfeature > testList.txt +echo testpower > pwrList.txt +echo key1 > keyList.txt + +echo testfeature >> testList.txt +echo testpower >> pwrList.txt +echo key2 >> keyList.txt + +${AUDIODB} -d testdb -B -F testList.txt -W pwrList.txt -K keyList.txt +# Cleanup +rm testList.txt pwrList.txt keyList.txt + +echo "query points (0.0,0.5),(0.0,0.5),(0.5,0.0)" +intstring 2 > testquery +floatstring 0 0.5 >> testquery +floatstring 0 0.5 >> testquery +floatstring 0.5 0 >> testquery + +# LARGE_ADB requires an INDEX +${AUDIODB} -d testdb -X -R 1 -l 1 + +# LARGE_ADB query from key +${AUDIODB} -d testdb -Q sequence -l 1 -k key1 -R 1 --absolute-threshold -4.5 > testoutput +echo key2 1 > test-expected-output +cmp testoutput test-expected-output + +# LARGE_ADB query from feature file and power file +${AUDIODB} -d testdb -Q sequence -l 1 -f testquery -w testpower -R 1 --absolute-threshold -4.5 > testoutput +echo key1 1 > test-expected-output +echo key2 1 >> test-expected-output +cmp testoutput test-expected-output + +# WS +WSPORT=10020 +start_server ${AUDIODB} ${WSPORT} + +# LARGE_ADB WS query from key +${AUDIODB} -c localhost:${WSPORT} -d testdb -Q sequence -l 1 -k key1 -R 1 --absolute-threshold -4.5 -n 1 --lsh_exact > testoutput +echo key2 0 0 0 > test-expected-output +cmp testoutput test-expected-output + +# LARGE_ADB WS query from feature file and power file tests +${AUDIODB} -c localhost:${WSPORT} -d testdb -Q sequence -l 1 -f testquery -w testpower -R 1 --absolute-threshold -4.5 -n 1 > testoutput +echo key1 1 > test-expected-output +echo key2 1 >> test-expected-output +cmp testoutput test-expected-output + +stop_server $! + +exit 104
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/0042/short-description Fri Sep 05 20:01:58 2008 +0000 @@ -0,0 +1,1 @@ +LARGE_ADB creation, query from key / file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/0043/clean.sh Fri Sep 05 20:01:58 2008 +0000 @@ -0,0 +1,10 @@ +#! /bin/sh + +if [ -d dbdir ]; then + rm -rf dbdir +fi + +if [ -d fdir ]; then + rm -rf fdir +fi +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/0043/run-test.sh Fri Sep 05 20:01:58 2008 +0000 @@ -0,0 +1,115 @@ +#! /bin/bash + +. ../test-utils.sh + +if [ -f testdb ]; then rm -f testdb; fi + +# Directories to store database / features +DBDIR=dbdir +FDIR=fdir +mkdir ${DBDIR} +mkdir ${FDIR} + +# Make LARGE_ADB +${AUDIODB} -d testdb -N --ntracks 50000 --adb_root ${DBDIR} +${AUDIODB} -d testdb -P --adb_root ${DBDIR} +${AUDIODB} -d testdb -L --adb_root ${DBDIR} + +${AUDIODB} -d testdb -S --adb_root ${DBDIR} | grep "flags:" > testoutput +echo "flags: l2norm[on] minmax[off] power[on] times[off] largeADB[on]" > test-expected-output +cmp testoutput test-expected-output + +intstring 2 > ${FDIR}/testfeature +floatstring 0 1 >> ${FDIR}/testfeature +floatstring 1 0 >> ${FDIR}/testfeature +floatstring 1 0 >> ${FDIR}/testfeature +floatstring 0 1 >> ${FDIR}/testfeature + +intstring 1 > ${FDIR}/testpower +floatstring -0.5 >> ${FDIR}/testpower +floatstring -1 >> ${FDIR}/testpower +floatstring -1 >> ${FDIR}/testpower +floatstring -0.5 >> ${FDIR}/testpower + +echo testfeature > ${FDIR}/testList.txt +echo testpower > ${FDIR}/pwrList.txt +echo key1 > ${FDIR}/keyList.txt + +echo testfeature >> ${FDIR}/testList.txt +echo testpower >> ${FDIR}/pwrList.txt +echo key2 >> ${FDIR}/keyList.txt + +pushd ${FDIR} +../${AUDIODB} -d testdb -B -F testList.txt -W pwrList.txt -K keyList.txt --adb_root ../${DBDIR} +rm testList.txt pwrList.txt keyList.txt +popd +# Cleanup + + +echo "query points (0.0,0.5),(0.0,0.5),(0.5,0.0)" +intstring 2 > testquery +floatstring 0 0.5 >> testquery +floatstring 0 0.5 >> testquery +floatstring 0.5 0 >> testquery + +cp ${FDIR}/testpower . + +# LARGE_ADB requires an INDEX +${AUDIODB} -d testdb -X -R 1 -l 1 --adb_root ${DBDIR} --adb_feature_root ${FDIR} + +# LARGE_ADB query from key +${AUDIODB} -d testdb -Q sequence -l 1 -k key1 -R 1 --absolute-threshold -4.5 --adb_root ${DBDIR} --adb_feature_root ${FDIR} > testoutput +echo key2 1 > test-expected-output +cmp testoutput test-expected-output + +# LARGE_ADB query from feature file and power file +${AUDIODB} -d testdb -Q sequence -l 1 -f testquery -w testpower -R 1 --absolute-threshold -4.5 \ + --adb_root ${DBDIR} --adb_feature_root ${FDIR} > testoutput +echo key1 1 > test-expected-output +echo key2 1 >> test-expected-output +cmp testoutput test-expected-output + +# WS +WSPORT=10020 +${AUDIODB} -s ${WSPORT} --adb_root ${DBDIR} --adb_feature_root ${FDIR} & +# HACK: deal with race on process creation +sleep 1 +trap 'kill $!; exit 1' ERR + +# LARGE_ADB WS query from key +${AUDIODB} -c localhost:${WSPORT} -d testdb -Q sequence -l 1 -k key1 -R 1 --absolute-threshold -4.5 -n 1 --lsh_exact > testoutput +echo key2 0 0 0 > test-expected-output +cmp testoutput test-expected-output + +# LARGE_ADB WS query from feature file and power file tests +${AUDIODB} -c localhost:${WSPORT} -d testdb -Q sequence -l 1 -f testquery -w testpower -R 1 --absolute-threshold -4.5 -n 1 > testoutput +echo key1 1 > test-expected-output +echo key2 1 >> test-expected-output +cmp testoutput test-expected-output + +stop_server $! + +# TEST LARGE_ADB WS WITH PRELOADED INDEX +WSPORT=10020 +${AUDIODB} -s ${WSPORT} --load_index -d testdb -R 1 -l 1 --adb_root ${DBDIR} --adb_feature_root ${FDIR} & +# HACK: deal with race on process creation +sleep 1 +trap 'kill $!; exit 1' ERR + +# LARGE_ADB WS query from key +${AUDIODB} -c localhost:${WSPORT} -d testdb -Q sequence -l 1 -k key1 -R 1 --absolute-threshold -4.5 -n 1 --lsh_exact > testoutput +echo key2 0 0 0 > test-expected-output +cmp testoutput test-expected-output + +# LARGE_ADB WS query from feature file and power file tests +${AUDIODB} -c localhost:${WSPORT} -d testdb -Q sequence -l 1 -f testquery -w testpower -R 1 --absolute-threshold -4.5 -n 1 > testoutput +echo key1 1 > test-expected-output +echo key2 1 >> test-expected-output +cmp testoutput test-expected-output + +stop_server $! + +# Clean up +. clean.sh + +exit 104
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/0043/short-description Fri Sep 05 20:01:58 2008 +0000 @@ -0,0 +1,1 @@ +LARGE_ADB --adb_root, --adb_feature_root query / WS query
--- a/tests/0050/run-test.sh Fri Sep 05 16:40:41 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -#! /bin/bash - -. ../test-utils.sh - -if [ -f testdb ]; then rm -f testdb; fi - -${AUDIODB} -d testdb -N - -intstring 2 > testfeature -floatstring 0 1 >> testfeature -floatstring 1 0 >> testfeature -floatstring 1 0 >> testfeature -floatstring 0 1 >> testfeature - -intstring 1 > testpower -floatstring -0.5 >> testpower -floatstring -1 >> testpower -floatstring -1 >> testpower -floatstring -0.5 >> testpower - -expect_clean_error_exit ${AUDIODB} -d testdb -I -f testfeature -w testpower -${AUDIODB} -d testdb -P -expect_clean_error_exit ${AUDIODB} -d testdb -I -f testfeature -${AUDIODB} -d testdb -I -f testfeature -w testpower - -# sequence queries require L2NORM -${AUDIODB} -d testdb -L - -echo "query points (0.0,0.5),(0.0,0.5),(0.5,0.0)" -intstring 2 > testquery -floatstring 0 0.5 >> testquery -floatstring 0 0.5 >> testquery -floatstring 0.5 0 >> testquery - -# LSH Indexing tests - -# Indexing requires a radius (-R) -expect_clean_error_exit ${AUDIODB} -d testdb -X -l 1 - -# Index with default LSH params -${AUDIODB} -d testdb -X -l 1 -R 1 - -WSPORT=10020 -start_server ${AUDIODB} ${WSPORT} - -# WS Query using the index - -${AUDIODB} -c localhost:${WSPORT} -d testdb -Q sequence -l 1 -f testquery -w testpower -R 1 > testoutput -echo testfeature 1 > test-expected-output -cmp testoutput test-expected-output - -${AUDIODB} -c localhost:${WSPORT} -d testdb -Q sequence -l 1 -f testquery -w testpower -p 0 -R 1 > testoutput -echo testfeature 1 > test-expected-output -cmp testoutput test-expected-output - -${AUDIODB} -c localhost:${WSPORT} -d testdb -Q sequence -l 1 -f testquery -w testpower -p 1 -R 1 > testoutput -echo testfeature 1 > test-expected-output -cmp testoutput test-expected-output - -${AUDIODB} -c localhost:${WSPORT} -d testdb -Q sequence -l 1 -f testquery -w testpower -e -R 1 > testoutput -echo testfeature 3 > test-expected-output -cmp testoutput test-expected-output - -${AUDIODB} -c localhost:${WSPORT} -d testdb -Q sequence -l 1 -f testquery -w testpower -e -R 1 --lsh_exact > testoutput -echo testfeature 3 > test-expected-output -cmp testoutput test-expected-output - -# make index, sequenceLength=2 -${AUDIODB} -d testdb -X -l 2 -R 1 - -# query, sequenceLength=2 -${AUDIODB} -c localhost:${WSPORT} -d testdb -Q sequence -l 2 -f testquery -w testpower -p 0 -R 1 > testoutput -echo testfeature 1 > test-expected-output -cmp testoutput test-expected-output - -${AUDIODB} -c localhost:${WSPORT} -d testdb -Q sequence -l 2 -f testquery -w testpower -p 1 -R 1 > testoutput -echo testfeature 1 > test-expected-output -cmp testoutput test-expected-output - -${AUDIODB} -c localhost:${WSPORT} -d testdb -Q sequence -l 2 -f testquery -w testpower -p 0 -R 1 --lsh_exact > testoutput -echo testfeature 1 > test-expected-output -cmp testoutput test-expected-output - -stop_server $! - -exit 104