build: prevent collision between homonymous ns-3 modules and dependencies

This commit is contained in:
Gabriel Ferreira
2023-03-31 23:20:43 -03:00
parent 8aca64eacc
commit 043199ce9d
2 changed files with 27 additions and 0 deletions

View File

@@ -144,6 +144,15 @@ function(build_lib)
foreach(library ${BLIB_LIBRARIES_TO_LINK})
remove_lib_prefix("${library}" module_name)
# Ignore the case where the library dependency name match the ns-3 module
# since it is most likely is due to brite, click and openflow collisions.
# All the ns-3 module targets should be prefixed with 'lib' to be
# differentiable.
if("${library}" STREQUAL "${BLIB_LIBNAME}")
list(APPEND non_ns_libraries_to_link ${library})
continue()
endif()
# Check if the module exists in the ns-3 modules list or if it is a
# 3rd-party library
if(${module_name} IN_LIST ns3-all-enabled-modules)

View File

@@ -2320,6 +2320,24 @@ class NS3BuildBaseTestCase(NS3BaseTestCase):
return_code, stdout, stderr = run_program("test.py", "-p ./examples/wireless/mixed-wired-wireless", python=True)
self.assertEqual(return_code, 0)
def test_13_FetchOptionalComponents(self):
"""!
Test if we had regressions with brite, click and openflow modules
that depend on homonymous libraries
@return None
"""
if shutil.which("git") is None:
self.skipTest("Missing git")
# First enable automatic components fetching
return_code, stdout, stderr = run_ns3("configure -- -DNS3_FETCH_OPTIONAL_COMPONENTS=ON")
self.assertEqual(return_code, 0)
# Build the optional components to check if their dependencies were fetched
# and there were no build regressions
return_code, stdout, stderr = run_ns3("build brite click openflow")
self.assertEqual(return_code, 0)
class NS3ExpectedUseTestCase(NS3BaseTestCase):
"""!