Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/e499f5c08f27b0fa738f784dbb91d8fc28d8ca01
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/e499f5c08f27b0fa738f784dbb91d8fc28d8ca01
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/e499f5c08f27b0fa738f784dbb91d8fc28d8ca01

The branch, master has been updated
       via  e499f5c08f27b0fa738f784dbb91d8fc28d8ca01 (commit)
      from  4e750bdab60ab5007a108a6c99de321e21bcf4ce (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 -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 test/Makefile                             |   29 +++++++++++++++++++++++++----
 frontends/windows/file.h => test/assert.c |   26 ++++++++++++++++++++------
 2 files changed, 45 insertions(+), 10 deletions(-)
 copy frontends/windows/file.h => test/assert.c (53%)

diff --git a/test/Makefile b/test/Makefile
index 833e7d6..39953a3 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -81,10 +81,19 @@ ifeq ($(MAKECMDGOALS),coverage)
   COV_CXXFLAGS ?= -fprofile-arcs -ftest-coverage -O0
   COV_LDFLAGS ?= -lgcov -fprofile-arcs
   TESTROOT := $(COV_ROOT)
+  ifeq ($(NOASSERTCOVERAGE),yes)
+    NOCOV_TESTSOURCES ?=
+    COV_CPPFLAGS ?=
+  else
+    NOCOV_TESTSOURCES ?= test/assert.c
+    COV_CPPFLAGS ?= -D__assert_fail=__ns_assert_fail
+  endif
 else
   COV_CFLAGS ?= -O0
   COV_CXXFLAGS ?= -O0
+  COV_CPPFLAGS ?=
   TESTROOT := build/$(HOST)-test
+  NOCOV_TESTSOURCES ?=
 endif
 
 
@@ -123,7 +132,7 @@ ifneq ($(CC_MAJOR),2)
   COMMON_WARNFLAGS += -Wno-unused-parameter
 endif
 
-TESTCFLAGS := -std=c99 -g \
+BASE_TESTCFLAGS := -std=c99 -g \
        $(COMMON_WARNFLAGS) \
        -D_BSD_SOURCE \
        -D_POSIX_C_SOURCE=200809L \
@@ -131,8 +140,10 @@ TESTCFLAGS := -std=c99 -g \
        -Itest -Iinclude -Icontent/handlers -Ifrontends -I. -I.. \
        -Dnsgtk \
        $(shell pkg-config --cflags libcurl libparserutils libwapcaplet libdom 
libnsutils libutf8proc) \
-       $(LIB_CFLAGS) \
-       $(COV_CFLAGS)
+       $(LIB_CFLAGS)
+TESTCFLAGS := $(BASE_TESTCFLAGS) \
+       $(COV_CFLAGS) \
+       $(COV_CPPFLAGS)
 
 TESTLDFLAGS := -L$(TESTROOT) \
        $(shell pkg-config --libs libcurl libparserutils libwapcaplet libdom 
libnsutils libutf8proc) -lz \
@@ -149,7 +160,7 @@ TESTSOURCES :=
 GCOV ?= gcov
 
 define gen_test_target
-$$(TESTROOT)/$(1): $$(sort $$(addprefix $$(TESTROOT)/,$$(subst /,_,$$(patsubst 
%.c,%.o,$$(patsubst %.cpp,%.o,$$(patsubst %.m,%.o,$$(patsubst 
%.s,%.o,$$($(1)_SRCS))))))))
+$$(TESTROOT)/$(1): $$(sort $$(addprefix $$(TESTROOT)/,$$(subst /,_,$$(patsubst 
%.c,%.o,$$(patsubst %.cpp,%.o,$$(patsubst %.m,%.o,$$(patsubst 
%.s,%.o,$$($(1)_SRCS) $$(NOCOV_TESTSOURCES))))))))
        $$(VQ)echo "LINKTEST: $$@"
        $$(Q)$$(CC) $$(TESTCFLAGS) $$^ -o $$@ $$($(1)_LD) $$(TESTLDFLAGS)
 
@@ -171,12 +182,22 @@ $$(TESTROOT)/$(2): $(1) $$(TESTROOT)/created
 
 endef
 
+define compile_test_nocov_target_c
+$$(TESTROOT)/$(2): $(1) $$(TESTROOT)/created
+       $$(VQ)echo " COMPILE: $(1) (No coverage)"
+       $$(Q)$$(RM) $$(TESTROOT)/$(2)
+       $$(Q)$$(CC) $$(BASE_TESTCFLAGS) -o $$(TESTROOT)/$(2) -c $(1)
+
+endef
+
 # Generate target for each test program and the list of objects it needs
 $(eval $(foreach TST,$(TESTS), $(call gen_test_target,$(TST))))
 
 # generate target rules for test objects
 $(eval $(foreach SOURCE,$(sort $(filter %.c,$(TESTSOURCES))), \
        $(call compile_test_target_c,$(SOURCE),$(subst 
/,_,$(SOURCE:.c=.o)),$(subst /,_,$(SOURCE:.c=.d)))))
+$(eval $(foreach SOURCE,$(sort $(filter %.c,$(NOCOV_TESTSOURCES))), \
+       $(call compile_test_nocov_target_c,$(SOURCE),$(subst 
/,_,$(SOURCE:.c=.o)),$(subst /,_,$(SOURCE:.c=.d)))))
 
 
 .PHONY:test coverage
diff --git a/frontends/windows/file.h b/test/assert.c
similarity index 53%
copy from frontends/windows/file.h
copy to test/assert.c
index 5262dde..d21926e 100644
--- a/frontends/windows/file.h
+++ b/test/assert.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2015 Vincent Sanders <[email protected]>
+ * Copyright 2017 Daniel Silverstone <[email protected]>
  *
  * This file is part of NetSurf, http://www.netsurf-browser.org/
  *
@@ -18,12 +18,26 @@
 
 /**
  * \file
- * Windows file operation table interface.
+ * Hack for assertion coverage output
  */
 
-#ifndef _NETSURF_WINDOWS_FILE_H_
-#define _NETSURF_WINDOWS_FILE_H_
+/* Bring in the real __assert_fail */
+#include <assert.h>
 
-struct gui_file_table *win32_file_table;
+/* This is what everyone else calls */
+extern void
+__ns_assert_fail(const char *__assertion, const char *__file,
+                unsigned int __line, const char *__function)
+       __THROW __attribute__ ((__noreturn__));
 
-#endif 
+/* We use this to flush coverage data */
+extern void __gcov_flush(void);
+
+/* And here's our entry point */
+void
+__ns_assert_fail(const char *__assertion, const char *__file,
+                unsigned int __line, const char *__function)
+{
+       __gcov_flush();
+       __assert_fail(__assertion, __file, __line, __function);
+}


-- 
NetSurf Browser

_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to