Skip to content

Commit

Permalink
Refs #20827: Tmp. Launch tests in auxiliary shell setting the envionm…
Browse files Browse the repository at this point in the history
…ent with .ps1

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
  • Loading branch information
Mario-DL committed May 6, 2024
1 parent 2f144af commit fee2a11
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 7 deletions.
31 changes: 24 additions & 7 deletions test/system/tools/fastdds/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
36 changes: 36 additions & 0 deletions test/system/tools/fastdds/launcher.ps1
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit fee2a11

Please sign in to comment.