Skip to content

Commit

Permalink
Add valgrind tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Godbolt committed Jul 25, 2014
1 parent dd93351 commit 17f079a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*.swp
/.fig
/.tests-pass
/.tests-pass-valgrind
/Makefile
/autom4te.cache
/bin
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ install:
- if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.4" CC="clang-3.4"; fi
- wget "https://googlemock.googlecode.com/files/gmock-1.7.0.zip"
- unzip gmock-1.7.0.zip
- sudo apt-get install valgrind
script:
- autoconf
- ./configure --with-gmock=gmock-1.7.0
Expand Down
15 changes: 13 additions & 2 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ AR=ar
ARFLAGS=cru
CXX=@CXX@
CXXFLAGS=@CXXFLAGS@
VALGRIND=@VALGRIND@
LDFLAGS=@LDFLAGS@
# hack for drw gcc on ubuntu
GCC_MULTIARCH := $(shell gcc -print-multiarch 2>/dev/null)
Expand All @@ -21,7 +22,7 @@ VERSION_STRING:=SeaSocks/$(or $(VERSION),unversioned) ($(shell git describe --al

CXXFLAGS += -fPIC -Wall -Werror '-DSEASOCKS_VERSION_STRING="$(VERSION_STRING)"' -I$(C_SRC)

.PHONY: all clean run test spotless header-checks
.PHONY: all clean run test spotless header-checks valgrind-test

OBJ_DIR=obj
BIN_DIR=bin
Expand All @@ -33,7 +34,7 @@ APPS_CPP_SRCS=$(shell find $(APPS_SRC) -name '*.cpp')
TARGETS=$(patsubst $(APPS_SRC)/%.cpp,$(BIN_DIR)/%,$(APPS_CPP_SRCS))

apps: $(TARGETS)
all: apps $(BIN_DIR)/libseasocks.so $(BIN_DIR)/libseasocks.a test header-checks
all: apps $(BIN_DIR)/libseasocks.so $(BIN_DIR)/libseasocks.a test header-checks valgrind-test

debug:
echo $($(DEBUG_VAR))
Expand Down Expand Up @@ -119,11 +120,21 @@ $(BIN_DIR)/tests: $(TEST_OBJS) $(BIN_DIR)/libseasocks.a \

test: .tests-pass

ifneq ("@VALGRIND@", "")
valgrind-test: .tests-pass
$(VALGRIND) --leak-check=full --error-exitcode=2 -- $(BIN_DIR)/tests
else
valgrind-test:
@echo "Not running valgrind-test as no valgrind binary found during configure"
endif

else

test:
@echo "Not running tests as no gmock/gtest specified during configure"
@echo "To configure, specify with --with-gmock=PATH_TO_GMOCK"
test-valgrind: test

endif

clean:
Expand Down
2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ General list of things todo

* git grep 'TODO' and fix
* include what you use: lots of headers rely on ambient includes
* add more tests and have a run-under-valgrind target at least
* add more tests
* move more things over to the Request/Response way of doing things
* Double check it's ok to remove hixie, and do so. Currently no way of testing it anyway
(with reference to http://en.wikipedia.org/wiki/WebSocket#Browser_support it's been dead
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ AC_DEFUN([AX_CXX_CHECK_UNORDERED_MAP_EMPLACE], [
AC_SUBST(HAVE_UNORDERED_MAP_EMPLACE)
])
AX_CXX_CHECK_UNORDERED_MAP_EMPLACE
AC_PATH_PROG(VALGRIND, valgrind)

dnl Basic headers and features
AC_HEADER_STDBOOL
Expand Down

0 comments on commit 17f079a

Please sign in to comment.