diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2009-04-08 10:47:56 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2009-04-08 10:47:56 +0000 |
commit | 2c6ba996e6c2afb32384344b00bb3d0a67b11fd5 (patch) | |
tree | 434b39da510b920e7b2b127293baa87c18db5eed /test | |
parent | 056e1ebed94379db41ebb2e40cc88a873cfb4411 (diff) | |
download | libnsfb-2c6ba996e6c2afb32384344b00bb3d0a67b11fd5.tar.gz libnsfb-2c6ba996e6c2afb32384344b00bb3d0a67b11fd5.tar.bz2 |
Integrate the testsuite.
svn path=/trunk/libnsfb/; revision=7062
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile | 111 | ||||
-rw-r--r-- | test/plottest.c | 5 |
2 files changed, 7 insertions, 109 deletions
diff --git a/test/Makefile b/test/Makefile index a87bc36..e027ba0 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,110 +1,3 @@ -# Child makefile fragment for libhubbub -# -# Toolchain is provided by top-level makefile -# -# Variables provided by top-level makefile -# -# COMPONENT The name of the component -# EXPORT The location of the export directory -# TOP The location of the source tree root -# RELEASEDIR The place to put release objects -# DEBUGDIR The place to put debug objects -# -# do_include Canned command sequence to include a child makefile -# -# Variables provided by parent makefile: -# -# DIR The name of the directory we're in, relative to $(TOP) -# -# Variables we can manipulate: -# -# ITEMS_CLEAN The list of items to remove for "make clean" -# ITEMS_DISTCLEAN The list of items to remove for "make distclean" -# TARGET_TESTS The list of target names to run for "make test" -# -# SOURCES The list of sources to build for $(COMPONENT) -# -# Plus anything from the toolchain +DIR_TEST_ITEMS := plottest:plottest.c;nsglobe.c -# Push parent directory onto the directory stack -sp := $(sp).x -dirstack_$(sp) := $(d) -d := $(DIR) - -ifeq ($(MAKECMDGOALS),test) -# Extend toolchain settings -CFLAGS := $(CFLAGS) -I$(TOP)/include/ -LDFLAGS := $(LDFLAGS) -Wl,--whole-archive -lnsfb0 -Wl,--no-whole-archive -lSDL -endif - -ifdef PROFILE - CFLAGS := $(CFLAGS) -pg -fno-omit-frame-pointer - LDFLAGS := $(LDFLAGS) -pg -endif - -# Tests -TESTS_$(d) := plottest - -# Items for top-level makefile to use -ITEMS_CLEAN := $(ITEMS_CLEAN) \ - $(addprefix $(d), $(addsuffix $(EXEEXT), $(TESTS_$(d)))) \ - $(addprefix $(d), $(addsuffix .gcda, $(TESTS_$(d)))) \ - $(addprefix $(d), $(addsuffix .gcno, $(TESTS_$(d)))) \ - $(addprefix $(d), $(addsuffix .d, $(TESTS_$(d)))) -ITEMS_DISTCLEAN := $(ITEMS_DISTCLEAN) $(d)log - -# Targets for top-level makefile to run -TARGET_TESTS := $(TARGET_TESTS) test_$(d) - -# Now we get to hack around so that we know what directory we're in. -# $(d) no longer exists when running the commands for a target, so we can't -# simply use it verbatim. Assigning to a variable doesn't really help, as -# there's no guarantee that someone else hasn't overridden that variable. -# So, what we do is make the target depend on $(d), then pick it out of the -# dependency list when running commands. This isn't pretty, but is effective. -test_$(d): $(d) $(addprefix $(d), $(TESTS_$(d))) - @$(PERL) $(TOP)/$<testrunner.pl $(TOP)/$< $(EXEEXT) - -DEP_$(d) := - -define dep_test -DEP_$(d) += $(2) -$(2): $(1) - @$$(RM) $$(RMFLAGS) $(2) - @$$(CC) $$(DEBUGCFLAGS) -MM -MT '$(2) $(3)' -MF $(2) $(1) - -endef - -# Build rules for each test binary -- they all depend on the debug library -# Except when building on RISC OS, of course because then make utterly fails to -# detect that the debug library exists. -define compile_test -ifeq ($(HOST),riscos) -$(2): $(3) -else -$(2): $(3) $(TOP)/$(COMPONENT)-debug.a -endif - @$$(ECHO) $$(ECHOFLAGS) "==> $(1)" - @$$(CC) -c -g $$(DEBUGCFLAGS) -o $$@.o $(1) - @$$(LD) -g -o $$@ $$@.o -lhubbub-debug $$(LDFLAGS) -lgcov - @$$(RM) $$(RMFLAGS) $$@.o - -endef - -$(eval $(foreach TEST,$(addprefix $(d), $(TESTS_$(d))), \ - $(call dep_test,$(addsuffix .c, $(TEST)),$(addsuffix .d, $(TEST)),$(TEST)))) - -ifeq ($(MAKECMDGOALS),test) --include $(sort $(DEP_$(d))) -endif - -$(eval $(foreach TEST,$(addprefix $(d), $(TESTS_$(d))), \ - $(call compile_test,$(addsuffix .c, $(TEST)),$(TEST),$(addsuffix .d, $(TEST))))) - -# Now include any children we may have -MAKE_INCLUDES := $(wildcard $(d)*/Makefile) -$(eval $(foreach INC, $(MAKE_INCLUDES), $(call do_include,$(INC)))) - -# Finally, pop off the directory stack -d := $(dirstack_$(sp)) -sp := $(basename $(sp)) +include build/makefiles/Makefile.subdir diff --git a/test/plottest.c b/test/plottest.c index 899f3f4..992fdd9 100644 --- a/test/plottest.c +++ b/test/plottest.c @@ -5,6 +5,8 @@ #include "libnsfb.h" #include "libnsfb_plot.h" +#define UNUSED(x) ((x) = (x)) + extern const struct { unsigned int width; unsigned int height; @@ -23,6 +25,9 @@ int main(int argc, char **argv) int p[] = { 300,300, 350,350, 400,300, 450,250, 400,200}; int loop; + UNUSED(argc); + UNUSED(argv); + nsfb = nsfb_init(NSFB_FRONTEND_SDL); if (nsfb == NULL) { fprintf(stderr, "Unable to initialise nsfb with SDL frontend\n"); |