diff options
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | tests/Makefile.am | 54 | ||||
-rw-r--r-- | tests/check-camera-list.sh.in | 40 |
3 files changed, 34 insertions, 61 deletions
diff --git a/configure.ac b/configure.ac index 59598d783..e9ec2a836 100644 --- a/configure.ac +++ b/configure.ac @@ -604,7 +604,6 @@ libgphoto2/Makefile libgphoto2.pc libgphoto2-uninstalled.pc tests/Makefile -tests/check-camera-list.sh tests/ddb/Makefile tests/ddb/check-ddb.sh packaging/Makefile 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 |