[gexiv2] test: Run with autotools testrunner
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gexiv2] test: Run with autotools testrunner
- Date: Sun, 12 Mar 2017 11:43:00 +0000 (UTC)
commit 7457c626d771e7058d88724915f2e1204a9156a1
Author: Jens Georg <mail jensge org>
Date: Sat Mar 11 14:28:25 2017 +0100
test: Run with autotools testrunner
Signed-off-by: Jens Georg <mail jensge org>
https://bugzilla.gnome.org/show_bug.cgi?id=723790
Makefile.am | 17 +--------------
autogen.sh | 1 -
check.am | 36 +++++++++++++++++++++++++++++++++
configure.ac | 53 ++++++++++++++++++++++++++-----------------------
test/python2-test.in | 3 ++
test/python3-test.in | 3 ++
6 files changed, 72 insertions(+), 41 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index d04eca6..d31a55f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -120,22 +120,9 @@ clean-local:
rm -rf test/python/gi test/python/__pycache__
# Tests and utilities #
+#
-if ENABLE_TESTS
-
-tests: test/gexiv2-dump test/python2 test/python3
-
-test/gexiv2-dump: test/gexiv2-dump.vala
- valac -g --enable-checking --vapidir=. --pkg gexiv2 $< -o $@
-
-test/python/gi/overrides/GExiv2.py:
- [ -d $(dir $@) ] || mkdir -p $(dir $@)
- ln -sf ../../../../GExiv2.py $@
-
-test/python%: $(TYPELIB_FILES) test/python/gi/overrides/GExiv2.py
- LD_LIBRARY_PATH=.libs GI_TYPELIB_PATH=. PYTHONPATH=test/python python$* -m unittest gexiv2
-
-endif
+include check.am
# Optional Introspection #
diff --git a/autogen.sh b/autogen.sh
index b44b7bb..c7b9a5b 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -22,7 +22,6 @@ if [ "$#" = 0 -a "x$NOCONFIGURE" = "x" ]; then
echo "" >&2
fi
-aclocal --install || exit 1
gtkdocize || exit 1
autoreconf --verbose --force --install || exit 1
diff --git a/check.am b/check.am
new file mode 100644
index 0000000..0724bb0
--- /dev/null
+++ b/check.am
@@ -0,0 +1,36 @@
+TESTS_ENVIRONMENT = \
+ G_SLICE=debug-blocks \
+ LD_LIBRARY_PATH=$(top_builddir)/.libs:$(LD_LIBRARY_PATH) \
+ GI_TYPELIB_PATH=$(top_builddir) \
+ PYTHONPATH=$(top_srcdir)/test/python
+
+tests: check
+
+TESTS =
+
+if PYTHON2_PATH
+TESTS += test/python2-test
+endif
+
+if PYTHON3_PATH
+TESTS += test/python3-test
+endif
+
+if HAVE_VALAC
+check_PROGRAMS = test/gexiv2-dump
+test_gexiv2_dump_SOURCES = test/gexiv2-dump.vala
+endif
+
+AM_VALAFLAGS = --pkg gexiv2 --pkg glib-2.0 --vapidir=$(top_srcdir)
+
+LDADD = \
+ $(top_builddir)/libgexiv2.la \
+ $(GLIB_LIBS) $(EXIV2_LIBS)
+AM_CFLAGS = \
+ $(GLIB_CFLAGS) $(EXIV2_CFLAGS) \
+ -I $(top_srcdir)
+
+EXTRA_DIST += \
+ test/sample-author-badencoding.jpg \
+ test/CaorVN.jpeg
+
diff --git a/configure.ac b/configure.ac
index 008ab1b..5f61976 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,8 @@
-AC_INIT([gexiv2],[0.10.4],[https://bugzilla.gnome.org/enter_bug.cgi?product=gexiv2],[gexiv2],[https://wiki.gnome.org/Projects/gexiv2])
+AC_INIT([gexiv2],
+ [0.10.4],
+ [https://bugzilla.gnome.org/enter_bug.cgi?product=gexiv2],
+ [gexiv2],
+ [https://wiki.gnome.org/Projects/gexiv2])
AC_PREREQ([2.69])
AC_CONFIG_MACRO_DIR([m4])
@@ -121,6 +125,14 @@ fi
GOBJECT_INTROSPECTION_CHECK([0.6.4])
+AC_PATH_PROGS([PYTHON2_PATH],[python2],[:])
+AC_SUBST(PYTHON2_PATH)
+AM_CONDITIONAL([PYTHON2_PATH], [test "x$PYTHON2_PATH" != "x:"])
+
+AC_PATH_PROGS([PYTHON3_PATH],[python3],[:])
+AC_SUBST(PYTHON3_PATH)
+AM_CONDITIONAL([PYTHON3_PATH], [test "x$PYTHON3_PATH" != "x:"])
+
AC_ARG_WITH([python2-girdir],
AS_HELP_STRING([--with-python2-girdir],
[Set the GI override file install dir]),
@@ -135,22 +147,28 @@ AC_ARG_WITH([python3-girdir],
enable_python2="no (introspection disabled)"
enable_python3="no (introspection disabled)"
-if test "x$found_introspection" = "xyes"; then
+PYTHON_CODE="import gi; print(gi._overridesdir)"
+AS_IF([test "x$found_introspection" = "xyes"],
+ [
# Used to determine where Python wants the .gi file to be installed ...
# if Python is not installed, PYTHON2 and PYTHON3 will be empty
- PYTHON="import gi; print(gi._overridesdir)"
AS_IF([test "x$ac_py2girdir" = "x"],
[
- PYTHON2_GIDIR=$(python2 -c "$PYTHON")
+ AS_IF([test "x$PYTHON2_PATH" != "x:"],
+ [PYTHON2_GIDIR=$($PYTHON2_PATH -c "$PYTHON_CODE")],
+ [PYTHON2_GIDIR=""])
],
[
PYTHON2_GIDIR=$ac_py2girdir
])
AC_MSG_RESULT([Python2 GObject Introspection directory: $PYTHON2_GIDIR])
+
AS_IF([test "x$ac_py3girdir" = "x"],
[
- PYTHON3_GIDIR=$(python3 -c "$PYTHON")
+ AS_IF([test "x$PYTHON3_PATH" != "x:"],
+ [PYTHON3_GIDIR=$($PYTHON3_PATH -c "$PYTHON_CODE")],
+ [PYTHON3_GIDIR=""])
],
[
PYTHON3_GIDIR=$ac_py3girdir
@@ -164,7 +182,7 @@ if test "x$found_introspection" = "xyes"; then
AC_SUBST(PYTHON2_GIDIR)
AC_SUBST(PYTHON3_GIDIR)
-fi
+ ])
AM_CONDITIONAL(HAS_PYTHON2, test "x$PYTHON2_GIDIR" != "x")
AM_CONDITIONAL(HAS_PYTHON3, test "x$PYTHON3_GIDIR" != "x")
@@ -172,24 +190,8 @@ AM_CONDITIONAL(HAS_PYTHON3, test "x$PYTHON3_GIDIR" != "x")
# Tests and utilities #
#######################
-AC_ARG_ENABLE(tests, [ --enable-tests enable tests and utilities (requires Vala) [[default=no]]],
- if eval "test x$enable_tests = xno"; then
- enable_tests=no
- else
- enable_tests=yes
- fi,
- enable_tests=no)
-
-if test "x$enable_tests" != "xno"; then
- AC_CHECK_TOOL([VALAC], [valac], [:])
- if test "x$VALAC" = "x:"; then
- enable_tests="no (missing valac)"
- fi
-fi
-AM_CONDITIONAL(ENABLE_TESTS, test "x$enable_tests" = "xyes")
-
-AC_MSG_CHECKING([enable tests])
-AC_MSG_RESULT([$enable_tests])
+AC_CHECK_TOOL([VALAC], [valac], [:])
+AM_CONDITIONAL([HAVE_VALAC], [test "x$VALAC" != "x:"])
###########################
# Check target architecture
@@ -241,6 +243,8 @@ gexiv2.pc:gexiv2.pc.in
docs/Makefile
docs/reference/Makefile
])
+AC_CONFIG_FILES([test/python2-test], [chmod +x test/python2-test])
+AC_CONFIG_FILES([test/python3-test], [chmod +x test/python3-test])
AC_OUTPUT
@@ -251,7 +255,6 @@ Options:
Introspection: $found_introspection
Python2 binding: $enable_python2
Python3 binding: $enable_python3
- Tests and utils: $enable_tests
])
if test "x$enable_tests" = "xyes"; then
diff --git a/test/python2-test.in b/test/python2-test.in
new file mode 100755
index 0000000..c58fc4c
--- /dev/null
+++ b/test/python2-test.in
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+@PYTHON2_PATH@ -m unittest gexiv2
diff --git a/test/python3-test.in b/test/python3-test.in
new file mode 100755
index 0000000..70e4bbc
--- /dev/null
+++ b/test/python3-test.in
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+@PYTHON3_PATH@ -m unittest gexiv2
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]