[gcab] Add autotest skeleton



commit c1a88301f9b7810042b031d4be338693cd33ac75
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date:   Fri Dec 14 14:16:23 2012 +0100

    Add autotest skeleton

 Makefile.am              |   25 ++++++++++++++++++++++++-
 atlocal.in               |    5 +++++
 build-aux/move-if-change |   17 +++++++++++++++++
 configure.ac             |    8 ++++++++
 tests/package.m4.in      |    8 ++++++++
 tests/testsuite.at       |   24 ++++++++++++++++++++++++
 6 files changed, 86 insertions(+), 1 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 5b5cf8f..cbfdf62 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,7 @@
 NULL =
 BUILT_SOURCES =
+CLEANFILES =
+DISTCLEANFILES =
 ACLOCAL_AMFLAGS = -I m4
 AM_MAKEFLAGS = --no-print-directory
 
@@ -101,7 +103,7 @@ gir_DATA = GCab-1.0.gir
 typelibdir = $(libdir)/girepository-1.0
 typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
 
-CLEANFILES = $(gir_DATA) $(typelib_DATA)
+CLEANFILES += $(gir_DATA) $(typelib_DATA)
 
 vapidir = $(datadir)/vala/vapi
 vapi_DATA = libgcab-1.0.vapi
@@ -118,6 +120,27 @@ libgcab-1.0.vapi: GCab-1.0.gir
 
 CLEANFILES += libgcab-1.0.vapi
 
+# Autotest support
+
+TESTSUITE = $(srcdir)/tests/testsuite
+EXTRA_DIST += tests/testsuite.at $(srcdir)/tests/package.m4 $(TESTSUITE)
+DISTCLEANFILES += atconfig
+CLEANFILES += testsuite.log
+
+check-local: $(TESTSUITE) atconfig
+	builddir=`pwd` && \
+		$(SHELL) $(TESTSUITE) AUTOTEST_PATH=$$builddir $(TESTSUITEFLAGS)
+
+installcheck-local: $(TESTSUITE) atconfig
+	$(SHELL) $(TESTSUITE) AUTOTEST_PATH=$(bindir) $(TESTSUITEFLAGS)
+
+clean-local:
+	-$(SHELL) $(TESTSUITE) --clean
+
+$(TESTSUITE): tests/testsuite.at tests/package.m4
+	$(AUTOM4TE) --language=autotest -I$(builddir)/tests -o $  tmp $  at
+	mv $  tmp $@
+
 MAINTAINERCLEANFILES =						\
 	$(srcdir)/INSTALL					\
 	$(srcdir)/aclocal.m4					\
diff --git a/atlocal.in b/atlocal.in
new file mode 100644
index 0000000..64c62d3
--- /dev/null
+++ b/atlocal.in
@@ -0,0 +1,5 @@
+EXEEXT= EXEEXT@
+
+_gcab() {
+  gcab$EXEEXT "$@"
+}
diff --git a/build-aux/move-if-change b/build-aux/move-if-change
new file mode 100755
index 0000000..03dd02e
--- /dev/null
+++ b/build-aux/move-if-change
@@ -0,0 +1,17 @@
+#!/bin/sh
+# Like mv $1 $2, but if the files are the same, just delete $1.
+# Status is zero if successful, nonzero otherwise.
+#
+# Copyright (C) 2011 Free Software Foundation, Inc.
+# License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
+# This is free software: you are free to change and redistribute it.
+# There is NO WARRANTY, to the extent permitted by law."
+
+if test -r "$2" && cmp -- "$1" "$2" >/dev/null; then
+  rm -f -- "$1"
+else
+  if mv -f -- "$1" "$2"; then :; else
+    # Ignore failure due to a concurrent move-if-change.
+    test -r "$2" && cmp -- "$1" "$2" >/dev/null && rm -f -- "$1"
+  fi
+fi
diff --git a/configure.ac b/configure.ac
index c9a7782..0a6e64f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,6 +16,14 @@ LT_INIT([win32-dll disable-fast-install])
 PKG_PROG_PKG_CONFIG
 GOBJECT_INTROSPECTION_CHECK([0.9.4])
 
+AM_MISSING_PROG([AUTOM4TE], [autom4te])
+AC_CONFIG_TESTDIR([.])
+AC_CONFIG_FILES([atlocal])
+AC_CONFIG_FILES([tests/package.m4.tmp:tests/package.m4.in],
+                [$srcdir/build-aux/move-if-change tests/package.m4.tmp $srcdir/tests/package.m4
+                 cp $srcdir/tests/package.m4 tests/package.m4.tmp])
+
+
 AM_PROG_VALAC([0.14])
 AC_PATH_PROG(VAPIGEN, vapigen, no)
 if test "x$VAPIGEN" == "xno"; then
diff --git a/tests/package.m4.in b/tests/package.m4.in
new file mode 100644
index 0000000..57ae927
--- /dev/null
+++ b/tests/package.m4.in
@@ -0,0 +1,8 @@
+# Signature of the current package.
+m4_define([AT_PACKAGE_NAME], [ PACKAGE_NAME@])
+m4_define([AT_PACKAGE_TARNAME], [ PACKAGE_TARNAME@])
+m4_define([AT_PACKAGE_VERSION], [ PACKAGE_VERSION@])
+m4_define([AT_PACKAGE_STRING], [ PACKAGE_STRING@])
+m4_define([AT_PACKAGE_BUGREPORT], [ PACKAGE_BUGREPORT@])
+m4_define([AT_PACKAGE_URL], [ PACKAGE_URL@])
+
diff --git a/tests/testsuite.at b/tests/testsuite.at
new file mode 100644
index 0000000..ae01304
--- /dev/null
+++ b/tests/testsuite.at
@@ -0,0 +1,24 @@
+## Autotest testsuite for msitools.
+
+# Copyright (C) 2012 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+m4_include([package.m4])
+
+AT_INIT
+# Cannot use AT_TESTED because of $EXEEXT (Autotest bug)
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]