Build the python binding as part of the tests
This commit is contained in:
parent
7ce21935c3
commit
37d705e217
6
Makefile
6
Makefile
|
@ -1,6 +1,6 @@
|
|||
PACKAGE = libDatabase
|
||||
VERSION = 0.0.0
|
||||
SUBDIRS = data doc include src tools
|
||||
SUBDIRS = data doc include src tests tools
|
||||
RM = rm -f
|
||||
LN = ln -f
|
||||
TAR = tar -czvf
|
||||
|
@ -57,6 +57,10 @@ dist:
|
|||
$(PACKAGE)-$(VERSION)/src/engines/template.c \
|
||||
$(PACKAGE)-$(VERSION)/src/engines/Makefile \
|
||||
$(PACKAGE)-$(VERSION)/src/engines/project.conf \
|
||||
$(PACKAGE)-$(VERSION)/tests/Makefile \
|
||||
$(PACKAGE)-$(VERSION)/tests/python.sh \
|
||||
$(PACKAGE)-$(VERSION)/tests/tests.sh \
|
||||
$(PACKAGE)-$(VERSION)/tests/project.conf \
|
||||
$(PACKAGE)-$(VERSION)/tools/client.c \
|
||||
$(PACKAGE)-$(VERSION)/tools/Makefile \
|
||||
$(PACKAGE)-$(VERSION)/tools/project.conf \
|
||||
|
|
|
@ -2,5 +2,5 @@ package=libDatabase
|
|||
version=0.0.0
|
||||
config=h,sh
|
||||
|
||||
subdirs=data,doc,include,src,tools
|
||||
subdirs=data,doc,include,src,tests,tools
|
||||
dist=Makefile,config.h,config.sh
|
||||
|
|
26
tests/Makefile
Normal file
26
tests/Makefile
Normal file
|
@ -0,0 +1,26 @@
|
|||
TARGETS = tests.log
|
||||
PREFIX = /usr/local
|
||||
DESTDIR =
|
||||
RM = rm -f
|
||||
LN = ln -f
|
||||
MKDIR = mkdir -m 0755 -p
|
||||
INSTALL = install
|
||||
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
tests.log: python.sh tests.sh
|
||||
./tests.sh -P "$(PREFIX)" -- "tests.log"
|
||||
|
||||
clean:
|
||||
$(RM) -- $(tests.log_OBJS)
|
||||
./tests.sh -c -P "$(PREFIX)" -- "tests.log"
|
||||
|
||||
distclean: clean
|
||||
$(RM) -- $(TARGETS)
|
||||
|
||||
install: $(TARGETS)
|
||||
|
||||
uninstall:
|
||||
|
||||
.PHONY: all clean distclean install uninstall
|
7
tests/project.conf
Normal file
7
tests/project.conf
Normal file
|
@ -0,0 +1,7 @@
|
|||
targets=tests.log
|
||||
dist=Makefile,python.sh,tests.sh
|
||||
|
||||
[tests.log]
|
||||
type=script
|
||||
script=./tests.sh
|
||||
depends=python.sh,tests.sh
|
24
tests/python.sh
Executable file
24
tests/python.sh
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
#$Id$
|
||||
#Copyright (c) 2014 Pierre Pronchery <khorben@defora.org>
|
||||
#This file is part of DeforaOS Database libDatabase
|
||||
#This program is free software: you can redistribute it and/or modify
|
||||
#it under the terms of the GNU General Public License as published by
|
||||
#the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
#This program is distributed in the hope that it will be useful,
|
||||
#but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
#GNU General Public License for more details.
|
||||
#
|
||||
#You should have received a copy of the GNU General Public License
|
||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
#variables
|
||||
#executables
|
||||
MAKE="make"
|
||||
|
||||
|
||||
(cd ../src/python && $MAKE clean all)
|
107
tests/tests.sh
Executable file
107
tests/tests.sh
Executable file
|
@ -0,0 +1,107 @@
|
|||
#!/bin/sh
|
||||
#$Id$
|
||||
#Copyright (c) 2011-2014 Pierre Pronchery <khorben@defora.org>
|
||||
#This file is part of DeforaOS Database libDatabase
|
||||
#This program is free software: you can redistribute it and/or modify
|
||||
#it under the terms of the GNU General Public License as published by
|
||||
#the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
#This program is distributed in the hope that it will be useful,
|
||||
#but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
#GNU General Public License for more details.
|
||||
#
|
||||
#You should have received a copy of the GNU General Public License
|
||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#variables
|
||||
#executables
|
||||
DATE="date"
|
||||
|
||||
|
||||
#functions
|
||||
#fail
|
||||
_fail()
|
||||
{
|
||||
test="$1"
|
||||
|
||||
shift
|
||||
echo -n "$test:" 1>&2
|
||||
(echo
|
||||
echo "Testing: ./$test" "$@"
|
||||
"./$test" "$@") >> "$target" 2>&1
|
||||
res=$?
|
||||
if [ $res -ne 0 ]; then
|
||||
echo " FAIL (error $res)" 1>&2
|
||||
else
|
||||
echo " PASS" 1>&2
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#test
|
||||
_test()
|
||||
{
|
||||
test="$1"
|
||||
|
||||
shift
|
||||
echo -n "$test:" 1>&2
|
||||
(echo
|
||||
echo "Testing: ./$test" "$@"
|
||||
"./$test" "$@") >> "$target" 2>&1
|
||||
res=$?
|
||||
if [ $res -ne 0 ]; then
|
||||
echo " FAIL" 1>&2
|
||||
FAILED="$FAILED $test(error $res)"
|
||||
return 2
|
||||
else
|
||||
echo " PASS" 1>&2
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#usage
|
||||
_usage()
|
||||
{
|
||||
echo "Usage: tests.sh [-c][-P prefix]" 1>&2
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
#main
|
||||
clean=0
|
||||
while getopts "cP:" name; do
|
||||
case "$name" in
|
||||
c)
|
||||
clean=1
|
||||
;;
|
||||
P)
|
||||
#XXX ignored
|
||||
;;
|
||||
?)
|
||||
_usage
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
if [ $# -ne 1 ]; then
|
||||
_usage
|
||||
exit $?
|
||||
fi
|
||||
target="$1"
|
||||
|
||||
[ "$clean" -ne 0 ] && exit 0
|
||||
|
||||
$DATE > "$target"
|
||||
FAILED=
|
||||
echo "Performing tests:" 1>&2
|
||||
echo "Expected failures:" 1>&2
|
||||
_fail "python.sh"
|
||||
if [ -n "$FAILED" ]; then
|
||||
echo "Failed tests:$FAILED" 1>&2
|
||||
exit 2
|
||||
fi
|
||||
echo "All tests completed" 1>&2
|
Loading…
Reference in New Issue
Block a user