discover/pxe: check for a valid boot option before adding
[petitboot] / test / parser / Makefile.am
index d90c368103299ad7676daaf7ba0f3d4253622f6a..e221bf2080c1918084ad92e59ec77badc980be5f 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)) $(noinst_DATA)
+       -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-multiple-resolve \
+       test-grub2-f18-ppc64 \
+       test-grub2-ubuntu-13_04-x86 \
+       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/grub2-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
 
-CLEANFILES = $(composed_files) $(addsuffix .tmp, $(composed_files))
+libtest_ro_SOURCES = \
+       main.c \
+       utils.c \
+       handler.c \
+       parser-test.h \
+       $(parser_objs)
+
+libtest.ro$(EXEEXT): $(libtest_ro_OBJECTS)
+       $(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