summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore4
-rw-r--r--Makefile.am24
-rwxr-xr-xbuild-aux/move-if-change17
-rw-r--r--configure.ac6
-rw-r--r--tests/package.m4.in8
-rw-r--r--tests/testsuite.at23
6 files changed, 82 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 9a61dc1..911a29f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,4 +3,8 @@
/config.h.in
/config.h.in~
/configure
+/tests/package.m4
+/tests/testsuite
+/tests/testsuite.dir
+/tests/testsuite.log
Makefile.in
diff --git a/Makefile.am b/Makefile.am
index a3da959..3456b5a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -17,3 +17,27 @@ msibuild_DEPENDENCIES = libmsi/libmsi.la
msiinfo_SOURCES = tools/msiinfo.c
msiinfo_LDADD = -lmsi $(GLIB_LIBS) $(GSF_LIBS)
msiinfo_DEPENDENCIES = libmsi/libmsi.la
+
+# Autotest support
+
+dist_noinst_DATA = tests/testsuite.at tests/package.m4 tests/testsuite
+DISTCLEANFILES = atconfig
+CLEANFILES = testsuite.log
+
+check-local: tests/testsuite atconfig
+ builddir=`pwd` && \
+ cd $(srcdir)/tests && \
+ $(SHELL) testsuite AUTOTEST_PATH=$$builddir $(TESTSUITEFLAGS)
+
+installcheck-local: tests/testsuite atconfig
+ cd $(srcdir)/tests && \
+ $(SHELL) testsuite AUTOTEST_PATH=$(bindir) $(TESTSUITEFLAGS)
+
+clean-local:
+ -$(SHELL) tests/testsuite --clean
+
+tests/testsuite: tests/testsuite.at tests/package.m4
+ cd $(srcdir)/tests && \
+ $(AUTOM4TE) --language=autotest -o testsuite.tmp testsuite.at && \
+ mv testsuite.tmp testsuite
+
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 fcb05b6..d9bb3ce 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,6 +25,12 @@ AS_IF([test "$uuid" = yes],
LT_INIT([win32-dll disable-fast-install])
+AM_MISSING_PROG([AUTOM4TE], [autom4te])
+AC_CONFIG_TESTDIR([.])
+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])
+
AC_CONFIG_FILES([Makefile libmsi/Makefile tests/Makefile])
AC_CONFIG_FILES([tests/runtest], [chmod +x tests/runtest])
AC_OUTPUT
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..681df93
--- /dev/null
+++ b/tests/testsuite.at
@@ -0,0 +1,23 @@
+## 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)