Mercurial > hg > audiodb
changeset 167:100b7ba08df3 audiodb-debian
Merge trunk changes -r156:196 to audiodb-debian branch.
(+ new debian/changelog version)
author | mas01cr |
---|---|
date | Tue, 06 Nov 2007 17:16:32 +0000 |
parents | 5bac833c41b5 |
children | 6da72f0e086b |
files | INSTALL.txt Makefile Makefile.osx Makefile.win32 audioDB.cpp audioDB.h debian/changelog docs/TODO.txt tests/0025/run-test.sh tests/0025/short-description tests/9000/run-test.sh tests/9000/short-description tests/run-tests.sh |
diffstat | 13 files changed, 127 insertions(+), 46 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- 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 <gengetopt.in + ${GENGETOPT} -e <gengetopt.in soapServer.cpp soapClient.cpp soapC.cpp: audioDBws.h - soapcpp2 audioDBws.h + ${SOAPCPP2} audioDBws.h ${EXECUTABLE}: audioDB.cpp audioDB.h soapServer.cpp soapClient.cpp soapC.cpp cmdline.c cmdline.h - g++ -c ${CFLAGS} -Wall -Werror audioDB.cpp - g++ -o ${EXECUTABLE} ${CFLAGS} audioDB.o soapServer.cpp soapClient.cpp soapC.cpp cmdline.c ${LIBS} + g++ -c ${CFLAGS} ${GSOAP_INCLUDE} -Wall -Werror audioDB.cpp + g++ -o ${EXECUTABLE} ${CFLAGS} ${GSOAP_INCLUDE} audioDB.o soapServer.cpp soapClient.cpp soapC.cpp cmdline.c ${GSOAP_CPP} clean: -rm cmdline.c cmdline.h
--- a/Makefile.osx Tue Oct 23 19:57:06 2007 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ - -CFLAGS=-O3 -LIBDIR= -LIBS= -SOAPDIR=bin_x86_osx/soapcpp-macosx-2.1.6 -SOAPOBS=${SOAPDIR}/stdsoap2.o soapServer.cpp soapClient.cpp soapC.cpp -CMDOBS=cmdline.c -INCDIR=-I${SOAPDIR} - -all: audioDB.h audioDB.cpp ${SOAPOBS} ${CMDOBS} Makefile.osx - ${SOAPDIR}/soapcpp2 audioDBws.h - g++ -o audioDB ${CFLAGS} audioDB.cpp ${SOAPOBS} ${CMDOBS} ${CFLAGS} ${INCDIR} ${LIBDIR} ${LIBS}
--- a/Makefile.win32 Tue Oct 23 19:57:06 2007 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -CFLAGS=-ggdb -LIBDIR= -LIBS= -SOAPDIR=bin_x86_win/gsoap-win32-2.7 -SOAPOBS=${SOAPDIR}/stdsoap2.o soapServer.cpp soapClient.cpp soapC.cpp -INCDIR=-I${SOAPDIR} - -all: audioDB.h audioDB.cpp ${SOAPOBS} Makefile.win32 - ${SOAPDIR}/soapcpp2 audioDBws.h - g++ -o audioDB ${CFLAGS} audioDB.cpp ${SOAPOBS} ${CFLAGS} ${INCDIR} ${LIBDIR} ${LIBS}
--- a/audioDB.cpp Tue Oct 23 19:57:06 2007 +0000 +++ b/audioDB.cpp Tue Nov 06 17:16:32 2007 +0000 @@ -42,7 +42,7 @@ printf("%s\n", gengetopt_args_info_help[1]); printf("%s\n", gengetopt_args_info_help[2]); printf("%s\n", gengetopt_args_info_help[0]); - exit(1); + error("No command found"); } if(O2_ACTION(COM_SERVER)) @@ -82,8 +82,8 @@ audioDB::audioDB(const unsigned argc, char* const argv[], adb__queryResponse *adbQueryResponse): O2_AUDIODB_INITIALIZERS { try { + isServer = 1; // FIXME: Hack processArgs(argc, argv); - isServer = 1; // FIXME: Hack assert(O2_ACTION(COM_QUERY)); query(dbName, inFile, adbQueryResponse); } catch(char *err) { @@ -95,8 +95,8 @@ audioDB::audioDB(const unsigned argc, char* const argv[], adb__statusResponse *adbStatusResponse): O2_AUDIODB_INITIALIZERS { try { + isServer = 1; // FIXME: Hack processArgs(argc, argv); - isServer = 1; // FIXME: Hack assert(O2_ACTION(COM_STATUS)); status(dbName, adbStatusResponse); } catch(char *err) { @@ -137,7 +137,7 @@ } if (cmdline_parser (argc, argv, &args_info) != 0) - exit(1) ; + error("Error parsing command line"); if(args_info.help_given){ cmdline_parser_print_help(); @@ -153,7 +153,7 @@ } if(args_info.size_given) { - if (args_info.size_arg < 250 || args_info.size_arg > 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,
--- 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<<w)-1) & ~((1<<w)-1)) #define ALIGN_DOWN(x,w) ((x) & ~((1<<w)-1)) +#define ENSURE_STRING(x) ((x) ? (x) : "") + using namespace std; typedef struct dbTableHeader{
--- a/debian/changelog Tue Oct 23 19:57:06 2007 +0000 +++ b/debian/changelog Tue Nov 06 17:16:32 2007 +0000 @@ -1,3 +1,10 @@ +audiodb (1.0-14) unstable; urgency=low + + * Updated to svn version #196 + * (fixes some command-line handling bugs in the server process) + + -- Christophe Rhodes <c.rhodes@gold.ac.uk> Tue, 6 Nov 2007 16:36:55 +0000 + audiodb (1.0-13) unstable; urgency=low * Updated to svn version #155
--- 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
--- /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 <<EOF +0 +1 +2 +EOF + +${AUDIODB} -d testdb -I -f testfeature -t testtimes + +# sequence queries require L2NORM +${AUDIODB} -d testdb -L + +echo "query point (0.0,0.5)" +intstring 2 > 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
--- /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
--- /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
--- /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
--- 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}