summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <gp@n-dimensional.de>2007-08-11 19:01:46 +0000
committerHans Ulrich Niedermann <gp@n-dimensional.de>2007-08-11 19:01:46 +0000
commit85df1337a916861ea23111eb947eae9c9dc7323e (patch)
tree29c951b9659f5d0e8ff82b06ce533eb463034acf /tests
parent43e929093345c3e2bdf22c9e4e333aa31eb73fcb (diff)
downloadlibgphoto2-85df1337a916861ea23111eb947eae9c9dc7323e.tar.gz
Rework testing of camera libs
* remove check-camera-list.sh script * run test-camera-list at "make check" with not-yet-installed camlibs * run test-camera-list at "make installcheck" with the installed camlibs * rely on presence of working "env" command for these tests git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@10582 67ed7778-7388-44ab-90cf-0a291f65f57c
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am54
-rw-r--r--tests/check-camera-list.sh.in40
2 files changed, 34 insertions, 60 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 20da5eaa8..a9d71a605 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,31 +1,29 @@
SUBDIRS = ddb
-check_PROGRAMS = \
- test-camera-list \
- test-pedantic-c
+EXTRA_DIST =
+EXTRA_PROGRAMS =
+check_PROGRAMS =
+check_SCRIPTS =
+TESTS =
+INSTALL_TESTS =
+noinst_PROGRAMS =
-if HAVE_CXX
-check_PROGRAMS += test-pedantic-cxx
-endif
-check_SCRIPTS = \
- check-camera-list.sh
+# Now that we build all the camlibs in one directory, we can run our checks
+# with CAMLIBS set to the camlib build directory.
+TESTS_ENVIRONMENT = env \
+ CAMLIBS="$(top_builddir)/camlibs"
-EXTRA_DIST = \
- check-camera-list.sh.in
+# After installation, this will be CAMLIBS = $(DESTDIR)$(camlibdir)
+INSTALL_TESTS_ENVIRONMENT = env \
+ CAMLIBS="$(DESTDIR)$(camlibdir)" \
+ LD_LIBRARY_PATH="$(DESTDIR)$(libdir)$${LD_LIBRARY_PATH+:$${LD_LIBRARY_PATH}}"
-TESTS = test-pedantic-c test-pedantic-cxx
-
-# These tests must run after installation because they need the
-# camlibs installed.
-INSTALL_TESTS = check-camera-list.sh
CLEANFILES = $(check_SCRIPTS)
-noinst_PROGRAMS = \
- test-gphoto2 \
- test-filesys
+noinst_PROGRAMS += test-gphoto2
test_gphoto2_SOURCE = test-gphoto2.c
test_gphoto2_LDADD = \
$(top_builddir)/libgphoto2/libgphoto2.la \
@@ -33,6 +31,7 @@ test_gphoto2_LDADD = \
$(LIBEXIF_LIBS) \
$(INTLLIBS)
+noinst_PROGRAMS += test-filesys
test_filesys_SOURCE = test-filesys.c
test_filesys_LDADD = \
$(top_builddir)/libgphoto2/libgphoto2.la \
@@ -40,6 +39,11 @@ test_filesys_LDADD = \
$(LIBEXIF_LIBS) \
$(INTLLIBS)
+
+
+TESTS += test-camera-list
+INSTALL_TESTS += test-camera-list
+check_PROGRAMS += test-camera-list
test_camera_list_SOURCE = test-camera-list.c
test_camera_list_LDADD = \
$(top_builddir)/libgphoto2/libgphoto2.la \
@@ -47,6 +51,7 @@ test_camera_list_LDADD = \
$(LIBEXIF_LIBS) \
$(INTLLIBS)
+
if HAVE_GCC
PEDANTIC_CFLAGS = -std=c99 -pedantic-errors -W -Wall -Wextra -Werror
PEDANTIC_CXXFLAGS = -std=c++98 -pedantic-errors -W -Wall -Wextra -Werror
@@ -55,12 +60,14 @@ PEDANTIC_CFLAGS =
PEDANTIC_CXXFLAGS =
endif
+TESTS += test-pedantic-c
+check_PROGRAMS += test-pedantic-c
test_pedantic_c_SOURCES = test-pedantic-compilation.c
test_pedantic_c_CPPFLAGS = \
$(AM_CPPFLAGS) $(CPPFLAGS) \
-U_GPHOTO2_INTERNAL_CODE
test_pedantic_c_CFLAGS = \
- $(PEDANTIC_CFLAGS) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_CFLAGS) $(PEDANTIC_CFLAGS) $(CFLAGS) \
-U_GPHOTO2_INTERNAL_CODE
test_pedantic_c_LDADD = \
$(top_builddir)/libgphoto2/libgphoto2.la \
@@ -68,12 +75,19 @@ test_pedantic_c_LDADD = \
$(LIBEXIF_LIBS) \
$(INTLLIBS)
+
+if HAVE_CXX
+check_PROGRAMS += test-pedantic-cxx
+TESTS += test-pedantic-cxx
+else
+EXTRA_PROGRAMS += test-pedantic-cxx
+endif
test_pedantic_cxx_SOURCES = test-pedantic-compilation.cxx
test_pedantic_cxx_CPPFLAGS = \
$(AM_CPPFLAGS) $(CPPFLAGS) \
-U_GPHOTO2_INTERNAL_CODE
test_pedantic_cxx_CXXFLAGS = \
- $(PEDANTIC_CXXFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) \
+ $(AM_CXXFLAGS) $(PEDANTIC_CXXFLAGS) $(CXXFLAGS) \
-U_GPHOTO2_INTERNAL_CODE
test_pedantic_cxx_LDADD = \
$(top_builddir)/libgphoto2/libgphoto2.la \
diff --git a/tests/check-camera-list.sh.in b/tests/check-camera-list.sh.in
deleted file mode 100644
index fdd94f79c..000000000
--- a/tests/check-camera-list.sh.in
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/sh
-# "make installcheck" testcase:
-# Lists all cameras found by libgphoto2.
-# Fails if no cameras are found.
-
-set -e
-
-debug=:
-#debug=false
-
-PACKAGE_TARNAME="${PACKAGE_TARNAME-"@PACKAGE_TARNAME@"}"
-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
-
-set -x
-./test-camera-list