Introduced a test suite for the configure project
This commit is contained in:
parent
0a9c9c687d
commit
e6f46314a9
7
Makefile
7
Makefile
@ -1,6 +1,6 @@
|
|||||||
PACKAGE = configure
|
PACKAGE = configure
|
||||||
VERSION = 0.1.0
|
VERSION = 0.1.0
|
||||||
SUBDIRS = doc src tools
|
SUBDIRS = doc src tests tools
|
||||||
OBJDIR =
|
OBJDIR =
|
||||||
PREFIX = /usr/local
|
PREFIX = /usr/local
|
||||||
DESTDIR =
|
DESTDIR =
|
||||||
@ -57,6 +57,11 @@ dist:
|
|||||||
$(PACKAGE)-$(VERSION)/src/makefile.h \
|
$(PACKAGE)-$(VERSION)/src/makefile.h \
|
||||||
$(PACKAGE)-$(VERSION)/src/settings.h \
|
$(PACKAGE)-$(VERSION)/src/settings.h \
|
||||||
$(PACKAGE)-$(VERSION)/src/project.conf \
|
$(PACKAGE)-$(VERSION)/src/project.conf \
|
||||||
|
$(PACKAGE)-$(VERSION)/tests/Makefile \
|
||||||
|
$(PACKAGE)-$(VERSION)/tests/tests.sh \
|
||||||
|
$(PACKAGE)-$(VERSION)/tests/library/project.conf \
|
||||||
|
$(PACKAGE)-$(VERSION)/tests/library/Makefile.NetBSD \
|
||||||
|
$(PACKAGE)-$(VERSION)/tests/project.conf \
|
||||||
$(PACKAGE)-$(VERSION)/tools/pkg-config.c \
|
$(PACKAGE)-$(VERSION)/tools/pkg-config.c \
|
||||||
$(PACKAGE)-$(VERSION)/tools/Makefile \
|
$(PACKAGE)-$(VERSION)/tools/Makefile \
|
||||||
$(PACKAGE)-$(VERSION)/tools/project.conf \
|
$(PACKAGE)-$(VERSION)/tools/project.conf \
|
||||||
|
@ -2,7 +2,7 @@ package=configure
|
|||||||
version=0.1.0
|
version=0.1.0
|
||||||
config=h,sh
|
config=h,sh
|
||||||
|
|
||||||
subdirs=doc,src,tools
|
subdirs=doc,src,tests,tools
|
||||||
dist=Makefile,AUTHORS,BUGS,CHANGES,COPYING,config.h,config.sh,INSTALL,README
|
dist=Makefile,AUTHORS,BUGS,CHANGES,COPYING,config.h,config.sh,INSTALL,README
|
||||||
|
|
||||||
[AUTHORS]
|
[AUTHORS]
|
||||||
|
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: ../src/configure library/project.conf library/Makefile.NetBSD 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
|
42
tests/library/Makefile.NetBSD
Normal file
42
tests/library/Makefile.NetBSD
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
TARGETS = libtest.a libtest.so.0.0 libtest.so.0 libtest.so
|
||||||
|
PREFIX = /usr/local
|
||||||
|
DESTDIR =
|
||||||
|
LIBDIR = $(PREFIX)/lib
|
||||||
|
AR = ar
|
||||||
|
RANLIB = ranlib
|
||||||
|
CCSHARED= $(CC) -shared
|
||||||
|
RM = rm -f
|
||||||
|
LN = ln -f
|
||||||
|
MKDIR = mkdir -m 0755 -p
|
||||||
|
INSTALL = install
|
||||||
|
|
||||||
|
|
||||||
|
all: $(TARGETS)
|
||||||
|
|
||||||
|
libtest_OBJS = test.o
|
||||||
|
libtest_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS)
|
||||||
|
libtest_LDFLAGS = $(LDFLAGSF) $(LDFLAGS)
|
||||||
|
|
||||||
|
libtest.a: $(libtest_OBJS)
|
||||||
|
$(AR) -rc libtest.a $(libtest_OBJS)
|
||||||
|
$(RANLIB) libtest.a
|
||||||
|
|
||||||
|
libtest.so.0.0 libtest.so.0 libtest.so: $(libtest_OBJS)
|
||||||
|
$(CCSHARED) -o libtest.so.0.0 -Wl,-soname,libtest.so.0 $(libtest_OBJS) $(libtest_LDFLAGS)
|
||||||
|
$(LN) -s -- libtest.so.0.0 libtest.so.0
|
||||||
|
$(LN) -s -- libtest.so.0.0 libtest.so
|
||||||
|
|
||||||
|
test.o: test.c
|
||||||
|
$(CC) $(libtest_CFLAGS) -c test.c
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(RM) -- $(libtest_OBJS)
|
||||||
|
|
||||||
|
distclean: clean
|
||||||
|
$(RM) -- $(TARGETS)
|
||||||
|
|
||||||
|
install: $(TARGETS)
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
|
||||||
|
.PHONY: all clean distclean install uninstall
|
6
tests/library/project.conf
Normal file
6
tests/library/project.conf
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
targets=libtest
|
||||||
|
dist=Makefile
|
||||||
|
|
||||||
|
[libtest]
|
||||||
|
type=library
|
||||||
|
sources=test.c
|
7
tests/project.conf
Normal file
7
tests/project.conf
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
targets=tests.log
|
||||||
|
dist=Makefile,tests.sh,library/project.conf,library/Makefile.NetBSD
|
||||||
|
|
||||||
|
[tests.log]
|
||||||
|
type=script
|
||||||
|
script=./tests.sh
|
||||||
|
depends=../src/configure,library/project.conf,library/Makefile.NetBSD,tests.sh
|
89
tests/tests.sh
Executable file
89
tests/tests.sh
Executable file
@ -0,0 +1,89 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#$Id$
|
||||||
|
#Copyright (c) 2014 Pierre Pronchery <khorben@defora.org>
|
||||||
|
#
|
||||||
|
#Redistribution and use in source and binary forms, with or without
|
||||||
|
#modification, are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above copyright notice, this
|
||||||
|
# list of conditions and the following disclaimer.
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer in the documentation
|
||||||
|
# and/or other materials provided with the distribution.
|
||||||
|
#
|
||||||
|
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
#AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
#IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
#DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
#FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
#DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
#SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
#OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
#OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#variables
|
||||||
|
#executables
|
||||||
|
CONFIGURE="../src/configure"
|
||||||
|
DATE="date"
|
||||||
|
DIFF="diff"
|
||||||
|
|
||||||
|
|
||||||
|
#functions
|
||||||
|
#test
|
||||||
|
_test()
|
||||||
|
{
|
||||||
|
[ $# -eq 2 ] || return 2
|
||||||
|
system="$1"
|
||||||
|
subdir="$2"
|
||||||
|
|
||||||
|
echo "Testing: $system $subdir"
|
||||||
|
$CONFIGURE -O "$system" -- "$subdir" 2>&1 || return 2
|
||||||
|
$DIFF -- "$subdir/Makefile" "$subdir/Makefile.$system" 2>&1
|
||||||
|
res=$?
|
||||||
|
if [ $res -ne 0 ]; then
|
||||||
|
echo "Failed with error code $res"
|
||||||
|
echo "$system $subdir: FAIL" 1>&2
|
||||||
|
else
|
||||||
|
echo "$system $subdir: PASS" 1>&2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#usage
|
||||||
|
_usage()
|
||||||
|
{
|
||||||
|
echo "Usage: test.sh target" 1>&2
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#main
|
||||||
|
clean=0
|
||||||
|
while getopts "cP:" name; do
|
||||||
|
case "$name" in
|
||||||
|
c)
|
||||||
|
clean=1
|
||||||
|
;;
|
||||||
|
P)
|
||||||
|
#we can ignore it
|
||||||
|
;;
|
||||||
|
?)
|
||||||
|
_usage
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
shift $(($OPTIND - 1))
|
||||||
|
if [ $# -ne 1 ]; then
|
||||||
|
_usage
|
||||||
|
exit $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ "$clean" -ne 0 ] && exit 0
|
||||||
|
|
||||||
|
($DATE
|
||||||
|
echo
|
||||||
|
_test "NetBSD" "library") > "tests.log"
|
Loading…
Reference in New Issue
Block a user