Skip to content

Commit

Permalink
Use autotest for the testsuite
Browse files Browse the repository at this point in the history
  • Loading branch information
sgranjoux committed Nov 3, 2009
1 parent 4043069 commit b5dcff1
Show file tree
Hide file tree
Showing 30 changed files with 218 additions and 168 deletions.
43 changes: 25 additions & 18 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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
58 changes: 35 additions & 23 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
@@ -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)])'; \
} >[email protected]
mv [email protected] $@


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)
5 changes: 5 additions & 0 deletions tests/anjuta.at
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions tests/empty.at
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion tests/empty.lst

This file was deleted.

Empty file removed tests/empty/Makefile.am
Empty file.
1 change: 0 additions & 1 deletion tests/empty/configure.ac

This file was deleted.

2 changes: 0 additions & 2 deletions tests/empty2.lst

This file was deleted.

2 changes: 0 additions & 2 deletions tests/empty3.lst

This file was deleted.

22 changes: 22 additions & 0 deletions tests/group.at
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions tests/local.at
Original file line number Diff line number Diff line change
@@ -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])
51 changes: 51 additions & 0 deletions tests/makefile.at
Original file line number Diff line number Diff line change
@@ -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
10 changes: 0 additions & 10 deletions tests/makefile.lst

This file was deleted.

29 changes: 0 additions & 29 deletions tests/makefile/Makefile

This file was deleted.

Empty file removed tests/makefile/bar.c
Empty file.
Empty file removed tests/makefile/foo.c
Empty file.
Empty file removed tests/makefile/foobar.c
Empty file.
18 changes: 18 additions & 0 deletions tests/parser.at
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion tests/parser.lst

This file was deleted.

Empty file removed tests/parser/Makefile.am
Empty file.
4 changes: 0 additions & 4 deletions tests/parser/configure.ac

This file was deleted.

22 changes: 22 additions & 0 deletions tests/target.at
Original file line number Diff line number Diff line change
@@ -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
3 changes: 0 additions & 3 deletions tests/test0.sh.in

This file was deleted.

10 changes: 0 additions & 10 deletions tests/test1.sh.in

This file was deleted.

10 changes: 0 additions & 10 deletions tests/test2.sh.in

This file was deleted.

17 changes: 0 additions & 17 deletions tests/test3.sh.in

This file was deleted.

17 changes: 0 additions & 17 deletions tests/test4.sh.in

This file was deleted.

Loading

0 comments on commit b5dcff1

Please sign in to comment.