diff --git a/configure.ac b/configure.ac index 2c1355f..f23ed48 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,9 @@ dnl Process this file with autoconf to produce a configure script. dnl Created by Anjuta application wizard. +dnl For autotest +AC_PREREQ(2.62) + AC_INIT(projectparser, 0.1) AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) @@ -53,23 +56,27 @@ tests/Makefile po/Makefile.in ]) -TESTLOGFILE=tests.log -AC_SUBST(TESTLOGFILE) - -AC_CONFIG_FILES([ -tests/test0.sh -tests/test1.sh -tests/test2.sh -tests/test3.sh -tests/test4.sh -tests/test5.sh -tests/test6.sh], [ -chmod +x tests/test0.sh -chmod +x tests/test1.sh -chmod +x tests/test2.sh -chmod +x tests/test3.sh -chmod +x tests/test4.sh -chmod +x tests/test5.sh -chmod +x tests/test6.sh]) +AC_CONFIG_TESTDIR(tests) +AC_CONFIG_FILES([tests/atlocal]) +AM_MISSING_PROG([AUTOM4TE], [autom4te]) + +#TESTLOGFILE=tests.log +#AC_SUBST(TESTLOGFILE) + +#AC_CONFIG_FILES([ +#tests/test0.sh +#tests/test1.sh +#tests/test2.sh +#tests/test3.sh +#tests/test4.sh +#tests/test5.sh +#tests/test6.sh], [ +#chmod +x tests/test0.sh +#chmod +x tests/test1.sh +#chmod +x tests/test2.sh +#chmod +x tests/test3.sh +#chmod +x tests/test4.sh +#chmod +x tests/test5.sh +#chmod +x tests/test6.sh]) AC_OUTPUT diff --git a/tests/Makefile.am b/tests/Makefile.am index 186d20f..13047ee 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,24 +1,36 @@ -dist_check_SCRIPTS = test0.sh \ - test1.sh \ - test2.sh \ - test3.sh \ - test4.sh \ - test5.sh \ - test6.sh - -TESTS = $(dist_check_SCRIPTS) - -EXTRA_DIST = \ - empty/configure.ac \ - empty/Makefile.am \ - empty.lst \ - anjuta/configure.ac \ - anjuta.lst \ - parser/configure.ac \ - parser/Makefile.am \ - parser.lst \ - makefile/Makefile \ - makefile.lst - --include $(top_srcdir)/git.mk +EXTRA_DIST = testsuite.at $(TESTSUITE_AT) $(srcdir)/package.m4 $(TESTSUITE) + +$(srcdir)/package.m4: $(top_srcdir)/configure.ac + rm -f $@ $@.tmp + { \ + echo '# Signature of the current package.'; \ + 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)])'; \ + } >$@.tmp + mv $@.tmp $@ + + +TESTSUITE_AT = \ + $(srcdir)/empty.at \ + $(srcdir)/anjuta.at \ + $(srcdir)/group.at \ + $(srcdir)/target.at \ + $(srcdir)/parser.at \ + $(srcdir)/makefile.at + +TESTSUITE = $(srcdir)/testsuite + +AUTOTEST = $(AUTOM4TE) --language=autotest +$(TESTSUITE): $(srcdir)/testsuite.at $(srcdir)/package.m4 $(TESTSUITE_AT) + $(AUTOTEST) -I $(srcdir) -o $@.tmp $@.at + mv $@.tmp $@ + +clean-local: + test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean + +check-local: atconfig $(TESTSUITE) + $(SHELL) $(TESTSUITE) $(TESTSUITEFLAGS) diff --git a/tests/anjuta.at b/tests/anjuta.at new file mode 100644 index 0000000..2ab8213 --- /dev/null +++ b/tests/anjuta.at @@ -0,0 +1,5 @@ +AT_SETUP([Load anjuta project]) +AT_PARSER_CHECK([load $at_srcdir/anjuta \ + list]) +AT_CHECK([diff output $at_srcdir/anjuta.lst]) +AT_CLEANUP diff --git a/tests/empty.at b/tests/empty.at new file mode 100644 index 0000000..cde3285 --- /dev/null +++ b/tests/empty.at @@ -0,0 +1,15 @@ +AT_SETUP([Load empty project]) +AS_MKDIR_P([empty]) +AT_DATA([empty/configure.ac], +[[AC_CONFIG_FILES(Makefile) +]]) +AT_DATA([empty/Makefile.am], +[[ +]]) +AT_DATA([expect], +[[ GROUP (0): empty +]]) +AT_PARSER_CHECK([load empty \ + list]) +AT_CHECK([diff output expect]) +AT_CLEANUP diff --git a/tests/empty.lst b/tests/empty.lst deleted file mode 100644 index f3bfc0a..0000000 --- a/tests/empty.lst +++ /dev/null @@ -1 +0,0 @@ - GROUP (0): empty diff --git a/tests/empty/Makefile.am b/tests/empty/Makefile.am deleted file mode 100644 index e69de29..0000000 diff --git a/tests/empty/configure.ac b/tests/empty/configure.ac deleted file mode 100644 index 00be0e0..0000000 --- a/tests/empty/configure.ac +++ /dev/null @@ -1 +0,0 @@ -AC_CONFIG_FILES(Makefile) diff --git a/tests/empty2.lst b/tests/empty2.lst deleted file mode 100644 index bc330b9..0000000 --- a/tests/empty2.lst +++ /dev/null @@ -1,2 +0,0 @@ - GROUP (0): empty2 - GROUP (0:0): group1 diff --git a/tests/empty3.lst b/tests/empty3.lst deleted file mode 100644 index c3fd7f6..0000000 --- a/tests/empty3.lst +++ /dev/null @@ -1,2 +0,0 @@ - GROUP (0): empty3 - TARGET (0:0): target1 diff --git a/tests/group.at b/tests/group.at new file mode 100644 index 0000000..eeedce8 --- /dev/null +++ b/tests/group.at @@ -0,0 +1,22 @@ +AT_SETUP([Add group]) +AS_MKDIR_P([empty]) +AT_DATA([empty/configure.ac], +[[AC_CONFIG_FILES(Makefile) +]]) +AT_DATA([empty/Makefile.am], +[[ +]]) +AT_DATA([expect], +[[ GROUP (0): empty2 + GROUP (0:0): group1 +]]) +AT_PARSER_CHECK([load empty \ + move empty2 \ + add group 0 group1 \ + list \ + save]) +AT_CHECK([diff output expect]) +AT_PARSER_CHECK([load empty2 \ + list]) +AT_CHECK([diff output expect]) +AT_CLEANUP diff --git a/tests/local.at b/tests/local.at new file mode 100644 index 0000000..b77f9fe --- /dev/null +++ b/tests/local.at @@ -0,0 +1,19 @@ +# We want a recent Autotest +m4_version_prereq([2.58]) + +# AT_PARSER_CHECK (PROJECTPARSER_ARG) +# ------------------------------ +# Run AT_CHECK on projectparser, ignoring stdout and stderr and putting the +# result in a file named output +m4_define([AT_PARSER_CHECK], +[AT_CHECK([$abs_top_builddir/src/projectparser -o output] m4_quote($1), + 0, + ignore, + ignore)]) + + +# Launch test suite +#------------------ +AT_INIT + +AT_TESTED([projectparser]) diff --git a/tests/makefile.at b/tests/makefile.at new file mode 100644 index 0000000..0e98bbd --- /dev/null +++ b/tests/makefile.at @@ -0,0 +1,51 @@ +AT_SETUP([Load makefile project]) +AS_MKDIR_P([makefile]) +AT_DATA([makefile/Makefile], +[[## Created by Anjuta + +CC = gcc +CFLAGS = -g -Wall +OBJECTS = foo.o bar.o +INCFLAGS = +LDFLAGS = -Wl,-rpath,/usr/local/lib +LIBS = + +all: foobar + +foobar: $(OBJECTS) + $(CC) -o foobar $(OBJECTS) $(LDFLAGS) $(LIBS) + +.SUFFIXES: +.SUFFIXES: .c .cc .C .cpp .o + +.c.o : + $(CC) -o $@ -c $(CFLAGS) $< $(INCFLAGS) + +count: + wc *.c *.cc *.C *.cpp *.h *.hpp + +clean: + rm -f *.o + +.PHONY: all +.PHONY: count +.PHONY: clean +]]) +AT_DATA([makefile/foo.c]) +AT_DATA([makefile/bar.c]) +AT_DATA([expect], +[[ VARIABLE: CFLAGS = -g -Wall + VARIABLE: OBJECTS = foo.o bar.o + VARIABLE: LDFLAGS = -Wl,-rpath,/usr/local/lib + VARIABLE: CC = gcc + VARIABLE: LIBS = (null) + VARIABLE: INCFLAGS = (null) + GROUP (0): makefile + TARGET (0:0): foobar + SOURCE (0:0:0): foo.c + SOURCE (0:0:1): bar.c +]]) +AT_PARSER_CHECK([load makefile \ + list]) +AT_CHECK([diff -b output expect]) +AT_CLEANUP diff --git a/tests/makefile.lst b/tests/makefile.lst deleted file mode 100644 index f6e9162..0000000 --- a/tests/makefile.lst +++ /dev/null @@ -1,10 +0,0 @@ - VARIABLE: CFLAGS = -g -Wall - VARIABLE: OBJECTS = foo.o bar.o - VARIABLE: LDFLAGS = -Wl,-rpath,/usr/local/lib - VARIABLE: CC = gcc - VARIABLE: LIBS = - VARIABLE: INCFLAGS = - GROUP (0): makefile - TARGET (0:0): foobar - SOURCE (0:0:0): foo.c - SOURCE (0:0:1): bar.c diff --git a/tests/makefile/Makefile b/tests/makefile/Makefile deleted file mode 100644 index 27f0b60..0000000 --- a/tests/makefile/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -## Created by Anjuta - -CC = gcc -CFLAGS = -g -Wall -OBJECTS = foo.o bar.o -INCFLAGS = -LDFLAGS = -Wl,-rpath,/usr/local/lib -LIBS = - -all: foobar - -foobar: $(OBJECTS) - $(CC) -o foobar $(OBJECTS) $(LDFLAGS) $(LIBS) - -.SUFFIXES: -.SUFFIXES: .c .cc .C .cpp .o - -.c.o : - $(CC) -o $@ -c $(CFLAGS) $< $(INCFLAGS) - -count: - wc *.c *.cc *.C *.cpp *.h *.hpp - -clean: - rm -f *.o - -.PHONY: all -.PHONY: count -.PHONY: clean diff --git a/tests/makefile/bar.c b/tests/makefile/bar.c deleted file mode 100644 index e69de29..0000000 diff --git a/tests/makefile/foo.c b/tests/makefile/foo.c deleted file mode 100644 index e69de29..0000000 diff --git a/tests/makefile/foobar.c b/tests/makefile/foobar.c deleted file mode 100644 index e69de29..0000000 diff --git a/tests/parser.at b/tests/parser.at new file mode 100644 index 0000000..f226f5a --- /dev/null +++ b/tests/parser.at @@ -0,0 +1,18 @@ +AT_SETUP([Check configure parser]) +AS_MKDIR_P([parser]) +AT_DATA([parser/configure.ac], +[[AC_CONFIG_FILES( +Makefile) + +AC_OUTPUT +]]) +AT_DATA([parser/Makefile.am], +[[ +]]) +AT_DATA([expect], +[[ GROUP (0): parser +]]) +AT_PARSER_CHECK([load parser \ + list]) +AT_CHECK([diff output expect]) +AT_CLEANUP diff --git a/tests/parser.lst b/tests/parser.lst deleted file mode 100644 index ea46458..0000000 --- a/tests/parser.lst +++ /dev/null @@ -1 +0,0 @@ - GROUP (0): parser diff --git a/tests/parser/Makefile.am b/tests/parser/Makefile.am deleted file mode 100644 index e69de29..0000000 diff --git a/tests/parser/configure.ac b/tests/parser/configure.ac deleted file mode 100644 index 82cae64..0000000 --- a/tests/parser/configure.ac +++ /dev/null @@ -1,4 +0,0 @@ -AC_CONFIG_FILES ( -Makefile) - -AC_OUTPUT diff --git a/tests/target.at b/tests/target.at new file mode 100644 index 0000000..e2e0109 --- /dev/null +++ b/tests/target.at @@ -0,0 +1,22 @@ +AT_SETUP([Add target]) +AS_MKDIR_P([empty]) +AT_DATA([empty/configure.ac], +[[AC_CONFIG_FILES(Makefile) +]]) +AT_DATA([empty/Makefile.am], +[[ +]]) +AT_DATA([expect], +[[ GROUP (0): empty3 + TARGET (0:0): target1 +]]) +AT_PARSER_CHECK([load empty \ + move empty3 \ + add target 0 target1 program \ + list \ + save]) +AT_CHECK([diff output expect]) +AT_PARSER_CHECK([load empty3 \ + list]) +AT_CHECK([diff output expect]) +AT_CLEANUP diff --git a/tests/test0.sh.in b/tests/test0.sh.in deleted file mode 100755 index e22c294..0000000 --- a/tests/test0.sh.in +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -echo "Running tests" > @TESTLOGFILE@ diff --git a/tests/test1.sh.in b/tests/test1.sh.in deleted file mode 100755 index 69ee53e..0000000 --- a/tests/test1.sh.in +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -echo >> @TESTLOGFILE@ -echo >> @TESTLOGFILE@ -echo "Running $0" >> @TESTLOGFILE@ -@top_builddir@/src/projectparser -o out \ - load @srcdir@/empty \ - list >> @TESTLOGFILE@ 2>&1 \ -&& diff out @srcdir@/empty.lst >> @TESTLOGFILE@ 2>&1 - diff --git a/tests/test2.sh.in b/tests/test2.sh.in deleted file mode 100755 index 29f9f70..0000000 --- a/tests/test2.sh.in +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -echo >> @TESTLOGFILE@ -echo >> @TESTLOGFILE@ -echo "Running $0" >> @TESTLOGFILE@ -@top_builddir@/src/projectparser -o out \ - load @srcdir@/anjuta \ - list >> @TESTLOGFILE@ 2>&1 \ -&& diff out @srcdir@/anjuta.lst >> @TESTLOGFILE@ 2>&1 - diff --git a/tests/test3.sh.in b/tests/test3.sh.in deleted file mode 100755 index 805525b..0000000 --- a/tests/test3.sh.in +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -echo >> @TESTLOGFILE@ -echo >> @TESTLOGFILE@ -echo "Running $0" >> @TESTLOGFILE@ -rm -fr empty2 -@top_builddir@/src/projectparser -o out \ - load @srcdir@/empty \ - move empty2 \ - add group 0 group1 \ - list \ - save >> @TESTLOGFILE@ 2>&1 \ -&& diff out @srcdir@/empty2.lst >> @TESTLOGFILE@ 2>&1 \ -&& @top_builddir@/src/projectparser -o out \ - load empty2 \ - list >> @TESTLOGFILE@ 2>&1 \ -&& diff out @srcdir@/empty2.lst >> @TESTLOGFILE@ 2>&1 diff --git a/tests/test4.sh.in b/tests/test4.sh.in deleted file mode 100755 index 2fe97c6..0000000 --- a/tests/test4.sh.in +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -echo >> @TESTLOGFILE@ -echo >> @TESTLOGFILE@ -echo "Running $0" >> @TESTLOGFILE@ -rm -fr empty2 -@top_builddir@/src/projectparser -o out \ - load @srcdir@/empty \ - move empty3 \ - add target 0 target1 1 \ - list \ - save >> @TESTLOGFILE@ 2>&1 \ -&& diff out @srcdir@/empty3.lst >> @TESTLOGFILE@ 2>&1 \ -&& @top_builddir@/src/projectparser -o out \ - load empty3 \ - list >> @TESTLOGFILE@ 2>&1 \ -&& diff out @srcdir@/empty3.lst >> @TESTLOGFILE@ 2>&1 diff --git a/tests/test5.sh.in b/tests/test5.sh.in deleted file mode 100755 index f3a1a82..0000000 --- a/tests/test5.sh.in +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -echo >> @TESTLOGFILE@ -echo >> @TESTLOGFILE@ -echo "Running $0" >> @TESTLOGFILE@ -@top_builddir@/src/projectparser -o out \ - load @srcdir@/parser \ - list >> @TESTLOGFILE@ 2>&1 \ -&& diff out @srcdir@/parser.lst >> @TESTLOGFILE@ 2>&1 - diff --git a/tests/test6.sh.in b/tests/test6.sh.in deleted file mode 100755 index ad4cb19..0000000 --- a/tests/test6.sh.in +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -echo >> @TESTLOGFILE@ -echo >> @TESTLOGFILE@ -echo "Running $0" >> @TESTLOGFILE@ -@top_builddir@/src/projectparser -o out \ - load @srcdir@/makefile \ - list >> @TESTLOGFILE@ 2>&1 \ -&& diff out @srcdir@/makefile.lst >> @TESTLOGFILE@ 2>&1 - diff --git a/tests/testsuite.at b/tests/testsuite.at new file mode 100644 index 0000000..83df46c --- /dev/null +++ b/tests/testsuite.at @@ -0,0 +1,6 @@ +m4_include([empty.at]) +m4_include([anjuta.at]) +m4_include([group.at]) +m4_include([target.at]) +m4_include([parser.at]) +m4_include([makefile.at])