mas01cr@277: #! /bin/bash mas01cr@107: mas01cr@107: . ../test-utils.sh mas01cr@107: mas01cr@107: if [ -f testdb ]; then rm -f testdb; fi mas01cr@107: mas01cr@107: ${AUDIODB} -d testdb -N mas01cr@107: mas01cr@107: # tests that the lack of -l when the query sequence is shorter doesn't mas01cr@107: # segfault. mas01cr@107: mas01cr@107: intstring 2 > testfeature mas01cr@107: floatstring 0 1 >> testfeature mas01cr@107: floatstring 1 0 >> testfeature mas01cr@107: mas01cr@107: ${AUDIODB} -d testdb -I -f testfeature mas01cr@107: mas01cr@107: # sequence queries require L2NORM mas01cr@107: ${AUDIODB} -d testdb -L mas01cr@107: mas01cr@107: start_server ${AUDIODB} 10017 mas01cr@107: mas01cr@107: echo "query point (0.0,0.5)" mas01cr@107: intstring 2 > testquery mas01cr@107: floatstring 0 0.5 >> testquery mas01cr@107: mas01cr@107: # FIXME: this actually revealed a horrible failure mode of the server: mas01cr@107: # since we were throwing exceptions from the constructor, the mas01cr@107: # destructor wasn't getting called and so we were retaining 2Gb of mas01cr@107: # address space, leading to immediate out of memory errors for the mas01cr@107: # /second/ call. We fix that by being a bit more careful about our mas01cr@107: # exception handling and cleanup discipline, but how to test...? mas01cr@107: mas01cr@107: expect_client_failure ${AUDIODB} -c localhost:10017 -d testdb -Q sequence -f testquery mas01cr@107: expect_client_failure ${AUDIODB} -c localhost:10017 -d testdb -Q sequence -f testquery -n 1 mas01cr@107: mas01cr@107: check_server $! mas01cr@107: mas01cr@107: echo "query point (0.5,0.0)" mas01cr@107: intstring 2 > testquery mas01cr@107: floatstring 0.5 0 >> testquery mas01cr@107: mas01cr@107: expect_client_failure ${AUDIODB} -c localhost:10017 -d testdb -Q sequence -f testquery mas01cr@107: expect_client_failure ${AUDIODB} -c localhost:10017 -d testdb -Q sequence -f testquery -n 1 mas01cr@107: mas01cr@107: check_server $! mas01cr@107: mas01cr@107: # see if the server can actually produce any output at this point mas01cr@107: ${AUDIODB} -c localhost:10017 -d testdb -Q sequence -l 1 -f testquery -n 1 > testoutput mas01cr@107: echo testfeature 0 0 1 > test-expected-output mas01cr@107: cmp testoutput test-expected-output mas01cr@107: mas01cr@107: stop_server $! mas01cr@107: mas01cr@107: exit 104