diff --git a/test/system/tools/fastdds/CMakeLists.txt b/test/system/tools/fastdds/CMakeLists.txt index ad28206c96e..fa506b53536 100644 --- a/test/system/tools/fastdds/CMakeLists.txt +++ b/test/system/tools/fastdds/CMakeLists.txt @@ -28,14 +28,31 @@ if(Python3_Interpreter_FOUND) test_fastdds_xml_validate ) + # windows auxiliary script to fork test execution + set(PWS_LAUNCHER + ${CMAKE_CURRENT_SOURCE_DIR}/launcher.ps1 + ) + foreach(TEST IN LISTS TESTS) - add_test( - NAME system.tools.fastdds.${TEST} - COMMAND ${Python3_EXECUTABLE} - ${CMAKE_CURRENT_SOURCE_DIR}/tests.py - ${CMAKE_INSTALL_PREFIX} - ${TEST} - ) + + if(WIN32) + add_test( + NAME system.tools.fastdds.${TEST} + COMMAND powershell "-File" ${PWS_LAUNCHER} + ${Python3_EXECUTABLE} + ${CMAKE_CURRENT_SOURCE_DIR}/tests.py + ${CMAKE_INSTALL_PREFIX} + ${TEST} + ) + else() + add_test( + NAME system.tools.fastdds.${TEST} + COMMAND ${Python3_EXECUTABLE} + ${CMAKE_CURRENT_SOURCE_DIR}/tests.py + ${CMAKE_INSTALL_PREFIX} + ${TEST} + ) + endif() # Set test properties set_property( diff --git a/test/system/tools/fastdds/launcher.ps1 b/test/system/tools/fastdds/launcher.ps1 new file mode 100644 index 00000000000..4d033486c0d --- /dev/null +++ b/test/system/tools/fastdds/launcher.ps1 @@ -0,0 +1,36 @@ +Param( + [Parameter(Position=0, Mandatory=$true)] + [ValidateScript({Test-Path $_ -PathType Leaf -IsValid })] + [String] + # python3 binary + $python_path, + + [Parameter(Position=1, Mandatory=$true)] + [ValidateScript({Test-Path $_ -PathType Leaf -IsValid })] + [String] + # python script that keeps the testing + $test_script, + + [Parameter(Position=2, Mandatory=$true)] + [ValidateScript({Test-Path $_ -PathType Leaf -IsValid })] + [String] + # fast server creation binary full qualified path + $tool_path, + + [Parameter(Position=3, Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [String] + # test_name + $test_name +) + +$test = Start-Process -Passthru -Wait ` + -FilePath $python_path ` + -ArgumentList ($test_script, $tool_path, $test_name) ` + -WindowStyle Hidden + +if( $test.ExitCode -ne 0 ) +{ + $error_message = "Test: $test_name failed with exit code $($test.ExitCode)." + throw $error_message +}