diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2019-07-11 11:14:52 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2019-07-11 11:14:52 +0300 |
commit | 6a7581f2e60a600a4915e4f55b74a15c80701978 (patch) | |
tree | 373f11b6a83a1e509320dd9b303334da7b427bd6 | |
parent | 6ccb9ad200f6fa0b59a3d17e7e069badb2d39e50 (diff) | |
download | wordsplit-6a7581f2e60a600a4915e4f55b74a15c80701978.tar.gz wordsplit-6a7581f2e60a600a4915e4f55b74a15c80701978.tar.bz2 |
Change the testsuite files to be easily incorporated into an existing testsuite
* README: Rewrite the testuite section.
* wordsplit.at: Remove AT_INIT
* wsp.c: Include wordsplit-version.h before wordsplit.h
-rw-r--r-- | README | 111 | ||||
-rw-r--r-- | wordsplit.at | 1 | ||||
-rw-r--r-- | wsp.c | 2 |
3 files changed, 44 insertions, 70 deletions
@@ -145,93 +145,69 @@ It is also possible to use LDADD as shown in the example below: The package contains two files for building the testsuite: wsp.c, which is used to build the auxiliary binary wsp, and wordsplit.at, -which is translated by GNU autotest into a testsuite shell script. +which can be included to a GNU autotest-based testsuite source. The discussion below is for those who wish to include wordsplit -testsuite into their project. It assumes the following layout of the -hosting project: - - lib/ - Directory holding the library that incorporates wordsplit.o. - This discussion assumes the library name is libmy.a - lib/wordsplit - Wordsplit sources. - -The testsuite will be built in lib. +testsuite into their project. It assumes that the hosting project +already has an autotest-based testsuite. ** Additional files -Three additional files are necessary for the testsuite: atlocal.in, -wordsplit-version.h, and package.m4. - -The file atlocal.in is a simple shell script that sets the PATH -environment variable for the testsuite. It contains just one line: - - PATH=$srcdir/wordsplit:$PATH - -The file wordsplit-version.h provides the version definition for the -test program wsp.c. Use the following script to create it: +To build the auxiliary tool wsp, you will need an additional file, +wordsplit-version.h. Normally, it should contain only a definition +of the macro or variable WORDSPLIT_VERSION. The following shell +fragment can be used to create it: version=$(cd wordsplit; git describe) cat > wordsplit-version.h <<EOF #define WORDSPLIT_VERSION "$version" EOF -The file package.m4 contains package description which allows -testsuite to generate an accurate report. To create it, use: - - cat > package.m4 <<EOF - m4_define([AT_PACKAGE_NAME], [wordsplit]) - m4_define([AT_PACKAGE_TARNAME], [wordsplit]) - m4_define([AT_PACKAGE_VERSION], [$version]) - m4_define([AT_PACKAGE_STRING], [AT_PACKAGE_NAME AT_PACKAGE_VERSION]) - m4_define([AT_PACKAGE_BUGREPORT], [gray@gnu.org]) - EOF +This file should be listed in the EXTRA_DIST variable to make sure +it is distributed with the tarball. -Here, $version is the same variable you used for wordsplit-version.h. +** testsuite.at -After creating the three files, list them in the EXTRA_DIST variable in -lib/Makefile.am to make sure they will be distributed with the tarball. +Include the file wordsplit.at to your testsuite.at: -** configure.ac + m4_include(wordsplit.at) -Add the following lines to your configure.ac: +** Makefile.am - AM_MISSING_PROG([AUTOM4TE], [autom4te]) +In the Makefile.am responsible for creating the testsuite, make sure +that the path to the wordsplit module is passed to the autotest +invocation, so that the above m4_include statement will work. The +usual make goal to build the testsuite looks as follows: - AC_CONFIG_TESTDIR([lib]) - AC_CONFIG_FILES([lib/Makefile lib/atlocal]) + $(TESTSUITE): package.m4 $(TESTSUITE_AT) + $(AM_V_GEN)$(AUTOTEST) \ + -I $(srcdir)\ + -I $(top_srcdir)/wordsplit\ + testsuite.at -o $@.tmp + $(AM_V_at)mv $@.tmp $@ -** lib/Makefile.am +Then, add the following fragment to build the auxiliary files: -The Makefile.am in lib must be modified to build the auxiliary program -wsp and create the testsuite script. This is done by the following -fragment: + # ########################### + # Wordsplit testsuite + # ########################### + EXTRA_DIST += wordsplit-version.h + $(srcdir)/wordsplit-version.h: $(top_srcdir)/configure.ac + $(AM_V_GEN){\ + if test -e $(top_srcdir)/libmailutils/wordsplit/.git; then \ + wsversion=$$(cd $(top_srcdir)/libmailutils/wordsplit; git describe); \ + else \ + wsversion="unknown"; \ + fi;\ + echo "#define WORDSPLIT_VERSION \"$wsversion\"";\ + echo '#include <mailutils/wordsplit.h>'; } > \ + > $(srcdir)/wordsplit-version.h - EXTRA_DIST = testsuite wordsplit/wordsplit.at package.m4 - DISTCLEANFILES = atconfig - MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE) - - TESTSUITE = $(srcdir)/testsuite - M4=m4 - AUTOTEST = $(AUTOM4TE) --language=autotest - $(TESTSUITE): src/wordsplit.at - $(AM_V_GEN)$(AUTOTEST) -I $(srcdir) wordsplit/wordsplit.at \ - -o $(TESTSUITE).tmp - $(AM_V_at)mv $(TESTSUITE).tmp $(TESTSUITE) - - noinst_PROGRAMS = wsp - wsp_SOURCES = wordsplit/wsp.c wordsplit-version.h - wsp_LDADD = ./libmy.a - - atconfig: $(top_builddir)/config.status - cd $(top_builddir) && ./config.status $@ - - clean-local: - @test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean - - check-local: atconfig atlocal $(TESTSUITE) - @$(SHELL) $(TESTSUITE) + noinst_PROGRAMS += wsp + wsp_SOURCES = + nodist_wsp_SOURCES = wsp.c + wsp.o: $(srcdir)/wordsplit-version.h + VPATH += $(top_srcdir)/libmailutils/wordsplit * History @@ -314,4 +290,3 @@ mode: outline paragraph-separate: "[ ]*$" version-control: never End: - diff --git a/wordsplit.at b/wordsplit.at index 52a4a75..d7d8bc9 100644 --- a/wordsplit.at +++ b/wordsplit.at @@ -14,7 +14,6 @@ # You should have received a copy of the GNU General Public License # along with wordsplit. If not, see <http://www.gnu.org/licenses/>. -AT_INIT AT_TESTED(wsp) m4_pushdef([wspnum],[0]) @@ -22,8 +22,8 @@ #include <string.h> #include <assert.h> #include <errno.h> -#include "wordsplit.h" #include "wordsplit-version.h" +#include "wordsplit.h" extern char **environ; |