diff options
author | Pavel Raiskup <praiskup@redhat.com> | 2014-11-05 10:46:31 +0100 |
---|---|---|
committer | Pavel Raiskup <praiskup@redhat.com> | 2014-11-05 10:46:31 +0100 |
commit | fbe0ef56fb4d4f89a254546dd368caf44b5f65ec (patch) | |
tree | cfc64bd713ba662cd9b36099accd3fe3988821a3 /controller/tests | |
parent | f45d146cb70d09be1face87ddede306302627349 (diff) | |
download | postgresql-setup-tests-fbe0ef56fb4d4f89a254546dd368caf44b5f65ec.tar.gz postgresql-setup-tests-fbe0ef56fb4d4f89a254546dd368caf44b5f65ec.tar.xz postgresql-setup-tests-fbe0ef56fb4d4f89a254546dd368caf44b5f65ec.zip |
controller: add basic testsuite
Copied from 'postgresql-setup' package. Also do some 'make dist'
fixes.
* controller/Makefile.am: Use $TEST_GEN_FILES_LIST. Also create
the share/ directory during build.
* controller/configure.ac: Initialize testsuite.
* controller/tests/Makefile.am: Bureaucracy for testsuite.
* controller/tests/atlocal.in: Likewise.
* controller/tests/testsuite.at: Add two tests copied from
postgresql-setup project.
Diffstat (limited to 'controller/tests')
-rw-r--r-- | controller/tests/Makefile.am | 45 | ||||
-rw-r--r-- | controller/tests/atlocal.in | 1 | ||||
-rw-r--r-- | controller/tests/testsuite.at | 36 |
3 files changed, 82 insertions, 0 deletions
diff --git a/controller/tests/Makefile.am b/controller/tests/Makefile.am new file mode 100644 index 0000000..28197e4 --- /dev/null +++ b/controller/tests/Makefile.am @@ -0,0 +1,45 @@ +EXTRA_DIST = testsuite.at \ + package.m4 \ + $(TESTSUITE) \ + atlocal.in + +$(srcdir)/package.m4: $(top_srcdir)/configure.ac + $(AM_V_GEN):;{ \ + echo '# Signature of the current package.' && \ + echo 'm4_define([AT_PACKAGE_NAME],' && \ + echo ' [$(PACKAGE_NAME)])' && \ + echo 'm4_define([AT_PACKAGE_TARNAME],' && \ + echo ' [$(PACKAGE_TARNAME)])' && \ + echo 'm4_define([AT_PACKAGE_VERSION],' && \ + echo ' [$(PACKAGE_VERSION)])' && \ + echo 'm4_define([AT_PACKAGE_STRING],' && \ + echo ' [$(PACKAGE_STRING)])' && \ + echo 'm4_define([AT_PACKAGE_BUGREPORT],' && \ + echo ' [$(PACKAGE_BUGREPORT)])'; \ + echo 'm4_define([AT_PACKAGE_URL],' && \ + echo ' [$(PACKAGE_URL)])'; \ + } >'$(srcdir)/package.m4' + +TESTSUITE = $(srcdir)/testsuite +CHECK_DEPS = atconfig atlocal $(TESTSUITE) $(srcdir)/../$(TEST_GEN_FILES_LIST) + +atlocal: atlocal.in $(c_s) + $(INSTANTIATE) + +check-local: $(CHECK_DEPS) + $(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS) + +installcheck-local: $(CHECK_DEPS) + $(SHELL) '$(TESTSUITE)' AUTOTEST_PATH='$(bindir)' $(TESTSUITEFLAGS) + +clean-local: + test ! -f '$(TESTSUITE)' || \ + $(SHELL) '$(TESTSUITE)' --clean + +AUTOTEST = $(AUTOM4TE) --language=autotest + +$(TESTSUITE): $(srcdir)/testsuite.at $(srcdir)/package.m4 + $(AM_V_GEN)$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at && \ + mv $@.tmp $@ + +DISTCLEANFILES = atconfig atlocal diff --git a/controller/tests/atlocal.in b/controller/tests/atlocal.in new file mode 100644 index 0000000..6015f6b --- /dev/null +++ b/controller/tests/atlocal.in @@ -0,0 +1 @@ +TEST_GEN_FILES_LIST=@TEST_GEN_FILES_LIST@ diff --git a/controller/tests/testsuite.at b/controller/tests/testsuite.at new file mode 100644 index 0000000..ade0eea --- /dev/null +++ b/controller/tests/testsuite.at @@ -0,0 +1,36 @@ +AT_INIT +AT_COLOR_TESTS + +m4_define([gen_file_list], [$abs_top_builddir/$TEST_GEN_FILES_LIST]) + +AT_SETUP([Files instantiated correctly]) +AT_CHECK([ +test -f "gen_file_list" || { echo "no such file 'gen_file_list'" ; exit 1 ; } + +pattern='@[[a-zA-Z0-9_]]*@' + +while read file; do + file=$abs_top_builddir/$file + test ! -f "$file" && exit 1 + grep $pattern $file && echo "file $file is incomplete" && exit 1 +done < gen_file_list +exit 0 +]) +AT_CLEANUP + +AT_SETUP([Basic bash syntax check]) +AT_CHECK([file_list=$abs_top_builddir/$TEST_GEN_FILES_LIST +while read file; do + file=$abs_top_builddir/$file + line="`head -1 $file`" + case "$line" in + "#!/bin/bash") + bash -n $file || exit 1 + ;; + "#!/bin/sh") + sh -n $file || exit 1 + ;; + esac +done < gen_file_list +]) +AT_CLEANUP |