Skip to content

Commit

Permalink
Merge pull request #2 from datasift/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
benjamg committed Aug 12, 2014
2 parents 811c802 + c0aa362 commit 1ff6db4
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 62 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build
docs
.cproject
.project
.settings
11 changes: 4 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ AR = ar
#

LIBRARY_NAME = zmqpp
VERSION_MAJOR = 3
VERSION_MINOR = 2
VERSION_REVISION = 0
VERSION_MAJOR = 4
VERSION_MINOR = 1
VERSION_REVISION = 1

#
# Paths
Expand Down Expand Up @@ -73,10 +73,6 @@ endif

COMMON_FLAGS = -MMD -std=c++11 -pipe -Wall -fPIC \
-DBUILD_ENV=$(CONFIG) \
-DBUILD_VERSION='"$(APP_VERSION)"' \
-DBUILD_VERSION_MAJOR=$(VERSION_MAJOR) \
-DBUILD_VERSION_MINOR=$(VERSION_MINOR) \
-DBUILD_VERSION_REVISION=$(VERSION_REVISION) \
-DBUILD_DATESTAMP='$(APP_DATESTAMP)' \
-DBUILD_LIBRARY_NAME='"$(LIBRARY_NAME)"' \
-DBUILD_CLIENT_NAME='"$(CLIENT_TARGET)"' \
Expand Down Expand Up @@ -124,6 +120,7 @@ all: $(LIBRARY_SHARED) $(LIBRARY_ARCHIVE) $(CLIENT_TARGET)
check: $(LIBRARY_SHARED) $(LIBRARY_ARCHIVE) test

install:
mkdir -p $(INCLUDEDIR)/$(LIBRARY_DIR)
install -m 644 $(ALL_LIBRARY_INCLUDES) $(INCLUDEDIR)/$(LIBRARY_DIR)
install -m 755 $(BUILD_PATH)/$(LIBRARY_SHARED).$(VERSION_MAJOR) $(LIBDIR)/$(LIBRARY_SHARED).$(APP_VERSION)
ln -sf $(LIBRARY_SHARED).$(APP_VERSION) $(LIBDIR)/$(LIBRARY_SHARED).$(VERSION_MAJOR)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ configuration file to generate them is in the root directory.

To build the documentation with doxygen use

cd docs; doxygen zmqpp.doxygen.conf
doxygen zmqpp.doxygen.conf

And the resulting html or latex docs will be in the docs/html or docs/latex
directories.
Expand Down
2 changes: 1 addition & 1 deletion src/client/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ int main(int argc, char const* argv[])
uint8_t major, minor, patch;
zmqpp::zmq_version(major, minor, patch);

std::cout << BUILD_CLIENT_NAME << " version " << BUILD_VERSION << std::endl;
std::cout << BUILD_CLIENT_NAME << " version " << zmqpp::version() << std::endl;
std::cout << " built against 0mq version " << static_cast<int>(major) << "." << static_cast<int>(minor) << "." << static_cast<int>(patch) << std::endl;

return EXIT_FAILURE;
Expand Down
8 changes: 3 additions & 5 deletions src/tests/test_sanity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@ BOOST_AUTO_TEST_CASE( correct_zmqpp_version )
uint8_t major, minor, patch;
zmqpp::version(major, minor, patch);

BOOST_CHECK_EQUAL( BUILD_VERSION_MAJOR, major );
BOOST_CHECK_EQUAL( BUILD_VERSION_MINOR, minor );
BOOST_CHECK_EQUAL( BUILD_VERSION_REVISION, patch );

BOOST_CHECK_EQUAL( BUILD_VERSION, zmqpp::version() );
BOOST_CHECK_EQUAL( ZMQPP_VERSION_MAJOR, major );
BOOST_CHECK_EQUAL( ZMQPP_VERSION_MINOR, minor );
BOOST_CHECK_EQUAL( ZMQPP_VERSION_REVISION, patch );
}

BOOST_AUTO_TEST_CASE( same_zmq_version_as_built_against )
Expand Down
39 changes: 1 addition & 38 deletions src/tests/test_socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,42 +93,6 @@ BOOST_AUTO_TEST_CASE( simple_pull_push )
BOOST_CHECK(!puller.has_more_parts());
}

BOOST_AUTO_TEST_CASE( seperate_pull_push_disconnect )
{
zmqpp::context pull_context;
zmqpp::socket puller(pull_context, zmqpp::socket_type::pull);
puller.set(zmqpp::socket_option::receive_high_water_mark, 5);
puller.bind("tcp://*:65400");

zmqpp::context push_context;
zmqpp::socket pusher(push_context, zmqpp::socket_type::push);
pusher.set( zmqpp::socket_option::immediate, true );
pusher.set(zmqpp::socket_option::send_high_water_mark, 5);
pusher.connect("tcp://localhost:65400");

{
BOOST_CHECK(pusher.send("hello world!"));
wait_for_socket(puller);
std::string message;
BOOST_CHECK(puller.receive(message));

zmqpp::context temp_context;
zmqpp::socket temp_socket( temp_context, zmqpp::socket_type::pull );
puller.set(zmqpp::socket_option::receive_high_water_mark, 5);

std::swap(temp_context, pull_context);
std::swap(temp_socket, puller);
}

sleep(5);
pusher.disconnect("tcp://localhost:65400");
sleep(5);
puller.bind("tcp://*:65400");
sleep(5);

BOOST_CHECK(pusher.send("hello world!"));
}

BOOST_AUTO_TEST_CASE( multipart_pair )
{
zmqpp::context context;
Expand Down Expand Up @@ -495,7 +459,7 @@ BOOST_AUTO_TEST_CASE( sending_large_messages_string )
puller.connect("inproc://test");

std::string message;
const size_t bytes_to_send = static_cast<size_t>(2.1 * 1024 * 1024 * 1024);
const size_t bytes_to_send = static_cast<size_t>(1024 * 1024 * 1024);
message.reserve(bytes_to_send);
for (size_t i = 0; i < bytes_to_send; i++)
{
Expand All @@ -518,7 +482,6 @@ BOOST_AUTO_TEST_CASE( sending_large_messages_string )
BOOST_CHECK_EQUAL(0, message.compare(received_message));
BOOST_CHECK(!puller.has_more_parts());
}

#endif

BOOST_AUTO_TEST_SUITE_END()
1 change: 1 addition & 0 deletions src/tests/test_socket_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ BOOST_AUTO_TEST_CASE( set_socket_options )
// For some reason -1 not working here
//CHECK_SET(socket, int, reconnect_interval);
CHECK_SET_POSITIVE(socket, int, reconnect_interval_max);
CHECK_SET_POSITIVE(socket, int, backlog);
#if (ZMQ_VERSION_MAJOR > 2)
CHECK_SET_POSITIVE(socket, int, send_buffer_size);
CHECK_SET_POSITIVE(socket, int, receive_buffer_size);
Expand Down
1 change: 1 addition & 0 deletions src/zmqpp/message.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#ifndef ZMQPP_MESSAGE_HPP_
#define ZMQPP_MESSAGE_HPP_

#include <cassert>
#include <functional>
#include <string>
#include <unordered_map>
Expand Down
2 changes: 1 addition & 1 deletion src/zmqpp/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ void socket::set(socket_option const option, int const value)
#endif

// Integers that require +ve numbers
case socket_option::backlog:
#if (ZMQ_VERSION_MAJOR == 2)
case socket_option::reconnect_interval_max:
#else
Expand All @@ -436,7 +437,6 @@ void socket::set(socket_option const option, int const value)
case socket_option::multicast_hops:
case socket_option::rate:
#endif
case socket_option::backlog:
if (value < 0) { throw exception("attempting to set a positive only integer option with a negative integer"); }
// Integers
case socket_option::reconnect_interval:
Expand Down
4 changes: 3 additions & 1 deletion src/zmqpp/zmqpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@

#include "zmqpp.hpp"

#define STRINGIZE(val) #val

namespace zmqpp
{

std::string version()
{
return BUILD_VERSION;
return STRINGIZE(ZMQPP_VERSION_MAJOR) "." STRINGIZE(ZMQPP_VERSION_MINOR) "." STRINGIZE(ZMQPP_VERSION_REVISION);
}

void version(uint8_t& major, uint8_t& minor, uint8_t& revision)
Expand Down
13 changes: 6 additions & 7 deletions src/zmqpp/zmqpp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,20 @@

/**
* \def ZMQPP_VERSION_MAJOR
* zmqpp major version number, generated at compile time
* zmqpp major version number
*/
#define ZMQPP_VERSION_MAJOR BUILD_VERSION_MAJOR
#define ZMQPP_VERSION_MAJOR 4

/**
* \def ZMQPP_VERSION_MINOR
* zmqpp minor version number, generated at compile time
* zmqpp minor version number
*/
#define ZMQPP_VERSION_MINOR BUILD_VERSION_MINOR

#define ZMQPP_VERSION_MINOR 1
/**
* \def ZMQPP_VERSION_REVISION
* zmqpp version revision number, generated at compile time
* zmqpp version revision number
*/
#define ZMQPP_VERSION_REVISION BUILD_VERSION_REVISION
#define ZMQPP_VERSION_REVISION 1

#include <zmq.h>

Expand Down
2 changes: 1 addition & 1 deletion docs/zmqpp.doxygen.conf → zmqpp.doxygen.conf
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ PROJECT_LOGO =
# If a relative path is entered, it will be relative to the location
# where doxygen was started. If left blank the current directory will be used.

OUTPUT_DIRECTORY =
OUTPUT_DIRECTORY = ./docs

# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
# 4096 sub-directories (in 2 levels) under the output directory of each output
Expand Down

0 comments on commit 1ff6db4

Please sign in to comment.