diff --git a/.github/workflows/config/fastdds_build.meta b/.github/workflows/config/fastdds_build.meta index 445b65d27b1..dfcf45c6f33 100644 --- a/.github/workflows/config/fastdds_build.meta +++ b/.github/workflows/config/fastdds_build.meta @@ -3,7 +3,7 @@ names: cmake-args: - "-DBUILD_DOCUMENTATION=OFF" - "-DCOMPILE_EXAMPLES=ON" - - "-DFASTDDS_ENFORCE_LOG_INFO=ON" + - "-DFASTDDS_ENFORCE_LOG_INFO=OFF" - "-DINSTALL_EXAMPLES=ON" - "-DINTERNAL_DEBUG=ON" - "-DNO_TLS=OFF" diff --git a/.github/workflows/config/fastdds_test.meta b/.github/workflows/config/fastdds_test.meta index 07b12fc1788..e2d83360da8 100644 --- a/.github/workflows/config/fastdds_test.meta +++ b/.github/workflows/config/fastdds_test.meta @@ -1,12 +1,12 @@ names: fastdds: cmake-args: - - "-DEPROSIMA_BUILD_TESTS=ON" - - "-DFASTDDS_PIM_API_TESTS=ON" - - "-DPERFORMANCE_TESTS=ON" + - "-DEPROSIMA_BUILD_TESTS=OFF" + - "-DFASTDDS_PIM_API_TESTS=OFF" + - "-DPERFORMANCE_TESTS=OFF" - "-DPROFILING_TESTS=OFF" - "-DCOMPILE_TOOLS=ON" - - "-DSYSTEM_TESTS=ON" + - "-DSYSTEM_TESTS=OFF" ctest-args: [ "--repeat", "until-pass:3", "--timeout", "300", diff --git a/.github/workflows/mac-ci.yml b/.github/workflows/mac-ci.yml deleted file mode 100644 index 21cf3f2652f..00000000000 --- a/.github/workflows/mac-ci.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Fast DDS MacOS CI - -on: - workflow_dispatch: - inputs: - label: - description: 'ID associated to the workflow' - required: true - type: string - colcon-args: - description: 'Extra arguments for colcon cli' - required: false - type: string - cmake-args: - description: 'Extra arguments for cmake cli' - required: false - type: string - ctest-args: - description: 'Extra arguments for ctest cli' - required: false - type: string - fastdds_branch: - description: 'Branch or tag of Fast DDS repository (https://github.com/eProsima/Fast-DDS)' - type: string - required: true - use-ccache: - description: 'Use CCache to speed up the build' - required: false - type: boolean - default: false - - pull_request: - types: - - review_requested - paths-ignore: - - '**.md' - - '**.txt' - - '!**/CMakeLists.txt' - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - mac-ci: - if: ${{ ( - !contains(github.event.pull_request.labels.*.name, 'skip-ci') && - !contains(github.event.pull_request.labels.*.name, 'conflicts') - ) }} - uses: ./.github/workflows/reusable-mac-ci.yml - with: - label: ${{ inputs.label || 'mac-ci' }} - colcon-args: ${{ inputs.colcon-args }} - cmake-args: '-DSECURITY=ON ${{ inputs.cmake-args }}' - ctest-args: ${{ inputs.ctest-args }} - fastdds-branch: ${{ inputs.fastdds_branch || github.ref || 'master' }} - use-ccache: ${{ ((inputs.use-ccache == true) && true) || false }} diff --git a/.github/workflows/reusable-windows-ci.yml b/.github/workflows/reusable-windows-ci.yml index 934049673f0..5af2cc2b2b3 100644 --- a/.github/workflows/reusable-windows-ci.yml +++ b/.github/workflows/reusable-windows-ci.yml @@ -30,7 +30,7 @@ defaults: jobs: reusable-windows-ci: - runs-on: windows-2019 + runs-on: windows-2022 strategy: fail-fast: false matrix: @@ -141,7 +141,7 @@ jobs: colcon_build_args: ${{ inputs.colcon-args }} # The following Fast DDS CMake options need to be specified here instead of in the meta files # because they vary from platform to platform - cmake_args_default: ${{ inputs.cmake-args }} -T ${{ matrix.vs-toolset }} -DTHIRDPARTY_Asio=FORCE -DTHIRDPARTY_TinyXML2=FORCE -DTHIRDPARTY_fastcdr=OFF -DTHIRDPARTY_UPDATE=ON -DEPROSIMA_EXTRA_CMAKE_CXX_FLAGS="/MP /WX" + cmake_args_default: ${{ inputs.cmake-args }} -T ${{ matrix.vs-toolset }} -DTHIRDPARTY_Asio=FORCE -DTHIRDPARTY_TinyXML2=FORCE -DTHIRDPARTY_fastcdr=OFF -DTHIRDPARTY_UPDATE=ON -DFASTDDS_EXAMPLE_TESTS=ON -DEPROSIMA_EXTRA_CMAKE_CXX_FLAGS="/MP /WX" cmake_build_type: ${{ matrix.cmake-config }} workspace: ${{ github.workspace }} diff --git a/.github/workflows/sanitizers-ci.yml b/.github/workflows/sanitizers-ci.yml deleted file mode 100644 index e4ec25ec298..00000000000 --- a/.github/workflows/sanitizers-ci.yml +++ /dev/null @@ -1,77 +0,0 @@ -name: Fast DDS Sanitizers CI - -on: - workflow_dispatch: - inputs: - label: - description: 'ID associated to the workflow' - required: true - type: string - run_asan_fastdds: - description: 'Run Addess Sanitizer job for Fast DDS' - required: false - type: boolean - run_asan_discovery_server: - description: 'Run Addess Sanitizer job for Discovery Server' - required: false - type: boolean - run_tsan_fastdds: - description: 'Run Thread Sanitizer job for Fast DDS' - required: false - type: boolean - colcon_build_args: - description: 'Optional colcon build arguments' - required: false - type: string - colcon_test_args: - description: 'Optional colcon test arguments' - required: false - type: string - cmake_args: - description: 'Optional CMake Compilation Flags' - required: false - type: string - ctest_args: - description: 'Optional CTest Testing Flags' - required: false - type: string - fastdds_ref: - description: 'Branch or tag of Fast DDS repository (https://github.com/eProsima/Fast-DDS)' - required: true - discovery_server_ref: - description: > - Branch or tag of Discovery Server repository (https://github.com/eProsima/Discovery-Server) - Required only if the Discovery Server job is requested - required: false - - pull_request: - types: - - review_requested - paths-ignore: - - '**.md' - - '**.txt' - - '!**/CMakeLists.txt' - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - sanitizers-ci: - if: ${{ ( - !contains(github.event.pull_request.labels.*.name, 'skip-ci') && - !contains(github.event.pull_request.labels.*.name, 'no-test') && - !contains(github.event.pull_request.labels.*.name, 'conflicts') - ) }} - uses: ./.github/workflows/reusable-sanitizers-ci.yml - with: - label: ${{ inputs.label || 'fastdds-sanitizers-ci' }} - run_asan_fastdds: ${{ ((inputs.run_asan_fastdds == true) && true) || github.event_name == 'pull_request' }} - run_asan_discovery_server: ${{ ((inputs.run_asan_discovery_server == true) && true) || github.event_name == 'pull_request' }} - run_tsan_fastdds: ${{ ((inputs.run_tsan_fastdds == true) && true) || github.event_name == 'pull_request' }} - colcon_build_args: ${{ inputs.colcon_build_args || '' }} - colcon_test_args: ${{ inputs.colcon_test_args || '' }} - cmake_args: ${{ inputs.cmake_args || '' }} - ctest_args: ${{ inputs.ctest_args || '' }} - fastdds_ref: ${{ inputs.fastdds_ref || github.ref || 'master' }} - discovery_server_ref: ${{ inputs.discovery_server_ref || 'master' }} diff --git a/.github/workflows/ubuntu-ci.yml b/.github/workflows/ubuntu-ci.yml deleted file mode 100644 index 58753443e15..00000000000 --- a/.github/workflows/ubuntu-ci.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: Fast DDS Ubuntu CI - -on: - workflow_dispatch: - inputs: - label: - description: 'ID associated to the workflow' - required: true - type: string - colcon-args: - description: 'Extra arguments for colcon cli' - required: false - type: string - cmake-args: - description: 'Extra arguments for cmake cli' - required: false - type: string - ctest-args: - description: 'Extra arguments for ctest cli' - required: false - type: string - fastdds_branch: - description: 'Branch or tag of Fast DDS repository (https://github.com/eProsima/Fast-DDS)' - type: string - required: true - security: - description: 'Enable security features' - required: false - type: boolean - default: true - run-tests: - description: 'Run suite of tests of Fast DDS, Fast DDS python, and Fast DDS Discovery Server' - required: false - type: boolean - default: true - use-ccache: - description: 'Use CCache to speed up the build' - required: false - type: boolean - default: false - - pull_request: - types: - - review_requested - paths-ignore: - - '**.md' - - '**.txt' - - '!**/CMakeLists.txt' - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - ubuntu-ci: - - if: ${{ !(github.event_name == 'pull_request') || !contains(github.event.pull_request.labels.*.name, 'conflicts') }} - uses: ./.github/workflows/reusable-ubuntu-ci.yml - with: - # It would be desirable to have a matrix of ubuntu OS for this job, but due to the issue opened in this ticket: - # https://github.com/orgs/community/discussions/128118 , it has been set as a single OS job. - os-image: 'ubuntu-22.04' - label: ${{ inputs.label || 'ubuntu-ci' }} - colcon-args: ${{ inputs.colcon-args }} - cmake-args: ${{ inputs.cmake-args }} - ctest-args: ${{ inputs.ctest-args || '-LE xfail' }} - fastdds-branch: ${{ inputs.fastdds_branch || github.ref || 'master' }} - security: ${{ ((inputs.security == true) && true) || github.event_name == 'pull_request' }} - run-build: ${{ !(github.event_name == 'pull_request') || !contains(github.event.pull_request.labels.*.name, 'skip-ci') }} - run-tests: ${{ ((inputs.run-tests == true) && true) || (github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'no-test')) }} - use-ccache: ${{ ((inputs.use-ccache == true) && true) || false }} - add-label: ${{ (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.full_name == github.repository) && true || false }} diff --git a/examples/cpp/hello_world/CLIParser.hpp b/examples/cpp/hello_world/CLIParser.hpp index edd0863e321..df39ed8e229 100644 --- a/examples/cpp/hello_world/CLIParser.hpp +++ b/examples/cpp/hello_world/CLIParser.hpp @@ -46,6 +46,7 @@ class CLIParser struct publisher_config { uint16_t samples = 0; + uint16_t matched = 1; }; //! Subscriber application configuration structure @@ -83,6 +84,9 @@ class CLIParser std::cout << " -s , --samples Number of samples to send or receive" << std::endl; std::cout << " [0 <= <= 65535]" << std::endl; std::cout << " (Default: 0 [unlimited])" << std::endl; + std::cout << "Publisher options:" << std::endl; + std::cout << " -m, --matched Number of participants to discover" << std::endl; + std::cout << " before start publishing (Default: 1)" << std::endl; std::cout << "Subscriber options:" << std::endl; std::cout << " -w, --waitset Use waitset & read condition" << std::endl; std::exit(return_code); @@ -194,6 +198,40 @@ class CLIParser print_help(EXIT_FAILURE); } } + else if (arg == "-m" || arg == "--matched") + { + try + { + int input = std::stoi(argv[++i]); + if (input < std::numeric_limits::min() || + input > std::numeric_limits::max()) + { + throw std::out_of_range("matched argument out of range"); + } + else + { + if (config.entity == CLIParser::EntityKind::PUBLISHER) + { + config.pub_config.matched = static_cast(input); + } + else + { + EPROSIMA_LOG_ERROR(CLI_PARSER, "matched can only be used with the publisher entity"); + print_help(EXIT_FAILURE); + } + } + } + catch (const std::invalid_argument& e) + { + EPROSIMA_LOG_ERROR(CLI_PARSER, "invalid sample argument for " + arg + ": " + e.what()); + print_help(EXIT_FAILURE); + } + catch (const std::out_of_range& e) + { + EPROSIMA_LOG_ERROR(CLI_PARSER, "sample argument out of range for " + arg + ": " + e.what()); + print_help(EXIT_FAILURE); + } + } else { EPROSIMA_LOG_ERROR(CLI_PARSER, "unknown option " + arg); diff --git a/examples/cpp/hello_world/PublisherApp.cpp b/examples/cpp/hello_world/PublisherApp.cpp index 63b4331137e..101c01173d8 100644 --- a/examples/cpp/hello_world/PublisherApp.cpp +++ b/examples/cpp/hello_world/PublisherApp.cpp @@ -47,6 +47,7 @@ PublisherApp::PublisherApp( , type_(new HelloWorldPubSubType()) , matched_(0) , samples_(config.samples) + , expected_matches_(config.matched) , stop_(false) { // Set up the data type with initial values @@ -152,7 +153,7 @@ bool PublisherApp::publish() cv_.wait(matched_lock, [&]() { // at least one has been discovered - return ((matched_ > 0) || is_stopped()); + return ((matched_ >= expected_matches_) || is_stopped()); }); if (!is_stopped()) diff --git a/examples/cpp/hello_world/PublisherApp.hpp b/examples/cpp/hello_world/PublisherApp.hpp index ed62f856780..a3d61e461b0 100644 --- a/examples/cpp/hello_world/PublisherApp.hpp +++ b/examples/cpp/hello_world/PublisherApp.hpp @@ -82,6 +82,8 @@ class PublisherApp : public Application, public DataWriterListener uint16_t samples_; + uint16_t expected_matches_; + std::mutex mutex_; std::condition_variable cv_; diff --git a/test/examples/CMakeLists.txt b/test/examples/CMakeLists.txt index 7dd4dfeedee..a94d07fa46f 100644 --- a/test/examples/CMakeLists.txt +++ b/test/examples/CMakeLists.txt @@ -28,6 +28,21 @@ set(SHELL_EXECUTABLE "") set(TINYXML2_LIB_DIR_COMPOSE_VOLUME "") set(TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH "") +# Configure TinyXML2 library path if installed in user library path +if(NOT (TINYXML2_FROM_SOURCE OR TINYXML2_FROM_THIRDPARTY)) + message(STATUS "TINYXML2_LIBRARY " ${TINYXML2_LIBRARY}) + file(GLOB TINYXML2_LIBRARY_DIRS LIST_DIRECTORIES false ${TINYXML2_LIBRARY}) + if (TINYXML2_LIBRARY_DIRS) + list (GET TINYXML2_LIBRARY_DIRS 0 TINYXML2_LIBRARY_HEAD_DIR) + get_filename_component(TINYXML2_LIB_DIR ${TINYXML2_LIBRARY_HEAD_DIR} DIRECTORY) + message(STATUS "TINYXML2_LIB_DIR " ${TINYXML2_LIB_DIR}) + set(TINYXML2_LIB_DIR_COMPOSE_VOLUME "- ${TINYXML2_LIB_DIR}:${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR}/fastdds:ro") + set(TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH "${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR}/fastdds") + else() + message(FATAL_ERROR "Could not find a valid TinyXML 2 lirbary path.") + endif() +endif() + # Linux configurations if(UNIX AND NOT(APPLE) AND NOT(QNXNTO) AND NOT(ANDROID)) # Find bash @@ -39,6 +54,21 @@ if(UNIX AND NOT(APPLE) AND NOT(QNXNTO) AND NOT(ANDROID)) set(SHELL_EXECUTABLE ${BASH_EXECUTABLE}) set(DOCKER_IMAGE_NAME "ubuntu:22.04") + set(PROJECT_BINATY_DIR_COMPOSE_VOLUME "${PROJECT_BINARY_DIR}:${PROJECT_BINARY_DIR}") + set(fastcdr_LIB_DIR_COMPOSE_VOLUME "${fastcdr_LIB_DIR}:${fastcdr_LIB_DIR}") + set(CMAKE_INSTALL_PREFIX_COMPOSE_VOLUME "${CMAKE_INSTALL_PREFIX}:${CMAKE_INSTALL_PREFIX}") + + set(PATH_ENVIRONMENT_VARIABLE_COMPOSE "LD_LIBRARY_PATH: ${PROJECT_BINARY_DIR}/src/cpp:${fastcdr_LIB_DIR}") + if (TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH) + set(PATH_ENVIRONMENT_VARIABLE_COMPOSE "${PATH_ENVIRONMENT_VARIABLE_COMPOSE}:${TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH}") + endif() + set(EXAMPLE_PREFIX_DIR_COMPOSE "${PROJECT_BINARY_DIR}/examples/cpp") + set(EXAMPLE_SUFFIX_DIR_COMPOSE "") + set(FASTDDS_DEFAULT_PROFILES_FILE_PREFIX_COMPOSE "${PROJECT_BINARY_DIR}/examples/cpp/") + set(COMMAND_EXAMPLE_DIR_PREFIX_COMPOSE "$\${EXAMPLE_DIR}") + set(COMMAND_CONCATENATE_COMPOSE "&") + set(COMMAND_BACKGROUND_JOB_COMPOSE "") + # Windows configurations elseif(WIN32) # Find pwsh @@ -47,26 +77,54 @@ elseif(WIN32) message(FATAL_ERROR "pwsh not found") endif() - set(PWSH_EXECUTABLE ${BASH_EXECUTABLE}) + set(PWSH_VERSION_DOCKER "latest") + set(SHELL_EXECUTABLE "C:/\"Program Files\"/PowerShell/${PWSH_VERSION_DOCKER}/pwsh.exe") + set(FILE_EXTENSION ".exe") + set(DOCKER_IMAGE_NAME "windows-testing") - # We don't know which docker image to use for Windows yet - message(FATAL_ERROR "Windows not supported yet") + cmake_path(GET fastcdr_LIB_DIR PARENT_PATH fastcdr_INSTALL_DIR) + # Ensure drives in docker are mounted in C: drive + string(REGEX REPLACE ".:" "C:" CMAKE_INSTALL_PREFIX_C ${CMAKE_INSTALL_PREFIX}) + string(REGEX REPLACE ".:" "C:" PROJECT_BINARY_DIR_C ${PROJECT_BINARY_DIR}) + string(REGEX REPLACE ".:" "C:" fastcdr_INSTALL_DIR_C ${fastcdr_INSTALL_DIR}) + + set(PROJECT_BINATY_DIR_COMPOSE_VOLUME "${PROJECT_BINARY_DIR}:${PROJECT_BINARY_DIR_C}") + set(fastcdr_LIB_DIR_COMPOSE_VOLUME "${fastcdr_INSTALL_DIR}/bin:${fastcdr_INSTALL_DIR_C}/bin") + set(CMAKE_INSTALL_PREFIX_COMPOSE_VOLUME "${CMAKE_INSTALL_PREFIX}/bin:${CMAKE_INSTALL_PREFIX_C}/bin") + + set(PATH_ENVIRONMENT_VARIABLE_COMPOSE "PATH: C:/Program Files/OpenSSL-Win64;${CMAKE_INSTALL_PREFIX_C}/bin;${fastcdr_INSTALL_DIR_C}/bin;C:/Windows/System32;C:/Windows/System32/downlevel;") + set(EXAMPLE_PREFIX_DIR_COMPOSE "${PROJECT_BINARY_DIR_C}/examples/cpp") + if (CMAKE_BUILD_TYPE) + set(EXAMPLE_SUFFIX_DIR_COMPOSE "${CMAKE_BUILD_TYPE}") + else() + set(EXAMPLE_SUFFIX_DIR_COMPOSE "Release") + endif() + set(FASTDDS_DEFAULT_PROFILES_FILE_PREFIX_COMPOSE "${PROJECT_BINARY_DIR_C}/examples/cpp") + set(COMMAND_EXAMPLE_DIR_PREFIX_COMPOSE "& $\$Env:EXAMPLE_DIR") + set(COMMAND_CONCATENATE_COMPOSE "&\" \"") + set(COMMAND_BACKGROUND_JOB_COMPOSE "; Receive-Job 1 -Wait") + + set(WIN_DOCKERFILE ${CMAKE_CURRENT_LIST_DIR}/windows/Dockerfile) + # Generate image for testing + add_custom_target( + windows_docker_image_testing_generation + ALL + # Launch the docker build command using the build context. + COMMAND ${DOCKER_EXECUTABLE} build + --tag ${DOCKER_IMAGE_NAME} + --file ${WIN_DOCKERFILE} + ${CMAKE_CURRENT_LIST_DIR} + COMMENT "Creating windows image for testing..." VERBATIM + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) # Unsupported platform else() message(FATAL_ERROR "Unsupported platform") endif() -# Configure TinyXML2 library path if installed in user library path -if(NOT (TINYXML2_FROM_SOURCE OR TINYXML2_FROM_THIRDPARTY)) - get_filename_component(TINYXML2_LIB_DIR ${TINYXML2_LIBRARY} DIRECTORY) - set(TINYXML2_LIB_DIR_COMPOSE_VOLUME "- ${TINYXML2_LIB_DIR}:${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR}/fastdds:ro") - set(TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH ":${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR}/fastdds") -endif() - # Find all pytest files for testing -file(GLOB examples_python_tests RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.py) +file(GLOB examples_python_tests RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*world.py) # Add security test only if security is enabled if (NOT SECURITY) diff --git a/test/examples/hello_world.compose.yml b/test/examples/hello_world.compose.yml index affe3533b8a..be66e11d6b8 100644 --- a/test/examples/hello_world.compose.yml +++ b/test/examples/hello_world.compose.yml @@ -11,33 +11,32 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -version: "3" services: waitset-subscriber: image: @DOCKER_IMAGE_NAME@ volumes: - - @PROJECT_BINARY_DIR@:@PROJECT_BINARY_DIR@ - - @fastcdr_LIB_DIR@:@fastcdr_LIB_DIR@ + - @PROJECT_BINATY_DIR_COMPOSE_VOLUME@ + - @fastcdr_LIB_DIR_COMPOSE_VOLUME@ + - @CMAKE_INSTALL_PREFIX_COMPOSE_VOLUME@ @TINYXML2_LIB_DIR_COMPOSE_VOLUME@ environment: - # TODO(eduponz): LD_LIBRARY_PATH is not the correct variable for Windows - LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ - EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/hello_world@FILE_EXTENSION@ - FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/hello_world/hello_world_profile.xml - command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/hello_world@FILE_EXTENSION@ subscriber --waitset --samples 10" + @PATH_ENVIRONMENT_VARIABLE_COMPOSE@ + EXAMPLE_DIR: @EXAMPLE_PREFIX_DIR_COMPOSE@/hello_world/@EXAMPLE_SUFFIX_DIR_COMPOSE@ + FASTDDS_DEFAULT_PROFILES_FILE: @FASTDDS_DEFAULT_PROFILES_FILE_PREFIX_COMPOSE@/hello_world/hello_world_profile.xml + command: @SHELL_EXECUTABLE@ -c "@COMMAND_EXAMPLE_DIR_PREFIX_COMPOSE@/hello_world@FILE_EXTENSION@ subscriber --waitset --samples 10" subscriber-publisher: image: @DOCKER_IMAGE_NAME@ volumes: - - @PROJECT_BINARY_DIR@:@PROJECT_BINARY_DIR@ - - @fastcdr_LIB_DIR@:@fastcdr_LIB_DIR@ + - @PROJECT_BINATY_DIR_COMPOSE_VOLUME@ + - @fastcdr_LIB_DIR_COMPOSE_VOLUME@ + - @CMAKE_INSTALL_PREFIX_COMPOSE_VOLUME@ @TINYXML2_LIB_DIR_COMPOSE_VOLUME@ environment: - # TODO(eduponz): LD_LIBRARY_PATH is not the correct variable for Windows - LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ - EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/hello_world - FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/hello_world/hello_world_profile.xml - command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/hello_world@FILE_EXTENSION@ subscriber --samples 10 & $${EXAMPLE_DIR}/hello_world@FILE_EXTENSION@ publisher --samples 10" + @PATH_ENVIRONMENT_VARIABLE_COMPOSE@ + EXAMPLE_DIR: @EXAMPLE_PREFIX_DIR_COMPOSE@/hello_world/@EXAMPLE_SUFFIX_DIR_COMPOSE@ + FASTDDS_DEFAULT_PROFILES_FILE: @FASTDDS_DEFAULT_PROFILES_FILE_PREFIX_COMPOSE@/hello_world/hello_world_profile.xml + command: @SHELL_EXECUTABLE@ -c "@COMMAND_EXAMPLE_DIR_PREFIX_COMPOSE@/hello_world@FILE_EXTENSION@ publisher --samples 10 --matched 2 @COMMAND_CONCATENATE_COMPOSE@ @COMMAND_EXAMPLE_DIR_PREFIX_COMPOSE@/hello_world@FILE_EXTENSION@ subscriber --samples 10@COMMAND_BACKGROUND_JOB_COMPOSE@" depends_on: - waitset-subscriber diff --git a/test/examples/test_hello_world.py b/test/examples/test_hello_world.py index 56503c5d988..f643f51a417 100644 --- a/test/examples/test_hello_world.py +++ b/test/examples/test_hello_world.py @@ -20,7 +20,7 @@ def test_hello_world(): out = '' try: out = subprocess.check_output( - '@DOCKER_EXECUTABLE@ compose -f hello_world.compose.yml up', + '"@DOCKER_EXECUTABLE@" compose -f hello_world.compose.yml up', stderr=subprocess.STDOUT, shell=True, timeout=20 @@ -34,7 +34,7 @@ def test_hello_world(): if 'RECEIVED' in line: received += 1 - + if sent != 0 and received != 0 and sent * 2 == received: ret = True else: @@ -42,9 +42,8 @@ def test_hello_world(): ' (expected: ' + str(sent * 2) + ')') raise subprocess.CalledProcessError(1, '') - except subprocess.CalledProcessError: - for l in out: - print(l) + except subprocess.CalledProcessError as e: + print ('ERROR %s', e.output) except subprocess.TimeoutExpired: print('TIMEOUT') print(out) diff --git a/test/examples/windows/Dockerfile b/test/examples/windows/Dockerfile new file mode 100644 index 00000000000..6d4fcd72d94 --- /dev/null +++ b/test/examples/windows/Dockerfile @@ -0,0 +1,12 @@ +FROM mcr.microsoft.com/powershell:windowsservercore-ltsc2022 + +SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +# Install Chocolately +RUN Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) + +# Install VC++ Redistributable 2022 +RUN choco install -y vcredist140 + +# Install OpenSSL latest +RUN choco install -y openssl