# HG changeset patch # User mas01cr # Date 1226596191 0 # Node ID cd63493c32a9f2f4545b3ccb662f016bf0ace1e3 # Parent 52406e53f1335d8c9ed5cea6954a3217a82979c9 Add library SONAME versioning. This has the unfortunate effect of altering how the linker and the runtime library resolver find relevant files, which has effects on how the library test suite should be run. So... ... also rework how to run libtests. Start by deleting 28 almost-identical copies of Makefile and run-test.sh, and also the completely useless copy of test-utils.sh. Then: * library tests assume the existence of ../libtest.mk, a file with make syntax; * ../libtest.mk is responsible for providing enough symbolic links to con the linker and the runtime resolver into finding our library; * the default way of doing that is by using the -rpath linker flag. * run-tests.sh converts from test1 success convention ("return 0") to tests success convention ("exit 104") * clean.sh cleans up our symbolic links. This test regime stands a reasonable chance of running on OS X eventually, and a snowball's chance in heaven (remember, heaven is hotter than hell) on Windows. It should still be straightforward to merge libtests/ into tests/ when that is appropriate. Don't forget to add ../libtest.mk diff -r 52406e53f133 -r cd63493c32a9 Makefile --- a/Makefile Thu Nov 13 15:31:54 2008 +0000 +++ b/Makefile Thu Nov 13 17:09:51 2008 +0000 @@ -23,8 +23,10 @@ EXECUTABLE=audioDB -LIBRARY=libaudioDB_API.so +SOVERSION=0 +MINORVERSION=0 +LIBRARY=lib$(EXECUTABLE).so.$(SOVERSION).$(MINORVERSION) .PHONY: all clean test @@ -56,7 +58,7 @@ $(LIBRARY): $(LIBOBJS) audioDB_library.o - g++ -shared -o $(LIBRARY) $(CFLAGS) $(LIBGSL) $^ + g++ -shared -Wl,-soname,lib$(EXECUTABLE).so.$(SOVERSION) -o $(LIBRARY) $(CFLAGS) $(LIBGSL) $^ tags: ctags *.cpp *.h @@ -87,6 +89,8 @@ install: cp $(LIBRARY) /usr/local/lib/ + ln -sf /usr/local/lib/$(LIBRARY) /usr/local/lib/lib$(EXECUTABLE).so.$(SOVERSION) + ln -sf /usr/local/lib/lib$(EXECUTABLE).so.$(SOVERSION) /usr/local/lib/lib$(EXECUTABLE).so ldconfig cp audioDB_API.h /usr/local/include/ diff -r 52406e53f133 -r cd63493c32a9 libtests/0001/Makefile --- a/libtests/0001/Makefile Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -CC=gcc -CFLAGS+=-O3 -g -RM=rm -rf - -all: test1 - - -test1: prog1.c - #gcc -Wall -o test1 prog1.c -laudioDB_API -L.. - gcc -Wall -o test1 prog1.c -laudioDB_API -L../.. - -clean: - $(RM) test1 diff -r 52406e53f133 -r cd63493c32a9 libtests/0001/run-test.sh --- a/libtests/0001/run-test.sh Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#! /bin/bash - -#. ../test-utils.sh -# -#if [ -f testdb ]; then rm -f testdb; fi -# -## creation -#${AUDIODB} -N -d testdb -# -#stat testdb -# -## should fail (testdb exists) -#expect_clean_error_exit ${AUDIODB} -N -d testdb -# -## should fail (no db given) -#expect_clean_error_exit ${AUDIODB} -N -# -#exit 104 - -LD_LIBRARY_PATH=../.. -export LD_LIBRARY_PATH - -. ../test-utils.sh - -make clean -make all - -./test1 - -exit_code=$? - -if [ $exit_code -eq 0 ]; then - exit 104 -else - exit -1 -fi diff -r 52406e53f133 -r cd63493c32a9 libtests/0002/Makefile --- a/libtests/0002/Makefile Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -CC=gcc -CFLAGS+=-O3 -g -RM=rm -rf - - -all: test1 - - -test1: prog1.c - gcc -Wall -o test1 prog1.c -laudioDB_API -L../.. - -clean: - $(RM) test1 diff -r 52406e53f133 -r cd63493c32a9 libtests/0002/run-test.sh --- a/libtests/0002/run-test.sh Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -#! /bin/bash - -#. ../test-utils.sh -# -#if [ -f testdb ]; then rm -f testdb; fi -# -## creation -#${AUDIODB} -N -d testdb -# -#stat testdb -# -## should fail (testdb exists) -#expect_clean_error_exit ${AUDIODB} -N -d testdb -# -## should fail (no db given) -#expect_clean_error_exit ${AUDIODB} -N -# -#exit 104 - - -LD_LIBRARY_PATH=../.. -export LD_LIBRARY_PATH - -. ../test-utils.sh - -make clean -make all - -./test1 - -exit_code=$? - -if [ $exit_code -eq 0 ]; then - exit 104 -else - exit -1 -fi diff -r 52406e53f133 -r cd63493c32a9 libtests/0003/Makefile --- a/libtests/0003/Makefile Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -CC=gcc -CFLAGS+=-O3 -g -RM=rm -rf - - -all: test1 - - -test1: prog1.c - gcc -Wall -o test1 prog1.c -laudioDB_API -L../.. - -clean: - $(RM) test1 diff -r 52406e53f133 -r cd63493c32a9 libtests/0003/run-test.sh --- a/libtests/0003/run-test.sh Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -#! /bin/bash - -#. ../test-utils.sh -# -#if [ -f testdb ]; then rm -f testdb; fi -# -## creation -#${AUDIODB} -N -d testdb -# -#stat testdb -# -## should fail (testdb exists) -#expect_clean_error_exit ${AUDIODB} -N -d testdb -# -## should fail (no db given) -#expect_clean_error_exit ${AUDIODB} -N -# -#exit 104 - - -LD_LIBRARY_PATH=../.. -export LD_LIBRARY_PATH - -. ../test-utils.sh - -make clean -make all - -./test1 - -exit_code=$? - -if [ $exit_code -eq 0 ]; then - exit 104 -else - exit -1 -fi diff -r 52406e53f133 -r cd63493c32a9 libtests/0004/Makefile --- a/libtests/0004/Makefile Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -CC=gcc -CFLAGS+=-O3 -g -RM=rm -rf - - -all: test1 - - -test1: prog1.c - gcc -Wall -o test1 prog1.c -laudioDB_API -L../.. - -clean: - $(RM) test1 diff -r 52406e53f133 -r cd63493c32a9 libtests/0004/run-test.sh --- a/libtests/0004/run-test.sh Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#! /bin/bash - -#. ../test-utils.sh -# -#if [ -f testdb ]; then rm -f testdb; fi -# -## creation -#${AUDIODB} -N -d testdb -# -#stat testdb -# -## should fail (testdb exists) -#expect_clean_error_exit ${AUDIODB} -N -d testdb -# -## should fail (no db given) -#expect_clean_error_exit ${AUDIODB} -N -# -#exit 104 - -LD_LIBRARY_PATH=../.. -export LD_LIBRARY_PATH - -. ../test-utils.sh - -make clean -make all - -./test1 - -exit_code=$? - -if [ $exit_code -eq 0 ]; then - exit 104 -else - exit -1 -fi diff -r 52406e53f133 -r cd63493c32a9 libtests/0005/Makefile --- a/libtests/0005/Makefile Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -CC=gcc -CFLAGS+=-O3 -g -RM=rm -rf - - -all: test1 - - -test1: prog1.c - gcc -Wall -o test1 prog1.c -laudioDB_API -L../.. - -clean: - $(RM) test1 diff -r 52406e53f133 -r cd63493c32a9 libtests/0005/run-test.sh --- a/libtests/0005/run-test.sh Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#! /bin/bash - -#. ../test-utils.sh -# -#if [ -f testdb ]; then rm -f testdb; fi -# -## creation -#${AUDIODB} -N -d testdb -# -#stat testdb -# -## should fail (testdb exists) -#expect_clean_error_exit ${AUDIODB} -N -d testdb -# -## should fail (no db given) -#expect_clean_error_exit ${AUDIODB} -N -# -#exit 104 - -LD_LIBRARY_PATH=../.. -export LD_LIBRARY_PATH - -. ../test-utils.sh - -make clean -make all - -./test1 - -exit_code=$? - -if [ $exit_code -eq 0 ]; then - exit 104 -else - exit -1 -fi diff -r 52406e53f133 -r cd63493c32a9 libtests/0006/Makefile --- a/libtests/0006/Makefile Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -CC=gcc -CFLAGS+=-O3 -g -RM=rm -rf - - -all: test1 - - -test1: prog1.c - gcc -Wall -o test1 prog1.c -laudioDB_API -L../.. - -clean: - $(RM) test1 diff -r 52406e53f133 -r cd63493c32a9 libtests/0006/run-test.sh --- a/libtests/0006/run-test.sh Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -#! /bin/bash - -#. ../test-utils.sh -# -#if [ -f testdb ]; then rm -f testdb; fi -# -## creation -#${AUDIODB} -N -d testdb -# -#stat testdb -# -## should fail (testdb exists) -#expect_clean_error_exit ${AUDIODB} -N -d testdb -# -## should fail (no db given) -#expect_clean_error_exit ${AUDIODB} -N -# -#exit 104 - - -LD_LIBRARY_PATH=../.. -export LD_LIBRARY_PATH - -. ../test-utils.sh - -make clean -make all - -./test1 - -exit_code=$? - -if [ $exit_code -eq 0 ]; then - exit 104 -else - exit -1 -fi diff -r 52406e53f133 -r cd63493c32a9 libtests/0007/Makefile --- a/libtests/0007/Makefile Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -CC=gcc -CFLAGS+=-O3 -g -RM=rm -rf - - -all: test1 - - -test1: prog1.c - gcc -Wall -o test1 prog1.c -laudioDB_API -L../.. - -clean: - $(RM) test1 diff -r 52406e53f133 -r cd63493c32a9 libtests/0007/run-test.sh --- a/libtests/0007/run-test.sh Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#! /bin/bash - -#. ../test-utils.sh -# -#if [ -f testdb ]; then rm -f testdb; fi -# -## creation -#${AUDIODB} -N -d testdb -# -#stat testdb -# -## should fail (testdb exists) -#expect_clean_error_exit ${AUDIODB} -N -d testdb -# -## should fail (no db given) -#expect_clean_error_exit ${AUDIODB} -N -# -#exit 104 - -LD_LIBRARY_PATH=../.. -export LD_LIBRARY_PATH - -. ../test-utils.sh - -make clean -make all - -./test1 - -exit_code=$? - -if [ $exit_code -eq 0 ]; then - exit 104 -else - exit -1 -fi diff -r 52406e53f133 -r cd63493c32a9 libtests/0008/Makefile --- a/libtests/0008/Makefile Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -CC=gcc -CFLAGS+=-O3 -g -RM=rm -rf - - -all: test1 - - -test1: prog1.c - gcc -Wall -o test1 prog1.c -laudioDB_API -L../.. - -clean: - $(RM) test1 diff -r 52406e53f133 -r cd63493c32a9 libtests/0008/run-test.sh --- a/libtests/0008/run-test.sh Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#! /bin/bash - -#. ../test-utils.sh -# -#if [ -f testdb ]; then rm -f testdb; fi -# -## creation -#${AUDIODB} -N -d testdb -# -#stat testdb -# -## should fail (testdb exists) -#expect_clean_error_exit ${AUDIODB} -N -d testdb -# -## should fail (no db given) -#expect_clean_error_exit ${AUDIODB} -N -# -#exit 104 - -LD_LIBRARY_PATH=../.. -export LD_LIBRARY_PATH - -. ../test-utils.sh - -make clean -make all - -./test1 - -exit_code=$? - -if [ $exit_code -eq 0 ]; then - exit 104 -else - exit -1 -fi diff -r 52406e53f133 -r cd63493c32a9 libtests/0009/Makefile --- a/libtests/0009/Makefile Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -CC=gcc -CFLAGS+=-O3 -g -RM=rm -rf - - -all: test1 - - -test1: prog1.c - gcc -Wall -o test1 prog1.c -laudioDB_API -L../.. - -clean: - $(RM) test1 diff -r 52406e53f133 -r cd63493c32a9 libtests/0009/run-test.sh --- a/libtests/0009/run-test.sh Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#! /bin/bash - -#. ../test-utils.sh -# -#if [ -f testdb ]; then rm -f testdb; fi -# -## creation -#${AUDIODB} -N -d testdb -# -#stat testdb -# -## should fail (testdb exists) -#expect_clean_error_exit ${AUDIODB} -N -d testdb -# -## should fail (no db given) -#expect_clean_error_exit ${AUDIODB} -N -# -#exit 104 - -LD_LIBRARY_PATH=../.. -export LD_LIBRARY_PATH - -. ../test-utils.sh - -make clean -make all - -./test1 - -exit_code=$? - -if [ $exit_code -eq 0 ]; then - exit 104 -else - exit -1 -fi diff -r 52406e53f133 -r cd63493c32a9 libtests/0010/Makefile --- a/libtests/0010/Makefile Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -CC=gcc -CFLAGS+=-O3 -g -RM=rm -rf - - -all: test1 - - -test1: prog1.c - gcc -Wall -o test1 prog1.c -laudioDB_API -L../.. - -clean: - $(RM) test1 diff -r 52406e53f133 -r cd63493c32a9 libtests/0010/run-test.sh --- a/libtests/0010/run-test.sh Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#! /bin/bash - -#. ../test-utils.sh -# -#if [ -f testdb ]; then rm -f testdb; fi -# -## creation -#${AUDIODB} -N -d testdb -# -#stat testdb -# -## should fail (testdb exists) -#expect_clean_error_exit ${AUDIODB} -N -d testdb -# -## should fail (no db given) -#expect_clean_error_exit ${AUDIODB} -N -# -#exit 104 - -LD_LIBRARY_PATH=../.. -export LD_LIBRARY_PATH - -. ../test-utils.sh - -make clean -make all - -./test1 - -exit_code=$? - -if [ $exit_code -eq 0 ]; then - exit 104 -else - exit -1 -fi diff -r 52406e53f133 -r cd63493c32a9 libtests/0011/Makefile --- a/libtests/0011/Makefile Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -CC=gcc -CFLAGS+=-O3 -g -RM=rm -rf - - -all: test1 - - -test1: prog1.c - gcc -Wall -o test1 prog1.c -laudioDB_API -L../.. - -clean: - $(RM) test1 diff -r 52406e53f133 -r cd63493c32a9 libtests/0011/run-test.sh --- a/libtests/0011/run-test.sh Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#! /bin/bash - -#. ../test-utils.sh -# -#if [ -f testdb ]; then rm -f testdb; fi -# -## creation -#${AUDIODB} -N -d testdb -# -#stat testdb -# -## should fail (testdb exists) -#expect_clean_error_exit ${AUDIODB} -N -d testdb -# -## should fail (no db given) -#expect_clean_error_exit ${AUDIODB} -N -# -#exit 104 - -LD_LIBRARY_PATH=../.. -export LD_LIBRARY_PATH - -. ../test-utils.sh - -make clean -make all - -./test1 - -exit_code=$? - -if [ $exit_code -eq 0 ]; then - exit 104 -else - exit -1 -fi diff -r 52406e53f133 -r cd63493c32a9 libtests/0012/Makefile --- a/libtests/0012/Makefile Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -CC=gcc -CFLAGS+=-O3 -g -RM=rm -rf - - -all: test1 - - -test1: prog1.c - gcc -Wall -o test1 prog1.c -laudioDB_API -L../.. - -clean: - $(RM) test1 diff -r 52406e53f133 -r cd63493c32a9 libtests/0012/run-test.sh --- a/libtests/0012/run-test.sh Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#! /bin/bash - -#. ../test-utils.sh -# -#if [ -f testdb ]; then rm -f testdb; fi -# -## creation -#${AUDIODB} -N -d testdb -# -#stat testdb -# -## should fail (testdb exists) -#expect_clean_error_exit ${AUDIODB} -N -d testdb -# -## should fail (no db given) -#expect_clean_error_exit ${AUDIODB} -N -# -#exit 104 - -LD_LIBRARY_PATH=../.. -export LD_LIBRARY_PATH - -. ../test-utils.sh - -make clean -make all - -./test1 - -exit_code=$? - -if [ $exit_code -eq 0 ]; then - exit 104 -else - exit -1 -fi diff -r 52406e53f133 -r cd63493c32a9 libtests/0022/Makefile --- a/libtests/0022/Makefile Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -CC=gcc -CFLAGS+=-O3 -g -RM=rm -rf - - -all: test1 - - -test1: prog1.c - gcc -Wall -o test1 prog1.c -laudioDB_API -L../.. - -clean: - $(RM) test1 diff -r 52406e53f133 -r cd63493c32a9 libtests/0022/run-test.sh --- a/libtests/0022/run-test.sh Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#! /bin/bash - -#. ../test-utils.sh -# -#if [ -f testdb ]; then rm -f testdb; fi -# -## creation -#${AUDIODB} -N -d testdb -# -#stat testdb -# -## should fail (testdb exists) -#expect_clean_error_exit ${AUDIODB} -N -d testdb -# -## should fail (no db given) -#expect_clean_error_exit ${AUDIODB} -N -# -#exit 104 - -LD_LIBRARY_PATH=../.. -export LD_LIBRARY_PATH - -. ../test-utils.sh - -make clean -make all - -./test1 - -exit_code=$? - -if [ $exit_code -eq 0 ]; then - exit 104 -else - exit -1 -fi diff -r 52406e53f133 -r cd63493c32a9 libtests/0023/Makefile --- a/libtests/0023/Makefile Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -CC=gcc -CFLAGS+=-O3 -g -RM=rm -rf - - -all: clean test1 - - -test1: prog1.c - gcc -Wall -o test1 prog1.c -laudioDB_API -L../.. - -clean: - $(RM) test1 diff -r 52406e53f133 -r cd63493c32a9 libtests/0023/run-test.sh --- a/libtests/0023/run-test.sh Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#! /bin/bash - -#. ../test-utils.sh -# -#if [ -f testdb ]; then rm -f testdb; fi -# -## creation -#${AUDIODB} -N -d testdb -# -#stat testdb -# -## should fail (testdb exists) -#expect_clean_error_exit ${AUDIODB} -N -d testdb -# -## should fail (no db given) -#expect_clean_error_exit ${AUDIODB} -N -# -#exit 104 - -LD_LIBRARY_PATH=../.. -export LD_LIBRARY_PATH - -. ../test-utils.sh - -make clean -make all - -./test1 - -exit_code=$? - -if [ $exit_code -eq 0 ]; then - exit 104 -else - exit -1 -fi diff -r 52406e53f133 -r cd63493c32a9 libtests/0024/Makefile --- a/libtests/0024/Makefile Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -CC=gcc -CFLAGS+=-O3 -g -RM=rm -rf - - -all: test1 - - -test1: prog1.c - gcc -Wall -o test1 prog1.c -laudioDB_API -L../.. - -clean: - $(RM) test1 diff -r 52406e53f133 -r cd63493c32a9 libtests/0024/run-test.sh --- a/libtests/0024/run-test.sh Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#! /bin/bash - -#. ../test-utils.sh -# -#if [ -f testdb ]; then rm -f testdb; fi -# -## creation -#${AUDIODB} -N -d testdb -# -#stat testdb -# -## should fail (testdb exists) -#expect_clean_error_exit ${AUDIODB} -N -d testdb -# -## should fail (no db given) -#expect_clean_error_exit ${AUDIODB} -N -# -#exit 104 - -LD_LIBRARY_PATH=../.. -export LD_LIBRARY_PATH - -. ../test-utils.sh - -make clean -make all - -./test1 - -exit_code=$? - -if [ $exit_code -eq 0 ]; then - exit 104 -else - exit -1 -fi diff -r 52406e53f133 -r cd63493c32a9 libtests/0025/Makefile --- a/libtests/0025/Makefile Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -CC=gcc -CFLAGS+=-O3 -g -RM=rm -rf - - -all: test1 - - -test1: prog1.c - gcc -Wall -o test1 prog1.c -laudioDB_API -L../.. - -clean: - $(RM) test1 diff -r 52406e53f133 -r cd63493c32a9 libtests/0025/run-test.sh --- a/libtests/0025/run-test.sh Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#! /bin/bash - -#. ../test-utils.sh -# -#if [ -f testdb ]; then rm -f testdb; fi -# -## creation -#${AUDIODB} -N -d testdb -# -#stat testdb -# -## should fail (testdb exists) -#expect_clean_error_exit ${AUDIODB} -N -d testdb -# -## should fail (no db given) -#expect_clean_error_exit ${AUDIODB} -N -# -#exit 104 - -LD_LIBRARY_PATH=../.. -export LD_LIBRARY_PATH - -. ../test-utils.sh - -make clean -make all - -./test1 - -exit_code=$? - -if [ $exit_code -eq 0 ]; then - exit 104 -else - exit -1 -fi diff -r 52406e53f133 -r cd63493c32a9 libtests/0026/Makefile --- a/libtests/0026/Makefile Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -CC=gcc -CFLAGS+=-O3 -g -RM=rm -rf - - -all: test1 - - -test1: prog1.c - gcc -Wall -o test1 prog1.c -laudioDB_API -L../.. - -clean: - $(RM) test1 diff -r 52406e53f133 -r cd63493c32a9 libtests/0026/run-test.sh --- a/libtests/0026/run-test.sh Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#! /bin/bash - -#. ../test-utils.sh -# -#if [ -f testdb ]; then rm -f testdb; fi -# -## creation -#${AUDIODB} -N -d testdb -# -#stat testdb -# -## should fail (testdb exists) -#expect_clean_error_exit ${AUDIODB} -N -d testdb -# -## should fail (no db given) -#expect_clean_error_exit ${AUDIODB} -N -# -#exit 104 - -LD_LIBRARY_PATH=../.. -export LD_LIBRARY_PATH - -. ../test-utils.sh - -make clean -make all - -./test1 - -exit_code=$? - -if [ $exit_code -eq 0 ]; then - exit 104 -else - exit -1 -fi diff -r 52406e53f133 -r cd63493c32a9 libtests/0027/Makefile --- a/libtests/0027/Makefile Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -CC=gcc -CFLAGS+=-O3 -g -RM=rm -rf - - -all: test1 - - -test1: prog1.c - gcc -Wall -o test1 prog1.c -laudioDB_API -L../.. - -clean: - $(RM) test1 diff -r 52406e53f133 -r cd63493c32a9 libtests/0027/run-test.sh --- a/libtests/0027/run-test.sh Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#! /bin/bash - -#. ../test-utils.sh -# -#if [ -f testdb ]; then rm -f testdb; fi -# -## creation -#${AUDIODB} -N -d testdb -# -#stat testdb -# -## should fail (testdb exists) -#expect_clean_error_exit ${AUDIODB} -N -d testdb -# -## should fail (no db given) -#expect_clean_error_exit ${AUDIODB} -N -# -#exit 104 - -LD_LIBRARY_PATH=../.. -export LD_LIBRARY_PATH - -. ../test-utils.sh - -make clean -make all - -./test1 - -exit_code=$? - -if [ $exit_code -eq 0 ]; then - exit 104 -else - exit -1 -fi diff -r 52406e53f133 -r cd63493c32a9 libtests/0028/Makefile --- a/libtests/0028/Makefile Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -CC=gcc -CFLAGS+=-O3 -g -RM=rm -rf - - -all: test1 - - -test1: prog1.c - gcc -Wall -o test1 prog1.c -laudioDB_API -L../.. - -clean: - $(RM) test1 diff -r 52406e53f133 -r cd63493c32a9 libtests/0028/run-test.sh --- a/libtests/0028/run-test.sh Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#! /bin/bash - -#. ../test-utils.sh -# -#if [ -f testdb ]; then rm -f testdb; fi -# -## creation -#${AUDIODB} -N -d testdb -# -#stat testdb -# -## should fail (testdb exists) -#expect_clean_error_exit ${AUDIODB} -N -d testdb -# -## should fail (no db given) -#expect_clean_error_exit ${AUDIODB} -N -# -#exit 104 - -LD_LIBRARY_PATH=../.. -export LD_LIBRARY_PATH - -. ../test-utils.sh - -make clean -make all - -./test1 - -exit_code=$? - -if [ $exit_code -eq 0 ]; then - exit 104 -else - exit -1 -fi diff -r 52406e53f133 -r cd63493c32a9 libtests/0029/Makefile --- a/libtests/0029/Makefile Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -CC=gcc -CFLAGS+=-O3 -g -RM=rm -rf - - -all: test1 - - -test1: prog1.c - gcc -Wall -o test1 prog1.c -laudioDB_API -L../.. - -clean: - $(RM) test1 diff -r 52406e53f133 -r cd63493c32a9 libtests/0029/run-test.sh --- a/libtests/0029/run-test.sh Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#! /bin/bash - -#. ../test-utils.sh -# -#if [ -f testdb ]; then rm -f testdb; fi -# -## creation -#${AUDIODB} -N -d testdb -# -#stat testdb -# -## should fail (testdb exists) -#expect_clean_error_exit ${AUDIODB} -N -d testdb -# -## should fail (no db given) -#expect_clean_error_exit ${AUDIODB} -N -# -#exit 104 - -LD_LIBRARY_PATH=../.. -export LD_LIBRARY_PATH - -. ../test-utils.sh - -make clean -make all - -./test1 - -exit_code=$? - -if [ $exit_code -eq 0 ]; then - exit 104 -else - exit -1 -fi diff -r 52406e53f133 -r cd63493c32a9 libtests/0030/Makefile --- a/libtests/0030/Makefile Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -CC=gcc -CFLAGS+=-O3 -g -RM=rm -rf - - -all: test1 - - -test1: prog1.c - gcc -Wall -o test1 prog1.c -laudioDB_API -L../.. - -clean: - $(RM) test1 diff -r 52406e53f133 -r cd63493c32a9 libtests/0030/run-test.sh --- a/libtests/0030/run-test.sh Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#! /bin/bash - -#. ../test-utils.sh -# -#if [ -f testdb ]; then rm -f testdb; fi -# -## creation -#${AUDIODB} -N -d testdb -# -#stat testdb -# -## should fail (testdb exists) -#expect_clean_error_exit ${AUDIODB} -N -d testdb -# -## should fail (no db given) -#expect_clean_error_exit ${AUDIODB} -N -# -#exit 104 - -LD_LIBRARY_PATH=../.. -export LD_LIBRARY_PATH - -. ../test-utils.sh - -make clean -make all - -./test1 - -exit_code=$? - -if [ $exit_code -eq 0 ]; then - exit 104 -else - exit -1 -fi diff -r 52406e53f133 -r cd63493c32a9 libtests/0031/Makefile --- a/libtests/0031/Makefile Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -CC=gcc -CFLAGS+=-O3 -g -RM=rm -rf - - -all: test1 - - -test1: prog1.c - gcc -Wall -o test1 prog1.c -laudioDB_API -L../.. - -clean: - $(RM) test1 diff -r 52406e53f133 -r cd63493c32a9 libtests/0031/run-test.sh --- a/libtests/0031/run-test.sh Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#! /bin/bash - -#. ../test-utils.sh -# -#if [ -f testdb ]; then rm -f testdb; fi -# -## creation -#${AUDIODB} -N -d testdb -# -#stat testdb -# -## should fail (testdb exists) -#expect_clean_error_exit ${AUDIODB} -N -d testdb -# -## should fail (no db given) -#expect_clean_error_exit ${AUDIODB} -N -# -#exit 104 - -LD_LIBRARY_PATH=../.. -export LD_LIBRARY_PATH - -. ../test-utils.sh - -make clean -make all - -./test1 - -exit_code=$? - -if [ $exit_code -eq 0 ]; then - exit 104 -else - exit -1 -fi diff -r 52406e53f133 -r cd63493c32a9 libtests/0032/Makefile --- a/libtests/0032/Makefile Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -CC=gcc -CFLAGS+=-O3 -g -RM=rm -rf - - -all: test1 - - -test1: prog1.c - gcc -Wall -o test1 prog1.c -laudioDB_API -L../.. - -clean: - $(RM) test1 diff -r 52406e53f133 -r cd63493c32a9 libtests/0032/run-test.sh --- a/libtests/0032/run-test.sh Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#! /bin/bash - -#. ../test-utils.sh -# -#if [ -f testdb ]; then rm -f testdb; fi -# -## creation -#${AUDIODB} -N -d testdb -# -#stat testdb -# -## should fail (testdb exists) -#expect_clean_error_exit ${AUDIODB} -N -d testdb -# -## should fail (no db given) -#expect_clean_error_exit ${AUDIODB} -N -# -#exit 104 - -LD_LIBRARY_PATH=../.. -export LD_LIBRARY_PATH - -. ../test-utils.sh - -make clean -make all - -./test1 - -exit_code=$? - -if [ $exit_code -eq 0 ]; then - exit 104 -else - exit -1 -fi diff -r 52406e53f133 -r cd63493c32a9 libtests/0033/Makefile --- a/libtests/0033/Makefile Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -CC=gcc -CFLAGS+=-O3 -g -RM=rm -rf - - -all: test1 - - -test1: prog1.c - gcc -Wall -o test1 prog1.c -laudioDB_API -L../.. - -clean: - $(RM) test1 diff -r 52406e53f133 -r cd63493c32a9 libtests/0033/run-test.sh --- a/libtests/0033/run-test.sh Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#! /bin/bash - -#. ../test-utils.sh -# -#if [ -f testdb ]; then rm -f testdb; fi -# -## creation -#${AUDIODB} -N -d testdb -# -#stat testdb -# -## should fail (testdb exists) -#expect_clean_error_exit ${AUDIODB} -N -d testdb -# -## should fail (no db given) -#expect_clean_error_exit ${AUDIODB} -N -# -#exit 104 - -LD_LIBRARY_PATH=../.. -export LD_LIBRARY_PATH - -. ../test-utils.sh - -make clean -make all - -./test1 - -exit_code=$? - -if [ $exit_code -eq 0 ]; then - exit 104 -else - exit -1 -fi diff -r 52406e53f133 -r cd63493c32a9 libtests/0034/Makefile --- a/libtests/0034/Makefile Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -CC=gcc -CFLAGS+=-O3 -g -RM=rm -rf - - -all: test1 - - -test1: prog1.c - gcc -Wall -o test1 prog1.c -laudioDB_API -L../.. - -clean: - $(RM) test1 diff -r 52406e53f133 -r cd63493c32a9 libtests/0034/run-test.sh --- a/libtests/0034/run-test.sh Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#! /bin/bash - -#. ../test-utils.sh -# -#if [ -f testdb ]; then rm -f testdb; fi -# -## creation -#${AUDIODB} -N -d testdb -# -#stat testdb -# -## should fail (testdb exists) -#expect_clean_error_exit ${AUDIODB} -N -d testdb -# -## should fail (no db given) -#expect_clean_error_exit ${AUDIODB} -N -# -#exit 104 - -LD_LIBRARY_PATH=../.. -export LD_LIBRARY_PATH - -. ../test-utils.sh - -make clean -make all - -./test1 - -exit_code=$? - -if [ $exit_code -eq 0 ]; then - exit 104 -else - exit -1 -fi diff -r 52406e53f133 -r cd63493c32a9 libtests/0035/Makefile --- a/libtests/0035/Makefile Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -CC=gcc -CFLAGS+=-O3 -g -RM=rm -rf - - -all: test1 - - -test1: prog1.c - gcc -Wall -o test1 prog1.c -laudioDB_API -L../.. - -clean: - $(RM) test1 diff -r 52406e53f133 -r cd63493c32a9 libtests/0035/run-test.sh --- a/libtests/0035/run-test.sh Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#! /bin/bash - -#. ../test-utils.sh -# -#if [ -f testdb ]; then rm -f testdb; fi -# -## creation -#${AUDIODB} -N -d testdb -# -#stat testdb -# -## should fail (testdb exists) -#expect_clean_error_exit ${AUDIODB} -N -d testdb -# -## should fail (no db given) -#expect_clean_error_exit ${AUDIODB} -N -# -#exit 104 - -LD_LIBRARY_PATH=../.. -export LD_LIBRARY_PATH - -. ../test-utils.sh - -make clean -make all - -./test1 - -exit_code=$? - -if [ $exit_code -eq 0 ]; then - exit 104 -else - exit -1 -fi diff -r 52406e53f133 -r cd63493c32a9 libtests/0036/Makefile --- a/libtests/0036/Makefile Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -CC=gcc -CFLAGS+=-O3 -g -RM=rm -rf - - -all: test1 - - -test1: prog1.c - gcc -Wall -o test1 prog1.c -laudioDB_API -L../.. - -clean: - $(RM) test1 diff -r 52406e53f133 -r cd63493c32a9 libtests/0036/run-test.sh --- a/libtests/0036/run-test.sh Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#! /bin/bash - -#. ../test-utils.sh -# -#if [ -f testdb ]; then rm -f testdb; fi -# -## creation -#${AUDIODB} -N -d testdb -# -#stat testdb -# -## should fail (testdb exists) -#expect_clean_error_exit ${AUDIODB} -N -d testdb -# -## should fail (no db given) -#expect_clean_error_exit ${AUDIODB} -N -# -#exit 104 - -LD_LIBRARY_PATH=../.. -export LD_LIBRARY_PATH - -. ../test-utils.sh - -make clean -make all - -./test1 - -exit_code=$? - -if [ $exit_code -eq 0 ]; then - exit 104 -else - exit -1 -fi diff -r 52406e53f133 -r cd63493c32a9 libtests/9000/Makefile --- a/libtests/9000/Makefile Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -CC=gcc -CFLAGS+=-O3 -g -RM=rm -rf - - -all: test1 - - -test1: prog1.c - gcc -Wall -o test1 prog1.c -laudioDB_API -L../.. - -clean: - $(RM) test1 diff -r 52406e53f133 -r cd63493c32a9 libtests/9000/run-test.sh --- a/libtests/9000/run-test.sh Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#! /bin/bash - -#. ../test-utils.sh -# -#if [ -f testdb ]; then rm -f testdb; fi -# -## creation -#${AUDIODB} -N -d testdb -# -#stat testdb -# -## should fail (testdb exists) -#expect_clean_error_exit ${AUDIODB} -N -d testdb -# -## should fail (no db given) -#expect_clean_error_exit ${AUDIODB} -N -# -#exit 104 - -LD_LIBRARY_PATH=../.. -export LD_LIBRARY_PATH - -. ../test-utils.sh - -make clean -make all - -./test1 - -exit_code=$? - -if [ $exit_code -eq 0 ]; then - exit 104 -else - exit -1 -fi diff -r 52406e53f133 -r cd63493c32a9 libtests/clean.sh --- a/libtests/clean.sh Thu Nov 13 15:31:54 2008 +0000 +++ b/libtests/clean.sh Thu Nov 13 17:09:51 2008 +0000 @@ -4,6 +4,7 @@ if [ -d ${file} ]; then echo Cleaning ${file} rm -f ${file}/test* + (cd ${file} && make -f ../libtest.mk clean >/dev/null 2>&1) if [ -f ${file}/clean.sh ]; then (cd ${file} && sh ./clean.sh) fi diff -r 52406e53f133 -r cd63493c32a9 libtests/libtest.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libtests/libtest.mk Thu Nov 13 17:09:51 2008 +0000 @@ -0,0 +1,13 @@ +all: libaudioDB.so.0 libaudioDB.so test1 + +libaudioDB.so.0: + -ln -s ../../libaudioDB.so.0.0 $@ + +libaudioDB.so: libaudioDB.so.0 + -ln -s $< $@ + +test1: prog1.c + gcc -Wall -laudioDB -L. -Wl,-rpath,. -o $@ $< + +clean: + -rm libaudioDB.so.0 libaudioDB.so \ No newline at end of file diff -r 52406e53f133 -r cd63493c32a9 libtests/run-tests.sh --- a/libtests/run-tests.sh Thu Nov 13 15:31:54 2008 +0000 +++ b/libtests/run-tests.sh Thu Nov 13 17:09:51 2008 +0000 @@ -3,9 +3,6 @@ AUDIODB=../../${EXECUTABLE:-audioDB} export AUDIODB -LD_LIBRARY_PATH=../ -export LD_LIBRARY_PATH - if [ -x ${AUDIODB#../} ]; then : else @@ -21,13 +18,13 @@ for file in ${pattern}; do if [ -d ${file} ]; then - if [ -f ${file}/run-test.sh ]; then + if [ /bin/true ]; then echo -n Running test ${file} if [ -f ${file}/short-description ]; then awk '{ printf(" (%s)",$0) }' < ${file}/short-description fi echo -n : - (cd ${file} && /bin/bash ./run-test.sh > test.out 2> test.err) + (cd ${file} && make -f ../libtest.mk >/dev/null 2>&1 && ./test1 > test.out 2> test.err && exit 104) EXIT_STATUS=$? if [ ${EXIT_STATUS} -eq 14 ]; then echo " n/a." diff -r 52406e53f133 -r cd63493c32a9 libtests/test-utils.sh --- a/libtests/test-utils.sh Thu Nov 13 15:31:54 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -# no shebang line: this file should be sourced by run-test.sh files - -set -E - -trap "exit 1" ERR - -if [ -z "${AUDIODB}" ]; then - AUDIODB=../../audioDB - #AUDIODB=/Datastore/group/omras2/releases/bin_x86-64_linux/audioDB -fi - -echo "AUDIODB:" - -echo ${AUDIODB} - - - - -# FIXME: maybe generalize to multiple arguments? Also, implement it -# properly, rather than just for a few floats that we know how to -# encode. This might involve writing some C code, as Bash doesn't do -# Floating Point. (scanf() is probably enough). - -expect_clean_error_exit() { - trap - ERR - "$@" - exit_code=$? - - trap "exit 1" ERR - if [ $exit_code -eq 0 ]; then - exit 1 - elif [ $exit_code -ge 126 ]; then - exit 1 - fi -} - -floatstring() { - for arg in "$@"; do - case ${arg} in - 0) - printf "\x00\x00\x00\x00\x00\x00\x00\x00";; - -0.5) - printf "\x00\x00\x00\x00\x00\x00\xe0\xbf";; - 0.5) - printf "\x00\x00\x00\x00\x00\x00\xe0\x3f";; - -1) - printf "\x00\x00\x00\x00\x00\x00\xf0\xbf";; - 1) - printf "\x00\x00\x00\x00\x00\x00\xf0\x3f";; - *) - echo "bad arg to floatstring(): ${arg}" - exit 1;; - esac - done -} - -# FIXME: likewise. And endianness issues (which are a reflection of -# the endianness of audioDB as of 2007-09-18, unfortunately). - -intstring() { - # works up to 9 for now - if [ $1 -ge 10 ]; then echo "intstring() arg too large: ${1}"; exit 1; fi - printf "%b\x00\x00\x00" "\\x${1}" -} - -# Web services utilities -start_server() { - $1 -s $2 & - # HACK: deal with race on process creation - sleep 1 - trap 'kill $!; exit 1' ERR -} - -stop_server() { - grep "${AUDIODB}" /proc/$1/cmdline > /dev/null - kill $1 - # HACK: deal with race on process exit - sleep 1 - expect_clean_error_exit grep ${AUDIODB} /proc/$1/cmdline -} - -check_server() { - grep "${AUDIODB}" /proc/$1/cmdline > /dev/null -} - -expect_client_failure() { - # FIXME: work out whether and how the client should report server - # errors. At present, the client exits with a zero exit code. - "$@" -}