Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
0b5d4c5
incrementing version number
mkind Oct 6, 2016
2d6fa5d
Add memdup functions to util module
Oct 21, 2016
e9077a3
Replace message serialize/deserialize and pack/unpack
Oct 21, 2016
71d87f0
Major api function simplification using the new helper modules
Oct 21, 2016
277b931
Include missing NULL checks
Oct 21, 2016
fb6b70a
Remove tests from old module and adapt tests to new helper modules
Oct 21, 2016
3491fb8
Refactor rpc modules and add support for subscribe/unsubscribe/broadcast
Oct 21, 2016
4e037f1
Update CMakeLists.txt
Oct 21, 2016
7d4f4af
Add functional tests for subscribe and unsubscribe
Oct 22, 2016
1ecdc38
Revert "Add functional tests for subscribe and unsubscribe"
Oct 22, 2016
c6fa3f0
Add functional tests for subscribe/unsubscribe
Oct 22, 2016
6d523a5
Add functional test for broadcast API call
Oct 22, 2016
1b9072b
Make request event handler more generic
Oct 22, 2016
98ac220
Add more functional tests of broadcast API call
Oct 22, 2016
1841e22
Add functional tests for new helper modules.
Oct 23, 2016
bd48781
Add additional tests to msgpack helper functional test
Oct 23, 2016
8b6489d
Pre-increment msgid before sending packet
Oct 31, 2016
dce4b8f
Fix overwriting connection in hashmap
Nov 8, 2016
bf434e4
Include msgpack/libuv static cmake build scripts from neovim
Nov 14, 2016
be624ab
Switch to multiqueue neovim implementation and refactor uv loop handling
Nov 14, 2016
c0b30be
Gardening with include what you use
Nov 14, 2016
effa41f
Fix bug which produced wrong responses
Nov 14, 2016
3b2a18f
Add missing header files
Nov 14, 2016
123465b
Try to make travis happy and downgrade msgpack from 2.0.0 to 1.4.2
Nov 14, 2016
f66c4df
Remove unused unit tests
Nov 14, 2016
b1c2e22
Revert "Try to make travis happy and downgrade msgpack from 2.0.0 to …
Nov 14, 2016
d403633
Try to make travis happy and downgrade msgpack version from 2.0.0 to
Nov 14, 2016
cebf5ed
Update travis config to new output dir structure
Nov 14, 2016
d037c41
Fix some gcc wshadow warnings
Nov 15, 2016
ae17d1a
Add python 3 to travis yml
Nov 15, 2016
66b9fb9
Add travis before install script to update python pip
Nov 15, 2016
3b4a74d
Fix git permission for travis before install script
Nov 15, 2016
7bd1823
Rearange travis before install dependencies
Nov 15, 2016
26950ae
Fix git permissions for travis install script
Nov 15, 2016
08f4c7f
Try to fix travis cmocka install failure
Nov 15, 2016
874f159
Try to fix gcov cmake flag usage
Nov 15, 2016
86cfa48
The check is not needed since the pointer is valid by definition. This
mkind Nov 16, 2016
1e6ebf9
adding sb assertions to api-calls
mkind Nov 17, 2016
292f20f
moving declaration at top of function
mkind Nov 17, 2016
65be7cf
increasing version number to 0.1.7
mkind Nov 17, 2016
ae76b7b
Merge branch 'master' into 2016-10-stze-issue-60
mkind Nov 17, 2016
addaa25
Merge branch '2016-10-stze-issue-60' of github.com:splone/splonebox-c…
mkind Nov 17, 2016
49a0ea9
Merge branch '2016-10-stze-issue-60'
mkind Nov 17, 2016
2681567
introducing memory functions that abort program on failure
mkind Nov 26, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci/after_success.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ set -e
set -o pipefail

if [[ -n "${GCOV}" ]]; then
coveralls -e test -e out/CMakeFiles/CompilerIdC/CMakeCCompilerId.c -e out/CMakeFiles/CompilerIdCXX/CMakeCXXCompilerId.cpp --gcov "$(which "${GCOV}")" --encoding iso-8859-1 -b out || echo 'coveralls upload failed.'
coveralls -e test -e build/CMakeFiles/CompilerIdC/CMakeCCompilerId.c -e build/CMakeFiles/CompilerIdCXX/CMakeCXXCompilerId.cpp --gcov "$(which "${GCOV}")" --encoding iso-8859-1 -b build || echo 'coveralls upload failed.'
fi
28 changes: 28 additions & 0 deletions .ci/before_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

set -e
set -o pipefail

if [[ -n "${CI_TARGET}" ]]; then
exit
fi

if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
brew update
fi

echo "Upgrade Python 2's pip."
pip2.7 -q install --user --upgrade pip

if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
echo "Install Python 3."
brew install python3
echo "Upgrade Python 3's pip."
pip3 -q install --user --upgrade pip
else
# TODO: Replace with upgrade when Travis gets python3-pip package.
echo "Install pip for Python 3."
curl -sSL https://bootstrap.pypa.io/get-pip.py -o "${HOME}/get-pip.py"
# After this, pip in PATH will refer to Python 3's pip.
python3.3 "${HOME}/get-pip.py" --user --upgrade
fi
17 changes: 17 additions & 0 deletions .ci/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

set -e
set -o pipefail

if [[ -n "${CI_TARGET}" ]]; then
exit
fi

if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
brew install gettext
brew reinstall -s libtool
fi

# Use default CC to avoid compilation problems when installing Python modules.
echo "Install coveralls for Python 2."
CC=cc pip2.7 -q install --user --upgrade cpp-coveralls
18 changes: 6 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ matrix:
env: EXTRA_FLAGS="-DCLANG_ADDRESS_SANITIZER=ON"
- os: linux
compiler: gcc-5
env: GCOV=gcov-5 EXTRA_FLAGS="-DUSE_COVERAGE=ON"
env: GCOV=gcov-5 CMAKE_FLAGS="-DUSE_COVERAGE=ON"

before_install:
# cmocka
Expand All @@ -17,16 +17,9 @@ before_install:
- cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr .. && make -j2 && sudo make install
- cd ../..
- rm -rf cmocka-1.0.1
# libuv
- curl -L https://github.com/libuv/libuv/archive/v1.8.0.tar.gz | tar xzf -
- (cd libuv-1.8.0 && ./autogen.sh && ./configure --prefix=/usr && make && sudo make install)
- rm -rf libuv-1.8.0
# msgpack-c
- curl -L https://github.com/msgpack/msgpack-c/archive/cpp-1.4.1.tar.gz | tar xzf -
- (cd msgpack-c-cpp-1.4.1 && ./bootstrap && ./configure --prefix=/usr && make && sudo make install)
- rm -rf msgpack-c-cpp-1.4.1
# coveralls
- pip install --user cpp-coveralls
- .ci/before_install.sh

install: .ci/install.sh

addons:
apt:
Expand All @@ -49,9 +42,10 @@ addons:
- llvm-3.4-dev
- ninja-build
- pkg-config
- python3.3-dev
- libbsd-dev
- libhiredis-dev

before_script: redis-server redis-test.conf
script: make sb && make test && make sb-makekey && ./out/bin/sb-makekey && ./out/bin/sb-test
script: make sb && make test && make sb-makekey && ./build/bin/sb-makekey && ./build/bin/sb-test
after_success: .ci/after_success.sh
80 changes: 49 additions & 31 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ option(CLANG_MEMORY_SANITIZER "Enable clang memory sanitizer." OFF)
option(CLANG_THREAD_SANITIZER "Enable clang thread sanitizer." OFF)
option(CLANG_ANALYZER "Enable clang static analyzer." OFF)

# Prefer our bundled versions of dependencies.
set(DEPS_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/.deps/usr" CACHE PATH "Path prefix for finding dependencies")
if(CMAKE_CROSSCOMPILING AND NOT UNIX)
list(INSERT CMAKE_FIND_ROOT_PATH 0 ${DEPS_PREFIX})
list(INSERT CMAKE_PREFIX_PATH 0 ${DEPS_PREFIX}/../host/bin)
else()
list(INSERT CMAKE_PREFIX_PATH 0 ${DEPS_PREFIX})
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${DEPS_PREFIX}/lib/pkgconfig")
endif()

list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")

if(NOT CMAKE_BUILD_TYPE)
Expand Down Expand Up @@ -97,8 +107,10 @@ file(GLOB MANPAGES
# splonebox target sources
set(SPLONEBOX-SOURCES
src/main.c
src/main.h
src/sb-common.h
src/khash.h
src/klist.h
src/kvec.h
src/queue.h
src/string.c
Expand All @@ -123,13 +135,21 @@ set(SPLONEBOX-SOURCES
src/address.c
src/address.h
src/sbmemzero.c
src/mem.c
src/mem.h
src/api/sb-api.h
src/api/register.c
src/api/result.c
src/api/run.c
src/api/broadcast.c
src/api/subscribe.c
src/api/unsubscribe.c
src/api/helpers.c
src/api/helpers.h
src/rpc/sb-rpc.h
src/rpc/connection/event.c
src/rpc/connection/event.h
src/rpc/connection/event-defs.h
src/rpc/connection/streamhandle.c
src/rpc/connection/streamhandle.h
src/rpc/connection/inputstream.c
Expand All @@ -144,10 +164,9 @@ set(SPLONEBOX-SOURCES
src/rpc/connection/crypto.c
src/rpc/connection/crypto.h
src/rpc/connection/loop.c
src/rpc/msgpack/sb-msgpack-rpc.h
src/rpc/msgpack/message.c
src/rpc/msgpack/pack.c
src/rpc/msgpack/unpack.c
src/rpc/connection/loop.h
src/rpc/msgpack/helpers.c
src/rpc/msgpack/helpers.h
src/rpc/db/sb-db.h
src/rpc/db/connect.c
src/rpc/db/plugin.c
Expand All @@ -159,6 +178,8 @@ set(SPLONEBOX-SOURCES
set(SB-PLUGINKEY-SOURCES
src/sb-pluginkey.c
src/sb-common.h
src/mem.c
src/mem.h
src/rpc/sb-rpc.h
src/util.c
src/confparse.c
Expand All @@ -170,6 +191,8 @@ set(SB-PLUGINKEY-SOURCES
# sb-makekey target sources
set(SB-MAKEKEY-SOURCES
src/sb-common.h
src/mem.c
src/mem.h
src/reallocarray.c
src/tweetnacl.c
src/tweetnacl.h
Expand All @@ -180,8 +203,10 @@ set(SB-MAKEKEY-SOURCES

# splonebox test(s) sources
set(TEST-SOURCES
src/main.h
src/sb-common.h
src/khash.h
src/klist.h
src/queue.h
src/string.c
src/reallocarray.c
Expand All @@ -202,16 +227,24 @@ set(TEST-SOURCES
src/parse.h
src/util.c
src/util.h
src/mem.c
src/mem.h
src/address.c
src/address.h
src/sbmemzero.c
src/api/sb-api.h
src/api/register.c
src/api/run.c
src/api/result.c
src/api/broadcast.c
src/api/subscribe.c
src/api/unsubscribe.c
src/api/helpers.c
src/api/helpers.h
src/rpc/sb-rpc.h
src/rpc/connection/event.c
src/rpc/connection/event.h
src/rpc/connection/event-defs.h
src/rpc/connection/streamhandle.c
src/rpc/connection/streamhandle.h
src/rpc/connection/inputstream.c
Expand All @@ -226,10 +259,9 @@ set(TEST-SOURCES
src/rpc/connection/crypto.c
src/rpc/connection/crypto.h
src/rpc/connection/loop.c
src/rpc/msgpack/sb-msgpack-rpc.h
src/rpc/msgpack/message.c
src/rpc/msgpack/pack.c
src/rpc/msgpack/unpack.c
src/rpc/connection/loop.h
src/rpc/msgpack/helpers.c
src/rpc/msgpack/helpers.h
src/rpc/db/sb-db.h
src/rpc/db/connect.c
src/rpc/db/plugin.c
Expand All @@ -245,28 +277,7 @@ set(TEST-SOURCES
test/helper-validate.h
test/unit/server-start.c
test/unit/server-stop.c
test/unit/pack-string.c
test/unit/pack-int.c
test/unit/pack-uint.c
test/unit/pack-array.c
test/unit/pack-nil.c
test/unit/pack-float.c
test/unit/pack-bool.c
test/unit/regression-issue-60.c
test/unit/unpack-string.c
test/unit/unpack-uint.c
test/unit/unpack-array.c
test/unit/dispatch-table-get.c
test/unit/event-queue-put.c
test/unit/event-queue-get.c
test/unit/message-deserialize-request.c
test/unit/message-deserialize-response.c
test/unit/message-deserialize-error-response.c
test/unit/message-serialize-request.c
test/unit/message-serialize-response.c
test/unit/message-serialize-error-response.c
test/unit/message-is-request.c
test/unit/message-is-response.c
test/functional/db-connect.c
test/functional/db-plugin-add.c
test/functional/db-pluginkey-verify.c
Expand All @@ -278,9 +289,12 @@ set(TEST-SOURCES
test/functional/dispatch-handle-register.c
test/functional/dispatch-handle-run.c
test/functional/dispatch-handle-result.c
test/functional/dispatch-handle-subscribe.c
test/functional/dispatch-handle-broadcast.c
test/functional/crypto.c
test/functional/confparse.c
test/functional/db-whitelist.c
test/functional/msgpack-rpc-helper.c
)

if(CLANG_ADDRESS_SANITIZER OR CLANG_MEMORY_SANITIZER OR CLANG_TSAN)
Expand All @@ -289,7 +303,11 @@ endif()

include_directories(${PROJECT_SOURCE_DIR}/src)
include_directories(${PROJECT_SOURCE_DIR}/test)
include_directories(${BSD_INCLUDE_DIRS} ${LIBUV_INCLUDE_DIRS} ${MSGPACK_INCLUDE_DIRS} ${HIREDIS_INCLUDE_DIRS} ${CMOCKA_INCLUDE_DIRS})
include_directories(SYSTEM ${BSD_INCLUDE_DIRS})
include_directories(SYSTEM ${LIBUV_INCLUDE_DIRS})
include_directories(SYSTEM ${MSGPACK_INCLUDE_DIRS})
include_directories(SYSTEM ${HIREDIS_INCLUDE_DIRS})
include_directories(SYSTEM ${CMOCKA_INCLUDE_DIRS})

# sb target
add_executable(sb ${SPLONEBOX-SOURCES})
Expand All @@ -311,7 +329,7 @@ add_executable(sb-test ${TEST-SOURCES})
add_executable(sb-pluginkey ${SB-PLUGINKEY-SOURCES})

# wrap some functions for testing
set_property(TARGET sb-test APPEND_STRING PROPERTY LINK_FLAGS "-Wl,--wrap=outputstream_write,--wrap=loop_wait_for_response,--wrap=crypto_write ")
set_property(TARGET sb-test APPEND_STRING PROPERTY LINK_FLAGS "-Wl,--wrap=outputstream_write,--wrap=loop_process_events_until,--wrap=crypto_write ")
set_property(TARGET sb-test APPEND_STRING PROPERTY COMPILE_FLAGS "-DBOX_UNIT_TESTS ")

target_link_libraries(sb-test
Expand Down
64 changes: 44 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BUILD_DIR := out
CMAKE_BUILD_TYPE ?= Debug
FLAGS := -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE)
CMAKE_FLAGS := -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE)
EXTRA_FLAGS ?=

BUILD_TYPE ?= $(shell (type ninja > /dev/null 2>&1 && echo "Ninja") || echo "Unix Makefiles")
Expand All @@ -26,35 +26,59 @@ endif

BUILD_CMD = $(BUILD_TOOL) $(VERBOSE_FLAG)

# Extra CMake flags which extend the default set
CMAKE_EXTRA_FLAGS ?=
USE_BUNDLED_DEPS ?=
DEPS_CMAKE_FLAGS ?=

ifneq (,$(USE_BUNDLED_DEPS))
BUNDLED_CMAKE_FLAG := -DUSE_BUNDLED=$(USE_BUNDLED_DEPS)
endif

all: sb test sb-makekey sb-pluginkey

sb:
test -d $(BUILD_DIR) || mkdir $(BUILD_DIR)
cd out && cmake -G '$(BUILD_TYPE)' $(FLAGS) $(EXTRA_FLAGS) ..
$(BUILD_CMD) -C out sb
sb: build/.ran-cmake deps
+$(BUILD_CMD) -C build sb

cmake:
touch CMakeLists.txt
$(MAKE) build/.ran-cmake

build/.ran-cmake: | deps
cd build && cmake -G '$(BUILD_TYPE)' $(CMAKE_FLAGS) $(CMAKE_EXTRA_FLAGS) ..
touch $@

deps: | build/.ran-third-party-cmake
ifeq ($(call filter-true,$(USE_BUNDLED_DEPS)),)
+$(BUILD_CMD) -C .deps
endif

build/.ran-third-party-cmake:
ifeq ($(call filter-true,$(USE_BUNDLED_DEPS)),)
mkdir -p .deps
cd .deps && \
cmake -G '$(BUILD_TYPE)' $(BUNDLED_CMAKE_FLAG) $(BUNDLED_LUA_CMAKE_FLAG) \
$(DEPS_CMAKE_FLAGS) ../third-party
endif
mkdir -p build
touch $@

test:
test -d $(BUILD_DIR) || mkdir $(BUILD_DIR)
cd out && cmake -G '$(BUILD_TYPE)' $(FLAGS) $(EXTRA_FLAGS) ..
$(BUILD_CMD) -C out sb-test
test: build/.ran-cmake deps
+$(BUILD_CMD) -C build sb-test

sb-makekey:
test -d $(BUILD_DIR) || mkdir $(BUILD_DIR)
cd out && cmake -G '$(BUILD_TYPE)' $(FLAGS) $(EXTRA_FLAGS) ..
$(BUILD_CMD) -C out sb-makekey
sb-makekey: build/.ran-cmake deps
+$(BUILD_CMD) -C build sb-makekey

sb-pluginkey:
test -d $(BUILD_DIR) || mkdir $(BUILD_DIR)
cd out && cmake -G '$(BUILD_TYPE)' $(FLAGS) $(EXTRA_FLAGS) ..
$(BUILD_CMD) -C out sb-pluginkey
sb-pluginkey: build/.ran-cmake deps
+$(BUILD_CMD) -C build sb-pluginkey

clean:
+test -d out && $(BUILD_CMD) -C out clean || true
+test -d build && $(BUILD_CMD) -C build clean || true

distclean: clean
rm -rf out
rm -rf .deps build

install: | sb
+$(BUILD_CMD) -C out install

.PHONY: test clean distclean sb install sb-makekey
.PHONY: test clean distclean sb install sb-makekey deps cmake
Loading