From 2fc5b35b79299e3ebd61b2d335ea8f4785473823 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Sun, 6 Jan 2013 15:45:49 +0100 Subject: test: add autotest infrastructure --- Makefile.am | 22 ++++++++++++++++++++++ atlocal.in | 5 +++++ build-aux/move-if-change | 17 +++++++++++++++++ configure.ac | 7 +++++++ tests/package.m4.in | 7 +++++++ tests/testsuite.at | 4 ++++ 6 files changed, 62 insertions(+) create mode 100644 atlocal.in create mode 100755 build-aux/move-if-change create mode 100644 tests/package.m4.in create mode 100644 tests/testsuite.at diff --git a/Makefile.am b/Makefile.am index bd2ae64..abf5ca0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,5 @@ NULL = +CLEANFILES = ACLOCAL_AMFLAGS = -I m4 AM_MAKEFLAGS = --no-print-directory @@ -18,3 +19,24 @@ DISTCLEANFILES = \ intltool-merge \ intltool-update \ $(NULL) + +# 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 $@ diff --git a/atlocal.in b/atlocal.in new file mode 100644 index 0000000..841543a --- /dev/null +++ b/atlocal.in @@ -0,0 +1,5 @@ +EXEEXT=@EXEEXT@ + +_wixl() { + wixl$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 +# 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 c3d2763..58e74ab 100644 --- a/configure.ac +++ b/configure.ac @@ -35,6 +35,13 @@ AC_SUBST(GETTEXT_PACKAGE) AM_GNU_GETTEXT_VERSION([1.11]) AM_GLIB_GNU_GETTEXT +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]) + CFLAGS="$CFLAGS -w" AC_CONFIG_FILES([ diff --git a/tests/package.m4.in b/tests/package.m4.in new file mode 100644 index 0000000..d2143db --- /dev/null +++ b/tests/package.m4.in @@ -0,0 +1,7 @@ +# 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_URL], [@PACKAGE_URL@]) +m4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@]) diff --git a/tests/testsuite.at b/tests/testsuite.at new file mode 100644 index 0000000..bdcf7a2 --- /dev/null +++ b/tests/testsuite.at @@ -0,0 +1,4 @@ +m4_include([package.m4]) + +AT_INIT +AT_BANNER([wixl]) \ No newline at end of file -- cgit