diff options
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 |