2015-07-07 02:05:05 +03:00
|
|
|
#
|
|
|
|
# NetSurf unit tests
|
|
|
|
|
2015-07-07 18:02:54 +03:00
|
|
|
|
|
|
|
test_CFLAGS := -std=c99 -g -Wall \
|
|
|
|
-D_BSD_SOURCE \
|
|
|
|
-D_POSIX_C_SOURCE=200809L \
|
|
|
|
-D_XOPEN_SOURCE=600 \
|
|
|
|
-Itest -I. -I.. \
|
2015-07-08 02:40:42 +03:00
|
|
|
$(shell pkg-config --cflags libcurl check)
|
|
|
|
test_LDFLAGS := $(shell pkg-config --libs libcurl check) -lz
|
2010-06-29 11:20:12 +04:00
|
|
|
|
2015-07-07 18:02:54 +03:00
|
|
|
# nsurl sources and flags
|
|
|
|
nsurl_SRCS := utils/corestrings.c utils/nsurl.c utils/idna.c test/log.c test/nsurl.c
|
|
|
|
nsurl_CFLAGS := $(shell pkg-config --cflags libwapcaplet libdom libutf8proc) -O0
|
|
|
|
nsurl_LDFLAGS := $(shell pkg-config --libs libwapcaplet libdom libutf8proc)
|
2010-03-28 16:56:39 +04:00
|
|
|
|
2015-07-07 18:02:54 +03:00
|
|
|
# low level cache sources and flags
|
2011-10-15 01:29:13 +04:00
|
|
|
llcache_SRCS := content/fetch.c content/fetchers/curl.c \
|
|
|
|
content/fetchers/about.c content/fetchers/data.c \
|
|
|
|
content/fetchers/resource.c content/llcache.c \
|
2015-07-07 02:05:05 +03:00
|
|
|
content/urldb.c desktop/version.c \
|
2011-10-15 01:29:13 +04:00
|
|
|
image/image_cache.c \
|
2013-04-08 20:50:55 +04:00
|
|
|
utils/base64.c utils/corestrings.c utils/hashtable.c \
|
2015-07-07 18:02:54 +03:00
|
|
|
utils/nsurl.c utils/messages.c utils/url.c \
|
2013-04-08 20:50:55 +04:00
|
|
|
utils/useragent.c utils/utils.c test/llcache.c
|
2015-07-07 18:02:54 +03:00
|
|
|
llcache_CFLAGS := $(shell pkg-config --cflags libparserutils libwapcaplet libdom) -O2
|
|
|
|
llcache_LDFLAGS := $(shell pkg-config --libs libparserutils libwapcaplet libdom)
|
2010-03-28 16:56:39 +04:00
|
|
|
|
2015-07-07 18:02:54 +03:00
|
|
|
# url database test sources and flags
|
|
|
|
urldbtest_SRCS := content/urldb.c utils/url.c utils/utils.c utils/idna.c \
|
|
|
|
utils/messages.c utils/hashtable.c utils/bloom.c utils/nsoption.c \
|
2012-10-08 23:22:04 +04:00
|
|
|
utils/filename.c utils/nsurl.c utils/corestrings.c \
|
2015-07-07 18:02:54 +03:00
|
|
|
test/log.c test/urldbtest.c
|
|
|
|
urldbtest_CFLAGS := $(shell pkg-config --cflags libwapcaplet libdom libnsutils libutf8proc) -O2
|
|
|
|
urldbtest_LDFLAGS := $(shell pkg-config --libs libwapcaplet libdom libnsutils libutf8proc)
|
2010-06-29 11:20:12 +04:00
|
|
|
|
2011-10-15 01:29:13 +04:00
|
|
|
|
2013-05-27 12:35:16 +04:00
|
|
|
nsoption_SRCS := utils/log.c utils/nsoption.c test/nsoption.c
|
|
|
|
nsoption_CFLAGS := -Dnsgtk
|
|
|
|
|
2015-07-07 18:02:54 +03:00
|
|
|
CLEANS += test-clean
|
|
|
|
|
|
|
|
TESTS := nsurl urldbtest
|
|
|
|
|
|
|
|
TESTROOT := build-$(HOST)-test
|
|
|
|
|
|
|
|
|
|
|
|
.PHONY:test
|
|
|
|
|
|
|
|
test: $(TESTROOT)/created $(addprefix $(TESTROOT)/,$(TESTS))
|
|
|
|
$(TESTROOT)/nsurl
|
|
|
|
$(TESTROOT)/urldbtest
|
|
|
|
|
|
|
|
$(TESTROOT)/created:
|
|
|
|
$(VQ)echo " MKDIR: $(TESTROOT)"
|
|
|
|
$(Q)$(MKDIR) $(TESTROOT)
|
|
|
|
$(Q)$(TOUCH) $@
|
|
|
|
|
|
|
|
$(TESTROOT)/nsurl: $(nsurl_SRCS)
|
|
|
|
$(CC) $(test_CFLAGS) $(nsurl_CFLAGS) $^ -o $@ $(test_LDFLAGS) $(nsurl_LDFLAGS)
|
|
|
|
|
2010-06-29 11:20:12 +04:00
|
|
|
|
2015-07-07 18:02:54 +03:00
|
|
|
$(TESTROOT)/urldbtest: $(urldbtest_SRCS)
|
|
|
|
$(CC) $(test_CFLAGS) $(urldbtest_CFLAGS) $^ -o $@ $(test_LDFLAGS) $(urldbtest_LDFLAGS)
|
2010-06-29 11:20:12 +04:00
|
|
|
|
2015-07-07 18:02:54 +03:00
|
|
|
$(TESTROOT)/llcache: $(llcache_SRCS)
|
|
|
|
$(CC) $(test_CFLAGS) $(llcache_CFLAGS) $^ -o $@ $(test_LDFLAGS) $(llcache_LDFLAGS)
|
2010-03-28 16:56:39 +04:00
|
|
|
|
|
|
|
|
2011-10-15 01:29:13 +04:00
|
|
|
|
2015-07-07 18:02:54 +03:00
|
|
|
$(TESTROOT)/nsoption: $(addprefix ../,$(nsoption_SRCS))
|
|
|
|
$(CC) $(test_CFLAGS) $(nsoption_CFLAGS) $^ -o $@ $(test_LDFLAGS) $(nsoption_LDFLAGS)
|
2013-05-27 12:35:16 +04:00
|
|
|
|
2015-07-07 18:02:54 +03:00
|
|
|
.PHONY: test-clean
|
2010-03-28 16:56:39 +04:00
|
|
|
|
2015-07-07 18:02:54 +03:00
|
|
|
test-clean:
|
|
|
|
$(RM) $(addprefix $(TESTROOT)/,$(TESTS))
|