Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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 .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "features/cucumber-tck"]
path = features/cucumber-tck
url = git://github.com/cucumber/cucumber-tck.git
url = git://github.com/konserw/cucumber-tck.git
32 changes: 26 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ set(CUKE_DISABLE_E2E_TESTS OFF CACHE BOOL "Disable end-to-end tests")
set(CUKE_ENABLE_EXAMPLES OFF CACHE BOOL "Enable the examples")
set(GMOCK_DIR "" CACHE STRING "Google Mock framework sources path (otherwise downloaded)")
set(GMOCK_VER "1.7.0" CACHE STRING "Google Mock framework version to be used")
set(VERBOSE OFF CACHE BOOL "Verbose output")

set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)

Expand All @@ -26,6 +25,24 @@ if(CMAKE_COMPILER_IS_GNUCXX)
elseif(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOMINMAX") # exclude M$ min/max macros
#set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /analyze")
add_definitions(-DNOMINMAX) # exclude M$ min/max macros
add_definitions(-D_SCL_SECURE_NO_WARNINGS) #turn off msvc warning
add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS) #likewise
set(variables
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
)
foreach(variable ${variables})
if(${variable} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${variable} "${${variable}}")
endif()
endforeach()
endif()

#
Expand All @@ -48,8 +65,10 @@ endif()
if(CUKE_USE_STATIC_BOOST)
set(CUKE_STATIC_BOOST_LIBS ${CUKE_CORE_BOOST_LIBS})
# "An external test runner utility is required to link with dynamic library" (Boost User's Guide)
set(CUKE_DYNAMIC_BOOST_LIBS ${CUKE_TEST_BOOST_LIBS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_TEST_DYN_LINK")
if(NOT CUKE_DISABLE_BOOST_TEST)
set(CUKE_DYNAMIC_BOOST_LIBS ${CUKE_TEST_BOOST_LIBS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_TEST_DYN_LINK")
endif()

if(NOT MSVC)
find_package(Threads)
Expand All @@ -62,6 +81,8 @@ endif()

if(CUKE_STATIC_BOOST_LIBS)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_STATIC_RUNTIME ON)
set(Boost_MULTITHREADED ON)
find_package(Boost ${BOOST_MIN_VERSION} COMPONENTS ${CUKE_STATIC_BOOST_LIBS})
endif()

Expand Down Expand Up @@ -151,16 +172,15 @@ else()
add_executable(e2e-steps EXCLUDE_FROM_ALL ${CUKE_DYNAMIC_CPP_STEPS})
target_link_libraries(e2e-steps ${CUKE_LIBRARIES})

# TODO It does not escape paths
set(CUKE_COMPILE_DYNAMIC_CPP_STEPS "${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target e2e-steps")
set(CUKE_COMPILE_DYNAMIC_CPP_STEPS "cmake --build ${CMAKE_BINARY_DIR} --target e2e-steps")

function(add_feature_target TARGET_NAME)
add_custom_target(${TARGET_NAME}
COMMAND ${CUCUMBER_RUBY}
TEST_FEATURES_DIR=${CUKE_TEST_FEATURES_DIR}
TMP_DIR=${CUKE_FEATURES_TMP}
DYNAMIC_CPP_STEPS_SRC=${CUKE_DYNAMIC_CPP_STEPS}
DYNAMIC_CPP_STEPS_EXE=${CMAKE_BINARY_DIR}/e2e-steps
DYNAMIC_CPP_STEPS_EXE=${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/e2e-steps
DYNAMIC_CPP_STEPS_OBJ=${CUKE_DYNAMIC_CPP_STEPS_OBJ}
COMPILE_DYNAMIC_CPP_STEPS=${CUKE_COMPILE_DYNAMIC_CPP_STEPS}
${ARGV1} ${ARGV2} ${ARGV3} ${ARGV4} ${ARGV5} ${ARGV6}
Expand Down
59 changes: 59 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
version: "{branch}-ci-{build}"
image: Visual Studio 2015

platform:
- x86
- x64

configuration:
- Debug
#- Release

on_finish:
#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

environment:
ruby_version: "200"
matrix:
- GENERATOR: '"Visual Studio 12 2013"'
BOOST_ROOT: 'C:\Libraries\boost'
BOOST_INCLUDEDIR: 'C:\Libraries\boost\boost'
BOOST_LIBRARYDIR: 'C:\Libraries\boost\lib32-msvc-12.0'
- GENERATOR: '"Visual Studio 12 2013"'
BOOST_ROOT: 'C:\Libraries\boost_1_58_0'
BOOST_INCLUDEDIR: 'C:\Libraries\boost_1_58_0\boost'
BOOST_LIBRARYDIR: 'C:\Libraries\boost_1_58_0\lib32-msvc-12.0'
- GENERATOR: '"Visual Studio 14 2015"'
BOOST_ROOT: 'C:\Libraries\boost_1_59_0'
BOOST_INCLUDEDIR: 'C:\Libraries\boost_1_59_0\boost'
BOOST_LIBRARYDIR: 'C:\Libraries\boost_1_59_0\lib32-msvc-14.0'


install:
- git submodule init
- git submodule update
- SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
- ruby --version
- gem update --system --no-ri --no-rdoc -q > gem.log
- gem install bundler --no-document
- bundle install
- ps: .\fixCucumber.ps1

build_script:
- cmake -E make_directory build
- cmake -E chdir build cmake -G%GENERATOR% -DCUKE_DISABLE_BOOST_TEST=on -DCUKE_ENABLE_EXAMPLES=on -DBOOST_ROOT="%BOOST_ROOT%" -DBOOST_INCLUDEDIR="%BOOST_INCLUDEDIR%" -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" ..
- cmake --build build

test_script:
- cmake --build build --target RUN_TESTS
- cmake --build build --target features

notifications:
- provider: Email
to:
# - cukes-devs@googlegroups.com
- konserw@gmail.com
subject: "[cucumber-cpp] AppVeyor Build"
on_build_success: false
on_build_failure: true
on_build_status_changed: true
8 changes: 2 additions & 6 deletions cmake/modules/FindGMock.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,8 @@ add_library(libgmock IMPORTED STATIC GLOBAL)
add_dependencies(libgmock gmock)
ExternalProject_Get_Property(gmock source_dir binary_dir)

if(MSVC)
set(MS_DIR "/${CMAKE_BUILD_TYPE}")
endif()

set(GTEST_LIB_DIR "${binary_dir}/gtest${MS_DIR}")
set(GMOCK_LIB_DIR "${binary_dir}${MS_DIR}")
set(GTEST_LIB_DIR "${binary_dir}/gtest/${CMAKE_CFG_INTDIR}")
set(GMOCK_LIB_DIR "${binary_dir}/${CMAKE_CFG_INTDIR}")

set_target_properties(libgmock PROPERTIES
"IMPORTED_LOCATION" "${GMOCK_LIB_DIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gmock.${Suffix}"
Expand Down
2 changes: 1 addition & 1 deletion features/cucumber-tck
Submodule cucumber-tck updated 1 files
+7 −9 step_definitions/cucumber_stepdefs.rb
45 changes: 32 additions & 13 deletions features/step_definitions/cucumber_cpp_mappings.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# encoding: utf-8

require 'json'

module CucumberCppMappings
Expand Down Expand Up @@ -131,33 +133,47 @@ def write_mapping_calling_world_function(step_name)
EOF
end

def assert_returned_success
expect(@return).to be == true
end

def assert_passing_feature
assert_no_partial_output("failed", @output.encode('UTF-8'))
expect(@return).to be == true
end

def assert_failing_feature(message)
assert_partial_output(message, @output)
expect(@return).to be == false
end

def assert_passing_scenario
assert_partial_output("1 scenario (1 passed)", all_output)
assert_success true
assert_partial_output("1 scenario (1 passed)", @output)
expect(@return).to be == true
end

def assert_failing_scenario
assert_partial_output("1 scenario (1 failed)", all_output)
assert_success false
assert_partial_output("1 scenario (1 failed)", @output)
expect(@return).to be == false
end

def assert_pending_scenario
assert_partial_output("1 scenario (1 pending)", all_output)
assert_success true
assert_partial_output("1 scenario (1 pending)", @output)
expect(@return).to be == true
end

def assert_undefined_scenario
assert_partial_output("1 scenario (1 undefined)", all_output)
assert_success true
assert_partial_output("1 scenario (1 undefined)", @output)
expect(@return).to be == true
end

def assert_scenario_reported_as_failing(scenario_name)
assert_partial_output("# Scenario: #{scenario_name}", all_output)
assert_success false
assert_partial_output("# Scenario: #{scenario_name}", @output)
expect(@return).to be == false
end

def assert_scenario_not_reported_as_failing(scenario_name)
assert_no_partial_output("# Scenario: #{scenario_name}", all_output)
assert_no_partial_output("# Scenario: #{scenario_name}", @output)
end

def assert_suggested_step_definition_snippet(stepdef_keyword, stepdef_pattern, parameter_count = 0, doc_string = false, data_table = false)
Expand Down Expand Up @@ -287,6 +303,7 @@ def nth_step_name n

def run_feature_with_params(params)
write_main_step_definitions_file
remove_step_definition_obj
compile_step_definitions
create_wire_file
run_cucumber_cpp
Expand All @@ -298,13 +315,13 @@ def write_main_step_definitions_file
end

def compile_step_definitions
remove_step_definition_obj
compiler_output = %x[ #{COMPILE_STEP_DEFINITIONS_CMD} ]
expect($?.success?).to be == true, "Compilation failed!\n#{compiler_output}"
end

def remove_step_definition_obj
remove STEP_DEFINITIONS_OBJ
remove STEP_DEFINITIONS_EXE
rescue Errno::ENOENT
end

Expand All @@ -320,7 +337,9 @@ def run_cucumber_cpp
end

def run_cucumber_test_feature(params)
run_simple "cucumber #{params} #{FEATURES_DIR}", false
cmd="cucumber #{params} #{FEATURES_DIR}"
@output = %x[ #{cmd} ]
@return = ($?.success?)
end
end

Expand Down
2 changes: 1 addition & 1 deletion features/support/hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# for when there are no scenarios
if @steps_out
begin
Process.kill :SIGTERM, @steps_out.pid
Process.kill "KILL", @steps_out.pid #windows accepts only KILL signal - do not change please
Process.wait @steps_out.pid
rescue Errno::ESRCH # exited already
rescue Errno::ECHILD # killed before wait call
Expand Down
9 changes: 9 additions & 0 deletions fixCucumber.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
If ($env:ruby_version -match "200") {
$path = "C:\Ruby200\lib\ruby\gems\2.0.0\gems\cucumber-2.0.0\lib\cucumber\formatter\ansicolor.rb"
} Else {
$path = "C:\Ruby193\lib\ruby\gems\1.9.1\gems\cucumber-2.0.0\lib\cucumber\formatter\ansicolor.rb"
}

(Get-Content $path) -replace '\ST\DERR.puts %', '#nope' | Set-Content $path
(Get-Content $path) -replace ' Cucumber::', '#nope' | Set-Content $path
(Get-Content $path) -replace '^Cucumber::', '#nope' | Set-Content $path
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to fix a problem in Cucumber 2.0.0... is it a documented problem? Can you post a link? Does it happen with Ruby 2.2 as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's more of a problem of how appveyor is implemented, i.e. it doesn't need any additional library to get colored output - just like on *nix - and cucumber thinks it is not possible on windows. See:
appveyor/ci#373
http://help.appveyor.com/discussions/suggestions/197-support-ansi-color-codes
It's not dependent on ruby version.

Bjorn Rasmusson wrote:

Cucumber-ruby v2.1.0 (and later) use Gherkin3, so to use a newer Ruby version on Windows, you need to update to a newer Cucumber-ruby version.

But AFAIR I tried newer cucumber-ruby and failed (when searching newest working ruby germs).