From 7fedf800365965f64b6d81e08f9863067702306f Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Mon, 25 Mar 2013 17:48:15 -0400 Subject: [PATCH] Tests: Use Perl prove as the testsuite runner MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Inspired by the test strategy deployed in lttng-tools. Signed-off-by: Jérémie Galarneau --- README | 2 ++ tests/Makefile.am | 7 ++++--- tests/run.sh | 22 ++++++++++++++++++++++ tests/snprintf/Makefile.am | 4 ++-- tests/snprintf/{run => test_snprintf} | 0 tests/unit_tests | 1 + 6 files changed, 31 insertions(+), 5 deletions(-) create mode 100755 tests/run.sh rename tests/snprintf/{run => test_snprintf} (100%) create mode 100644 tests/unit_tests diff --git a/README b/README index 390a719b..84cc6913 100644 --- a/README +++ b/README @@ -34,6 +34,8 @@ compile the git repository tree : (make sure your system wide "automake" points to a recent version!) - GNU Libtool >=2.2 (for more information, go to http://www.gnu.org/software/autoconf/) +- Perl (optional) + Needed for make check and tests. If you get the tree from the repository, you will need to use the "bootstrap" script in the root of the tree. It calls all the GNU tools needed to prepare the diff --git a/tests/Makefile.am b/tests/Makefile.am index 21ba285b..6f9b969c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -8,6 +8,7 @@ dist_noinst_SCRIPTS = test_loop runtests trace_matches noinst_LIBRARIES = libtap.a -libtap_a_SOURCES = \ - tap.c \ - tap.h +libtap_a_SOURCES = tap.c tap.h + +check-am: + ./run.sh unit_tests diff --git a/tests/run.sh b/tests/run.sh new file mode 100755 index 00000000..c6c50fd9 --- /dev/null +++ b/tests/run.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# +# Copyright (C) 2013 - Christian Babeux +# +# 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; only version 2 +# of the License. +# +# 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. +# + +[ -z "$1" ] && echo "Error: No testlist. Please specify a testlist to run." && exit 1 + +prove --merge --exec '' - < $1 diff --git a/tests/snprintf/Makefile.am b/tests/snprintf/Makefile.am index 9ca4f09a..d9f9da08 100644 --- a/tests/snprintf/Makefile.am +++ b/tests/snprintf/Makefile.am @@ -5,5 +5,5 @@ prog_SOURCES = prog.c prog_LDADD = $(top_builddir)/snprintf/libustsnprintf.la \ $(top_builddir)/tests/libtap.a -noinst_SCRIPT = run -EXTRA_DIST = run +noinst_SCRIPT = test_snprintf +EXTRA_DIST = test_snprintf diff --git a/tests/snprintf/run b/tests/snprintf/test_snprintf similarity index 100% rename from tests/snprintf/run rename to tests/snprintf/test_snprintf diff --git a/tests/unit_tests b/tests/unit_tests new file mode 100644 index 00000000..91101383 --- /dev/null +++ b/tests/unit_tests @@ -0,0 +1 @@ +snprintf/test_snprintf -- 2.34.1