From 7a43ea1c2b418811b4d80286772f15dd08278174 Mon Sep 17 00:00:00 2001 From: Lemutar Date: Tue, 10 Jun 2014 14:45:41 +0200 Subject: [PATCH 01/36] add option parser for wireserver --- src/main.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 5288980e..ca779e4f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,6 +2,8 @@ #include #include #include +#include +using boost::program_options::value; namespace { @@ -18,8 +20,26 @@ void acceptWireProtocol(int port) { } int main(int argc, char **argv) { + + boost::program_options::options_description optionDescription("Allowed options"); + optionDescription.add_options() + ("help", "this help message") + ("port", value(), "listening port of wireserver") + ; + boost::program_options::variables_map optionVariableMap; + boost::program_options::store( boost::program_options::parse_command_line(argc, argv, optionDescription), optionVariableMap); + boost::program_options::notify(optionVariableMap); + + if (optionVariableMap.count("help")) { + std::cout << optionDescription << std::endl; + } + + int port = 3902; + if (optionVariableMap.count("port")) { + port = optionVariableMap["port"].as(); + } + try { - int port = 3902; if (argc > 1) { std::string firstArg(argv[1]); port = ::cucumber::internal::fromString(firstArg); From 9255936cbe69e47f492cd4dbc4f76c6fe60c52b5 Mon Sep 17 00:00:00 2001 From: Lemutar Date: Tue, 10 Jun 2014 14:47:36 +0200 Subject: [PATCH 02/36] remove old parser from wirde server --- src/main.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index ca779e4f..b36d8d56 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -40,10 +40,6 @@ int main(int argc, char **argv) { } try { - if (argc > 1) { - std::string firstArg(argv[1]); - port = ::cucumber::internal::fromString(firstArg); - } acceptWireProtocol(port); } catch (std::exception &e) { std::cerr << e.what() << std::endl; From 796b569867428aaa2654fcaafb5e5b5ef751b70f Mon Sep 17 00:00:00 2001 From: Lemutar Date: Tue, 10 Jun 2014 14:50:11 +0200 Subject: [PATCH 03/36] Update main.cpp Change help message --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index b36d8d56..ff5860dc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -23,7 +23,7 @@ int main(int argc, char **argv) { boost::program_options::options_description optionDescription("Allowed options"); optionDescription.add_options() - ("help", "this help message") + ("help", "help for cucumber-cpp") ("port", value(), "listening port of wireserver") ; boost::program_options::variables_map optionVariableMap; From da603cf19e227e98186bda7ad354366cd079eddf Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Sun, 7 Feb 2016 20:20:22 +0100 Subject: [PATCH 04/36] do not build this branch --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 096dcf55..90d7e3e1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,3 +24,7 @@ script: ./travis.sh notifications: email: - cukes-devs@googlegroups.com + +branches: + only: + - master From 0754b4bdadbc5c98a2ab26059b21001ced549143 Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Thu, 11 Feb 2016 09:06:55 +0100 Subject: [PATCH 05/36] add osx build --- .travis.yml | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 90d7e3e1..460d9f9f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,22 @@ language: cpp +os: + - linux + - osx sudo: required dist: trusty compiler: - clang - gcc env: - matrix: - - GMOCK_VER=1.7.0 - - GMOCK_PATH=/usr/src/gmock #1.6.0 from ubuntu trusty repo + - GMOCK_VER=1.6.0 + - GMOCK_VER=1.7.0 + - GMOCK_PATH=/usr/src/gmock #1.6.0 from ubuntu trusty repo +matrix: + exclude: + - os: linux + env: GMOCK_VER=1.6.0 + - os: osx + env: GMOCK_PATH=/usr/src/gmock addons: apt: @@ -21,10 +30,10 @@ addons: script: ./travis.sh -notifications: - email: - - cukes-devs@googlegroups.com +#notifications: +# email: +# - cukes-devs@googlegroups.com -branches: - only: - - master +#branches: +# only: +# - master From 4c28008d781192c8708651eb898517cda0ae97f8 Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Thu, 11 Feb 2016 09:10:43 +0100 Subject: [PATCH 06/36] disable gcc on osx --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 460d9f9f..b31f7e5d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,8 @@ matrix: env: GMOCK_VER=1.6.0 - os: osx env: GMOCK_PATH=/usr/src/gmock - + - os: osx + compiler: gcc #does anyone on osx use it? addons: apt: packages: From 8b9f18ccce182e34b868f05fec66330411aa9457 Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Thu, 11 Feb 2016 09:49:46 +0100 Subject: [PATCH 07/36] try to fix gtest 1.6 on osx --- cmake/modules/FindGMock.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/modules/FindGMock.cmake b/cmake/modules/FindGMock.cmake index e7dcfb57..5d6f294f 100644 --- a/cmake/modules/FindGMock.cmake +++ b/cmake/modules/FindGMock.cmake @@ -141,6 +141,9 @@ if(UNIX) else() set(Suffix ".lib") endif() +if(APPLE) + add_definitions(-DGTEST_USE_OWN_TR1_TUPLE=1 -DGTEST_LANG_CXX11) +endif if("${GMOCK_SRC_DIR}" STREQUAL "") if("${GMOCK_VER}" STREQUAL "") From a16bbc14db6a2cf447ef5f02b6bbfcbd7e54caf4 Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Thu, 11 Feb 2016 10:02:52 +0100 Subject: [PATCH 08/36] fix cmake --- cmake/modules/FindGMock.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/modules/FindGMock.cmake b/cmake/modules/FindGMock.cmake index 5d6f294f..eb53f6ec 100644 --- a/cmake/modules/FindGMock.cmake +++ b/cmake/modules/FindGMock.cmake @@ -143,7 +143,7 @@ else() endif() if(APPLE) add_definitions(-DGTEST_USE_OWN_TR1_TUPLE=1 -DGTEST_LANG_CXX11) -endif +endif() if("${GMOCK_SRC_DIR}" STREQUAL "") if("${GMOCK_VER}" STREQUAL "") From 5821b967a731ca9d019f3a8e785079dc75222e84 Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Thu, 11 Feb 2016 10:32:31 +0100 Subject: [PATCH 09/36] remove own tuple --- cmake/modules/FindGMock.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/modules/FindGMock.cmake b/cmake/modules/FindGMock.cmake index eb53f6ec..e61c5cc6 100644 --- a/cmake/modules/FindGMock.cmake +++ b/cmake/modules/FindGMock.cmake @@ -142,7 +142,7 @@ else() set(Suffix ".lib") endif() if(APPLE) - add_definitions(-DGTEST_USE_OWN_TR1_TUPLE=1 -DGTEST_LANG_CXX11) + add_definitions(-DGTEST_LANG_CXX11) endif() if("${GMOCK_SRC_DIR}" STREQUAL "") From c29c7dbbf2e9ccbef716e427a8468234b57a4ebb Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Thu, 11 Feb 2016 10:50:52 +0100 Subject: [PATCH 10/36] Revert "remove own tuple" This reverts commit 5821b967a731ca9d019f3a8e785079dc75222e84. --- cmake/modules/FindGMock.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/modules/FindGMock.cmake b/cmake/modules/FindGMock.cmake index e61c5cc6..eb53f6ec 100644 --- a/cmake/modules/FindGMock.cmake +++ b/cmake/modules/FindGMock.cmake @@ -142,7 +142,7 @@ else() set(Suffix ".lib") endif() if(APPLE) - add_definitions(-DGTEST_LANG_CXX11) + add_definitions(-DGTEST_USE_OWN_TR1_TUPLE=1 -DGTEST_LANG_CXX11) endif() if("${GMOCK_SRC_DIR}" STREQUAL "") From 43e8f7172a163cd63396a78b43a5bcb1f0125dcf Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Thu, 11 Feb 2016 10:51:38 +0100 Subject: [PATCH 11/36] opsite combination? --- cmake/modules/FindGMock.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/modules/FindGMock.cmake b/cmake/modules/FindGMock.cmake index eb53f6ec..5085cad2 100644 --- a/cmake/modules/FindGMock.cmake +++ b/cmake/modules/FindGMock.cmake @@ -142,7 +142,7 @@ else() set(Suffix ".lib") endif() if(APPLE) - add_definitions(-DGTEST_USE_OWN_TR1_TUPLE=1 -DGTEST_LANG_CXX11) + add_definitions(-DGTEST_USE_OWN_TR1_TUPLE=1) endif() if("${GMOCK_SRC_DIR}" STREQUAL "") From 79872d25d6f516d746b74aec10ede107e8af7901 Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Thu, 11 Feb 2016 11:11:21 +0100 Subject: [PATCH 12/36] Revert "opsite combination?" This reverts commit 43e8f7172a163cd63396a78b43a5bcb1f0125dcf. --- cmake/modules/FindGMock.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/modules/FindGMock.cmake b/cmake/modules/FindGMock.cmake index 5085cad2..eb53f6ec 100644 --- a/cmake/modules/FindGMock.cmake +++ b/cmake/modules/FindGMock.cmake @@ -142,7 +142,7 @@ else() set(Suffix ".lib") endif() if(APPLE) - add_definitions(-DGTEST_USE_OWN_TR1_TUPLE=1) + add_definitions(-DGTEST_USE_OWN_TR1_TUPLE=1 -DGTEST_LANG_CXX11) endif() if("${GMOCK_SRC_DIR}" STREQUAL "") From e6c153ea65ea27ac4c6f5a921dfffb73a40546a0 Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Thu, 11 Feb 2016 11:28:21 +0100 Subject: [PATCH 13/36] spceial defines only for gtest 1.6, add variadic max? --- cmake/modules/FindGMock.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/modules/FindGMock.cmake b/cmake/modules/FindGMock.cmake index eb53f6ec..ef619322 100644 --- a/cmake/modules/FindGMock.cmake +++ b/cmake/modules/FindGMock.cmake @@ -141,8 +141,8 @@ if(UNIX) else() set(Suffix ".lib") endif() -if(APPLE) - add_definitions(-DGTEST_USE_OWN_TR1_TUPLE=1 -DGTEST_LANG_CXX11) +if(APPLE AND "${GMOCK_VER}" STREQUAL "1.6.0") + add_definitions(-DGTEST_USE_OWN_TR1_TUPLE=1 -DGTEST_LANG_CXX11 -D_VARIADIC_MAX=10) endif() if("${GMOCK_SRC_DIR}" STREQUAL "") From 17616b99b294f71cc4bee88ca179db91a88ce57c Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Thu, 11 Feb 2016 11:49:09 +0100 Subject: [PATCH 14/36] another try --- cmake/modules/FindGMock.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/modules/FindGMock.cmake b/cmake/modules/FindGMock.cmake index ef619322..e2ada756 100644 --- a/cmake/modules/FindGMock.cmake +++ b/cmake/modules/FindGMock.cmake @@ -142,7 +142,9 @@ else() set(Suffix ".lib") endif() if(APPLE AND "${GMOCK_VER}" STREQUAL "1.6.0") - add_definitions(-DGTEST_USE_OWN_TR1_TUPLE=1 -DGTEST_LANG_CXX11 -D_VARIADIC_MAX=10) + # add_definitions(-DGTEST_USE_OWN_TR1_TUPLE=1 -DGTEST_LANG_CXX11 -D_VARIADIC_MAX=10) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGTEST_USE_OWN_TR1_TUPLE=1 -DGTEST_HAS_TR1_TUPLE=1 -std=c++11 -stdlib=libc++ -Wno-narrowing" + set(CMAKE_CXX_LINKER_FLAGS "{CMAKE_CXX_LINKER_FLAGS} -stdlib=libc++") endif() if("${GMOCK_SRC_DIR}" STREQUAL "") From 1a6e61f29fc64d0216e873ae1955f3d639e7a5ff Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Thu, 11 Feb 2016 12:05:03 +0100 Subject: [PATCH 15/36] fix typo --- cmake/modules/FindGMock.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/modules/FindGMock.cmake b/cmake/modules/FindGMock.cmake index e2ada756..4013748f 100644 --- a/cmake/modules/FindGMock.cmake +++ b/cmake/modules/FindGMock.cmake @@ -143,7 +143,7 @@ else() endif() if(APPLE AND "${GMOCK_VER}" STREQUAL "1.6.0") # add_definitions(-DGTEST_USE_OWN_TR1_TUPLE=1 -DGTEST_LANG_CXX11 -D_VARIADIC_MAX=10) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGTEST_USE_OWN_TR1_TUPLE=1 -DGTEST_HAS_TR1_TUPLE=1 -std=c++11 -stdlib=libc++ -Wno-narrowing" + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGTEST_USE_OWN_TR1_TUPLE=1 -DGTEST_HAS_TR1_TUPLE=1 -std=c++11 -stdlib=libc++ -Wno-narrowing") set(CMAKE_CXX_LINKER_FLAGS "{CMAKE_CXX_LINKER_FLAGS} -stdlib=libc++") endif() From ea9f90716adf3ef7fc75e14eba6b84be046261ae Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Thu, 11 Feb 2016 12:43:09 +0100 Subject: [PATCH 16/36] another try --- cmake/modules/FindGMock.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/modules/FindGMock.cmake b/cmake/modules/FindGMock.cmake index 4013748f..40c3effb 100644 --- a/cmake/modules/FindGMock.cmake +++ b/cmake/modules/FindGMock.cmake @@ -142,8 +142,8 @@ else() set(Suffix ".lib") endif() if(APPLE AND "${GMOCK_VER}" STREQUAL "1.6.0") - # add_definitions(-DGTEST_USE_OWN_TR1_TUPLE=1 -DGTEST_LANG_CXX11 -D_VARIADIC_MAX=10) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGTEST_USE_OWN_TR1_TUPLE=1 -DGTEST_HAS_TR1_TUPLE=1 -std=c++11 -stdlib=libc++ -Wno-narrowing") + add_definitions(-DGTEST_USE_OWN_TR1_TUPLE=1 -DGTEST_HAS_TR1_TUPLE=1 -DGTEST_LANG_CXX11)# -D_VARIADIC_MAX=10) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++ -Wno-narrowing") set(CMAKE_CXX_LINKER_FLAGS "{CMAKE_CXX_LINKER_FLAGS} -stdlib=libc++") endif() From cc33bc8ea10abec98faee105ef7504bc4ddc7798 Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Thu, 11 Feb 2016 12:59:39 +0100 Subject: [PATCH 17/36] gmock 1.6 on osx does not build --- .travis.yml | 18 +++++++++--------- cmake/modules/FindGMock.cmake | 5 ----- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index b31f7e5d..93026b24 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,13 +8,13 @@ compiler: - clang - gcc env: - - GMOCK_VER=1.6.0 +# - GMOCK_VER=1.6.0 - GMOCK_VER=1.7.0 - GMOCK_PATH=/usr/src/gmock #1.6.0 from ubuntu trusty repo matrix: exclude: - - os: linux - env: GMOCK_VER=1.6.0 +# - os: linux +# env: GMOCK_VER=1.6.0 - os: osx env: GMOCK_PATH=/usr/src/gmock - os: osx @@ -31,10 +31,10 @@ addons: script: ./travis.sh -#notifications: -# email: -# - cukes-devs@googlegroups.com +notifications: + email: + - cukes-devs@googlegroups.com -#branches: -# only: -# - master +branches: + only: + - master diff --git a/cmake/modules/FindGMock.cmake b/cmake/modules/FindGMock.cmake index 40c3effb..e7dcfb57 100644 --- a/cmake/modules/FindGMock.cmake +++ b/cmake/modules/FindGMock.cmake @@ -141,11 +141,6 @@ if(UNIX) else() set(Suffix ".lib") endif() -if(APPLE AND "${GMOCK_VER}" STREQUAL "1.6.0") - add_definitions(-DGTEST_USE_OWN_TR1_TUPLE=1 -DGTEST_HAS_TR1_TUPLE=1 -DGTEST_LANG_CXX11)# -D_VARIADIC_MAX=10) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++ -Wno-narrowing") - set(CMAKE_CXX_LINKER_FLAGS "{CMAKE_CXX_LINKER_FLAGS} -stdlib=libc++") -endif() if("${GMOCK_SRC_DIR}" STREQUAL "") if("${GMOCK_VER}" STREQUAL "") From 033bce9a75ee59ec130f502380b9bca6a2febea0 Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Sun, 14 Feb 2016 12:40:59 +0100 Subject: [PATCH 18/36] retry --- .travis.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 93026b24..4c3a34ea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,10 +31,10 @@ addons: script: ./travis.sh -notifications: - email: - - cukes-devs@googlegroups.com - -branches: - only: - - master +#notifications: +# email: +# - cukes-devs@googlegroups.com +# +#branches: +# only: +# - master From cbb2db5df65e478006f61f425018fe4908de192e Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Mon, 15 Feb 2016 15:20:27 +0100 Subject: [PATCH 19/36] first try on suggested resolution from #96 for failing features target in OSX --- features/step_definitions/cucumber_cpp_mappings.rb | 3 +++ src/main.cpp | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/features/step_definitions/cucumber_cpp_mappings.rb b/features/step_definitions/cucumber_cpp_mappings.rb index 9dee4c36..ad539566 100644 --- a/features/step_definitions/cucumber_cpp_mappings.rb +++ b/features/step_definitions/cucumber_cpp_mappings.rb @@ -1,4 +1,5 @@ require 'json' +require "io/wait" # it might be already included module CucumberCppMappings @@ -314,6 +315,8 @@ def create_wire_file def run_cucumber_cpp @steps_out = IO.popen STEP_DEFINITIONS_EXE + expect(@steps_out.wait(1)).not_to be_nil + expect(@steps_out.readline).to start_with("Listening") end def run_cucumber_test_feature(params) diff --git a/src/main.cpp b/src/main.cpp index 5288980e..202554ff 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,13 +5,15 @@ namespace { -void acceptWireProtocol(int port) { +void acceptWireProtocol(int port, bool verbose = false) { using namespace ::cucumber::internal; CukeEngineImpl cukeEngine; JsonSpiritWireMessageCodec wireCodec; WireProtocolHandler protocolHandler(&wireCodec, &cukeEngine); SocketServer server(&protocolHandler); server.listen(port); + if (verbose) + std::cerr << "Listening on port " << port << std::endl; server.acceptOnce(); } @@ -24,7 +26,7 @@ int main(int argc, char **argv) { std::string firstArg(argv[1]); port = ::cucumber::internal::fromString(firstArg); } - acceptWireProtocol(port); + acceptWireProtocol(port, true); } catch (std::exception &e) { std::cerr << e.what() << std::endl; exit(1); From 222d82f712ac37cae747b88fe30d9771a34a2194 Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Mon, 15 Feb 2016 17:10:45 +0100 Subject: [PATCH 20/36] fix CMAkelists for #73 --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 28e03fc9..77851950 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,7 +41,7 @@ else() set(BOOST_MIN_VERSION "1.40") endif() -set(CUKE_CORE_BOOST_LIBS thread system regex date_time) +set(CUKE_CORE_BOOST_LIBS thread system regex date_time program_options) if(NOT CUKE_DISABLE_BOOST_TEST) set(CUKE_TEST_BOOST_LIBS unit_test_framework) endif() @@ -73,7 +73,7 @@ endif() if(Boost_FOUND) include_directories(${Boost_INCLUDE_DIRS}) - set(CUKE_EXTRA_LIBRARIES ${CUKE_EXTRA_LIBRARIES} ${Boost_THREAD_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_REGEX_LIBRARY} ${Boost_DATE_TIME_LIBRARY}) + set(CUKE_EXTRA_LIBRARIES ${CUKE_EXTRA_LIBRARIES} ${Boost_THREAD_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_REGEX_LIBRARY} ${Boost_DATE_TIME_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY}) endif() # From 605219e61c7f793e01321cae92e609d079403490 Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Mon, 15 Feb 2016 17:12:38 +0100 Subject: [PATCH 21/36] update boost section of readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a82d9b46..bc2b6957 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,8 @@ with [CPP]. It relies on a few libraries: -* [Boost](http://www.boost.org/) 1.40 or later. - Required libraries: *thread*, *system*, *regex*, and *date_time*. +* [Boost](http://www.boost.org/) 1.40 or later (1.51 for MSVC11). + Required libraries: *thread*, *system*, *regex*, *program_options* and *date_time*. Optional library for Boost Test driver: *test*. * [GTest](http://code.google.com/p/googletest/) 1.6 or later. Optional for the GTest driver. By default downloaded and built by CMake. From 4996630a39c9d20c011adaa683ec4b48271f32eb Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Mon, 15 Feb 2016 19:33:44 +0100 Subject: [PATCH 22/36] should fix osx travis --- features/step_definitions/cucumber_cpp_mappings.rb | 5 ++--- src/main.cpp | 12 +++++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/features/step_definitions/cucumber_cpp_mappings.rb b/features/step_definitions/cucumber_cpp_mappings.rb index ad539566..ddef94f0 100644 --- a/features/step_definitions/cucumber_cpp_mappings.rb +++ b/features/step_definitions/cucumber_cpp_mappings.rb @@ -1,5 +1,5 @@ require 'json' -require "io/wait" # it might be already included +require 'timeout' module CucumberCppMappings @@ -314,8 +314,7 @@ def create_wire_file end def run_cucumber_cpp - @steps_out = IO.popen STEP_DEFINITIONS_EXE - expect(@steps_out.wait(1)).not_to be_nil + @steps_out = IO.popen [STEP_DEFINITIONS_EXE, "-v"] expect(@steps_out.readline).to start_with("Listening") end diff --git a/src/main.cpp b/src/main.cpp index ffc496ab..e62e1808 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -15,17 +15,19 @@ void acceptWireProtocol(int port, bool verbose = false) { SocketServer server(&protocolHandler); server.listen(port); if (verbose) - std::cerr << "Listening on port " << port << std::endl; + std::cout << "Listening on port " << port << std::endl; server.acceptOnce(); } } int main(int argc, char **argv) { + bool verbose = false; boost::program_options::options_description optionDescription("Allowed options"); optionDescription.add_options() - ("help", "help for cucumber-cpp") + ("help,h", "help for cucumber-cpp") + ("verbose,v", "verbose output") ("port", value(), "listening port of wireserver") ; boost::program_options::variables_map optionVariableMap; @@ -36,13 +38,17 @@ int main(int argc, char **argv) { std::cout << optionDescription << std::endl; } + if (optionVariableMap.count("verbose")) { + verbose = true; + } + int port = 3902; if (optionVariableMap.count("port")) { port = optionVariableMap["port"].as(); } try { - acceptWireProtocol(port, true); + acceptWireProtocol(port, verbose); } catch (std::exception &e) { std::cerr << e.what() << std::endl; exit(1); From 4fdc87c591010dfd9d23d7184d7abc4159a969ea Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Mon, 15 Feb 2016 19:53:44 +0100 Subject: [PATCH 23/36] fix travis.yml - missing boost program options in apt --- .travis.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4c3a34ea..bccad162 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,14 +27,15 @@ addons: - libboost-regex-dev - libboost-date-time-dev - libboost-test-dev + - libboost-program-options-dev - google-mock script: ./travis.sh -#notifications: -# email: -# - cukes-devs@googlegroups.com -# -#branches: -# only: -# - master +notifications: + email: + - cukes-devs@googlegroups.com + +branches: + only: + - master From a13b1f702f2de249e6a22fe836dffa81f107c77e Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Mon, 15 Feb 2016 20:28:25 +0100 Subject: [PATCH 24/36] add some debug output --- features/step_definitions/cucumber_cpp_mappings.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/features/step_definitions/cucumber_cpp_mappings.rb b/features/step_definitions/cucumber_cpp_mappings.rb index ddef94f0..f036aaa8 100644 --- a/features/step_definitions/cucumber_cpp_mappings.rb +++ b/features/step_definitions/cucumber_cpp_mappings.rb @@ -1,5 +1,4 @@ require 'json' -require 'timeout' module CucumberCppMappings @@ -315,7 +314,9 @@ def create_wire_file def run_cucumber_cpp @steps_out = IO.popen [STEP_DEFINITIONS_EXE, "-v"] - expect(@steps_out.readline).to start_with("Listening") + out = @steps_out.readline + puts "definition output: #{out}" + expect(out).to start_with("Listening") end def run_cucumber_test_feature(params) From 46b01ef2148f25f6bc293b5f44e74bc678bb2fca Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Mon, 15 Feb 2016 20:47:15 +0100 Subject: [PATCH 25/36] prettyprint features for debuging --- travis.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/travis.sh b/travis.sh index 4c30f28e..a67e3c59 100755 --- a/travis.sh +++ b/travis.sh @@ -10,7 +10,7 @@ else fi cmake --build build cmake --build build --target test -cmake --build build --target features +cmake --build build --target features-pretty GTEST=build/examples/Calc/GTestCalculatorSteps BOOST=build/examples/Calc/BoostCalculatorSteps From 0932f56311ef4b595a0f2a1ff7ab5feb870805f0 Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Mon, 15 Feb 2016 21:29:45 +0100 Subject: [PATCH 26/36] change kill signal to int --- features/step_definitions/cucumber_cpp_mappings.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/step_definitions/cucumber_cpp_mappings.rb b/features/step_definitions/cucumber_cpp_mappings.rb index f036aaa8..229165a2 100644 --- a/features/step_definitions/cucumber_cpp_mappings.rb +++ b/features/step_definitions/cucumber_cpp_mappings.rb @@ -292,7 +292,7 @@ def run_feature_with_params(params) create_wire_file run_cucumber_cpp run_cucumber_test_feature params - Process.kill(:SIGTERM, @steps_out.pid) # for when there are no scenarios + Process.kill(9, @steps_out.pid) # for when there are no scenarios Process.wait @steps_out.pid end @@ -315,7 +315,7 @@ def create_wire_file def run_cucumber_cpp @steps_out = IO.popen [STEP_DEFINITIONS_EXE, "-v"] out = @steps_out.readline - puts "definition output: #{out}" +# puts "definition output: #{out}" expect(out).to start_with("Listening") end From 2424d95926a1c19c040c11ce594d4b5745609483 Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Mon, 15 Feb 2016 21:36:35 +0100 Subject: [PATCH 27/36] Wait a second - add sleep --- features/step_definitions/cucumber_cpp_mappings.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/features/step_definitions/cucumber_cpp_mappings.rb b/features/step_definitions/cucumber_cpp_mappings.rb index 229165a2..01ea5424 100644 --- a/features/step_definitions/cucumber_cpp_mappings.rb +++ b/features/step_definitions/cucumber_cpp_mappings.rb @@ -291,6 +291,8 @@ def run_feature_with_params(params) compile_step_definitions create_wire_file run_cucumber_cpp + puts "wait a second" + sleep(1) run_cucumber_test_feature params Process.kill(9, @steps_out.pid) # for when there are no scenarios Process.wait @steps_out.pid From 69100f32b85caaf9d74b77f03684ee2a302cf964 Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Mon, 15 Feb 2016 22:43:50 +0100 Subject: [PATCH 28/36] cleanup a little --- Gemfile | 1 + features/step_definitions/cucumber_cpp_mappings.rb | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index 0357afa7..19248b76 100644 --- a/Gemfile +++ b/Gemfile @@ -4,5 +4,6 @@ group :test do gem 'cucumber', "=1.3.20" gem 'aruba', "=0.6.1" gem 'rspec', "=2.14.1" + gem 'os' end diff --git a/features/step_definitions/cucumber_cpp_mappings.rb b/features/step_definitions/cucumber_cpp_mappings.rb index 01ea5424..cf2cdf2f 100644 --- a/features/step_definitions/cucumber_cpp_mappings.rb +++ b/features/step_definitions/cucumber_cpp_mappings.rb @@ -1,4 +1,5 @@ require 'json' +require 'os' module CucumberCppMappings @@ -291,8 +292,10 @@ def run_feature_with_params(params) compile_step_definitions create_wire_file run_cucumber_cpp - puts "wait a second" - sleep(1) + if OS.mac? + puts "wait a second" + sleep(1) + end run_cucumber_test_feature params Process.kill(9, @steps_out.pid) # for when there are no scenarios Process.wait @steps_out.pid @@ -315,10 +318,7 @@ def create_wire_file end def run_cucumber_cpp - @steps_out = IO.popen [STEP_DEFINITIONS_EXE, "-v"] - out = @steps_out.readline -# puts "definition output: #{out}" - expect(out).to start_with("Listening") + @steps_out = IO.popen STEP_DEFINITIONS_EXE end def run_cucumber_test_feature(params) From abc988b5cbfa6c84704b04abc5719b59376a76b6 Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Tue, 16 Feb 2016 17:18:40 +0100 Subject: [PATCH 29/36] another try using PTY module --- .../step_definitions/cucumber_cpp_mappings.rb | 21 ++++++++++++------- src/main.cpp | 7 ++++--- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/features/step_definitions/cucumber_cpp_mappings.rb b/features/step_definitions/cucumber_cpp_mappings.rb index cf2cdf2f..01139cd7 100644 --- a/features/step_definitions/cucumber_cpp_mappings.rb +++ b/features/step_definitions/cucumber_cpp_mappings.rb @@ -1,5 +1,6 @@ require 'json' -require 'os' +require 'io/wait' +require 'pty' module CucumberCppMappings @@ -292,13 +293,12 @@ def run_feature_with_params(params) compile_step_definitions create_wire_file run_cucumber_cpp - if OS.mac? - puts "wait a second" - sleep(1) - end run_cucumber_test_feature params - Process.kill(9, @steps_out.pid) # for when there are no scenarios - Process.wait @steps_out.pid + begin + Process.kill(:SIGTERM, @steps_pid) + Process.wait @steps_pid + rescue Errno::ESRCH + end end def write_main_step_definitions_file @@ -318,7 +318,12 @@ def create_wire_file end def run_cucumber_cpp - @steps_out = IO.popen STEP_DEFINITIONS_EXE + PTY.spawn(STEP_DEFINITIONS_EXE, '-v') do + |output, input, pid| + @steps_pid = pid + expect(output.wait(2)).not_to be_nil + expect(output.readline).to start_with("Listening") + end end def run_cucumber_test_feature(params) diff --git a/src/main.cpp b/src/main.cpp index e62e1808..348d5216 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -15,7 +15,7 @@ void acceptWireProtocol(int port, bool verbose = false) { SocketServer server(&protocolHandler); server.listen(port); if (verbose) - std::cout << "Listening on port " << port << std::endl; + std::cerr << "Listening on port " << port << std::endl; server.acceptOnce(); } @@ -28,7 +28,7 @@ int main(int argc, char **argv) { optionDescription.add_options() ("help,h", "help for cucumber-cpp") ("verbose,v", "verbose output") - ("port", value(), "listening port of wireserver") + ("port,p", value(), "listening port of wireserver") ; boost::program_options::variables_map optionVariableMap; boost::program_options::store( boost::program_options::parse_command_line(argc, argv, optionDescription), optionVariableMap); @@ -36,6 +36,7 @@ int main(int argc, char **argv) { if (optionVariableMap.count("help")) { std::cout << optionDescription << std::endl; + return 0; } if (optionVariableMap.count("verbose")) { @@ -51,7 +52,7 @@ int main(int argc, char **argv) { acceptWireProtocol(port, verbose); } catch (std::exception &e) { std::cerr << e.what() << std::endl; - exit(1); + return 1; } return 0; } From 7f560ef3e4c03514589a3a3904029e880a03cf9c Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Tue, 16 Feb 2016 17:29:28 +0100 Subject: [PATCH 30/36] extend timeout --- features/step_definitions/cucumber_cpp_mappings.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/step_definitions/cucumber_cpp_mappings.rb b/features/step_definitions/cucumber_cpp_mappings.rb index 01139cd7..9344e638 100644 --- a/features/step_definitions/cucumber_cpp_mappings.rb +++ b/features/step_definitions/cucumber_cpp_mappings.rb @@ -321,7 +321,7 @@ def run_cucumber_cpp PTY.spawn(STEP_DEFINITIONS_EXE, '-v') do |output, input, pid| @steps_pid = pid - expect(output.wait(2)).not_to be_nil + expect(output.wait(10)).not_to be_nil expect(output.readline).to start_with("Listening") end end From dcb63c902da178dd9e04fcb5627e32c1cc9d8d3a Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Tue, 16 Feb 2016 17:46:34 +0100 Subject: [PATCH 31/36] remove wait --- features/step_definitions/cucumber_cpp_mappings.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/step_definitions/cucumber_cpp_mappings.rb b/features/step_definitions/cucumber_cpp_mappings.rb index 9344e638..c09034c7 100644 --- a/features/step_definitions/cucumber_cpp_mappings.rb +++ b/features/step_definitions/cucumber_cpp_mappings.rb @@ -321,7 +321,7 @@ def run_cucumber_cpp PTY.spawn(STEP_DEFINITIONS_EXE, '-v') do |output, input, pid| @steps_pid = pid - expect(output.wait(10)).not_to be_nil +# expect(output.wait(10)).not_to be_nil expect(output.readline).to start_with("Listening") end end From 40677cf5b877f87389f71cfc028b18742394bcd1 Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Mon, 29 Feb 2016 20:22:09 +0100 Subject: [PATCH 32/36] delete object file on mac as workaround OSX issue --- features/step_definitions/cucumber_cpp_mappings.rb | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/features/step_definitions/cucumber_cpp_mappings.rb b/features/step_definitions/cucumber_cpp_mappings.rb index c09034c7..4c1e3284 100644 --- a/features/step_definitions/cucumber_cpp_mappings.rb +++ b/features/step_definitions/cucumber_cpp_mappings.rb @@ -1,6 +1,5 @@ require 'json' -require 'io/wait' -require 'pty' +require 'os' module CucumberCppMappings @@ -306,6 +305,9 @@ def write_main_step_definitions_file end def compile_step_definitions + if OS.mac? + File.delete(cpp_step.cpp.o) + end compiler_output = %x[ #{COMPILE_STEP_DEFINITIONS_CMD} ] expect($?.success?).to be_true, "Compilation failed!\n#{compiler_output}" end @@ -318,12 +320,8 @@ def create_wire_file end def run_cucumber_cpp - PTY.spawn(STEP_DEFINITIONS_EXE, '-v') do - |output, input, pid| - @steps_pid = pid -# expect(output.wait(10)).not_to be_nil - expect(output.readline).to start_with("Listening") - end + output = IO.popen STEP_DEFINITIONS_EXE + @steps_pid = output.pid end def run_cucumber_test_feature(params) From a4b616911a7ef9eb4c711a7d3f5cc30daf6a1bfc Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Mon, 29 Feb 2016 20:50:32 +0100 Subject: [PATCH 33/36] fix cucumber-cpp specific feature --- features/step_definitions/cucumber_cpp_mappings.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/features/step_definitions/cucumber_cpp_mappings.rb b/features/step_definitions/cucumber_cpp_mappings.rb index 4c1e3284..0f02355a 100644 --- a/features/step_definitions/cucumber_cpp_mappings.rb +++ b/features/step_definitions/cucumber_cpp_mappings.rb @@ -294,8 +294,8 @@ def run_feature_with_params(params) run_cucumber_cpp run_cucumber_test_feature params begin - Process.kill(:SIGTERM, @steps_pid) - Process.wait @steps_pid + Process.kill(:SIGTERM, @steps_out.pid) + Process.wait @steps_out.pid rescue Errno::ESRCH end end @@ -320,8 +320,7 @@ def create_wire_file end def run_cucumber_cpp - output = IO.popen STEP_DEFINITIONS_EXE - @steps_pid = output.pid + @steps_out = IO.popen STEP_DEFINITIONS_EXE end def run_cucumber_test_feature(params) From 25e500084af1489b0cdc631a6f4c46542a602475 Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Mon, 29 Feb 2016 20:52:13 +0100 Subject: [PATCH 34/36] use normal, not pretty formatter --- travis.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/travis.sh b/travis.sh index a67e3c59..4c30f28e 100755 --- a/travis.sh +++ b/travis.sh @@ -10,7 +10,7 @@ else fi cmake --build build cmake --build build --target test -cmake --build build --target features-pretty +cmake --build build --target features GTEST=build/examples/Calc/GTestCalculatorSteps BOOST=build/examples/Calc/BoostCalculatorSteps From c98987975da5dd9113692c80a3f9782f31dfe731 Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Mon, 29 Feb 2016 22:16:21 +0100 Subject: [PATCH 35/36] fix path to object file --- features/step_definitions/cucumber_cpp_mappings.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/step_definitions/cucumber_cpp_mappings.rb b/features/step_definitions/cucumber_cpp_mappings.rb index 0f02355a..3398d971 100644 --- a/features/step_definitions/cucumber_cpp_mappings.rb +++ b/features/step_definitions/cucumber_cpp_mappings.rb @@ -306,7 +306,7 @@ def write_main_step_definitions_file def compile_step_definitions if OS.mac? - File.delete(cpp_step.cpp.o) + File.delete("./CMakeFiles/functional-steps.dir/tmp/test_features/step_definitions/cpp_steps.cpp.o") end compiler_output = %x[ #{COMPILE_STEP_DEFINITIONS_CMD} ] expect($?.success?).to be_true, "Compilation failed!\n#{compiler_output}" From a0b56345ef55cfb6768cf72f30c6bd0f2278a861 Mon Sep 17 00:00:00 2001 From: Kamil Strzempowicz Date: Mon, 29 Feb 2016 22:17:04 +0100 Subject: [PATCH 36/36] build osx first --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bccad162..be89cf09 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: cpp os: - - linux - osx + - linux sudo: required dist: trusty compiler: