# HG changeset patch # User mas01cr # Date 1194369392 0 # Node ID 100b7ba08df303eb1bc0947efa04a0ec45b396d9 # Parent 5bac833c41b5802cf8af762e39dacdd7faad3cba Merge trunk changes -r156:196 to audiodb-debian branch. (+ new debian/changelog version) diff -r 5bac833c41b5 -r 100b7ba08df3 INSTALL.txt --- a/INSTALL.txt Tue Oct 23 19:57:06 2007 +0000 +++ b/INSTALL.txt Tue Nov 06 17:16:32 2007 +0000 @@ -14,6 +14,14 @@ Use the following Makefiles to compile audioDB on your system: -Linux: Makefile -Mac OS X: Makefile.osx -Win32: Makefile.win32 +Linux: make +(Debian-derived systems, with the right versions of gengetopt, gsoap +and help2man installed) + +OS X or Win32: make \ + GENGETOPT=/path/to/bin/gengetopt \ + SOAPCPP2=/path/to/bin/soapcpp2 \ + GSOAP_CPP=/path/to/gsoap/stdsoap2.cpp \ + GSOAP_INCLUDE="-I /path/to/gsoap" +(where the path in GSOAP_INCLUDE should name the directory in which +stdsoap2.h resides) diff -r 5bac833c41b5 -r 100b7ba08df3 Makefile --- a/Makefile Tue Oct 23 19:57:06 2007 +0000 +++ b/Makefile Tue Nov 06 17:16:32 2007 +0000 @@ -1,5 +1,10 @@ +HELP2MAN=help2man +GENGETOPT=gengetopt +SOAPCPP2=soapcpp2 +GSOAP_CPP=-lgsoap++ +GSOAP_INCLUDE= + CFLAGS=-O3 -g -LIBS=-lgsoap++ EXECUTABLE=audioDB @@ -8,20 +13,20 @@ all: ${EXECUTABLE} ${EXECUTABLE}.1: ${EXECUTABLE} - help2man ./${EXECUTABLE} > ${EXECUTABLE}.1 + ${HELP2MAN} ./${EXECUTABLE} > ${EXECUTABLE}.1 HELP.txt: ${EXECUTABLE} ./${EXECUTABLE} --help > HELP.txt cmdline.c cmdline.h: gengetopt.in - gengetopt 4000) { + if (args_info.size_arg < 50 || args_info.size_arg > 4000) { error("Size out of range", ""); } size = args_info.size_arg * 1000000; @@ -175,7 +175,7 @@ port=args_info.SERVER_arg; if(port<100 || port > 100000) error("port out of range"); - isServer=1; + isServer = 1; #if defined(O2_DEBUG) struct sigaction sa; sa.sa_sigaction = sigterm_action; @@ -398,6 +398,8 @@ dbH = new dbTableHeaderT(); assert(dbH); + unsigned int maxfiles = (unsigned int) rint((double) O2_MAXFILES * (double) size / (double) O2_DEFAULTDBSIZE); + // Initialize header dbH->magic = O2_MAGIC; dbH->version = O2_FORMAT_VERSION; @@ -406,10 +408,10 @@ dbH->flags = 0; dbH->length = 0; dbH->fileTableOffset = ALIGN_UP(O2_HEADERSIZE, 8); - dbH->trackTableOffset = ALIGN_UP(dbH->fileTableOffset + O2_FILETABLESIZE*O2_MAXFILES, 8); - dbH->dataOffset = ALIGN_UP(dbH->trackTableOffset + O2_TRACKTABLESIZE*O2_MAXFILES, 8); - dbH->l2normTableOffset = ALIGN_DOWN(size - O2_MAXFILES*O2_MEANNUMVECTORS*sizeof(double), 8); - dbH->timesTableOffset = ALIGN_DOWN(dbH->l2normTableOffset - O2_MAXFILES*O2_MEANNUMVECTORS*sizeof(double), 8); + dbH->trackTableOffset = ALIGN_UP(dbH->fileTableOffset + O2_FILETABLESIZE*maxfiles, 8); + dbH->dataOffset = ALIGN_UP(dbH->trackTableOffset + O2_TRACKTABLESIZE*maxfiles, 8); + dbH->l2normTableOffset = ALIGN_DOWN(size - maxfiles*O2_MEANNUMVECTORS*sizeof(double), 8); + dbH->timesTableOffset = ALIGN_DOWN(dbH->l2normTableOffset - maxfiles*O2_MEANNUMVECTORS*sizeof(double), 8); dbH->dbSize = size; memcpy (db, dbH, O2_HEADERSIZE); @@ -2627,13 +2629,13 @@ COM_QUERY, queryType, // Need to pass a parameter COM_DATABASE, - dbName, + ENSURE_STRING(dbName), COM_FEATURES, - qKey, + ENSURE_STRING(qKey), COM_KEYLIST, - keyList==0?"":keyList, + ENSURE_STRING(keyList), COM_TIMES, - timesFileName==0?"":timesFileName, + ENSURE_STRING(timesFileName), COM_QPOINT, qPosStr, COM_POINTNN, diff -r 5bac833c41b5 -r 100b7ba08df3 audioDB.h --- a/audioDB.h Tue Oct 23 19:57:06 2007 +0000 +++ b/audioDB.h Tue Nov 06 17:16:32 2007 +0000 @@ -83,6 +83,8 @@ #define ALIGN_UP(x,w) ((x) + ((1< Tue, 6 Nov 2007 16:36:55 +0000 + audiodb (1.0-13) unstable; urgency=low * Updated to svn version #155 diff -r 5bac833c41b5 -r 100b7ba08df3 docs/TODO.txt --- a/docs/TODO.txt Tue Oct 23 19:57:06 2007 +0000 +++ b/docs/TODO.txt Tue Nov 06 17:16:32 2007 +0000 @@ -64,6 +64,13 @@ * architectural issues +** more safety + +A couple of areas are not yet safe against runtime faults. The simple +case is zero-length features, which will lead to division by zero +errors; more pressingly, large databases might well end up writing off +the end of the various tables (e.g. track, l2norm). + ** API vs command-line While having a command line interface is nice, having the only way to diff -r 5bac833c41b5 -r 100b7ba08df3 tests/0025/run-test.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/0025/run-test.sh Tue Nov 06 17:16:32 2007 +0000 @@ -0,0 +1,46 @@ +#! /bin/sh + +. ../test-utils.sh + +if [ -f testdb ]; then rm -f testdb; fi + +${AUDIODB} -d testdb -N + +intstring 2 > testfeature +floatstring 0 0.5 >> testfeature +floatstring 0.5 0 >> testfeature + +cat > testtimes < testquery +floatstring 0 0.5 >> testquery + +${AUDIODB} -d testdb -Q sequence -l 1 -f testquery > testoutput +echo testfeature 1 0 0 > test-expected-output +cmp testoutput test-expected-output +${AUDIODB} -d testdb -Q sequence -l 1 -f testquery -n 1 > testoutput +echo testfeature 0 0 0 > test-expected-output +cmp testoutput test-expected-output + +echo "query point (0.5,0.0)" +intstring 2 > testquery +floatstring 0.5 0 >> testquery + +${AUDIODB} -d testdb -Q sequence -l 1 -f testquery > testoutput +echo testfeature 1 0 1 > test-expected-output +cmp testoutput test-expected-output +${AUDIODB} -d testdb -Q sequence -l 1 -f testquery -n 1 > testoutput +echo testfeature 0 0 1 > test-expected-output +cmp testoutput test-expected-output + +exit 104 diff -r 5bac833c41b5 -r 100b7ba08df3 tests/0025/short-description --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/0025/short-description Tue Nov 06 17:16:32 2007 +0000 @@ -0,0 +1,1 @@ +insertion with times \ No newline at end of file diff -r 5bac833c41b5 -r 100b7ba08df3 tests/9000/run-test.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/9000/run-test.sh Tue Nov 06 17:16:32 2007 +0000 @@ -0,0 +1,18 @@ +#! /bin/sh + +. ../test-utils.sh + +for file in `find .. -name testdb -print | sort -n` +do + dir=`mktemp -d` + echo dumping "${file}" into "${dir}/${file:3:4}" + ${AUDIODB} -d ${file} -D --output="${dir}/${file:3:4}" + echo restoring "${file}" into "${dir}"/"${file:3:4}"/restoredb + export restoreadb=${AUDIODB} + (export AUDIODB=`pwd`/$restoreadb && cd "${dir}"/"${file:3:4}" && sh ./restore.sh restoredb) + echo comparing dbs for "${file:3:4}" + cmp "${file}" "${dir}"/"${file:3:4}"/restoredb + rm -rf "${dir}" +done + +exit 104 diff -r 5bac833c41b5 -r 100b7ba08df3 tests/9000/short-description --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/9000/short-description Tue Nov 06 17:16:32 2007 +0000 @@ -0,0 +1,1 @@ +dump/restore of testdbs \ No newline at end of file diff -r 5bac833c41b5 -r 100b7ba08df3 tests/run-tests.sh --- a/tests/run-tests.sh Tue Oct 23 19:57:06 2007 +0000 +++ b/tests/run-tests.sh Tue Nov 06 17:16:32 2007 +0000 @@ -10,7 +10,13 @@ exit 1 fi -for file in [0-9][0-9][0-9][0-9]*; do +if [ "$1" = "--full" ]; then + pattern="[0-9][0-9][0-9][0-9]*" +else + pattern="[0-8][0-9][0-9][0-9]*" +fi + +for file in ${pattern}; do if [ -d ${file} ]; then if [ -f ${file}/run-test.sh ]; then echo -n Running test ${file}