From c5431d4029cfe61dcdd3f28a3bd6d9f22a0b80ea Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Tue, 12 Jan 2010 10:16:17 +0530 Subject: [PATCH] build tests on make, but run on make check --- ChangeLog.unit-testing-framework | 5 ++++- Makefile.in | 21 +++++++++------------ conf/tests.rmk | 31 ++++++++++++++++++------------- 3 files changed, 31 insertions(+), 26 deletions(-) diff --git a/ChangeLog.unit-testing-framework b/ChangeLog.unit-testing-framework index 973a7c756..620ac80cf 100644 --- a/ChangeLog.unit-testing-framework +++ b/ChangeLog.unit-testing-framework @@ -1,6 +1,9 @@ 2010-01-12 BVK Chaitanya - * include/grub/test.h: Removed EXPORT_* usage. + * conf/tests.rmk: Build tests on make. + * Makefile.in (check): Use new variables. + + * include/grub/test.h: Remove EXPORT_* usage. * tests/util/grub-shell-tester.in: Fix error message. diff --git a/Makefile.in b/Makefile.in index 567571897..45c6f3e45 100644 --- a/Makefile.in +++ b/Makefile.in @@ -460,15 +460,18 @@ distcheck: dist @echo "$(distdir).tar.gz is ready for distribution" | \ sed 'h;s/./=/g;p;x;p;x' -TESTS = $(check_UTILITIES) $(check_SCRIPTS) $(check_MODULES) -$(TESTS): $(test_framework_SCRIPTS) $(test_framework_MODULES) - -check: all $(TESTS) - @list="$(check_UTILITIES)"; \ +check: all $(UNIT_TESTS) $(FUNCTIONAL_TESTS) $(SCRIPTED_TESTS) + @list="$(UNIT_TESTS)"; \ for file in $$list; do \ $(builddir)/$$file; \ done - @list="$(check_SCRIPTS)"; \ + @list="$(FUNCTIONAL_TESTS)"; \ + for file in $$list; do \ + mod=`basename $$file .mod`; \ + echo "insmod functional_test; insmod $$mod; functional_test" \ + | $(builddir)/grub-shell; \ + done + @list="$(SCRIPTED_TESTS)"; \ for file in $$list; do \ echo "$$file:"; \ if $(builddir)/$$file; then \ @@ -477,12 +480,6 @@ check: all $(TESTS) echo "$$file: FAIL"; \ fi; \ done - @list="$(check_MODULES)"; \ - for file in $$list; do \ - mod=`basename $$file .mod`; \ - echo "insmod functional_test; insmod $$mod; functional_test" \ - | $(builddir)/grub-shell; \ - done .SUFFIX: .SUFFIX: .c .o .S .d diff --git a/conf/tests.rmk b/conf/tests.rmk index c35ea0baa..e894323ae 100644 --- a/conf/tests.rmk +++ b/conf/tests.rmk @@ -4,38 +4,43 @@ grub-shell: tests/util/grub-shell.in config.status ./config.status --file=$@:$< chmod +x $@ -test_framework_SCRIPTS += grub-shell +bin_SCRIPTS += grub-shell CLEANFILES += grub-shell # For grub-shell-tester grub-shell-tester: tests/util/grub-shell-tester.in config.status ./config.status --file=$@:$< chmod +x $@ -test_framework_SCRIPTS += grub-shell-tester +bin_SCRIPTS += grub-shell-tester CLEANFILES += grub-shell-tester -test_framework_MODULES += functional_test.mod +pkglib_MODULES += functional_test.mod functional_test_mod_SOURCES = tests/lib/functional_test.c tests/lib/test.c functional_test_mod_CFLAGS = $(COMMON_CFLAGS) functional_test_mod_LDFLAGS = $(COMMON_LDFLAGS) -# Unit tests - -check_UTILITIES += example_unit_test +# Rules for unit tests +bin_UTILITIES += example_unit_test example_unit_test_SOURCES = tests/example_unit_test.c kern/list.c kern/misc.c tests/lib/test.c tests/lib/unit_test.c example_unit_test_CFLAGS = -Wno-format -# Functional tests - -check_MODULES += example_functional_test.mod +# Rules for functional tests +pkglib_MODULES += example_functional_test.mod example_functional_test_mod_SOURCES = tests/example_functional_test.c example_functional_test_mod_CFLAGS = -Wno-format $(COMMON_CFLAGS) example_functional_test_mod_LDFLAGS = $(COMMON_LDFLAGS) -# Scripted tests - -check_SCRIPTS += example_scripted_test +# Rules for scripted tests +bin_SCRIPTS += example_scripted_test example_scripted_test_SOURCES = tests/example_scripted_test.in -check_SCRIPTS += example_grub_script_test +bin_SCRIPTS += example_grub_script_test example_grub_script_test_SOURCES = tests/example_grub_script_test.in + + +# List of tests to execute on "make check" + +SCRIPTED_TESTS = example_scripted_test +SCRIPTED_TESTS += example_grub_script_test +UNIT_TESTS = example_unit_test +FUNCTIONAL_TESTS = example_functional_test.mod