Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[21886] Run examples in windows ci playground #5347

Closed
wants to merge 10 commits into from
2 changes: 1 addition & 1 deletion .github/workflows/config/fastdds_build.meta
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/config/fastdds_test.meta
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
57 changes: 0 additions & 57 deletions .github/workflows/mac-ci.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/reusable-windows-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ defaults:

jobs:
reusable-windows-ci:
runs-on: windows-2019
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -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 }}

Expand Down
77 changes: 0 additions & 77 deletions .github/workflows/sanitizers-ci.yml

This file was deleted.

72 changes: 0 additions & 72 deletions .github/workflows/ubuntu-ci.yml

This file was deleted.

38 changes: 38 additions & 0 deletions examples/cpp/hello_world/CLIParser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class CLIParser
struct publisher_config
{
uint16_t samples = 0;
uint16_t matched = 1;
};

//! Subscriber application configuration structure
Expand Down Expand Up @@ -83,6 +84,9 @@ class CLIParser
std::cout << " -s <num>, --samples <num> Number of samples to send or receive" << std::endl;
std::cout << " [0 <= <num> <= 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);
Expand Down Expand Up @@ -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<std::uint16_t>::min() ||
input > std::numeric_limits<std::uint16_t>::max())
{
throw std::out_of_range("matched argument out of range");
}
else
{
if (config.entity == CLIParser::EntityKind::PUBLISHER)
{
config.pub_config.matched = static_cast<uint16_t>(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);
Expand Down
3 changes: 2 additions & 1 deletion examples/cpp/hello_world/PublisherApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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())
Expand Down
2 changes: 2 additions & 0 deletions examples/cpp/hello_world/PublisherApp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ class PublisherApp : public Application, public DataWriterListener

uint16_t samples_;

uint16_t expected_matches_;

std::mutex mutex_;

std::condition_variable cv_;
Expand Down
Loading