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

[20652] Improve filtering of DNS tests (backport #4603) #4619

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,18 @@ set(MEMORYCHECK_SUPPRESSIONS_FILE ${MEMORYCHECK_SUPPRESSIONS_FILE_TMP} CACHE FIL

# Check if /etc/hosts file has been modified to add dummy host test subjects
if(WIN32)
execute_process(COMMAND powershell -C Resolve-DNSName www.acme.com.test
execute_process(COMMAND powershell -C Resolve-DNSName -Name www.acme.com.test -CacheOnly
RESULT_VARIABLE EPROSIMA_TEST_DNS_NOT_SET_UP OUTPUT_QUIET ERROR_QUIET)
else(WIN32)
elseif(APPLE)
execute_process(
COMMAND dscacheutil -q host -a name www.acme.com.test
COMMAND grep www.acme.com.test
RESULT_VARIABLE EPROSIMA_TEST_DNS_NOT_SET_UP OUTPUT_QUIET ERROR_QUIET)
else()
execute_process(COMMAND getent hosts www.acme.com.test
RESULT_VARIABLE EPROSIMA_TEST_DNS_NOT_SET_UP OUTPUT_QUIET ERROR_QUIET)
endif(WIN32)
endif()
message(STATUS "EPROSIMA_TEST_DNS_NOT_SET_UP: '${EPROSIMA_TEST_DNS_NOT_SET_UP}'")

###############################################################################
# Testing
Expand Down
17 changes: 12 additions & 5 deletions test/blackbox/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,20 @@ endif()

# Filter pksc11 related tests if library is not available
if(NOT LibP11_FOUND)
set(pkcs_filter "-*pkcs*")
set(pkcs_filter "*pkcs*")
endif() # LibP11_FOUND

if(EPROSIMA_TEST_DNS_NOT_SET_UP)
set(dns_filter "-*ServerClientEnvironmentSetUpDNS*")
set(dns_filter "*ServerClientEnvironmentSetUpDNS*")
endif()

string(JOIN ":" BLACKBOX_HIGH_LEVEL_IGNORED_TESTS ${pkcs_filter} ${dns_filter})
if(NOT BLACKBOX_HIGH_LEVEL_IGNORED_TESTS STREQUAL "")
message(STATUS "Ignoring tests '${BLACKBOX_HIGH_LEVEL_IGNORED_TESTS}'")
string(PREPEND BLACKBOX_HIGH_LEVEL_IGNORED_TESTS "-")
endif()
message(STATUS "BLACKBOX_HIGH_LEVEL_IGNORED_TESTS set to '${BLACKBOX_HIGH_LEVEL_IGNORED_TESTS}'")

file(GLOB RTPS_BLACKBOXTESTS_TEST_SOURCE "common/RTPSBlackboxTests*.cpp")
set(RTPS_BLACKBOXTESTS_SOURCE ${RTPS_BLACKBOXTESTS_TEST_SOURCE}
types/Data1mb.cxx
Expand Down Expand Up @@ -100,7 +107,7 @@ target_include_directories(BlackboxTests_RTPS PRIVATE
target_link_libraries(BlackboxTests_RTPS fastrtps fastcdr foonathan_memory GTest::gtest)
gtest_discover_tests(BlackboxTests_RTPS
TEST_PREFIX "BlackboxTests_RTPS."
TEST_FILTER ${pkcs_filter}
TEST_FILTER ${BLACKBOX_HIGH_LEVEL_IGNORED_TESTS}
NO_PRETTY_VALUES
)

Expand Down Expand Up @@ -226,7 +233,7 @@ if(FASTRTPS_API_TESTS)
ENVIRONMENT "MULTICAST_PORT_RANDOM_NUMBER=${MULTICAST_PORT_RANDOM_NUMBER}"
ENVIRONMENT $<IF:$<BOOL:${OPENSSL_CONF}>,OPENSSL_CONF=${OPENSSL_CONF},>
TEST_PREFIX "BlackboxTests_FastRTPS."
TEST_FILTER ${pkcs_filter} ${dns_filter}
TEST_FILTER ${BLACKBOX_HIGH_LEVEL_IGNORED_TESTS}
NO_PRETTY_VALUES
)
endif(FASTRTPS_API_TESTS)
Expand Down Expand Up @@ -281,7 +288,7 @@ if(FASTDDS_PIM_API_TESTS)
ENVIRONMENT "MULTICAST_PORT_RANDOM_NUMBER=${MULTICAST_PORT_RANDOM_NUMBER}"
ENVIRONMENT $<IF:$<BOOL:${OPENSSL_CONF}>,OPENSSL_CONF=${OPENSSL_CONF},>
TEST_PREFIX "BlackboxTests_DDS_PIM."
TEST_FILTER ${pkcs_filter} ${dns_filter}
TEST_FILTER ${BLACKBOX_HIGH_LEVEL_IGNORED_TESTS}
NO_PRETTY_VALUES
)
endif(FASTDDS_PIM_API_TESTS)
Expand Down
1 change: 1 addition & 0 deletions test/unittest/dds/participant/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ target_link_libraries(ParticipantTests fastrtps fastcdr foonathan_memory
${CMAKE_DL_LIBS})

if(EPROSIMA_TEST_DNS_NOT_SET_UP)
message(STATUS "Ignoring 'ParticipantTests.SimpleParticipantRemoteServerListConfigurationDNS'")
set(dns_filter "-ParticipantTests.SimpleParticipantRemoteServerListConfigurationDNS")
endif()

Expand Down
11 changes: 2 additions & 9 deletions test/unittest/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,18 +119,11 @@ if(QNX)
target_link_libraries(LocatorTests socket)
endif()
if(EPROSIMA_TEST_DNS_NOT_SET_UP)
set(IGNORE_COMMAND LocatorDNSTests)
message(STATUS "Ignoring 'LocatorDNSTests*'")
set(IGNORE_COMMAND "-LocatorDNSTests*")
endif()
gtest_discover_tests(LocatorTests TEST_FILTER ${IGNORE_COMMAND})
unset(IGNORE_COMMAND)
# Skip DNS related tests when not running on our CI
if(NOT(EPROSIMA_BUILD))
message(STATUS "Ignoring DNS tests")
set(CTEST_CUSTOM_TESTS_IGNORE
${CTEST_CUSTOM_TESTS_IGNORE}
LocatorDNSTests
)
endif()

add_executable(FixedSizeQueueTests ${FIXEDSIZEQUEUETESTS_SOURCE})
target_include_directories(FixedSizeQueueTests PRIVATE
Expand Down
Loading