Permalink
Browse files

Merge branch 'features/io-rewrite-nanopb' into bleeding

  • Loading branch information...
Snaipe committed Jan 18, 2016
2 parents 813a526 + 0019864 commit e638cf3d43d2bbdbd3476e5bd0ee72434704095e
@@ -26,31 +26,4 @@ else()
)
endif()
### Then, checkout each submodule to the specified commit
# Note: Execute separate processes here, to make sure each one is run,
# should one crash (because of branch not existing, this, that ... whatever)
foreach(GIT_SUBMODULE ${GIT_SUBMODULES})
if( "${GIT_SUBMODULE_VERSION_${GIT_SUBMODULE}}" STREQUAL "" )
message(STATUS "no specific version given for submodule ${GIT_SUBMODULE}, checking out master")
set(GIT_SUBMODULE_VERSION_${GIT_SUBMODULE} "master")
endif()
if(${GIT_SUBMODULES_CHECKOUT_QUIET})
execute_process(
COMMAND git checkout ${GIT_SUBMODULE_VERSION_${GIT_SUBMODULE}}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/${GIT_SUBMODULES_DIRECTORY}/${GIT_SUBMODULE}
OUTPUT_QUIET
ERROR_QUIET
)
else()
message(STATUS "checking out ${GIT_SUBMODULE}'s commit/tag ${GIT_SUBMODULE_VERSION_${GIT_SUBMODULE}}")
execute_process(
COMMAND git checkout -q ${GIT_SUBMODULE_VERSION_${GIT_SUBMODULE}}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/${GIT_SUBMODULES_DIRECTORY}/${GIT_SUBMODULE}
)
endif()
endforeach(${GIT_SUBMODULE})
endif()
@@ -18,6 +18,7 @@
!*.po
!*.in
!*.t
!*.proto
!.cmake/Modules/*.cmake
!samples/tests/*.sh
!samples/**/*.expected
@@ -10,3 +10,12 @@
[submodule "dependencies/klib"]
path = dependencies/klib
url = https://github.com/attractivechaos/klib.git
[submodule "dependencies/nanopb"]
path = dependencies/nanopb
url = https://github.com/nanopb/nanopb.git
[submodule "dependencies/nanomsg"]
path = dependencies/nanomsg
url = https://github.com/nanomsg/nanomsg.git
[submodule "dependencies/nanomsg-patched"]
path = dependencies/nanomsg-patched
url = https://github.com/Snaipe/nanomsg.git
@@ -133,7 +133,7 @@ script:
- |
if [ "${TESTS:-ON}" = "ON" ]; then
TERM=dumb cmake --build . --target criterion_tests -- -j4
ctest -j4
ctest
else
TERM=dumb cmake --build . -- -j4
fi
@@ -22,6 +22,52 @@ endif ()
add_subdirectory(dependencies/libcsptr/ EXCLUDE_FROM_ALL)
include(ExternalProject)
include(CMakeParseArguments)
function (add_cmake_subproject _NAME)
set (options)
set (oneValueArgs GIT PATH PREFIX)
set (multiValueArgs OPTS)
cmake_parse_arguments (ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if (NOT "${ARGS_PREFIX}" STREQUAL "")
set (install_prefix ${CMAKE_BINARY_DIR}/external/${ARGS_PREFIX})
else ()
set (install_prefix ${CMAKE_BINARY_DIR}/external)
endif ()
if (NOT "${ARGS_GIT}" STREQUAL "")
string(REPLACE "#" ";" git_opts ${ARGS_GIT})
list(LENGTH ${git_opts} git_opts_len)
list(GET 0 repo)
set (epa_opts GIT_REPOSITORY "${repo}")
if (git_opts_len GREATER 1)
list(GET 1 object)
set (epa_opts ${epa_opts} GIT_TAG "${object}")
endif ()
elseif (NOT "${ARGS_PATH}" STREQUAL "")
set (epa_opts SOURCE_DIR "${CMAKE_SOURCE_DIR}/${ARGS_PATH}")
endif ()
externalproject_add(
${_NAME}
${epa_opts}
BINARY_DIR "${CMAKE_BINARY_DIR}/${_NAME}"
CONFIGURE_COMMAND ${CMAKE_COMMAND} <SOURCE_DIR>
-DCMAKE_INSTALL_PREFIX=${install_prefix}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
${ARGS_OPTS}
BUILD_COMMAND ${CMAKE_COMMAND} --build "${CMAKE_BINARY_DIR}/${_NAME}"
INSTALL_COMMAND ${CMAKE_COMMAND} --build "${CMAKE_BINARY_DIR}/${_NAME}" --target install
)
endfunction ()
include_directories(${CMAKE_BINARY_DIR}/external/include)
link_directories(${CMAKE_BINARY_DIR}/external/lib)
if (THEORIES)
add_subdirectory(dependencies/dyncall/ EXCLUDE_FROM_ALL)
include_directories(dependencies/dyncall/dyncall/)
@@ -32,10 +78,39 @@ include_directories(SYSTEM
/usr/include/GNUstep
)
if (MSVC)
add_cmake_subproject(nanomsg
PATH dependencies/nanomsg-patched
OPTS "-DNN_TESTS=OFF")
else ()
include(ExternalProject)
externalproject_add(
nanomsg
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/nanomsg-patched"
PREFIX "${CMAKE_CURRENT_BINARY_DIR}/nanomsg-patched"
UPDATE_COMMAND <SOURCE_DIR>/autogen.sh
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
BUILD_COMMAND make -j4
INSTALL_COMMAND make install
)
externalproject_get_property(nanomsg install_dir)
set(NANOMSG_INSTALL_DIR "${install_dir}")
include_directories(${CMAKE_CURRENT_BINARY_DIR}/nanomsg-patched/include/)
link_directories(${CMAKE_CURRENT_BINARY_DIR}/nanomsg-patched/lib/)
endif ()
include_directories(
dependencies/libcsptr/include/
dependencies/valgrind/include/
dependencies/klib/
dependencies/nanopb/
)
if (MSVC)
@@ -74,6 +149,7 @@ set(GettextTranslate_ALL 1)
set(GettextTranslate_GMO_BINARY 1)
add_definitions(-DCRITERION_BUILDING_DLL=1)
add_definitions(-DPB_ENABLE_MALLOC=1)
set(CMAKE_C_FLAGS_DEFAULT "${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS_DEFAULT "${CMAKE_CXX_FLAGS}")
@@ -150,6 +226,8 @@ set(SOURCE_FILES
src/core/stats.h
src/core/ordered-set.c
src/core/test.c
src/core/client.c
src/core/client.h
src/compat/internal.h
src/compat/pipe.c
src/compat/pipe.h
@@ -187,8 +265,22 @@ set(SOURCE_FILES
src/entry/options.c
src/entry/params.c
src/entry/entry.c
src/protocol/criterion.pb.c
src/protocol/criterion.pb.h
src/protocol/protocol.c
src/protocol/messages.c
src/protocol/messages.h
src/protocol/connect.c
src/protocol/connect.h
src/common.h
src/config.h
dependencies/nanopb/pb_common.c
dependencies/nanopb/pb_common.h
dependencies/nanopb/pb_encode.c
dependencies/nanopb/pb_encode.h
dependencies/nanopb/pb_decode.c
dependencies/nanopb/pb_decode.h
)
if (THEORIES)
@@ -250,13 +342,28 @@ configure_file(
include_directories(include src)
add_library(criterion SHARED ${SOURCE_FILES} ${INTERFACE_FILES})
set_target_properties(criterion PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_SOVERSION}
)
add_dependencies(criterion nanomsg)
target_link_libraries(criterion csptr)
if (WIN32)
target_link_libraries(criterion ${CMAKE_BINARY_DIR}/external/lib/nanomsg.lib)
else ()
target_link_libraries(criterion ${CMAKE_CURRENT_BINARY_DIR}/nanomsg-patched/lib/libnanomsg.a)
endif ()
if (NOT WIN32)
target_link_libraries(criterion csptr pthread)
if (NOT APPLE)
target_link_libraries(criterion csptr anl)
endif ()
endif ()
if (THEORIES)
target_link_libraries(criterion dyncall_s)
endif ()
@@ -4,7 +4,7 @@ os: Visual Studio 2015
init:
- git config --global core.autocrlf input
- 'SET PATH=C:\MinGW\bin;%PATH%;C:\MinGW\msys\1.0\bin;%APPVEYOR_BUILD_FOLDER%\build;%APPVEYOR_BUILD_FOLDER%\build\Debug'
- 'SET PATH=C:\MinGW\bin;%PATH%;C:\MinGW\msys\1.0\bin;%APPVEYOR_BUILD_FOLDER%\build;%APPVEYOR_BUILD_FOLDER%\build\Debug;%APPVEYOR_BUILD_FOLDER%\build\external\bin;%APPVEYOR_BUILD_FOLDER%\build\external\lib'
environment:
COVERALLS_REPO_TOKEN:
@@ -63,7 +63,7 @@ before_deploy:
test_script:
- cmake --build . --target criterion_tests
- ps: |
ctest -j2
ctest
if (-not $lastexitcode -eq 0) {
type Testing/Temporary/LastTest.log
}
Submodule nanomsg added at fd66ff
Submodule nanomsg-patched added at e0d49e
Submodule nanopb added at 56f7c4
@@ -30,10 +30,11 @@
# include <stddef.h>
# endif
# include "internal/common.h"
# include "stats.h"
CR_BEGIN_C_API
CR_API void criterion_send_event(int kind, void *data, size_t size);
CR_API void criterion_send_assert(struct criterion_assert_stats *stats);
CR_END_C_API
@@ -95,32 +95,18 @@ CR_END_C_API
"" CR_TRANSLATE_DEF_MSG__(CR_VA_HEAD(CR_VA_TAIL(__VA_ARGS__))) \
))
# define CR_INIT_STATS_(BufSize, MsgVar, ...) CR_EXPAND( \
# define CR_INIT_STATS_(MsgVar, ...) CR_EXPAND( \
do { \
char *def_msg = CR_EXPAND(CR_TRANSLATE_DEF_MSG_(__VA_ARGS__)); \
char *formatted_msg = NULL; \
int msglen = cr_asprintf(&formatted_msg, \
"" CR_VA_TAIL(CR_VA_TAIL(__VA_ARGS__))); \
cr_asprintf(&formatted_msg, "" CR_VA_TAIL(CR_VA_TAIL(__VA_ARGS__))); \
if (formatted_msg && *formatted_msg) { \
MsgVar = formatted_msg; \
CR_STDN free(def_msg); \
} else { \
MsgVar = def_msg; \
msglen = strlen(def_msg); \
CR_STDN free(formatted_msg); \
} \
\
BufSize = sizeof(struct criterion_assert_stats) \
+ sizeof (size_t) + msglen + 1; \
\
char *buf = (char*) CR_STDN malloc(BufSize); \
stat = (struct criterion_assert_stats*) buf; \
CR_STDN memset(buf, 0, sizeof (struct criterion_assert_stats)); \
buf += sizeof (struct criterion_assert_stats); \
*((size_t*) buf) = msglen + 1; \
buf += sizeof (size_t); \
CR_STDN strcpy(buf, MsgVar); \
CR_STDN free(MsgVar); \
} while (0))
# define CR_FAIL_ABORT_ criterion_abort_test
@@ -137,16 +123,16 @@ CR_END_C_API
bool passed = !!(Condition); \
\
char *msg = NULL; \
size_t bufsize; \
\
struct criterion_assert_stats *stat; \
CR_EXPAND(CR_INIT_STATS_(bufsize, msg, CR_VA_TAIL(__VA_ARGS__))); \
stat->passed = passed; \
stat->file = __FILE__; \
stat->line = __LINE__; \
CR_EXPAND(CR_INIT_STATS_(msg, CR_VA_TAIL(__VA_ARGS__))); \
struct criterion_assert_stats stat; \
stat.passed = passed; \
stat.file = __FILE__; \
stat.line = __LINE__; \
stat.message = msg; \
criterion_send_assert(&stat); \
\
criterion_send_event(ASSERT, stat, bufsize); \
CR_STDN free(stat); \
CR_STDN free(msg); \
\
if (!passed) \
Fail(); \
@@ -105,6 +105,13 @@ struct criterion_options {
* default: true
*/
bool measure_time;
/**
* Whether criterion should wait for incoming connections in server mode
*
* default: false
*/
bool wait_for_clients;
};
CR_BEGIN_C_API
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: criterion 2.0.0\n"
"Report-Msgid-Bugs-To: franklinmathieu+criterion@gmail.com\n"
"POT-Creation-Date: 2015-11-27 12:24+0100\n"
"POT-Creation-Date: 2016-01-18 01:27+0100\n"
"PO-Revision-Date: 2015-04-03 17:58+0200\n"
"Last-Translator: <franklinmathieu@gmail.com>\n"
"Language-Team: French\n"
@@ -185,7 +185,7 @@ msgstr "L'instruction `%1$s` a levé une instance de l'exception `%2$s`."
msgid "The statement `%1$s` did not throw an instance of the `%2$s` exception."
msgstr "L'instruction `%1$s` n'a pas levé d'instance de l'exception `%2$s`."
#: src/core/runner.c:58
#: src/core/runner.c:64
#, c-format
msgid ""
"%1$sWarning! Criterion has detected that it is running under valgrind, but "
@@ -196,7 +196,7 @@ msgstr ""
"l'option no_early_exit est explicitement désactivée. Les rapports d'erreur "
"ne seront pas précis!%2$s\n"
#: src/core/runner.c:62
#: src/core/runner.c:68
#, c-format
msgid ""
"%1$sWarning! Criterion has detected that it is running under valgrind, but "
Oops, something went wrong.

0 comments on commit e638cf3

Please sign in to comment.