summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Haberman <jhaberman@gmail.com>2015-01-09 19:13:29 -0800
committerJosh Haberman <jhaberman@gmail.com>2015-01-09 19:13:29 -0800
commitbebdc009b484295f06185b5bab884a3754bbbacd (patch)
tree36206ec73f7cf8cb0ac113dd476fd03f3dda8892
parentb55f32b278deddaf2c75d7d24b5722017850d6d1 (diff)
Coverage support for coveralls.io.
-rw-r--r--.travis.yml4
-rw-r--r--Makefile25
-rw-r--r--README.md1
-rwxr-xr-xtravis.sh21
-rw-r--r--upb/pb/compile_decoder_x64.c3
5 files changed, 40 insertions, 14 deletions
diff --git a/.travis.yml b/.travis.yml
index a65f56a..4407f5c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,8 +1,12 @@
+language: cpp
+compiler: gcc
install: ./travis.sh install
script: ./travis.sh script
+after_success: ./travis.sh after_success
env:
- UPB_TRAVIS_BUILD=bare
- UPB_TRAVIS_BUILD=barejit
- UPB_TRAVIS_BUILD=core32
- UPB_TRAVIS_BUILD=withprotobuf
- UPB_TRAVIS_BUILD=lua
+ - UPB_TRAVIS_BUILD=coverage
diff --git a/Makefile b/Makefile
index c456484..8af52d4 100644
--- a/Makefile
+++ b/Makefile
@@ -85,7 +85,7 @@ dep:
clean_leave_profile:
@rm -rf obj lib
- @rm -f tests/*.pb* tests/google_message?.h
+ @rm -f tests/google_message?.h
@rm -f $(TESTS) tests/testmain.o tests/t.*
@rm -f upb/descriptor.pb
@rm -rf tools/upbc deps
@@ -115,8 +115,8 @@ clean: clean_leave_profile
.SECONDEXPANSION:
to_srcs = $(subst .,_,$(1)_SRCS)
pc = %
-make_objs = $$(patsubst upb/$$(pc).c,obj/$$(pc).$(1),$$($$(call to_srcs,$$*)))
-make_objs_cc = $$(patsubst upb/$$(pc).cc,obj/$$(pc).$(1),$$($$(call to_srcs,$$*)))
+make_objs = $$(patsubst upb/$$(pc).c,obj/upb/$$(pc).$(1),$$($$(call to_srcs,$$*)))
+make_objs_cc = $$(patsubst upb/$$(pc).cc,obj/upb/$$(pc).$(1),$$($$(call to_srcs,$$*)))
# Core libraries (ie. not bindings). ###############################################################
@@ -146,8 +146,7 @@ upb_pb_SRCS = \
# If Lua is present we can use DynASM to regenerate the .h file.
ifdef USE_JIT
upb_pb_SRCS += upb/pb/compile_decoder_x64.c
-obj/pb/compile_decoder_x64.o obj/pb/compile_decoder_x64.lo: upb/pb/compile_decoder_x64.h
-obj/pb/compile_decoder_x64.o: CFLAGS=-std=gnu99
+obj/upb/pb/compile_decoder_x64.o obj/upb/pb/compile_decoder_x64.lo: upb/pb/compile_decoder_x64.h
upb/pb/compile_decoder_x64.h: upb/pb/compile_decoder_x64.dasc
$(E) DYNASM $<
@@ -168,11 +167,11 @@ ifeq (, $(findstring -O, $(USER_CPPFLAGS)))
OPT = -O3
lib/libupb.a : OPT = -Os
lib/libupb.descriptor.a : OPT = -Os
-obj/pb/compile_decoder.o : OPT = -Os
-obj/pb/compile_decoder_64.o : OPT = -Os
+obj/upb/pb/compile_decoder.o : OPT = -Os
+obj/upb/pb/compile_decoder_64.o : OPT = -Os
ifdef USE_JIT
-obj/pb/compile_decoder_x64.o: OPT=-Os
+obj/upb/pb/compile_decoder_x64.o: OPT=-Os
endif
endif
@@ -186,19 +185,19 @@ $(UPB_LIBS): lib/lib%.a: $(call make_objs,o)
$(Q) mkdir -p lib && ar rcs $@ $^
-obj/%.o: upb/%.c | $$(@D)/.
+obj/upb/%.o: upb/%.c | $$(@D)/.
$(E) CC $<
$(Q) $(CC) $(OPT) $(WARNFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
-obj/%.o: upb/%.cc | $$(@D)/.
+obj/upb/%.o: upb/%.cc | $$(@D)/.
$(E) CXX $<
$(Q) $(CXX) $(OPT) $(WARNFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
-obj/%.lo: upb/%.c | $$(@D)/.
+obj/upb/%.lo: upb/%.c | $$(@D)/.
$(E) 'CC -fPIC' $<
$(Q) $(CC) $(OPT) $(WARNFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< -fPIC
-obj/%.lo: upb/%.cc | $$(@D)/.
+obj/upb/%.lo: upb/%.cc | $$(@D)/.
$(E) CXX $<
$(Q) $(CXX) $(OPT) $(WARNFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< -fPIC
@@ -315,7 +314,7 @@ clean_googlepb:
googlepb: default $(GOOGLEPB_LIB)
googlepbtests: googlepb $(GOOGLEPB_TESTS)
-lib/libupb.bindings.googlepb.a: $(upb_bindings_googlepb_SRCS:upb/%.cc=obj/%.o)
+lib/libupb.bindings.googlepb.a: $(upb_bindings_googlepb_SRCS:upb/%.cc=obj/upb/%.o)
$(E) AR $@
$(Q) mkdir -p lib && ar rcs $@ $^
diff --git a/README.md b/README.md
index 953e4d3..98cd4ff 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,7 @@
# Unleaded - small, fast parsers for the 21st century
[![Build Status](https://travis-ci.org/haberman/upb.svg?branch=master)](https://travis-ci.org/haberman/upb)
+[![Coverage Status](https://img.shields.io/coveralls/haberman/upb.svg)](https://coveralls.io/r/haberman/upb?branch=master)
Unleaded is a library of fast parsers and serializers. These
parsers/serializers are written in C and use every available
diff --git a/travis.sh b/travis.sh
index b4c1afa..1cb6a04 100755
--- a/travis.sh
+++ b/travis.sh
@@ -49,7 +49,26 @@ lua_script() {
make -j12 testlua USER_CPPFLAGS=`pkg-config lua5.2 --cflags`
}
+# A run that executes with coverage support and uploads to coveralls.io
+coverage_install() {
+ sudo apt-get update -qq
+ sudo apt-get install protobuf-compiler libprotobuf-dev lua5.2 liblua5.2-dev
+ sudo pip install cpp-coveralls
+}
+coverage_script() {
+ make -j12 tests googlepbtests testlua WITH_JIT=yes \
+ USER_CPPFLAGS="--coverage `pkg-config lua5.2 --cflags`"
+ make test
+}
+coverage_after_success() {
+ coveralls --exclude dynasm --exclude tests --exclude upb/bindings/linux --gcov-options '\-lp'
+}
+
+if [ "$1" == "after_success" ] && [ "$UPB_TRAVIS_BUILD" != "coverage" ]; then
+ # after_success is only used for coverage.
+ exit
+fi
+
set -e
set -x
eval ${UPB_TRAVIS_BUILD}_${1}
-
diff --git a/upb/pb/compile_decoder_x64.c b/upb/pb/compile_decoder_x64.c
index b4086c7..a0cb3c9 100644
--- a/upb/pb/compile_decoder_x64.c
+++ b/upb/pb/compile_decoder_x64.c
@@ -7,6 +7,9 @@
* Driver code for the x64 JIT compiler.
*/
+// Needed to ensure we get defines like MAP_ANON.
+#define _GNU_SOURCE
+
#include <dlfcn.h>
#include <stdio.h>
#include <sys/mman.h>
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback