Commit 9ca99535 authored by Paolo Ambrosio's avatar Paolo Ambrosio
Browse files

Fix E2E tests not running on Windows

parent 276aa68c
......@@ -135,18 +135,17 @@ else()
find_program(CUCUMBER_RUBY cucumber)
if(CUCUMBER_RUBY)
message(STATUS "Found Cucumber")
set(CUKE_FEATURES_DIR ${CMAKE_SOURCE_DIR}/features)
set(CUKE_FEATURES_TMP ${CMAKE_BINARY_DIR}/tmp)
set(CUKE_TEST_FEATURES_DIR ${CUKE_FEATURES_TMP}/test_features)
set(CUKE_DYNAMIC_CPP_STEPS ${CUKE_TEST_FEATURES_DIR}/step_definitions/cpp_steps.cpp)
set(CUKE_FEATURES_DIR "${CMAKE_SOURCE_DIR}/features")
set(CUKE_FEATURES_TMP "${CMAKE_BINARY_DIR}/tmp")
set(CUKE_TEST_FEATURES_DIR "${CUKE_FEATURES_TMP}/test_features")
set(CUKE_DYNAMIC_CPP_STEPS "${CUKE_TEST_FEATURES_DIR}/step_definitions/cpp_steps.cpp")
string(REPLACE "/tmp" "${CMAKE_FILES_DIRECTORY}/e2e-steps.dir/tmp" CUKE_DYNAMIC_CPP_STEPS_OBJ "${CUKE_DYNAMIC_CPP_STEPS}${CMAKE_CXX_OUTPUT_EXTENSION}")
file(WRITE ${CUKE_DYNAMIC_CPP_STEPS})
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_COMMAND}" --build "${CMAKE_BINARY_DIR}" --target e2e-steps')
function(add_feature_target TARGET_NAME)
add_custom_target(${TARGET_NAME}
......@@ -154,9 +153,10 @@ else()
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}
CUCUMBER_RUBY=${CUCUMBER_RUBY}
${ARGV1} ${ARGV2} ${ARGV3} ${ARGV4} ${ARGV5} ${ARGV6}
${CUKE_FEATURES_DIR}
DEPENDS cucumber-cpp
......
......@@ -253,6 +253,7 @@ EOF
STEP_DEFINITIONS_OBJ = ENV["DYNAMIC_CPP_STEPS_OBJ"]
STEP_DEFINITIONS_EXE = ENV["DYNAMIC_CPP_STEPS_EXE"]
COMPILE_STEP_DEFINITIONS_CMD = ENV["COMPILE_DYNAMIC_CPP_STEPS"]
CUCUMBER_RUBY = ENV["CUCUMBER_RUBY"]
WORLD_VARIABLE_LOG_FILE = "#{TMP_DIR}/world_variable.log"
WORLD_FUNCTION_LOG_FILE = "#{TMP_DIR}/world_function.log"
......@@ -320,7 +321,7 @@ EOF
end
def run_cucumber_test_feature(params)
run_simple "cucumber #{params} #{FEATURES_DIR}", false
run_simple "#{CUCUMBER_RUBY} #{params} #{FEATURES_DIR}", false
end
end
......
......@@ -10,7 +10,7 @@ After do
# for when there are no scenarios
if @steps_out
begin
Process.kill :SIGTERM, @steps_out.pid
Process.kill :SIGKILL, @steps_out.pid # :SIGTERM not supported on Windows
Process.wait @steps_out.pid
rescue Errno::ESRCH # exited already
rescue Errno::ECHILD # killed before wait call
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment