summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <gp@n-dimensional.de>2006-09-29 15:15:04 +0000
committerHans Ulrich Niedermann <gp@n-dimensional.de>2006-09-29 15:15:04 +0000
commit4b8a7c75147d80186a4b28805bafd17152962bfc (patch)
tree5902e402cc376bc930d1d87a56353bb7b5ba3c78 /tests
parent0b313c94f2f00dd1858692c786220dd6d5778cb5 (diff)
downloadlibgphoto2-4b8a7c75147d80186a4b28805bafd17152962bfc.tar.gz
configure/make cleanup removing about 60 lines of make/check/config code
* generate check- scripts from config.status * use libexecdir for print-* utilities * let utilsdir be defined from configure * require libexif >= 0.6.13; automatically update libgphoto2.pc with that. * get rid of "make check" local installation * moved some tests from "make check" to "make installcheck" * use one common rule file for "make installcheck" git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@9231 67ed7778-7388-44ab-90cf-0a291f65f57c
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am41
-rw-r--r--tests/check-camera-list.in58
-rw-r--r--tests/check-camera-list.sh.in38
-rw-r--r--tests/ddb/Makefile.am38
-rw-r--r--tests/ddb/check-ddb.in41
-rw-r--r--tests/ddb/check-ddb.sh.in37
6 files changed, 84 insertions, 169 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index cfedd8f5b..1e50c59ca 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -6,32 +6,11 @@ check_SCRIPTS = \
check-camera-list.sh
EXTRA_DIST = \
- check-camera-list.in
+ check-camera-list.sh.in
# TESTS = $(check_SCRIPTS)
-# FIXME: Only run this if not cross-compiling
-installcheck-local: test-camera-list
- @export CAMLIBS="$(DESTDIR)$(camlibdir)"; \
- total=0; failed=0; success=0; \
- echo "Running \"installcheck\" test cases..."; \
- for script in test-camera-list; do \
- echo "Test case: $$script"; \
- total="$$(expr $$total + 1)"; \
- if "./$$script"; then \
- echo "SUCCEEDED: $$script"; \
- success="$$(expr $$success + 1)"; \
- else \
- s="$$?"; \
- echo "FAILED (return code $$s): $$script"; \
- failed="$$(expr $$failed + 1)"; \
- fi; \
- done; \
- echo "Test summary: $$success succeeded, $$failed failed, $$total in total."; \
- if test "$$failed" -gt 0; then \
- echo "Error: One or more \"installcheck\" testcases have failed."; \
- exit 1; \
- fi
+INSTALL_TESTS = check-camera-list.sh
CLEANFILES = $(check_SCRIPTS)
@@ -60,18 +39,4 @@ test_camera_list_LDADD = \
$(LIBEXIF_LIBS) \
$(INTLLIBS)
-clean-local:
- rm -rf _inst
- rm -f _camlibs
-
-.in.sh:
- @echo "Creating $@"
- @sed \
- -e 's|@top_builddir\@|$(top_builddir)|g' \
- -e 's|@camlibdir\@|$(camlibdir)|g' \
- -e 's|@libdir\@|$(libdir)|g' \
- -e 's|@DESTDIR\@|$(DESTDIR)|g' \
- -e 's|@MAKE\@|$(MAKE)|g' \
- < "$<" > "$@"
- @chmod +x $@
-
+include $(top_srcdir)/installcheck.mk
diff --git a/tests/check-camera-list.in b/tests/check-camera-list.in
deleted file mode 100644
index 768bc915e..000000000
--- a/tests/check-camera-list.in
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/bin/sh
-
-top_builddir="@top_builddir@"
-camlibdir="@camlibdir@"
-libdir="@libdir@"
-DESTDIR="@DESTDIR@"
-MAKE="@MAKE@"
-
-echo "---------------------"
-pwd
-echo "camlibdir=$camlibdir"
-echo "libdir=$libdir"
-echo "DESTDIR=$DESTDIR"
-echo "top_builddir=$top_builddir"
-
-CAMLIBS="${DESTDIR}${camlibdir}"
-
-pwd="$(pwd)"
-if test -d "${CAMLIBS}"; then
- echo "Found camlibs in default install dir."
- :
-else
- echo "Going to use our own camlib installation"
- DESTDIR="${pwd}/_inst"
- CAMLIBS="${DESTDIR}${camlibdir}"
- for reldir in \
- libgphoto2_port/libgphoto2_port \
- libgphoto2 \
- camlibs
- do
- (cd "${top_builddir}/${reldir}" && ${MAKE} DESTDIR="$DESTDIR" install)
- done
- ln -s "${CAMLIBS}" "_camlibs"
- CAMLIBS="${pwd}/_camlibs"
- if test -d "${CAMLIBS}"; then
- echo "Test installation successful"
- else
- echo "Test installation failed"
- exit 1
- fi
-fi
-
-#LD_LIBRARY_PATH="$DESTDIR$libdir:$LD_LIBRARY_PATH"
-#export LD_LIBRARY_PATH
-echo "Using camlib dir: $CAMLIBS"
-export CAMLIBS
-
-echo "====================="
-pwd
-echo "camlibdir=$camlibdir"
-echo "libdir=$libdir"
-echo "DESTDIR=$DESTDIR"
-echo "top_builddir=$top_builddir"
-echo "CAMLIBS=$CAMLIBS"
-echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
-echo "#####################"
-
-./test-camera-list
diff --git a/tests/check-camera-list.sh.in b/tests/check-camera-list.sh.in
new file mode 100644
index 000000000..b80c1b837
--- /dev/null
+++ b/tests/check-camera-list.sh.in
@@ -0,0 +1,38 @@
+#!/bin/sh
+# "make installcheck" testcase:
+# Lists all cameras found by libgphoto2.
+# Fails if no cameras are found.
+
+set -ex
+
+debug=:
+#debug=false
+
+prefix="${prefix-"@prefix@"}"
+exec_prefix="${exec_prefix-"@exec_prefix@"}"
+libdir="${libdir-"@libdir@"}"
+libexecdir="${libexecdir-"@libexecdir@"}"
+camlibdir="${camlibdir-"@camlibdir@"}"
+CAMLIBS="${DESTDIR}${camlibdir}"
+export CAMLIBS
+LD_LIBRARY_PATH="${DESTDIR}/${libdir}${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}"
+export LD_LIBRARY_PATH
+
+
+if test -d "${CAMLIBS}"; then :; else
+ echo "camlibs directory '${CAMLIBS}' does not exist"
+ exit 13
+fi
+
+if "$debug"; then
+ echo "====================="
+ pwd
+ echo "camlibdir=$camlibdir"
+ echo "libdir=$libdir"
+ echo "DESTDIR=$DESTDIR"
+ echo "CAMLIBS=$CAMLIBS"
+ echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
+ echo "#####################"
+fi
+
+./test-camera-list
diff --git a/tests/ddb/Makefile.am b/tests/ddb/Makefile.am
index ca9133d54..371df7182 100644
--- a/tests/ddb/Makefile.am
+++ b/tests/ddb/Makefile.am
@@ -12,32 +12,11 @@ check_SCRIPTS = \
EXTRA_DIST = \
README.ddb \
- check-ddb.in \
+ check-ddb.sh.in \
ddb-txt.l \
ddb-txt.y
-# FIXME: Only run this if not cross-compiling
-installcheck-local: $(check_SCRIPTS)
- @export CAMLIBS="$(DESTDIR)$(camlibdir)"; \
- total=0; failed=0; success=0; \
- echo "Running \"installcheck\" test cases..."; \
- for script in $(check_SCRIPTS); do \
- echo "Test case: $$script"; \
- total="$$(expr $$total + 1)"; \
- if "./$$script"; then \
- echo "SUCCEEDED: $$script"; \
- success="$$(expr $$success + 1)"; \
- else \
- s="$$?"; \
- echo "FAILED (return code $$s): $$script"; \
- failed="$$(expr $$failed + 1)"; \
- fi; \
- done; \
- echo "Test summary: $$success succeeded, $$failed failed, $$total in total."; \
- if test "$$failed" -gt 0; then \
- echo "Error: One or more \"installcheck\" testcases have failed."; \
- exit 1; \
- fi
+INSTALL_TESTS = $(check_SCRIPTS)
# TESTS = $(check_SCRIPTS)
@@ -64,15 +43,10 @@ ddb-txt.tab.c ddb-txt.tab.h: ddb-txt.y
clean-local:
rm -f *.s *.i
-.in.sh:
- @echo "Creating $@"
- @sed \
- -e 's|@top_builddir\@|$(top_builddir)|g' \
- -e 's|@camlibdir\@|$(camlibdir)|g' \
- < "$<" > "$@"
- @chmod +x $@
-
-check-ddb.sh: check-ddb.in $(top_builddir)/packaging/generic/print-camera-list test-ddb
+check-ddb.sh: check-ddb.sh.in $(top_builddir)/packaging/generic/print-camera-list test-ddb
$(top_builddir)/packaging/generic/print-camera-list:
cd $(top_builddir)/packaging/generic && $(MAKE) print-camera-list
+
+include $(top_srcdir)/installcheck.mk
+
diff --git a/tests/ddb/check-ddb.in b/tests/ddb/check-ddb.in
deleted file mode 100644
index 0fa71cd73..000000000
--- a/tests/ddb/check-ddb.in
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/sh
-
-set -e
-
-export CAMLIBS="@camlibdir@"
-
-true ./test-ddb<<EOF
-# This is a pre-alpha test example
-
-device "Canon PowerShot G1"
-{
- driver "canon";
- operations config;
-
- interface serial
- {
- speeds 9600, 19200, 38400, 57600, 115200;
- };
- interface usb
- {
- vendor 0x04a9;
- product 0x3040;
- };
-};
-
-device "Canon PowerShot G2"
-{
- driver "canon";
- interface usb
- {
- vendor 0x04a9;
- product 0x3055;
- };
-};
-
-EOF
-
-@top_builddir@/packaging/generic/print-camera-list gp2ddb > gp2ddb.txt
-true ./test-ddb gp2ddb.txt
-
-./test-ddb --compare < gp2ddb.txt
diff --git a/tests/ddb/check-ddb.sh.in b/tests/ddb/check-ddb.sh.in
new file mode 100644
index 000000000..90de59304
--- /dev/null
+++ b/tests/ddb/check-ddb.sh.in
@@ -0,0 +1,37 @@
+#!/bin/sh
+# "make installcheck" testcase:
+# Compares camera list printed by by print-camera-list and parsed by
+#test-ddb with the camera list from gp_abilities_list_load().
+# Fails if differences are found.
+
+set -ex
+
+debug=:
+#debug=false
+
+prefix="${prefix-"@prefix@"}"
+exec_prefix="${exec_prefix-"@exec_prefix@"}"
+libdir="${libdir-"@libdir@"}"
+libexecdir="${libexecdir-"@libexecdir@"}"
+camlibdir="${camlibdir-"@camlibdir@"}"
+utilsdir="${utilsdir-"@utilsdir@"}"
+CAMLIBS="${DESTDIR}${camlibdir}"
+export CAMLIBS
+LD_LIBRARY_PATH="${DESTDIR}/${libdir}${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}"
+export LD_LIBRARY_PATH
+
+if "$debug"; then
+ echo "====================="
+ pwd
+ echo "camlibdir=$camlibdir"
+ echo "libdir=$libdir"
+ echo "utilsdir=$utilsdir"
+ echo "DESTDIR=$DESTDIR"
+ echo "CAMLIBS=$CAMLIBS"
+ echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
+ echo "#####################"
+fi
+
+${DESTDIR}${utilsdir}/print-camera-list gp2ddb > gp2ddb.txt
+
+./test-ddb --compare < gp2ddb.txt