build tests on make, but run on make check

This commit is contained in:
BVK Chaitanya 2010-01-12 10:16:17 +05:30
parent 350285caae
commit c5431d4029
3 changed files with 31 additions and 26 deletions

View file

@ -1,6 +1,9 @@
2010-01-12 BVK Chaitanya <bvk@dbook>
* 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.

View file

@ -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

View file

@ -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