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

Fix tests failing with subprocess aborted error [16199] #3094

Merged
merged 9 commits into from
Nov 23, 2022
Merged
2 changes: 2 additions & 0 deletions test/blackbox/api/dds-pim/PubSubParticipant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,8 @@ class PubSubParticipant
bool update_user_data(
const std::vector<eprosima::fastrtps::rtps::octet>& user_data)
{
// Update QoS before updating user data as statistics properties might have changed internally
participant_qos_ = participant_->get_qos();
participant_qos_.user_data().data_vec(user_data);
return ReturnCode_t::RETCODE_OK == participant_->set_qos(participant_qos_);
}
Expand Down
2 changes: 1 addition & 1 deletion test/blackbox/common/DDSBlackboxTestsUserDataQos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class UserDataQos : public testing::TestWithParam<communication_type>

/**
* This test checks that the user data updates once the participant is initialized are correctly applied
* In order to check that the user data is correctly updated, tow participants are created and the discovery info is
* In order to check that the user data is correctly updated, two participants are created and the discovery info is
* checked.
*/
TEST_P(UserDataQos, update_user_data_qos)
Expand Down
1 change: 0 additions & 1 deletion test/blackbox/common/TCPReqRepHelloWorldReplier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ void TCPReqRepHelloWorldReplier::init(
descriptor->tls_config.add_option(TLSOptions::SINGLE_DH_USE);
descriptor->tls_config.add_option(TLSOptions::NO_COMPRESSION);
descriptor->tls_config.add_option(TLSOptions::NO_SSLV2);
descriptor->tls_config.add_option(TLSOptions::NO_SSLV3);
}

pattr.rtps.userTransports.push_back(descriptor);
Expand Down
1 change: 0 additions & 1 deletion test/blackbox/common/TCPReqRepHelloWorldRequester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ void TCPReqRepHelloWorldRequester::init(
descriptor->tls_config.add_option(TLSOptions::SINGLE_DH_USE);
descriptor->tls_config.add_option(TLSOptions::NO_COMPRESSION);
descriptor->tls_config.add_option(TLSOptions::NO_SSLV2);
descriptor->tls_config.add_option(TLSOptions::NO_SSLV3);
}

pattr.rtps.userTransports.push_back(descriptor);
Expand Down
5 changes: 4 additions & 1 deletion test/unittest/dds/topic/DDSSQLFilter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ target_link_libraries(DDSSQLFilterTests fastcdr foonathan_memory
${CMAKE_DL_LIBS})
add_gtest(DDSSQLFilterTests SOURCES ${DDSSQLFILTERTEST_SOURCES})

# Tests with specific timeout
set_tests_properties("DDSSQLFilterValueTests.test_filtered_value" PROPERTIES TIMEOUT 500)

if(ANDROID)
set_property(TARGET DDSSQLFilterTests PROPERTY CROSSCOMPILING_EMULATOR "adb;shell;cd;${CMAKE_CURRENT_BINARY_DIR};&&")
endif()
endif()
129 changes: 80 additions & 49 deletions test/unittest/dds/topic/DDSSQLFilter/DDSSQLFilterTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,48 @@ static const std::map<std::string, std::set<std::string>> type_compatibility_mat
{"ENUM2_STR", {"ENUM2", "CHAR", "STRING"}}
};

static const std::vector<std::string> operators
jparisu marked this conversation as resolved.
Show resolved Hide resolved
{
" = ", " > ", " >= ", " < ", " <= ", " <> ", " != "
};

static const std::vector<std::pair<std::string, std::string>> checks_compare
{
// string values
{"'XYZ'", "STRING"},
{"'%XYZ'", "STRING"},
{"'XYZ%'", "STRING"},
{"'%X%Y%Z%'", "STRING"},
// Char values
{"'A'", "CHAR"},
{"'%'", "CHAR"},
{"'''", "CHAR"},
// Boolean values
{"FALSE", "BOOL"},
{"false", "BOOL"},
{"TRUE", "BOOL"},
{"true", "BOOL"},
// Integer values
{"1", "INT"},
{"-1", "INT"},
{"0xabcdef", "INT"},
{"-0xFEEDBAC0", "INT"},
// Floating point values
{"1.0", "FLOAT"},
{"-1.0", "FLOAT"},
{"1e2", "FLOAT"},
{"-1e2", "FLOAT"},
// Enum Color values
{"'RED'", "ENUM_STR"},
{"'GREEN'", "ENUM_STR"},
{"'BLUE'", "ENUM_STR"},
// Enum Material values
{"'WOOD'", "ENUM2_STR"},
{"'PLASTIC'", "ENUM2_STR"},
{"'METAL'", "ENUM2_STR"},
{"'CONCRETE'", "ENUM2_STR"},
};

static bool are_types_compatible(
const std::string& type1,
const std::string& type2)
Expand Down Expand Up @@ -132,6 +174,7 @@ class DDSSQLFilterTests : public testing::Test
void run(
const std::vector<TestCase>& test_cases)
{
std::cout << "Test Cases: " << test_cases.size() << std::endl;
for (const TestCase& tc : test_cases)
{
run(tc);
Expand Down Expand Up @@ -406,13 +449,8 @@ TEST_F(DDSSQLFilterTests, type_compatibility_match)
}
}

TEST_F(DDSSQLFilterTests, type_compatibility_compare)
TEST_F(DDSSQLFilterTests, type_compatibility_compare_field_op_field)
{
static const std::vector<std::string> operators
{
" = ", " > ", " >= ", " < ", " <= ", " <> ", " != "
};

// field1 OP field2
{
std::vector<TestCase> test_cases;
Expand All @@ -430,52 +468,16 @@ TEST_F(DDSSQLFilterTests, type_compatibility_compare)
}
run(test_cases);
}
}

TEST_F(DDSSQLFilterTests, type_compatibility_compare_field_op_operand)
{
// field OP operand
// operand OP field
// operand OP operand
{
static const std::vector<std::pair<std::string, std::string>> checks
{
// string values
{"'XYZ'", "STRING"},
{"'%XYZ'", "STRING"},
{"'XYZ%'", "STRING"},
{"'%X%Y%Z%'", "STRING"},
// Char values
{"'A'", "CHAR"},
{"'%'", "CHAR"},
{"'''", "CHAR"},
// Boolean values
{"FALSE", "BOOL"},
{"false", "BOOL"},
{"TRUE", "BOOL"},
{"true", "BOOL"},
// Integer values
{"1", "INT"},
{"-1", "INT"},
{"0xabcdef", "INT"},
{"-0xFEEDBAC0", "INT"},
// Floating point values
{"1.0", "FLOAT"},
{"-1.0", "FLOAT"},
{"1e2", "FLOAT"},
{"-1e2", "FLOAT"},
// Enum Color values
{"'RED'", "ENUM_STR"},
{"'GREEN'", "ENUM_STR"},
{"'BLUE'", "ENUM_STR"},
// Enum Material values
{"'WOOD'", "ENUM2_STR"},
{"'PLASTIC'", "ENUM2_STR"},
{"'METAL'", "ENUM2_STR"},
{"'CONCRETE'", "ENUM2_STR"},
};

std::vector<TestCase> test_cases;
for (const auto& field : primitive_fields)
{
for (auto& check : checks)
for (auto& check : checks_compare)
{
bool ok = are_types_compatible(field.second, check.second);
ReturnCode_t ret = ok ? ok_code : bad_code;
Expand All @@ -487,8 +489,28 @@ TEST_F(DDSSQLFilterTests, type_compatibility_compare)
test_cases.emplace_back(TestCase{ field.first + op + "%0", {check.first}, ret });
test_cases.emplace_back(TestCase{ field.first + op + "%1", {check.first}, bad_code });
test_cases.emplace_back(TestCase{ field.first + op + "%0", {}, bad_code });
}
}
}

// operand OP field
run(test_cases);
}
}

TEST_F(DDSSQLFilterTests, type_compatibility_compare_operand_op_field)
{
// operand OP field
{
std::vector<TestCase> test_cases;
for (const auto& field : primitive_fields)
{
for (auto& check : checks_compare)
{
bool ok = are_types_compatible(field.second, check.second);
ReturnCode_t ret = ok ? ok_code : bad_code;

for (const std::string& op : operators)
{
test_cases.emplace_back(TestCase{ check.first + op + field.first, {}, ret });
test_cases.emplace_back(TestCase{ "%0" + op + field.first, {check.first}, ret });
test_cases.emplace_back(TestCase{ "%1" + op + field.first, {check.first}, bad_code });
Expand All @@ -497,9 +519,18 @@ TEST_F(DDSSQLFilterTests, type_compatibility_compare)
}
}

for (const auto& check1 : checks)
run(test_cases);
}
}

TEST_F(DDSSQLFilterTests, type_compatibility_compare_operand_op_operand)
{
// operand OP operand
{
std::vector<TestCase> test_cases;
for (const auto& check1 : checks_compare)
{
for (auto& check2 : checks)
for (auto& check2 : checks_compare)
{
for (const std::string& op : operators)
{
Expand Down
4 changes: 3 additions & 1 deletion test/unittest/logging/log_macros/LogMacrosDefaultTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ TEST_F(LogMacrosTests, default_macros_test)
# endif // Visual Studio specific behavior
#endif // Check default macro values

#if !HAVE_LOG_NO_INFO && (defined(_DEBUG) || defined(__DEBUG) || !defined(NDEBUG))
#if !HAVE_LOG_NO_INFO && \
((defined(__INTERNALDEBUG) || defined(_INTERNALDEBUG)) && (defined(_DEBUG) || defined(__DEBUG) || \
!defined(NDEBUG)))
static constexpr unsigned int expected_result = 3;
#else
static constexpr unsigned int expected_result = 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ TEST_F(StatisticsDomainParticipantTests, EnableDisableStatisticsDataWriterTest)
create_participant(0, eprosima::fastdds::dds::PARTICIPANT_QOS_DEFAULT);
ASSERT_NE(participant, nullptr);

eprosima::fastdds::dds::DataWriterQos inconsistent_qos = eprosima::fastdds::dds::DATAWRITER_QOS_DEFAULT;
eprosima::fastdds::dds::DataWriterQos inconsistent_qos = STATISTICS_DATAWRITER_QOS;
inconsistent_qos.reliability().kind = eprosima::fastdds::dds::BEST_EFFORT_RELIABILITY_QOS;
inconsistent_qos.ownership().kind = eprosima::fastdds::dds::EXCLUSIVE_OWNERSHIP_QOS;

Expand Down
5 changes: 0 additions & 5 deletions test/unittest/statistics/rtps/RTPSStatisticsTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -702,8 +702,6 @@ TEST_F(RTPSStatisticsTests, statistics_rpts_listener_callbacks)
// wait for acknowledgement
EXPECT_TRUE(writer_->wait_for_all_acked(Duration_t(5, 0)));

reader_->releaseCache(reader_change);

EXPECT_TRUE(writer_->remove_statistics_listener(writer_listener));
EXPECT_TRUE(reader_->remove_statistics_listener(reader_listener));

Expand Down Expand Up @@ -796,8 +794,6 @@ TEST_F(RTPSStatisticsTests, statistics_rpts_listener_callbacks_fragmented)
// wait for acknowledgement
EXPECT_TRUE(writer_->wait_for_all_acked(Duration_t(1, 0)));

reader_->releaseCache(reader_change);

EXPECT_TRUE(participant_->remove_statistics_listener(participant_listener, mask));
}

Expand Down Expand Up @@ -865,7 +861,6 @@ TEST_F(RTPSStatisticsTests, statistics_rpts_listener_gap_callback)

// wait for acknowledgement
EXPECT_TRUE(writer_->wait_for_all_acked(Duration_t(1, 0)));
reader_->releaseCache(reader_change);

// release the listeners
EXPECT_TRUE(writer_->remove_statistics_listener(writer_listener));
Expand Down
16 changes: 9 additions & 7 deletions test/unittest/transport/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ if(TLS_FOUND)
${CMAKE_CURRENT_BINARY_DIR}/mainsubcert.pem COPYONLY)
configure_file(${PROJECT_SOURCE_DIR}/test/certs/mainsubkey.pem
${CMAKE_CURRENT_BINARY_DIR}/mainsubkey.pem COPYONLY)
configure_file(${PROJECT_SOURCE_DIR}/test/unittest/transport/ca.pem
${CMAKE_CURRENT_BINARY_DIR}/ca.pem COPYONLY)
configure_file(${PROJECT_SOURCE_DIR}/test/unittest/transport/server.pem
${CMAKE_CURRENT_BINARY_DIR}/server.pem COPYONLY)
configure_file(${PROJECT_SOURCE_DIR}/test/unittest/transport/dh2048.pem
${CMAKE_CURRENT_BINARY_DIR}/dh2048.pem COPYONLY)
configure_file(${PROJECT_SOURCE_DIR}/test/unittest/transport/certs/ca.crt
${CMAKE_CURRENT_BINARY_DIR}/ca.crt COPYONLY)
configure_file(${PROJECT_SOURCE_DIR}/test/unittest/transport/certs/fastdds.crt
${CMAKE_CURRENT_BINARY_DIR}/fastdds.crt COPYONLY)
configure_file(${PROJECT_SOURCE_DIR}/test/unittest/transport/certs/fastdds.key
${CMAKE_CURRENT_BINARY_DIR}/fastdds.key COPYONLY)
configure_file(${PROJECT_SOURCE_DIR}/test/unittest/transport/certs/dh_params.pem
${CMAKE_CURRENT_BINARY_DIR}/dh_params.pem COPYONLY)
#configure_file(${PROJECT_SOURCE_DIR}/test/certs/governance_helloworld_all_enable.smime
# ${CMAKE_CURRENT_BINARY_DIR}/governance_helloworld_all_enable.smime COPYONLY)
#configure_file(${PROJECT_SOURCE_DIR}/test/certs/permissions_helloworld.smime
Expand Down Expand Up @@ -402,4 +404,4 @@ if(ANDROID)
set_property(TARGET TCPv6Tests PROPERTY CROSSCOMPILING_EMULATOR "adb;shell;cd;${CMAKE_CURRENT_BINARY_DIR};&&")
set_property(TARGET SharedMemTests PROPERTY CROSSCOMPILING_EMULATOR "adb;shell;cd;${CMAKE_CURRENT_BINARY_DIR};&&")
set_property(TARGET test_UDPv4Tests PROPERTY CROSSCOMPILING_EMULATOR "adb;shell;cd;${CMAKE_CURRENT_BINARY_DIR};&&")
endif()
endif()
30 changes: 16 additions & 14 deletions test/unittest/transport/TCPv4Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,23 +470,26 @@ TEST_F(TCPv4Tests, send_and_receive_between_secure_ports_client_verifies)
TCPv4TransportDescriptor recvDescriptor;
recvDescriptor.add_listener_port(g_default_port);
recvDescriptor.apply_security = true;
recvDescriptor.tls_config.password = "test";
recvDescriptor.tls_config.cert_chain_file = "server.pem";
recvDescriptor.tls_config.private_key_file = "server.pem";
recvDescriptor.tls_config.tmp_dh_file = "dh2048.pem";
recvDescriptor.tls_config.password = "fastddspwd";
recvDescriptor.tls_config.cert_chain_file = "fastdds.crt";
recvDescriptor.tls_config.private_key_file = "fastdds.key";
recvDescriptor.tls_config.tmp_dh_file = "dh_params.pem";
recvDescriptor.tls_config.verify_mode = TLSVerifyMode::VERIFY_PEER;
recvDescriptor.tls_config.add_option(TLSOptions::DEFAULT_WORKAROUNDS);
recvDescriptor.tls_config.add_option(TLSOptions::SINGLE_DH_USE);
//recvDescriptor.tls_config.add_option(TLSOptions::NO_COMPRESSION);
recvDescriptor.tls_config.add_option(TLSOptions::NO_SSLV2);
//recvDescriptor.tls_config.add_option(TLSOptions::NO_SSLV3);
recvDescriptor.tls_config.add_option(TLSOptions::NO_COMPRESSION);
TCPv4Transport receiveTransportUnderTest(recvDescriptor);
receiveTransportUnderTest.init();

TCPv4TransportDescriptor sendDescriptor;
sendDescriptor.apply_security = true;
//sendDescriptor.tls_config.password = "test";
sendDescriptor.tls_config.verify_file = "ca.pem";
sendDescriptor.tls_config.verify_file = "ca.crt";
sendDescriptor.tls_config.verify_mode = TLSVerifyMode::VERIFY_PEER;
recvDescriptor.tls_config.add_option(TLSOptions::DEFAULT_WORKAROUNDS);
sendDescriptor.tls_config.add_option(TLSOptions::SINGLE_DH_USE);
sendDescriptor.tls_config.add_option(TLSOptions::NO_SSLV2);
recvDescriptor.tls_config.add_option(TLSOptions::NO_COMPRESSION);
TCPv4Transport sendTransportUnderTest(sendDescriptor);
sendTransportUnderTest.init();

Expand Down Expand Up @@ -565,8 +568,7 @@ TEST_F(TCPv4Tests, send_and_receive_between_secure_ports_server_verifies)
recvDescriptor.add_listener_port(g_default_port);
recvDescriptor.apply_security = true;
recvDescriptor.tls_config.handshake_role = TLSHSRole::CLIENT;
recvDescriptor.tls_config.password = "test";
recvDescriptor.tls_config.verify_file = "maincacert.pem";
recvDescriptor.tls_config.verify_file = "ca.crt";
recvDescriptor.tls_config.verify_mode = TLSVerifyMode::VERIFY_PEER;
recvDescriptor.tls_config.add_option(TLSOptions::DEFAULT_WORKAROUNDS);
recvDescriptor.tls_config.add_option(TLSOptions::SINGLE_DH_USE);
Expand All @@ -578,10 +580,10 @@ TEST_F(TCPv4Tests, send_and_receive_between_secure_ports_server_verifies)
TCPv4TransportDescriptor sendDescriptor;
sendDescriptor.apply_security = true;
sendDescriptor.tls_config.handshake_role = TLSHSRole::SERVER;
sendDescriptor.tls_config.password = "test";
sendDescriptor.tls_config.cert_chain_file = "server.pem";
sendDescriptor.tls_config.private_key_file = "server.pem";
sendDescriptor.tls_config.tmp_dh_file = "dh2048.pem";
sendDescriptor.tls_config.password = "fastddspwd";
sendDescriptor.tls_config.cert_chain_file = "fastdds.crt";
sendDescriptor.tls_config.private_key_file = "fastdds.key";
sendDescriptor.tls_config.tmp_dh_file = "dh_params.pem";
sendDescriptor.tls_config.verify_mode = TLSVerifyMode::VERIFY_PEER | TLSVerifyMode::VERIFY_FAIL_IF_NO_PEER_CERT;
sendDescriptor.tls_config.add_option(TLSOptions::DEFAULT_WORKAROUNDS);
sendDescriptor.tls_config.add_option(TLSOptions::SINGLE_DH_USE);
Expand Down
Loading