Skip to content
Open
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
10 changes: 8 additions & 2 deletions ddsrouter_yaml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,14 @@ compile_test_library(
###############################################################################
# Resources
###############################################################################
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
"${PROJECT_SOURCE_DIR}/../resources/configurations/ddsrouter_config_schema.json")
# NOTE: the path must be normalized (no "..") so that it matches the one registered by
# configure_file. The Ninja generator emits every CMake input in a single build statement and
# canonicalizes the paths, so two spellings of the same file would collide with
# "multiple rules generate <file>".
get_filename_component(_CONFIG_SCHEMA_FILE
"${PROJECT_SOURCE_DIR}/../resources/configurations/ddsrouter_config_schema.json" ABSOLUTE)

set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${_CONFIG_SCHEMA_FILE}")

file(READ "${PROJECT_SOURCE_DIR}/../resources/configurations/ddsrouter_config_schema.json"
DDSROUTER_CONFIG_SCHEMA_CONTENT)
Expand Down
36 changes: 24 additions & 12 deletions tools/ddsrouter_tool/test/application/launcher.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,31 @@ Param(
$test_config_file
)

$test = Start-Process -Passthru -Wait `
-FilePath $python_path `
-ArgumentList (
$test_script,
"--exe", $tool_path,
"--config-file", $test_config_file,
"--debug",
"--signal", "sigint") `
-WindowStyle Hidden

if( $test.ExitCode -ne 0 )
# The test runs in a new hidden console: the CTRL_C_EVENT it sends to the DDS Router reaches every
# process attached to the console, so it must not share the console with CTest.
#
# The console is created by Python's subprocess (CreateProcess) instead of Start-Process: Start-Process
# fails with "An attempt was made to reference a token that does not exist" when there is no
# interactive user session, e.g. on CI runners running as a service.
$new_console_launcher = `
'import subprocess, sys; ' + `
'startupinfo = subprocess.STARTUPINFO(); ' + `
'startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW; ' + `
'startupinfo.wShowWindow = 0; ' + `
'sys.exit(subprocess.call(sys.argv[1:], ' + `
'creationflags=subprocess.CREATE_NEW_CONSOLE, startupinfo=startupinfo))'

& $python_path -c $new_console_launcher `
$python_path $test_script `
--exe $tool_path `
--config-file $test_config_file `
--debug `
--signal sigint
$exit_code = $LASTEXITCODE

if( $exit_code -ne 0 )
{
$error_message = "Test: $test_name failed with exit code $($test.ExitCode)."
$error_message = "Test: $test_config_file failed with exit code $exit_code."
throw $error_message
}

Expand Down
Loading