build, docs: Replace python-based with cmake-based .ns3rc files

This commit is contained in:
Gabriel Ferreira
2022-07-21 22:15:19 -03:00
parent 4e03143b2e
commit 3e43ef1742
8 changed files with 350 additions and 190 deletions

View File

@@ -55,6 +55,9 @@ Changes from ns-3.36 to ns-3.37
* Replaced `./ns3 --check-profile` with `./ns3 show profile`.
* Replaced `./ns3 --check-version` with `./ns3 show version`.
* Added the `build_exec` macro to declare new executables.
* Replaced Python-based .ns3rc with a CMake-based version.
* Deprecated .ns3rc files will be updated to the new CMake-based format and a backup will be placed alongside it.
### Changed behavior

View File

@@ -109,12 +109,15 @@ subdirlist(libs_to_build ${CMAKE_CURRENT_SOURCE_DIR}/src)
subdirlist(contrib_libs_to_build ${CMAKE_CURRENT_SOURCE_DIR}/contrib)
# Before filtering, we need to load settings from .ns3rc
parse_ns3rc(ns3rc_enabled_modules ns3rc_examples_enabled ns3rc_tests_enabled)
parse_ns3rc(
ns3rc_enabled_modules ns3rc_disabled_modules ns3rc_examples_enabled
ns3rc_tests_enabled
)
# After scanning modules, we can filter enabled and disabled ones
filter_enabled_and_disabled_modules(
libs_to_build contrib_libs_to_build NS3_ENABLED_MODULES NS3_DISABLED_MODULES
ns3rc_enabled_modules
ns3rc_enabled_modules ns3rc_disabled_modules
)
# ##############################################################################

View File

@@ -0,0 +1,21 @@
# A list of the modules that will be enabled when ns-3 is run.
# Modules that depend on the listed modules will be enabled also.
#
# All modules can be enabled by emptying the list.
set(ns3rc_enabled_modules @ns3rc_enabled_modules@)
# A list of the modules that will be disabled when ns-3 is run.
# Modules that depend on the listed modules will be disabled also.
#
# If the list is empty, no module will be disabled.
set(ns3rc_disabled_modules @ns3rc_disabled_modules@)
# Set this equal to ON if you want examples to be run.
set(ns3rc_examples_enabled @ns3rc_examples_enabled@)
# Set this equal to ON if you want tests to be run.
set(ns3rc_tests_enabled @ns3rc_tests_enabled@)
# Override other ns-3 settings by setting their values below
# Note: command-line settings will also be overridden.
#set(NS3_LOG ON)

View File

@@ -1628,8 +1628,14 @@ function(recursive_dependency module_name)
endforeach()
endfunction()
macro(filter_enabled_and_disabled_modules libs_to_build contrib_libs_to_build
NS3_ENABLED_MODULES NS3_DISABLED_MODULES ns3rc_enabled_modules
macro(
filter_enabled_and_disabled_modules
libs_to_build
contrib_libs_to_build
NS3_ENABLED_MODULES
NS3_DISABLED_MODULES
ns3rc_enabled_modules
ns3rc_disabled_modules
)
mark_as_advanced(ns3-all-enabled-modules)
@@ -1676,7 +1682,14 @@ macro(filter_enabled_and_disabled_modules libs_to_build contrib_libs_to_build
endif()
endif()
if(${NS3_DISABLED_MODULES})
if(${NS3_DISABLED_MODULES} OR ${ns3rc_disabled_modules})
# List of disabled modules passed by the command line overwrites list read
# from ns3rc
if(${NS3_DISABLED_MODULES})
set(ns3rc_disabled_modules ${${NS3_DISABLED_MODULES}})
endif()
set(all_libs ${${libs_to_build}};${${contrib_libs_to_build}})
# We then use the recursive dependency finding to get all dependencies of
@@ -1689,7 +1702,7 @@ macro(filter_enabled_and_disabled_modules libs_to_build contrib_libs_to_build
endforeach()
# Now we can begin removing libraries that require disabled dependencies
set(disabled_libs "${${NS3_DISABLED_MODULES}}")
set(disabled_libs "${${ns3rc_disabled_modules}}")
foreach(libo ${all_libs})
foreach(lib ${all_libs})
foreach(disabled_lib ${disabled_libs})
@@ -1735,61 +1748,98 @@ macro(filter_enabled_and_disabled_modules libs_to_build contrib_libs_to_build
endmacro()
# Parse .ns3rc
function(parse_ns3rc enabled_modules examples_enabled tests_enabled)
set(ns3rc ${PROJECT_SOURCE_DIR}/.ns3rc)
# Set parent scope variables with default values (all modules, no examples nor
# tests)
set(${enabled_modules} "" PARENT_SCOPE)
set(${examples_enabled} "FALSE" PARENT_SCOPE)
set(${tests_enabled} "FALSE" PARENT_SCOPE)
if(EXISTS ${ns3rc})
# If ns3rc exists in ns-3-dev, read it
file(READ ${ns3rc} ns3rc_contents)
macro(parse_ns3rc enabled_modules disabled_modules examples_enabled
tests_enabled
)
# Try to find .ns3rc
find_file(NS3RC .ns3rc PATHS /etc $ENV{HOME} $ENV{USERPROFILE}
${PROJECT_SOURCE_DIR} NO_CACHE
)
# Match modules_enabled list
if(ns3rc_contents MATCHES "modules_enabled.*\\[(.*).*\\]")
set(${enabled_modules} ${CMAKE_MATCH_1})
if(${enabled_modules} MATCHES "all_modules")
# If all modules, just clean the filter and all modules will get built
# by default
set(${enabled_modules})
else()
# If modules are listed, remove quotes and replace commas with
# semicolons transforming a string into a cmake list
string(REPLACE "," ";" ${enabled_modules} "${${enabled_modules}}")
string(REPLACE "'" "" ${enabled_modules} "${${enabled_modules}}")
string(REPLACE "\"" "" ${enabled_modules} "${${enabled_modules}}")
string(REPLACE " " "" ${enabled_modules} "${${enabled_modules}}")
string(REPLACE "\n" ";" ${enabled_modules} "${${enabled_modules}}")
list(SORT ${enabled_modules})
# Set variables with default values (all modules, no examples nor tests)
set(${enabled_modules} "")
set(${disabled_modules} "")
set(${examples_enabled} "FALSE")
set(${tests_enabled} "FALSE")
# Remove possibly empty entry
list(REMOVE_ITEM ${enabled_modules} "")
foreach(element ${${enabled_modules}})
# Inspect each element for comments
if(${element} MATCHES "#.*")
list(REMOVE_ITEM ${enabled_modules} ${element})
endif()
endforeach()
endif()
if(NOT (${NS3RC} STREQUAL "NS3RC-NOTFOUND"))
message(${HIGHLIGHTED_STATUS}
"Configuration file .ns3rc being used : ${NS3RC}"
)
file(READ ${NS3RC} ns3rc_contents)
# Check if ns3rc file is CMake or Python based and act accordingly
if(ns3rc_contents MATCHES "ns3rc_*")
include(${NS3RC})
else()
parse_python_ns3rc(
"${ns3rc_contents}" ${enabled_modules} ${examples_enabled}
${tests_enabled} ${NS3RC}
)
endif()
# Match examples_enabled flag
if(ns3rc_contents MATCHES "examples_enabled = (True|False)")
set(${examples_enabled} ${CMAKE_MATCH_1})
endif()
# Match tests_enabled flag
if(ns3rc_contents MATCHES "tests_enabled = (True|False)")
set(${tests_enabled} ${CMAKE_MATCH_1})
endif()
# Save variables to parent scope
set(${enabled_modules} "${${enabled_modules}}" PARENT_SCOPE)
set(${examples_enabled} "${${examples_enabled}}" PARENT_SCOPE)
set(${tests_enabled} "${${tests_enabled}}" PARENT_SCOPE)
endif()
endfunction(parse_ns3rc)
endmacro(parse_ns3rc)
function(parse_python_ns3rc ns3rc_contents enabled_modules examples_enabled
tests_enabled ns3rc_location
)
# Save .ns3rc backup
file(WRITE ${ns3rc_location}.backup ${ns3rc_contents})
# Match modules_enabled list
if(ns3rc_contents MATCHES "modules_enabled.*\\[(.*).*\\]")
set(${enabled_modules} ${CMAKE_MATCH_1})
if(${enabled_modules} MATCHES "all_modules")
# If all modules, just clean the filter and all modules will get built by
# default
set(${enabled_modules})
else()
# If modules are listed, remove quotes and replace commas with semicolons
# transforming a string into a cmake list
string(REPLACE "," ";" ${enabled_modules} "${${enabled_modules}}")
string(REPLACE "'" "" ${enabled_modules} "${${enabled_modules}}")
string(REPLACE "\"" "" ${enabled_modules} "${${enabled_modules}}")
string(REPLACE " " "" ${enabled_modules} "${${enabled_modules}}")
string(REPLACE "\n" ";" ${enabled_modules} "${${enabled_modules}}")
list(SORT ${enabled_modules})
# Remove possibly empty entry
list(REMOVE_ITEM ${enabled_modules} "")
foreach(element ${${enabled_modules}})
# Inspect each element for comments
if(${element} MATCHES "#.*")
list(REMOVE_ITEM ${enabled_modules} ${element})
endif()
endforeach()
endif()
endif()
string(REPLACE "True" "ON" ns3rc_contents ${ns3rc_contents})
string(REPLACE "False" "OFF" ns3rc_contents ${ns3rc_contents})
# Match examples_enabled flag
if(ns3rc_contents MATCHES "examples_enabled = (ON|OFF)")
set(${examples_enabled} ${CMAKE_MATCH_1})
endif()
# Match tests_enabled flag
if(ns3rc_contents MATCHES "tests_enabled = (ON|OFF)")
set(${tests_enabled} ${CMAKE_MATCH_1})
endif()
# Save variables to parent scope
set(${enabled_modules} "${${enabled_modules}}" PARENT_SCOPE)
set(${examples_enabled} "${${examples_enabled}}" PARENT_SCOPE)
set(${tests_enabled} "${${tests_enabled}}" PARENT_SCOPE)
# Save updated .ns3rc file
message(
${HIGHLIGHTED_STATUS}
"The python-based .ns3rc file format is deprecated and was updated to the CMake format"
)
configure_file(
${PROJECT_SOURCE_DIR}/build-support/.ns3rc-template ${ns3rc_location} @ONLY
)
endfunction(parse_python_ns3rc)
function(log_find_searched_paths)
# Parse arguments

View File

@@ -91,39 +91,55 @@ Assuming that you are in the top level |ns3| directory, you can get a copy of th
The .ns3rc file should now be in your top level |ns3| directory, and it contains the following:
.. sourcecode:: python
.. sourcecode:: cmake
#! /usr/bin/env python
# A list of the modules that will be enabled when ns-3 is run.
# Modules that depend on the listed modules will be enabled also.
#
# All modules can be enabled by emptying the list.
set(ns3rc_enabled_modules)
# A list of the modules that will be enabled when ns-3 is run.
# Modules that depend on the listed modules will be enabled also.
#
# All modules can be enabled by choosing 'all_modules'.
modules_enabled = ['all_modules']
# A list of the modules that will be disabled when ns-3 is run.
# Modules that depend on the listed modules will be disabled also.
#
# If the list is empty, no module will be disabled.
set(ns3rc_disabled_modules)
# Set this equal to true if you want examples to be run.
examples_enabled = False
# Set this equal to ON if you want examples to be run.
set(ns3rc_examples_enabled OFF)
# Set this equal to true if you want tests to be run.
tests_enabled = False
# Set this equal to ON if you want tests to be run.
set(ns3rc_tests_enabled OFF)
# Override other ns-3 settings by setting their values below
# Note: command-line settings will also be overridden.
#set(NS3_LOG ON)
Use your favorite editor to modify the .ns3rc file to only enable the core module with examples and tests like this:
.. sourcecode:: python
.. sourcecode:: cmake
#! /usr/bin/env python
# A list of the modules that will be enabled when ns-3 is run.
# Modules that depend on the listed modules will be enabled also.
#
# All modules can be enabled by emptying the list.
set(ns3rc_enabled_modules core)
# A list of the modules that will be enabled when ns-3 is run.
# Modules that depend on the listed modules will be enabled also.
#
# All modules can be enabled by choosing 'all_modules'.
modules_enabled = ['core']
# A list of the modules that will be disabled when ns-3 is run.
# Modules that depend on the listed modules will be disabled also.
#
# If the list is empty, no module will be disabled.
set(ns3rc_disabled_modules)
# Set this equal to true if you want examples to be run.
examples_enabled = True
# Set this equal to ON if you want examples to be run.
set(ns3rc_examples_enabled ON)
# Set this equal to true if you want tests to be run.
tests_enabled = True
# Set this equal to ON if you want tests to be run.
set(ns3rc_tests_enabled ON)
# Override other ns-3 settings by setting their values below
# Note: command-line settings will also be overridden.
#set(NS3_LOG ON)
Only the core module will be enabled now if you try these commands: ::

View File

@@ -98,21 +98,29 @@ Assuming that you are in the top level |ns3| directory, you can get a copy of th
The .ns3rc file should now be in your top level |ns3| directory, and it contains the following:
.. sourcecode:: python
.. sourcecode:: cmake
#! /usr/bin/env python
# A list of the modules that will be enabled when ns-3 is run.
# Modules that depend on the listed modules will be enabled also.
#
# All modules can be enabled by emptying the list.
set(ns3rc_enabled_modules)
# A list of the modules that will be enabled when ns-3 is run.
# Modules that depend on the listed modules will be enabled also.
#
# All modules can be enabled by choosing 'all_modules'.
modules_enabled = ['all_modules']
# A list of the modules that will be disabled when ns-3 is run.
# Modules that depend on the listed modules will be disabled also.
#
# If the list is empty, no module will be disabled.
set(ns3rc_disabled_modules)
# Set this equal to true if you want examples to be run.
examples_enabled = False
# Set this equal to ON if you want examples to be run.
set(ns3rc_examples_enabled OFF)
# Set this equal to true if you want tests to be run.
tests_enabled = False
# Set this equal to ON if you want tests to be run.
set(ns3rc_tests_enabled OFF)
# Override other ns-3 settings by setting their values below
# Note: command-line settings will also be overridden.
#set(NS3_LOG ON)
From the top level |ns3| directory, you can build |ns3| without any
examples or tests simply by doing: ::
@@ -128,23 +136,31 @@ Running test.py now will cause no examples or tests to be run:
If you would like build |ns3| with examples and tests, use your
favorite editor to change the values in the .ns3rc file for
examples_enabled and tests_enabled file to be True:
ns3rc_examples_enabled and ns3rc_tests_enabled file to be True:
.. sourcecode:: python
.. sourcecode:: cmake
#! /usr/bin/env python
# A list of the modules that will be enabled when ns-3 is run.
# Modules that depend on the listed modules will be enabled also.
#
# All modules can be enabled by emptying the list.
set(ns3rc_enabled_modules)
# A list of the modules that will be enabled when ns-3 is run.
# Modules that depend on the listed modules will be enabled also.
#
# All modules can be enabled by choosing 'all_modules'.
modules_enabled = ['all_modules']
# A list of the modules that will be disabled when ns-3 is run.
# Modules that depend on the listed modules will be disabled also.
#
# If the list is empty, no module will be disabled.
set(ns3rc_disabled_modules)
# Set this equal to true if you want examples to be run.
examples_enabled = True
# Set this equal to ON if you want examples to be run.
set(ns3rc_examples_enabled ON)
# Set this equal to true if you want tests to be run.
tests_enabled = True
# Set this equal to ON if you want tests to be run.
set(ns3rc_tests_enabled ON)
# Override other ns-3 settings by setting their values below
# Note: command-line settings will also be overridden.
#set(NS3_LOG ON)
From the top level |ns3| directory, you can build |ns3| with examples
and tests simply by doing: ::

View File

@@ -1,13 +1,21 @@
#! /usr/bin/env python
# A list of the modules that will be enabled when ns-3 is run.
# Modules that depend on the listed modules will be enabled also.
#
# All modules can be enabled by choosing 'all_modules'.
modules_enabled = ['all_modules']
# All modules can be enabled by emptying the list.
set(ns3rc_enabled_modules)
# Set this equal to true if you want examples to be run.
examples_enabled = False
# A list of the modules that will be disabled when ns-3 is run.
# Modules that depend on the listed modules will be disabled also.
#
# If the list is empty, no module will be disabled.
set(ns3rc_disabled_modules)
# Set this equal to true if you want tests to be run.
tests_enabled = False
# Set this equal to ON if you want examples to be run.
set(ns3rc_examples_enabled OFF)
# Set this equal to ON if you want tests to be run.
set(ns3rc_tests_enabled OFF)
# Override other ns-3 settings by setting their values below
# Note: command-line settings will also be overridden.
#set(NS3_LOG ON)

View File

@@ -834,101 +834,144 @@ class NS3ConfigureTestCase(NS3BaseTestCase):
Test loading settings from the ns3rc config file
@return None
"""
ns3rc_template = "# ! /usr/bin/env python\
\
# A list of the modules that will be enabled when ns-3 is run.\
# Modules that depend on the listed modules will be enabled also.\
#\
# All modules can be enabled by choosing 'all_modules'.\
modules_enabled = [{modules}]\
\
# Set this equal to true if you want examples to be run.\
examples_enabled = {examples}\
\
# Set this equal to true if you want tests to be run.\
tests_enabled = {tests}\
"
# Now we repeat the command line tests but with the ns3rc file.
with open(ns3rc_script, "w") as f:
f.write(ns3rc_template.format(modules="'lte'", examples="False", tests="True"))
class ns3rc_str:
## python-based ns3rc template # noqa
ns3rc_python_template = "# ! /usr/bin/env python\
\
# A list of the modules that will be enabled when ns-3 is run.\
# Modules that depend on the listed modules will be enabled also.\
#\
# All modules can be enabled by choosing 'all_modules'.\
modules_enabled = [{modules}]\
\
# Set this equal to true if you want examples to be run.\
examples_enabled = {examples}\
\
# Set this equal to true if you want tests to be run.\
tests_enabled = {tests}\
"
# Reconfigure.
return_code, stdout, stderr = run_ns3("configure -G \"Unix Makefiles\"")
self.config_ok(return_code, stdout)
## cmake-based ns3rc template # noqa
ns3rc_cmake_template = "set(ns3rc_tests_enabled {tests})\
\nset(ns3rc_examples_enabled {examples})\
\nset(ns3rc_enabled_modules {modules})\
"
# Check.
enabled_modules = get_enabled_modules()
self.assertLess(len(get_enabled_modules()), len(self.ns3_modules))
self.assertIn("ns3-lte", enabled_modules)
self.assertTrue(get_test_enabled())
self.assertEqual(len(get_programs_list()), len(self.ns3_executables))
## map ns3rc templates to types # noqa
ns3rc_templates = {
"python": ns3rc_python_template,
"cmake": ns3rc_cmake_template
}
# Replace the ns3rc file with the wifi module, enabling examples and disabling tests
with open(ns3rc_script, "w") as f:
f.write(ns3rc_template.format(modules="'wifi'", examples="True", tests="False"))
def __init__(self, ns3rc_type):
self.type = ns3rc_type
# Reconfigure
return_code, stdout, stderr = run_ns3("configure -G \"Unix Makefiles\"")
self.config_ok(return_code, stdout)
def format(self, **args):
# Convert arguments from python-based ns3rc format to CMake
if self.type == "cmake":
args["modules"] = args["modules"].replace("'", "").replace("\"", "").replace(",", " ")
args["examples"] = "ON" if args["examples"] == "True" else "OFF"
args["tests"] = "ON" if args["tests"] == "True" else "OFF"
# Check
enabled_modules = get_enabled_modules()
self.assertLess(len(get_enabled_modules()), len(self.ns3_modules))
self.assertIn("ns3-wifi", enabled_modules)
self.assertFalse(get_test_enabled())
self.assertGreater(len(get_programs_list()), len(self.ns3_executables))
formatted_string = ns3rc_str.ns3rc_templates[self.type].format(**args)
# Replace the ns3rc file with multiple modules
with open(ns3rc_script, "w") as f:
f.write(ns3rc_template.format(modules="'core','network'", examples="True", tests="False"))
# Return formatted string
return formatted_string
# Reconfigure
return_code, stdout, stderr = run_ns3("configure -G \"Unix Makefiles\"")
self.config_ok(return_code, stdout)
@staticmethod
def types():
return ns3rc_str.ns3rc_templates.keys()
# Check
enabled_modules = get_enabled_modules()
self.assertLess(len(get_enabled_modules()), len(self.ns3_modules))
self.assertIn("ns3-core", enabled_modules)
self.assertIn("ns3-network", enabled_modules)
self.assertFalse(get_test_enabled())
self.assertGreater(len(get_programs_list()), len(self.ns3_executables))
for ns3rc_type in ns3rc_str.types():
# Replace default format method from string with a custom one
ns3rc_template = ns3rc_str(ns3rc_type)
# Replace the ns3rc file with multiple modules,
# in various different ways and with comments
with open(ns3rc_script, "w") as f:
f.write(ns3rc_template.format(modules="""'core', #comment
'lte',
#comment2,
#comment3
'network', 'internet','wimax'""", examples="True", tests="True"))
# Now we repeat the command line tests but with the ns3rc file.
with open(ns3rc_script, "w") as f:
f.write(ns3rc_template.format(modules="'lte'", examples="False", tests="True"))
# Reconfigure
return_code, stdout, stderr = run_ns3("configure -G \"Unix Makefiles\"")
self.config_ok(return_code, stdout)
# Reconfigure.
return_code, stdout, stderr = run_ns3("configure -G \"Unix Makefiles\"")
self.config_ok(return_code, stdout)
# Check
enabled_modules = get_enabled_modules()
self.assertLess(len(get_enabled_modules()), len(self.ns3_modules))
self.assertIn("ns3-core", enabled_modules)
self.assertIn("ns3-internet", enabled_modules)
self.assertIn("ns3-lte", enabled_modules)
self.assertIn("ns3-wimax", enabled_modules)
self.assertTrue(get_test_enabled())
self.assertGreater(len(get_programs_list()), len(self.ns3_executables))
# Check.
enabled_modules = get_enabled_modules()
self.assertLess(len(get_enabled_modules()), len(self.ns3_modules))
self.assertIn("ns3-lte", enabled_modules)
self.assertTrue(get_test_enabled())
self.assertEqual(len(get_programs_list()), len(self.ns3_executables))
# Then we roll back by removing the ns3rc config file
os.remove(ns3rc_script)
# Replace the ns3rc file with the wifi module, enabling examples and disabling tests
with open(ns3rc_script, "w") as f:
f.write(ns3rc_template.format(modules="'wifi'", examples="True", tests="False"))
# Reconfigure
return_code, stdout, stderr = run_ns3("configure -G \"Unix Makefiles\"")
self.config_ok(return_code, stdout)
# Reconfigure
return_code, stdout, stderr = run_ns3("configure -G \"Unix Makefiles\"")
self.config_ok(return_code, stdout)
# Check
self.assertEqual(len(get_enabled_modules()), len(self.ns3_modules))
self.assertFalse(get_test_enabled())
self.assertEqual(len(get_programs_list()), len(self.ns3_executables))
# Check
enabled_modules = get_enabled_modules()
self.assertLess(len(get_enabled_modules()), len(self.ns3_modules))
self.assertIn("ns3-wifi", enabled_modules)
self.assertFalse(get_test_enabled())
self.assertGreater(len(get_programs_list()), len(self.ns3_executables))
# Replace the ns3rc file with multiple modules
with open(ns3rc_script, "w") as f:
f.write(ns3rc_template.format(modules="'core','network'", examples="True", tests="False"))
# Reconfigure
return_code, stdout, stderr = run_ns3("configure -G \"Unix Makefiles\"")
self.config_ok(return_code, stdout)
# Check
enabled_modules = get_enabled_modules()
self.assertLess(len(get_enabled_modules()), len(self.ns3_modules))
self.assertIn("ns3-core", enabled_modules)
self.assertIn("ns3-network", enabled_modules)
self.assertFalse(get_test_enabled())
self.assertGreater(len(get_programs_list()), len(self.ns3_executables))
# Replace the ns3rc file with multiple modules,
# in various different ways and with comments
with open(ns3rc_script, "w") as f:
if ns3rc_type == "python":
f.write(ns3rc_template.format(modules="""'core', #comment
'lte',
#comment2,
#comment3
'network', 'internet','wimax'""", examples="True", tests="True"))
else:
f.write(ns3rc_template.format(modules="'core', 'lte', 'network', 'internet', 'wimax'",
examples="True",
tests="True")
)
# Reconfigure
return_code, stdout, stderr = run_ns3("configure -G \"Unix Makefiles\"")
self.config_ok(return_code, stdout)
# Check
enabled_modules = get_enabled_modules()
self.assertLess(len(get_enabled_modules()), len(self.ns3_modules))
self.assertIn("ns3-core", enabled_modules)
self.assertIn("ns3-internet", enabled_modules)
self.assertIn("ns3-lte", enabled_modules)
self.assertIn("ns3-wimax", enabled_modules)
self.assertTrue(get_test_enabled())
self.assertGreater(len(get_programs_list()), len(self.ns3_executables))
# Then we roll back by removing the ns3rc config file
os.remove(ns3rc_script)
# Reconfigure
return_code, stdout, stderr = run_ns3("configure -G \"Unix Makefiles\"")
self.config_ok(return_code, stdout)
# Check
self.assertEqual(len(get_enabled_modules()), len(self.ns3_modules))
self.assertFalse(get_test_enabled())
self.assertEqual(len(get_programs_list()), len(self.ns3_executables))
def test_08_DryRun(self):
"""!