]> git.ozlabs.org Git - petitboot/blobdiff - test/parser/Makefile.am
discover: Handle and track plugin_options
[petitboot] / test / parser / Makefile.am
index d90c368103299ad7676daaf7ba0f3d4253622f6a..fa644fe3f98daa417cc49289e0eb0791965dd754 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
 
+parser_TESTS = \
+       test/parser/test-null \
+       test/parser/test-grub2-single \
+       test/parser/test-grub2-default \
+       test/parser/test-grub2-empty \
+       test/parser/test-grub2-noeol \
+       test/parser/test-grub2-menuentry-formats \
+       test/parser/test-grub2-if-formats \
+       test/parser/test-grub2-default-index \
+       test/parser/test-grub2-default-multiword \
+       test/parser/test-grub2-implicit-default-unset \
+       test/parser/test-grub2-implicit-default-invalid \
+       test/parser/test-grub2-multiple-resolve \
+       test/parser/test-grub2-multiple-id \
+       test/parser/test-grub2-single-line-if \
+       test/parser/test-grub2-pos-param \
+       test/parser/test-grub2-load-env \
+       test/parser/test-grub2-save-env \
+       test/parser/test-grub2-save-env-dash-f \
+       test/parser/test-grub2-saved-default \
+       test/parser/test-grub2-nondefault-prefix \
+       test/parser/test-grub2-f18-ppc64 \
+       test/parser/test-grub2-f20-ppc64 \
+       test/parser/test-grub2-ubuntu-13_04-x86 \
+       test/parser/test-grub2-sles-btrfs-snapshot \
+       test/parser/test-grub2-lexer-error \
+       test/parser/test-grub2-parser-error \
+       test/parser/test-grub2-test-file-ops \
+       test/parser/test-kboot-single \
+       test/parser/test-yaboot-empty \
+       test/parser/test-yaboot-single \
+       test/parser/test-yaboot-partition \
+       test/parser/test-yaboot-partition-override \
+       test/parser/test-yaboot-external \
+       test/parser/test-yaboot-root-global \
+       test/parser/test-yaboot-root-override \
+       test/parser/test-yaboot-device-override \
+       test/parser/test-yaboot-global-state \
+       test/parser/test-yaboot-leftovers \
+       test/parser/test-yaboot-default \
+       test/parser/test-yaboot-rh8-ppc64 \
+       test/parser/test-pxe-empty \
+       test/parser/test-pxe-single \
+       test/parser/test-pxe-initrd-in-append \
+       test/parser/test-pxe-mac-without-conf \
+       test/parser/test-pxe-ip-without-conf \
+       test/parser/test-pxe-non-url-conf \
+       test/parser/test-pxe-local \
+       test/parser/test-pxe-ipappend \
+       test/parser/test-pxe-pathprefix-with-conf \
+       test/parser/test-pxe-non-url-pathprefix-with-conf \
+       test/parser/test-pxe-pathprefix-discover \
+       test/parser/test-pxe-pathprefix-discover-mac \
+       test/parser/test-pxe-path-resolve-relative \
+       test/parser/test-pxe-path-resolve-absolute \
+       test/parser/test-pxe-discover-bootfile-root \
+       test/parser/test-pxe-discover-bootfile-subdir \
+       test/parser/test-pxe-discover-bootfile-pathprefix \
+       test/parser/test-pxe-discover-bootfile-relative-conffile \
+       test/parser/test-pxe-discover-bootfile-absolute-conffile \
+       test/parser/test-unresolved-remove
 
-AM_CPPFLAGS = \
-       -I$(top_srcdir) \
-       -I$(top_srcdir)/lib \
-       -I$(includedir) \
-       $(DEFAULT_CPPFLAGS)
+TESTS += $(parser_TESTS)
+check_PROGRAMS += $(parser_TESTS) test/parser/libtest.ro
 
-AM_CFLAGS = \
-       $(DEFAULT_CFLAGS)
+check_DATA += \
+       test/parser/data/grub2-f18-ppc64.conf \
+       test/parser/data/grub2-f20-ppc.conf \
+       test/parser/data/grub2-ubuntu-13_04-x86.conf \
+       test/parser/data/yaboot-rh8-ppc64.conf
 
-common_libs = \
-       $(top_builddir)/lib/libpbcore.la \
-       $(top_builddir)/discover/libparser.la
+$(parser_TESTS): AM_CPPFLAGS += \
+               -I$(top_srcdir)/discover \
+               -DLOCAL_STATE_DIR='"$(localstatedir)"'
+$(parser_TESTS): LDADD += $@.embedded-config.o test/parser/libtest.ro $(core_lib)
+$(parser_TESTS): %: %.embedded-config.o test/parser/libtest.ro $(core_lib)
 
-noinst_PROGRAMS = parser-test
+extract_config = $(srcdir)/test/parser/extract-config.awk
 
-parser_test_SOURCES = parser-test.c
-parser_test_LDADD = $(common_libs)
+%.embedded-config.c: %.c $(extract_config)
+       $(AM_V_GEN)$(AWK) -f $(extract_config) $< > $@
 
-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
+# objects under test
 
-composed_noinst_scripts = \
-       run-parser-tests
+test_parser_libtest_ro_SOURCES = \
+       test/parser/main.c \
+       test/parser/utils.c \
+       test/parser/handler.c \
+       test/parser/network.c \
+       test/parser/user-event.c \
+       test/parser/parser-test.h \
+       discover/yaboot-parser.c \
+       discover/kboot-parser.c \
+       discover/pxe-parser.c \
+       discover/platform.c \
+       discover/resource.c \
+       discover/paths.c \
+       discover/device-handler.c \
+       discover/parser-conf.c \
+       discover/user-event.c \
+       discover/event.c \
+       $(discover_grub2_grub2_parser_ro_SOURCES)
 
-noinst_SCRIPTS = $(composed_noinst_scripts)
+test_parser_libtest_ro_CPPFLAGS = \
+       $(AM_CPPFLAGS) \
+       -I$(top_srcdir)/discover \
+       -I$(top_srcdir)/discover/grub2 \
+       -I$(top_builddir)/discover/grub2 \
+       -DPETITBOOT_TEST \
+       -DLOCAL_STATE_DIR='"$(localstatedir)"' \
+       -DTEST_CONF_BASE='"$(top_srcdir)/test/parser/data"'
 
-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'
+test/parser/libtest.ro$(EXEEXT): $(test_parser_libtest_ro_OBJECTS) \
+                                          $(test_parser_libtest_ro_LDADD)
+       $(AM_V_GEN)$(LD) -o $@ -r $^
 
-run-parser-tests: Makefile $(srcdir)/run-parser-tests.in
-       rm -f $@ $@.tmp
-       $(edit) $(srcdir)/$@.in >$@.tmp
-       chmod +x $@.tmp
-       mv $@.tmp $@
+EXTRA_DIST += $(check_DATA) $(extract_config)
 
-composed_files = $(composed_noinst_scripts)
+CLEANFILES += \
+       $(foreach f, $(TESTS), $(f).embedded-config.c $(f).embedded-config.o)
 
-EXTRA_DIST = $(addsuffix .in, $(composed_files)) $(noinst_DATA)
-
-MAINTAINERCLEANFILES = Makefile.in
-
-CLEANFILES = $(composed_files) $(addsuffix .tmp, $(composed_files))