Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/bd802e763e5c035817a62...
...commit
http://git.netsurf-browser.org/netsurf.git/commit/bd802e763e5c035817a6211...
...tree
http://git.netsurf-browser.org/netsurf.git/tree/bd802e763e5c035817a62114b...
The branch, master has been updated
via bd802e763e5c035817a62114b957ed6778ad491f (commit)
from ccfc2aeefa87400d506a59799933ad591e7d92ca (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=bd802e763e5c035817a...
commit bd802e763e5c035817a62114b957ed6778ad491f
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
Restructure test makefile to be called from main makefile
This changes the make test to be executed from the main netsurf
makefile instead of being standalone. It also fixes up the urldbtest
to run.
diff --git a/Makefile b/Makefile
index fc3225a..8e1fcc3 100644
--- a/Makefile
+++ b/Makefile
@@ -22,6 +22,8 @@
# make docs
#
+.PHONY: all
+
all: all-program
# Determine host type
@@ -778,7 +780,7 @@ $(eval $(foreach SOURCE,$(filter %.m,$(SOURCES)), \
#$(eval $(foreach SOURCE,$(filter %.s,$(SOURCES)), \
# $(call dependency_generate_s,$(SOURCE),$(subst /,_,$(SOURCE:.s=.d)),$(subst
/,_,$(SOURCE:.s=.o)))))
-ifneq ($(MAKECMDGOALS),clean)
+ifeq ($(filter $(MAKECMDGOALS),clean test),)
-include $(sort $(addprefix $(DEPROOT)/,$(DEPFILES)))
-include $(D_JSAPI_BINDING)
endif
@@ -797,14 +799,54 @@ $(eval $(foreach SOURCE,$(filter %.m,$(SOURCES)), \
$(eval $(foreach SOURCE,$(filter %.s,$(SOURCES)), \
$(call compile_target_s,$(SOURCE),$(subst /,_,$(SOURCE:.s=.o)),$(subst
/,_,$(SOURCE:.s=.d)))))
-.PHONY: all clean docs install package-$(TARGET) package install-$(TARGET)
+# ----------------------------------------------------------------------------
+# Test setup
+# ----------------------------------------------------------------------------
+
+include test/Makefile
+
+
+# ----------------------------------------------------------------------------
+# Clean setup
+# ----------------------------------------------------------------------------
+
+.PHONY: clean
clean: $(CLEANS)
-# Target builds a distribution package
+
+# ----------------------------------------------------------------------------
+# build distribution package
+# ----------------------------------------------------------------------------
+
+.PHONY: package-$(TARGET) package
+
package: all-program package-$(TARGET)
+# ----------------------------------------------------------------------------
+# local install on the host system
+# ----------------------------------------------------------------------------
+
+.PHONY: install install-$(TARGET)
+
+install: all-program install-$(TARGET)
+
+
+# ----------------------------------------------------------------------------
+# Documentation build
+# ----------------------------------------------------------------------------
+
+.PHONY: docs
+
+docs:
+ doxygen Docs/Doxyfile
+
+
+# ----------------------------------------------------------------------------
+# Transifex message processing
+# ----------------------------------------------------------------------------
+
.PHONY: messages-split-tfx messages-fetch-tfx messages-import-tfx
# split fat messages into properties files suitable for uploading to transifex
@@ -819,13 +861,3 @@ messages-fetch-tfx:
messages-import-tfx: messages-fetch-tfx
for tfxlang in $(FAT_LANGUAGES);do perl ./utils/import-messages.pl -l $${tfxlang} -p any
-f transifex -o resources/FatMessages -i resources/FatMessages -I
Messages.any.$${tfxlang}.tfx ; $(RM) Messages.any.$${tfxlang}.tfx; done
-# Target installs executable on the host system
-install: all-program install-$(TARGET)
-
-docs:
- doxygen Docs/Doxyfile
-
-.PHONY:test
-
-test:
- make -C test
\ No newline at end of file
diff --git a/test/Makefile b/test/Makefile
index 7327580..ce3e274 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -1,55 +1,78 @@
#
# NetSurf unit tests
-CFLAGS := -std=c99 -g -O0 -D_BSD_SOURCE -D_POSIX_C_SOURCE -I. -I.. \
+
+test_CFLAGS := -std=c99 -g -Wall \
+ -D_BSD_SOURCE \
+ -D_POSIX_C_SOURCE=200809L \
+ -D_XOPEN_SOURCE=600 \
+ -Itest -I. -I.. \
$(shell pkg-config --cflags libcurl)
-LDFLAGS := $(shell pkg-config --libs libcurl) -lz
+test_LDFLAGS := $(shell pkg-config --libs libcurl) -lz
-llcache_CFLAGS := $(shell pkg-config --cflags libparserutils libwapcaplet libdom) -O2
-llcache_LDFLAGS := $(shell pkg-config --libs libparserutils libwapcaplet libdom)
+# 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)
+# low level cache sources and flags
llcache_SRCS := content/fetch.c content/fetchers/curl.c \
content/fetchers/about.c content/fetchers/data.c \
content/fetchers/resource.c content/llcache.c \
content/urldb.c desktop/version.c \
image/image_cache.c \
utils/base64.c utils/corestrings.c utils/hashtable.c \
- utils/log.c utils/nsurl.c utils/messages.c utils/url.c \
+ utils/nsurl.c utils/messages.c utils/url.c \
utils/useragent.c utils/utils.c test/llcache.c
+llcache_CFLAGS := $(shell pkg-config --cflags libparserutils libwapcaplet libdom) -O2
+llcache_LDFLAGS := $(shell pkg-config --libs libparserutils libwapcaplet libdom)
-urldbtest_SRCS := content/urldb.c utils/url.c utils/utils.c utils/log.c \
- utils/messages.c utils/hashtable.c \
+# 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 \
utils/filename.c utils/nsurl.c utils/corestrings.c \
- test/urldbtest.c
+ 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)
-urldbtest_CFLAGS := $(shell pkg-config --cflags libwapcaplet libdom libnsutils) -O2
-urldbtest_LDFLAGS := $(shell pkg-config --libs libwapcaplet libdom libnsutils)
-
-nsurl_SRCS := utils/corestrings.c utils/log.c utils/nsurl.c utils/idna.c
desktop/version.c test/nsurl.c
-nsurl_CFLAGS := $(shell pkg-config --cflags libwapcaplet libdom libutf8proc)
-nsurl_LDFLAGS := $(shell pkg-config --libs libwapcaplet libdom libutf8proc)
nsoption_SRCS := utils/log.c utils/nsoption.c test/nsoption.c
nsoption_CFLAGS := -Dnsgtk
-.PHONY: all
+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)
+
-all: nsurl
- ./nsurl
+$(TESTROOT)/urldbtest: $(urldbtest_SRCS)
+ $(CC) $(test_CFLAGS) $(urldbtest_CFLAGS) $^ -o $@ $(test_LDFLAGS) $(urldbtest_LDFLAGS)
-llcache: $(addprefix ../,$(llcache_SRCS))
- $(CC) $(CFLAGS) $(llcache_CFLAGS) $^ -o $@ $(LDFLAGS) $(llcache_LDFLAGS)
+$(TESTROOT)/llcache: $(llcache_SRCS)
+ $(CC) $(test_CFLAGS) $(llcache_CFLAGS) $^ -o $@ $(test_LDFLAGS) $(llcache_LDFLAGS)
-urldbtest: $(addprefix ../,$(urldbtest_SRCS))
- $(CC) $(CFLAGS) $(urldbtest_CFLAGS) $^ -o $@ $(LDFLAGS) $(urldbtest_LDFLAGS)
-nsurl: $(addprefix ../,$(nsurl_SRCS))
- $(CC) $(CFLAGS) $(nsurl_CFLAGS) $^ -o $@ $(LDFLAGS) $(nsurl_LDFLAGS)
-nsoption: $(addprefix ../,$(nsoption_SRCS))
- $(CC) $(CFLAGS) $(nsoption_CFLAGS) $^ -o $@ $(LDFLAGS) $(nsoption_LDFLAGS)
+$(TESTROOT)/nsoption: $(addprefix ../,$(nsoption_SRCS))
+ $(CC) $(test_CFLAGS) $(nsoption_CFLAGS) $^ -o $@ $(test_LDFLAGS) $(nsoption_LDFLAGS)
-.PHONY: clean
+.PHONY: test-clean
-clean:
- $(RM) llcache urldbtest nsurl nsoption
+test-clean:
+ $(RM) $(addprefix $(TESTROOT)/,$(TESTS))
diff --git a/test/log.c b/test/log.c
new file mode 100644
index 0000000..90b4379
--- /dev/null
+++ b/test/log.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2015 Vincent Sanders <vince(a)netsurf-browser.org>
+ *
+ * This file is part of NetSurf,
http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <
http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file
+ * Minimal unit test log implementation.
+ *
+ * It is necessary to have a logging implementation for the unit tests
+ * so other netsurf modules that assume this functionality work.
+ */
+
+#include <stdarg.h>
+#include <stdio.h>
+
+#include "utils/log.h"
+
+/** flag to enable verbose logging */
+bool verbose_log = false;
+
+nserror nslog_init(nslog_ensure_t *ensure, int *pargc, char **argv)
+{
+ return NSERROR_OK;
+}
+
+
+void nslog_log(const char *file, const char *func, int ln, const char *format, ...)
+{
+ va_list ap;
+
+ fprintf(stderr, "%s:%i %s: ", file, ln, func);
+
+ va_start(ap, format);
+
+ vfprintf(stderr, format, ap);
+
+ va_end(ap);
+
+ fputc('\n', stderr);
+}
diff --git a/test/urldbtest.c b/test/urldbtest.c
index 4536ddd..f72d77f 100644
--- a/test/urldbtest.c
+++ b/test/urldbtest.c
@@ -46,7 +46,7 @@
#include "utils/utils.h"
int option_expire_url = 0;
-bool verbose_log = true;
+struct netsurf_table *guit = NULL;
static void netsurf_lwc_iterator(lwc_string *str, void *pw)
{
@@ -163,6 +163,8 @@ int main(void)
nsurl *urlr;
char *path_query;
+ verbose_log = true;
+
corestrings_init();
h = urldb_add_host("127.0.0.1");
-----------------------------------------------------------------------
Summary of changes:
Makefile | 58 ++++++++++++++++++++++++-------
test/Makefile | 79 +++++++++++++++++++++++++++---------------
windows/file.h => test/log.c | 35 ++++++++++++++++---
test/urldbtest.c | 4 ++-
4 files changed, 129 insertions(+), 47 deletions(-)
copy windows/file.h => test/log.c (53%)
diff --git a/Makefile b/Makefile
index fc3225a..8e1fcc3 100644
--- a/Makefile
+++ b/Makefile
@@ -22,6 +22,8 @@
# make docs
#
+.PHONY: all
+
all: all-program
# Determine host type
@@ -778,7 +780,7 @@ $(eval $(foreach SOURCE,$(filter %.m,$(SOURCES)), \
#$(eval $(foreach SOURCE,$(filter %.s,$(SOURCES)), \
# $(call dependency_generate_s,$(SOURCE),$(subst /,_,$(SOURCE:.s=.d)),$(subst
/,_,$(SOURCE:.s=.o)))))
-ifneq ($(MAKECMDGOALS),clean)
+ifeq ($(filter $(MAKECMDGOALS),clean test),)
-include $(sort $(addprefix $(DEPROOT)/,$(DEPFILES)))
-include $(D_JSAPI_BINDING)
endif
@@ -797,14 +799,54 @@ $(eval $(foreach SOURCE,$(filter %.m,$(SOURCES)), \
$(eval $(foreach SOURCE,$(filter %.s,$(SOURCES)), \
$(call compile_target_s,$(SOURCE),$(subst /,_,$(SOURCE:.s=.o)),$(subst
/,_,$(SOURCE:.s=.d)))))
-.PHONY: all clean docs install package-$(TARGET) package install-$(TARGET)
+# ----------------------------------------------------------------------------
+# Test setup
+# ----------------------------------------------------------------------------
+
+include test/Makefile
+
+
+# ----------------------------------------------------------------------------
+# Clean setup
+# ----------------------------------------------------------------------------
+
+.PHONY: clean
clean: $(CLEANS)
-# Target builds a distribution package
+
+# ----------------------------------------------------------------------------
+# build distribution package
+# ----------------------------------------------------------------------------
+
+.PHONY: package-$(TARGET) package
+
package: all-program package-$(TARGET)
+# ----------------------------------------------------------------------------
+# local install on the host system
+# ----------------------------------------------------------------------------
+
+.PHONY: install install-$(TARGET)
+
+install: all-program install-$(TARGET)
+
+
+# ----------------------------------------------------------------------------
+# Documentation build
+# ----------------------------------------------------------------------------
+
+.PHONY: docs
+
+docs:
+ doxygen Docs/Doxyfile
+
+
+# ----------------------------------------------------------------------------
+# Transifex message processing
+# ----------------------------------------------------------------------------
+
.PHONY: messages-split-tfx messages-fetch-tfx messages-import-tfx
# split fat messages into properties files suitable for uploading to transifex
@@ -819,13 +861,3 @@ messages-fetch-tfx:
messages-import-tfx: messages-fetch-tfx
for tfxlang in $(FAT_LANGUAGES);do perl ./utils/import-messages.pl -l $${tfxlang} -p any
-f transifex -o resources/FatMessages -i resources/FatMessages -I
Messages.any.$${tfxlang}.tfx ; $(RM) Messages.any.$${tfxlang}.tfx; done
-# Target installs executable on the host system
-install: all-program install-$(TARGET)
-
-docs:
- doxygen Docs/Doxyfile
-
-.PHONY:test
-
-test:
- make -C test
\ No newline at end of file
diff --git a/test/Makefile b/test/Makefile
index 7327580..ce3e274 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -1,55 +1,78 @@
#
# NetSurf unit tests
-CFLAGS := -std=c99 -g -O0 -D_BSD_SOURCE -D_POSIX_C_SOURCE -I. -I.. \
+
+test_CFLAGS := -std=c99 -g -Wall \
+ -D_BSD_SOURCE \
+ -D_POSIX_C_SOURCE=200809L \
+ -D_XOPEN_SOURCE=600 \
+ -Itest -I. -I.. \
$(shell pkg-config --cflags libcurl)
-LDFLAGS := $(shell pkg-config --libs libcurl) -lz
+test_LDFLAGS := $(shell pkg-config --libs libcurl) -lz
-llcache_CFLAGS := $(shell pkg-config --cflags libparserutils libwapcaplet libdom) -O2
-llcache_LDFLAGS := $(shell pkg-config --libs libparserutils libwapcaplet libdom)
+# 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)
+# low level cache sources and flags
llcache_SRCS := content/fetch.c content/fetchers/curl.c \
content/fetchers/about.c content/fetchers/data.c \
content/fetchers/resource.c content/llcache.c \
content/urldb.c desktop/version.c \
image/image_cache.c \
utils/base64.c utils/corestrings.c utils/hashtable.c \
- utils/log.c utils/nsurl.c utils/messages.c utils/url.c \
+ utils/nsurl.c utils/messages.c utils/url.c \
utils/useragent.c utils/utils.c test/llcache.c
+llcache_CFLAGS := $(shell pkg-config --cflags libparserutils libwapcaplet libdom) -O2
+llcache_LDFLAGS := $(shell pkg-config --libs libparserutils libwapcaplet libdom)
-urldbtest_SRCS := content/urldb.c utils/url.c utils/utils.c utils/log.c \
- utils/messages.c utils/hashtable.c \
+# 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 \
utils/filename.c utils/nsurl.c utils/corestrings.c \
- test/urldbtest.c
+ 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)
-urldbtest_CFLAGS := $(shell pkg-config --cflags libwapcaplet libdom libnsutils) -O2
-urldbtest_LDFLAGS := $(shell pkg-config --libs libwapcaplet libdom libnsutils)
-
-nsurl_SRCS := utils/corestrings.c utils/log.c utils/nsurl.c utils/idna.c
desktop/version.c test/nsurl.c
-nsurl_CFLAGS := $(shell pkg-config --cflags libwapcaplet libdom libutf8proc)
-nsurl_LDFLAGS := $(shell pkg-config --libs libwapcaplet libdom libutf8proc)
nsoption_SRCS := utils/log.c utils/nsoption.c test/nsoption.c
nsoption_CFLAGS := -Dnsgtk
-.PHONY: all
+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)
+
-all: nsurl
- ./nsurl
+$(TESTROOT)/urldbtest: $(urldbtest_SRCS)
+ $(CC) $(test_CFLAGS) $(urldbtest_CFLAGS) $^ -o $@ $(test_LDFLAGS) $(urldbtest_LDFLAGS)
-llcache: $(addprefix ../,$(llcache_SRCS))
- $(CC) $(CFLAGS) $(llcache_CFLAGS) $^ -o $@ $(LDFLAGS) $(llcache_LDFLAGS)
+$(TESTROOT)/llcache: $(llcache_SRCS)
+ $(CC) $(test_CFLAGS) $(llcache_CFLAGS) $^ -o $@ $(test_LDFLAGS) $(llcache_LDFLAGS)
-urldbtest: $(addprefix ../,$(urldbtest_SRCS))
- $(CC) $(CFLAGS) $(urldbtest_CFLAGS) $^ -o $@ $(LDFLAGS) $(urldbtest_LDFLAGS)
-nsurl: $(addprefix ../,$(nsurl_SRCS))
- $(CC) $(CFLAGS) $(nsurl_CFLAGS) $^ -o $@ $(LDFLAGS) $(nsurl_LDFLAGS)
-nsoption: $(addprefix ../,$(nsoption_SRCS))
- $(CC) $(CFLAGS) $(nsoption_CFLAGS) $^ -o $@ $(LDFLAGS) $(nsoption_LDFLAGS)
+$(TESTROOT)/nsoption: $(addprefix ../,$(nsoption_SRCS))
+ $(CC) $(test_CFLAGS) $(nsoption_CFLAGS) $^ -o $@ $(test_LDFLAGS) $(nsoption_LDFLAGS)
-.PHONY: clean
+.PHONY: test-clean
-clean:
- $(RM) llcache urldbtest nsurl nsoption
+test-clean:
+ $(RM) $(addprefix $(TESTROOT)/,$(TESTS))
diff --git a/windows/file.h b/test/log.c
similarity index 53%
copy from windows/file.h
copy to test/log.c
index 5262dde..90b4379 100644
--- a/windows/file.h
+++ b/test/log.c
@@ -18,12 +18,37 @@
/**
* \file
- * Windows file operation table interface.
+ * Minimal unit test log implementation.
+ *
+ * It is necessary to have a logging implementation for the unit tests
+ * so other netsurf modules that assume this functionality work.
*/
-#ifndef _NETSURF_WINDOWS_FILE_H_
-#define _NETSURF_WINDOWS_FILE_H_
+#include <stdarg.h>
+#include <stdio.h>
+
+#include "utils/log.h"
+
+/** flag to enable verbose logging */
+bool verbose_log = false;
+
+nserror nslog_init(nslog_ensure_t *ensure, int *pargc, char **argv)
+{
+ return NSERROR_OK;
+}
+
+
+void nslog_log(const char *file, const char *func, int ln, const char *format, ...)
+{
+ va_list ap;
+
+ fprintf(stderr, "%s:%i %s: ", file, ln, func);
+
+ va_start(ap, format);
+
+ vfprintf(stderr, format, ap);
-struct gui_file_table *win32_file_table;
+ va_end(ap);
-#endif
+ fputc('\n', stderr);
+}
diff --git a/test/urldbtest.c b/test/urldbtest.c
index 4536ddd..f72d77f 100644
--- a/test/urldbtest.c
+++ b/test/urldbtest.c
@@ -46,7 +46,7 @@
#include "utils/utils.h"
int option_expire_url = 0;
-bool verbose_log = true;
+struct netsurf_table *guit = NULL;
static void netsurf_lwc_iterator(lwc_string *str, void *pw)
{
@@ -163,6 +163,8 @@ int main(void)
nsurl *urlr;
char *path_query;
+ verbose_log = true;
+
corestrings_init();
h = urldb_add_host("127.0.0.1");
--
NetSurf Browser