Enabled asserts() and verbosity for most Travis builds.

Also added a separate ndebug build for testing that
-DNDEBUG builds still work.

Also disabled reference debugging by default, since it
requires either a global lock or -DUPB_THREAD_UNSAFE.
pull/13171/head
Josh Haberman 10 years ago
parent 93791bfe65
commit e087947c84
  1. 1
      .travis.yml
  2. 4
      Makefile
  3. 22
      travis.sh
  4. 2
      upb/pb/decoder.c
  5. 6
      upb/refcounted.h

@ -11,5 +11,6 @@ env:
- UPB_TRAVIS_BUILD=core32
- UPB_TRAVIS_BUILD=withprotobuf
- UPB_TRAVIS_BUILD=lua
- UPB_TRAVIS_BUILD=ndebug
- UPB_TRAVIS_BUILD=coverage
- UPB_TRAVIS_BUILD=genfiles

@ -33,7 +33,7 @@ all: lib tests tools/upbc lua python
testall: test pythontest
# Set this to have user-specific flags (especially things like -O0 and -g).
USER_CPPFLAGS=
USER_CPPFLAGS?=
# Build with "make WITH_JIT=yes" (or anything besides "no") to enable the JIT.
WITH_JIT=no
@ -72,7 +72,7 @@ ifneq ($(UPB_FAIL_WARNINGS), no)
endif
# Build with "make Q=" to see all commands that are being executed.
Q=@
Q?=@
# Function to expand a wildcard pattern recursively.
rwildcard=$(strip $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2)$(filter $(subst *,%,$2),$d)))

@ -74,6 +74,18 @@ genfiles_script() {
git diff --exit-code
}
# Tests the ndebug build.
ndebug_install() {
sudo apt-get update -qq
sudo apt-get install lua5.2 liblua5.2-dev protobuf-compiler libprotobuf-dev
}
ndebug_script() {
# Override of USER_CPPFLAGS removes -UNDEBUG.
export USER_CPPFLAGS="`pkg-config lua5.2 --cflags` -g -fomit-frame-pointer"
make -j12 tests googlepbtests testlua WITH_JIT=yes
make test
}
# A run that executes with coverage support and uploads to coveralls.io
coverage_install() {
sudo apt-get update -qq
@ -81,8 +93,8 @@ coverage_install() {
sudo pip install cpp-coveralls
}
coverage_script() {
make -j12 tests googlepbtests testlua WITH_JIT=yes \
USER_CPPFLAGS="--coverage -O0 `pkg-config lua5.2 --cflags`"
export USER_CPPFLAGS="--coverage -O0 `pkg-config lua5.2 --cflags`"
make -j12 tests googlepbtests testlua WITH_JIT=yes
make test
}
coverage_after_success() {
@ -99,6 +111,12 @@ if [ "$CC" != "gcc" ] && [ "$UPB_TRAVIS_BUILD" == "coverage" ]; then
exit
fi
# Enable asserts and ref debugging (though some configurations override this).
export USER_CPPFLAGS="-UNDEBUG -DUPB_DEBUG_REFS -DUPB_THREAD_UNSAFE -g"
# Enable verbose build.
export Q=
set -e
set -x

@ -874,7 +874,7 @@ bool upb_pbdecoder_end(void *closure, const void *handler_data) {
assert(getop(*d->pc) == OP_TAG1 ||
getop(*d->pc) == OP_TAG2 ||
getop(*d->pc) == OP_TAGN ||
getop(*d->pc == OP_DISPATCH));
getop(*d->pc) == OP_DISPATCH);
d->pc = p;
}
upb_pbdecoder_decode(closure, handler_data, &dummy, 0, NULL);

@ -28,9 +28,9 @@
//
// Enabling this requires the application to define upb_lock()/upb_unlock()
// functions that acquire/release a global mutex (or #define UPB_THREAD_UNSAFE).
#ifndef NDEBUG
#define UPB_DEBUG_REFS
#endif
// For this reason we don't enable it by default, even in debug builds.
// #define UPB_DEBUG_REFS
#ifdef __cplusplus
namespace upb { class RefCounted; }

Loading…
Cancel
Save