test/parser: Update test cases as per new parser requesting conf files
[petitboot] / test / parser / Makefile.am
index b9f9384725f1786f100507b4125e7d2acf4c4d89..32f204d31fa7337f775ca3e8ead1f69c8e7b049c 100644 (file)
 #  along with this program; if not, write to the Free Software
 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
+AUTOMAKE_OPTIONS = parallel-tests
 
 AM_CPPFLAGS = \
        -I$(top_srcdir) \
        -I$(top_srcdir)/lib \
-       -I$(includedir) \
-       $(DEFAULT_CPPFLAGS)
-
-AM_CFLAGS = \
-       $(DEFAULT_CFLAGS)
-
-common_libs = \
-       $(top_builddir)/lib/libpbcore.la \
-       $(top_builddir)/discover/libparser.la
-
-noinst_PROGRAMS = parser-test
-
-parser_test_SOURCES = parser-test.c
-parser_test_LDADD = $(common_libs)
-
-noinst_DATA = \
-       data/grub-01/grub.cfg \
-       data/grub-02/grub.cfg \
-       data/kboot-01/expected-output \
-       data/kboot-01/etc/kboot.conf \
-       data/kboot-02/expected-output \
-       data/kboot-02/etc/kboot.conf \
-       data/kboot-03/expected-output \
-       data/kboot-03/etc/kboot.conf \
-       data/kboot-04/expected-output \
-       data/kboot-04/etc/kboot.conf \
-       data/kboot-05/expected-output \
-       data/kboot-05/etc/kboot.conf \
-       data/kboot-06/expected-output \
-       data/kboot-06/etc/kboot.conf \
-       data/kboot-07/etc/kboot.conf \
-       data/yaboot-01/expected-output \
-       data/yaboot-01/etc/yaboot.conf \
-       data/yaboot-02/etc/yaboot.conf \
-       data/yaboot-03/etc/yaboot.conf \
-       data/yaboot-04/etc/yaboot.conf \
-       data/yaboot-05/etc/yaboot.conf \
-       data/yaboot-06/etc/yaboot.conf
-
-composed_noinst_scripts = \
-       run-parser-tests
-
-noinst_SCRIPTS = $(composed_noinst_scripts)
-
-edit = sed \
-       -e 's|@PACKAGE_NAME\@|$(PACKAGE_NAME)|g' \
-       -e 's|@PACKAGE_VERSION\@|$(PACKAGE_VERSION)|g' \
-       -e 's|@PACKAGE_BUGREPORT\@|$(PACKAGE_BUGREPORT)|g' \
-       -e 's|@abs_srcdir\@|$(abs_srcdir)|g' \
-       -e 's|@abs_builddir\@|$(abs_builddir)|g' \
-       -e 's|@prefix\@|$(prefix)|g'
-
-run-parser-tests: Makefile $(srcdir)/run-parser-tests.in
-       rm -f $@ $@.tmp
-       $(edit) $(srcdir)/$@.in >$@.tmp
-       chmod +x $@.tmp
-       mv $@.tmp $@
-
-composed_files = $(composed_noinst_scripts)
-
-EXTRA_DIST = $(addsuffix .in, $(composed_files))
+       -I$(top_srcdir)/discover \
+       -DLOCAL_STATE_DIR='"$(localstatedir)"' \
+       -DTEST_CONF_BASE='"$(srcdir)/data"' \
+       -DDEBUG -DPETITBOOT_TEST
 
-MAINTAINERCLEANFILES = Makefile.in
+AM_CFLAGS = -O0 -ggdb -Wall -Wextra -Werror
+
+LDADD = $(top_builddir)/lib/libpbcore.la libtest.ro
+
+TESTS = \
+       test-null \
+       test-grub2-single \
+       test-grub2-default \
+       test-grub2-default-index \
+       test-grub2-default-multiword \
+       test-grub2-multiple-resolve \
+       test-grub2-single-line-if \
+       test-grub2-load-env \
+       test-grub2-save-env \
+       test-grub2-f18-ppc64 \
+       test-grub2-ubuntu-13_04-x86 \
+       test-grub2-lexer-error \
+       test-grub2-parser-error \
+       test-kboot-single \
+       test-yaboot-single \
+       test-yaboot-partition \
+       test-yaboot-partition-override \
+       test-yaboot-external \
+       test-yaboot-root-global \
+       test-yaboot-root-override \
+       test-yaboot-device-override \
+       test-yaboot-default \
+       test-yaboot-rh8-ppc64 \
+       test-pxe-empty \
+       test-pxe-single \
+       test-pxe-initrd-in-append
+
+$(TESTS): %: %.embedded-config.o
+$(TESTS): LDADD += $@.embedded-config.o
+
+extract_config = $(srcdir)/extract-config.awk
+
+%.embedded-config.c: %.c $(extract_config)
+       $(AWK) -f $(extract_config) $< > $@
+
+# objects under test
+parser_objs = \
+       $(top_srcdir)/discover/yaboot-parser.c \
+       $(top_srcdir)/discover/kboot-parser.c \
+       $(top_srcdir)/discover/pxe-parser.c \
+       $(top_srcdir)/discover/resource.c \
+       $(top_srcdir)/discover/paths.c \
+       $(top_srcdir)/discover/device-handler.c \
+       $(top_srcdir)/discover/parser-conf.c \
+       $(top_srcdir)/discover/user-event.c \
+       $(top_srcdir)/discover/event.c
+
+libtest_ro_SOURCES = \
+       main.c \
+       utils.c \
+       handler.c \
+       parser-test.h \
+       $(parser_objs)
 
-CLEANFILES = $(composed_files) $(addsuffix .tmp, $(composed_files))
+libtest_ro_LDADD = \
+       ../../discover/grub2/grub2-parser.ro
+
+libtest.ro$(EXEEXT): $(libtest_ro_OBJECTS) $(libtest_ro_LDADD)
+       $(LD) -o $@ -r $^
+
+check_PROGRAMS = $(TESTS) libtest.ro
+
+check_DATA = \
+       data/grub2-f18-ppc64.conf \
+       data/grub2-ubuntu-13_04-x86.conf \
+       data/yaboot-rh8-ppc64.conf
+
+EXTRA_DIST = $(check_DATA) $(extract_config)
+
+CLEANFILES = \
+       $(foreach f, $(TESTS), $(f).embedded-config.c $(f).embedded-config.o)
+
+MAINTAINERCLEANFILES = Makefile.in