diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/.gitignore | 3 | ||||
-rw-r--r-- | test/Makefile.am | 101 | ||||
-rw-r--r-- | test/atlocal.in | 0 | ||||
-rw-r--r-- | test/autotest.at | 9 | ||||
-rw-r--r-- | test/local.at | 3 | ||||
-rw-r--r-- | test/nbb-basic.at | 41 | ||||
-rw-r--r-- | test/nbb-commands.at | 44 |
7 files changed, 201 insertions, 0 deletions
diff --git a/test/.gitignore b/test/.gitignore new file mode 100644 index 0000000..b197ec4 --- /dev/null +++ b/test/.gitignore @@ -0,0 +1,3 @@ +package.m4 +testsuite +testsuite.at diff --git a/test/Makefile.am b/test/Makefile.am new file mode 100644 index 0000000..ee1666c --- /dev/null +++ b/test/Makefile.am @@ -0,0 +1,101 @@ +# tests/Makefile.am - handle the autotest based testsuite + +EXTRA_DIST = +DISTCLEANFILES = + +TESTCASES = +TESTCASES += autotest.at +TESTCASES += nbb-basic.at +# Add more testcases here + +EXTRA_DIST += $(TESTCASES) + +TESTSUITE_NAME = general-foo +TESTSUITE_COPYRIGHT = Copyright (C) 2007, 2008 Hans Ulrich Niedermann +TESTED_EXECUTABLES = git bzr +TESTSUITE = testsuite + +EXTRA_DIST += atlocal.in local.at +DISTCLEANFILES += atconfig atlocal + +DISTCLEANFILES += \ + testsuite.log \ + testsuite.dir/at-stderr \ + testsuite.dir/at-stdout \ + testsuite.dir/at-check-line \ + testsuite.dir/at-status + +git-version-check: + cd $(top_builddir) && $(MAKE) git-version-check + +check-local: git-version-check atconfig atlocal $(srcdir)/$(TESTSUITE) + $(SHELL) "$(srcdir)/$(TESTSUITE)" AUTOTEST_PATH=`cd $(top_builddir) > /dev/null && pwd`:`cd $(top_builddir)/nbb > /dev/null && pwd` \ + $(TESTSUITEFLAGS) + +installcheck-local: atconfig atlocal $(srcdir)/$(TESTSUITE) + $(SHELL) "$(srcdir)/$(TESTSUITE)" AUTOTEST_PATH='$(bindir)' \ + $(TESTSUITEFLAGS) + +clean-local: + test ! -f '$(srcdir)/$(TESTSUITE)' || \ + $(SHELL) '$(srcdir)/$(TESTSUITE)' --clean + +# Note about the location of testsuite.at, $(TESTSUITE), and package.m4: +# We locate these files in the $(srcdir), because +# a) They are shipped in the source tarball. +# b) If they are created in $(builddir), they will need to be removed on +# "make clean" or "make distclean". Re-generation requires tools a +# normal system does not need to have. +# c) They do not change depending on any configure run, they only change +# depending on configure.ac or tests/Makefile.am updates - and those +# require special build tools to handle anyway. Thus, a normal build +# will not touch these files at all and just leave the filese from +# upstream in place. + +# testsuite.at depends on Makefile.in to make sure that changes in the +# list of TESTCASES are reflected in testsuite.at. We do not depend on +# Makefile, as Makefile is re-created on every ./configure run, and that +# does not imply an addition to TESTCASES. +EXTRA_DIST += $(srcdir)/testsuite.at +$(srcdir)/testsuite.at: $(TESTCASES) Makefile.in + { \ + echo "dnl testsuite.at autogenerated from tests/Makefile.am"; \ + echo "AT_INIT()"; : "([$(TESTSUITE_NAME)])"; \ + echo "AT_COPYRIGHT([$(TESTSUITE_COPYRIGHT)])"; \ + for exe in $(TESTED_EXECUTABLES); do \ + echo "AT_TESTED([$${exe}])"; \ + done; \ + for tc in $(TESTCASES); do \ + echo "m4_include([$${tc}])"; \ + done; \ + } > $(srcdir)/testsuite.at + +# FIXME: Hack to handle unset AUTOM4TE variable +EXTRA_DIST += $(srcdir)/$(TESTSUITE) +$(srcdir)/$(TESTSUITE): $(srcdir)/testsuite.at $(srcdir)/local.at $(srcdir)/package.m4 + AUTOM4TE="$(AUTOM4TE)"; \ + if test "x$${AUTOM4TE}" = "x"; then AUTOM4TE="autom4te"; fi; \ + $${AUTOM4TE} --language=autotest -I '$(srcdir)' -o $(TESTSUITE).tmp $(srcdir)/testsuite.at + if test -f $(srcdir)/$(TESTSUITE) && cmp $(TESTSUITE).tmp $(srcdir)/$(TESTSUITE); \ + then rm -f $(TESTSUITE).tmp; \ + else mv -f $(TESTSUITE).tmp $(srcdir)/$(TESTSUITE); fi + +EXTRA_DIST += $(srcdir)/package.m4 +$(srcdir)/package.m4: $(top_srcdir)/configure.ac $(top_builddir)/config.status Makefile.in + :; { \ + echo '# Signature of the current package (generated by tests/Makefile.am).'; \ + echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \ + echo 'm4_define([AT_PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \ + echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \ + echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \ + echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \ + } > package.m4.tmp + if test -f $(srcdir)/package.m4 && cmp package.m4.tmp $(srcdir)/package.m4; \ + then rm -f package.m4.tmp; \ + else mv -f package.m4.tmp $(srcdir)/package.m4; fi + +dist-hook: + $(MAKE) $(srcdir)/package.m4 $(srcdir)/$(TESTSUITE) + +# End of tests/Makefile.am. + diff --git a/test/atlocal.in b/test/atlocal.in new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/atlocal.in diff --git a/test/autotest.at b/test/autotest.at new file mode 100644 index 0000000..3017987 --- /dev/null +++ b/test/autotest.at @@ -0,0 +1,9 @@ +AT_SETUP([autotest tests]) +AT_KEYWORDS([autotest]) +AT_CHECK([:], [0], [], []) +AT_KEYWORDS([shell]) +AT_TESTED([sh grep cmp]) +AT_CHECK([${SHELL} --version], [ignore], [stdout], [stderr]) +AT_CAPTURE_FILE([stdout]) +AT_CAPTURE_FILE([stderr]) +AT_CLEANUP() diff --git a/test/local.at b/test/local.at new file mode 100644 index 0000000..1f52645 --- /dev/null +++ b/test/local.at @@ -0,0 +1,3 @@ +AT_COPYRIGHT([Copyright (C) 2007,2008 Hans Ulrich Niedermann]) +AT_TESTED([autom4te autoconf autoheader autoupdate autoreconf]) +# Local initialization of the test environment would happen here diff --git a/test/nbb-basic.at b/test/nbb-basic.at new file mode 100644 index 0000000..68ddf71 --- /dev/null +++ b/test/nbb-basic.at @@ -0,0 +1,41 @@ +dnl =================================================================== + +AT_COPYRIGHT([Copyright (C) 2008 Hans Ulrich Niedermann]) +AT_TESTED([nbb]) + +dnl =================================================================== + +dnl =================================================================== + +AT_SETUP([nbb: --version option]) +AT_KEYWORDS([nbb version]) +AT_CHECK([nbb --version], +[0], +[nbb (ndims git utilities) AT_PACKAGE_VERSION +]) +AT_CLEANUP() + +dnl =================================================================== + +AT_SETUP([nbb: --help option]) +AT_KEYWORDS([nbb help]) +AT_CHECK([nbb --help], [0], [ignore], [ignore]) +AT_CLEANUP() + +dnl =================================================================== + +AT_SETUP([nbb: help command]) +AT_KEYWORDS([nbb help]) +AT_CHECK([nbb help], [0], [ignore], []) +AT_CLEANUP() + +dnl =================================================================== + +AT_SETUP([nbb: internal-config command]) +AT_KEYWORDS([nbb internal-config]) +AT_CHECK([nbb internal-config], [0], [ignore], []) +AT_CLEANUP() + +dnl =================================================================== + +dnl =================================================================== diff --git a/test/nbb-commands.at b/test/nbb-commands.at new file mode 100644 index 0000000..4f045ab --- /dev/null +++ b/test/nbb-commands.at @@ -0,0 +1,44 @@ +dnl =================================================================== + +AT_COPYRIGHT([Copyright (C) 2008 Hans Ulrich Niedermann]) +AT_TESTED([nbb]) + +dnl =================================================================== + +AT_SETUP([nbb: git config default defaults]) +AT_KEYWORDS([nbb git config]) +AT_CHECK([mkdir test.git && cd test.git]) +AT_CHECK([cd test.git && git init], [0], +[Initialized empty Git repository in .git/ +]) +echo "$PWD/test.git" > expout +AT_CHECK([cd test.git && nbb config srcdir], [0], [expout]) +echo "$PWD/test.git/_build/_master" > expout +AT_CHECK([cd test.git && nbb config builddir], [0], [expout]) +echo "$PWD/test.git/_install/master" > expout +AT_CHECK([cd test.git && nbb config installdir], [0], [expout]) +AT_CHECK([rm -rf test.git]) +AT_CLEANUP() + +dnl =================================================================== + +AT_SETUP([nbb: bzr config defaults]) +AT_KEYWORDS([nbb bzr config]) +AT_CHECK([mkdir test.bzr && cd test.bzr]) +AT_CHECK([cd test.bzr && bzr init]) +echo "$PWD/test.bzr" > expout +AT_CHECK([cd test.bzr && nbb config srcdir], [0], [expout]) +echo "$PWD/test.bzr/_build" > expout +AT_CHECK([cd test.bzr && nbb config builddir], [0], [expout]) +echo "$PWD/test.bzr/_install" > expout +AT_CHECK([cd test.bzr && nbb config installdir], [0], [expout]) +AT_CHECK([rm -rf test.git]) +AT_CLEANUP() + +dnl =================================================================== + +dnl =================================================================== + +dnl =================================================================== + + |