Coverage support for coveralls.io.

pull/13171/head
Josh Haberman 10 years ago
parent b55f32b278
commit bebdc009b4
  1. 4
      .travis.yml
  2. 25
      Makefile
  3. 1
      README.md
  4. 21
      travis.sh
  5. 3
      upb/pb/compile_decoder_x64.c

@ -1,8 +1,12 @@
language: cpp
compiler: gcc
install: ./travis.sh install install: ./travis.sh install
script: ./travis.sh script script: ./travis.sh script
after_success: ./travis.sh after_success
env: env:
- UPB_TRAVIS_BUILD=bare - UPB_TRAVIS_BUILD=bare
- UPB_TRAVIS_BUILD=barejit - UPB_TRAVIS_BUILD=barejit
- UPB_TRAVIS_BUILD=core32 - UPB_TRAVIS_BUILD=core32
- UPB_TRAVIS_BUILD=withprotobuf - UPB_TRAVIS_BUILD=withprotobuf
- UPB_TRAVIS_BUILD=lua - UPB_TRAVIS_BUILD=lua
- UPB_TRAVIS_BUILD=coverage

@ -85,7 +85,7 @@ dep:
clean_leave_profile: clean_leave_profile:
@rm -rf obj lib @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 $(TESTS) tests/testmain.o tests/t.*
@rm -f upb/descriptor.pb @rm -f upb/descriptor.pb
@rm -rf tools/upbc deps @rm -rf tools/upbc deps
@ -115,8 +115,8 @@ clean: clean_leave_profile
.SECONDEXPANSION: .SECONDEXPANSION:
to_srcs = $(subst .,_,$(1)_SRCS) to_srcs = $(subst .,_,$(1)_SRCS)
pc = % pc = %
make_objs = $$(patsubst upb/$$(pc).c,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/$$(pc).$(1),$$($$(call to_srcs,$$*))) make_objs_cc = $$(patsubst upb/$$(pc).cc,obj/upb/$$(pc).$(1),$$($$(call to_srcs,$$*)))
# Core libraries (ie. not bindings). ############################################################### # 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. # If Lua is present we can use DynASM to regenerate the .h file.
ifdef USE_JIT ifdef USE_JIT
upb_pb_SRCS += upb/pb/compile_decoder_x64.c 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/upb/pb/compile_decoder_x64.o obj/upb/pb/compile_decoder_x64.lo: upb/pb/compile_decoder_x64.h
obj/pb/compile_decoder_x64.o: CFLAGS=-std=gnu99
upb/pb/compile_decoder_x64.h: upb/pb/compile_decoder_x64.dasc upb/pb/compile_decoder_x64.h: upb/pb/compile_decoder_x64.dasc
$(E) DYNASM $< $(E) DYNASM $<
@ -168,11 +167,11 @@ ifeq (, $(findstring -O, $(USER_CPPFLAGS)))
OPT = -O3 OPT = -O3
lib/libupb.a : OPT = -Os lib/libupb.a : OPT = -Os
lib/libupb.descriptor.a : OPT = -Os lib/libupb.descriptor.a : OPT = -Os
obj/pb/compile_decoder.o : OPT = -Os obj/upb/pb/compile_decoder.o : OPT = -Os
obj/pb/compile_decoder_64.o : OPT = -Os obj/upb/pb/compile_decoder_64.o : OPT = -Os
ifdef USE_JIT ifdef USE_JIT
obj/pb/compile_decoder_x64.o: OPT=-Os obj/upb/pb/compile_decoder_x64.o: OPT=-Os
endif endif
endif endif
@ -186,19 +185,19 @@ $(UPB_LIBS): lib/lib%.a: $(call make_objs,o)
$(Q) mkdir -p lib && ar rcs $@ $^ $(Q) mkdir -p lib && ar rcs $@ $^
obj/%.o: upb/%.c | $$(@D)/. obj/upb/%.o: upb/%.c | $$(@D)/.
$(E) CC $< $(E) CC $<
$(Q) $(CC) $(OPT) $(WARNFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< $(Q) $(CC) $(OPT) $(WARNFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
obj/%.o: upb/%.cc | $$(@D)/. obj/upb/%.o: upb/%.cc | $$(@D)/.
$(E) CXX $< $(E) CXX $<
$(Q) $(CXX) $(OPT) $(WARNFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< $(Q) $(CXX) $(OPT) $(WARNFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
obj/%.lo: upb/%.c | $$(@D)/. obj/upb/%.lo: upb/%.c | $$(@D)/.
$(E) 'CC -fPIC' $< $(E) 'CC -fPIC' $<
$(Q) $(CC) $(OPT) $(WARNFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< -fPIC $(Q) $(CC) $(OPT) $(WARNFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< -fPIC
obj/%.lo: upb/%.cc | $$(@D)/. obj/upb/%.lo: upb/%.cc | $$(@D)/.
$(E) CXX $< $(E) CXX $<
$(Q) $(CXX) $(OPT) $(WARNFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< -fPIC $(Q) $(CXX) $(OPT) $(WARNFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< -fPIC
@ -315,7 +314,7 @@ clean_googlepb:
googlepb: default $(GOOGLEPB_LIB) googlepb: default $(GOOGLEPB_LIB)
googlepbtests: googlepb $(GOOGLEPB_TESTS) 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 $@ $(E) AR $@
$(Q) mkdir -p lib && ar rcs $@ $^ $(Q) mkdir -p lib && ar rcs $@ $^

@ -2,6 +2,7 @@
# Unleaded - small, fast parsers for the 21st century # 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) [![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 Unleaded is a library of fast parsers and serializers. These
parsers/serializers are written in C and use every available parsers/serializers are written in C and use every available

@ -49,7 +49,26 @@ lua_script() {
make -j12 testlua USER_CPPFLAGS=`pkg-config lua5.2 --cflags` 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 -e
set -x set -x
eval ${UPB_TRAVIS_BUILD}_${1} eval ${UPB_TRAVIS_BUILD}_${1}

@ -7,6 +7,9 @@
* Driver code for the x64 JIT compiler. * Driver code for the x64 JIT compiler.
*/ */
// Needed to ensure we get defines like MAP_ANON.
#define _GNU_SOURCE
#include <dlfcn.h> #include <dlfcn.h>
#include <stdio.h> #include <stdio.h>
#include <sys/mman.h> #include <sys/mman.h>

Loading…
Cancel
Save