Tests: Use Perl prove as the testsuite runner
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 25 Mar 2013 21:48:15 +0000 (17:48 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 26 Mar 2013 15:22:02 +0000 (11:22 -0400)
Inspired by the test strategy deployed in lttng-tools.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
README
tests/Makefile.am
tests/run.sh [new file with mode: 0755]
tests/snprintf/Makefile.am
tests/snprintf/run [deleted file]
tests/snprintf/test_snprintf [new file with mode: 0755]
tests/unit_tests [new file with mode: 0644]

diff --git a/README b/README
index 390a719b93083e819c21cdd4866f831053ba2d9a..84cc69133953e8fd9e85ebc81e2dd3c8a443a6c4 100644 (file)
--- 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
index 21ba285b1e5f81874d6e3c213b5223d7aa8aa4fa..6f9b969ccddbbb23fc01201d0b4a902e2a0bd3a7 100644 (file)
@@ -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 (executable)
index 0000000..c6c50fd
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/bash
+#
+# Copyright (C) 2013 - Christian Babeux <christian.babeux@efficios.com>
+#
+# 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
index 9ca4f09a24d89d8494db333b9649f3f1f27481d3..d9f9da08f532ebda0e7be489935557fdabfd2bc4 100644 (file)
@@ -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/run
deleted file mode 100755 (executable)
index cc77d40..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-
-TEST_DIR=$(dirname $0)
-./${TEST_DIR}/prog
diff --git a/tests/snprintf/test_snprintf b/tests/snprintf/test_snprintf
new file mode 100755 (executable)
index 0000000..cc77d40
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+TEST_DIR=$(dirname $0)
+./${TEST_DIR}/prog
diff --git a/tests/unit_tests b/tests/unit_tests
new file mode 100644 (file)
index 0000000..9110138
--- /dev/null
@@ -0,0 +1 @@
+snprintf/test_snprintf
This page took 0.027738 seconds and 4 git commands to generate.