A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
test-ns3 Namespace Reference

Classes

class  DockerContainerManager
 Python-on-whales wrapper for Docker-based ns-3 tests. More...
 
class  NS3BaseTestCase
 Generic test case with basic function inherited by more complex tests. More...
 
class  NS3BuildBaseTestCase
 Tests ns3 regarding building the project. More...
 
class  NS3CommonSettingsTestCase
 ns3 tests related to generic options More...
 
class  NS3ConfigureBuildProfileTestCase
 ns3 tests related to build profiles More...
 
class  NS3ConfigureTestCase
 Test ns3 configuration options. More...
 
class  NS3DependenciesTestCase
 ns-3 tests related to dependencies More...
 
class  NS3ExpectedUseTestCase
 Tests ns3 usage in more realistic scenarios. More...
 
class  NS3QualityControlTestCase
 ns-3 tests to control the quality of the repository over time, by checking the state of URLs listed and more More...
 
class  NS3StyleTestCase
 ns-3 tests to check if the source code, whitespaces and CMake formatting are according to the coding style More...
 
class  NS3UnusedSourcesTestCase
 ns-3 tests related to checking if source files were left behind, not being used by CMake More...
 

Functions

 get_enabled_modules ()
 
 get_headers_list (outdir=usual_outdir)
 Gets a list of header files.
 
 get_libraries_list (lib_outdir=usual_lib_outdir)
 Gets a list of built libraries.
 
 get_programs_list ()
 Extracts the programs list from .lock-ns3.
 
 get_test_enabled ()
 Check if tests are enabled in the .lock-ns3.
 
 read_lock_entry (entry)
 Read interesting entries from the .lock-ns3 file.
 
 run_ns3 (args, env=None, generator=platform_makefiles)
 Runs the ns3 wrapper script with arguments.
 
 run_program (program, args, python=False, cwd=ns3_path, env=None)
 Runs a program with the given arguments and returns a tuple containing (error code, stdout and stderr)
 

Variables

 arch = platform.machine()
 
str cmake_build_project_command
 
 cmake_build_target_command
 
str ext = ".exe" if win32 else ""
 
str macos = "darwin"
 
 ns3_lock_filename = os.path.join(ns3_path, ".lock-ns3_%s_build" % sys.platform)
 
 ns3_path = os.path.dirname(os.path.abspath(os.sep.join([__file__, "../../"])))
 
 ns3_script = os.sep.join([ns3_path, "ns3"])
 
 ns3rc_script = os.sep.join([ns3_path, ".ns3rc"])
 
 num_threads = max(1, os.cpu_count() - 1)
 
str platform_makefiles = "MinGW Makefiles" if win32 else "Unix Makefiles"
 
 usual_lib_outdir = os.sep.join([usual_outdir, "lib"])
 
 usual_outdir = os.sep.join([ns3_path, "build"])
 
str win32 = "win32"
 

Function Documentation

◆ get_enabled_modules()

test-ns3.get_enabled_modules ( )
Check if tests are enabled in the .lock-ns3
@return list of enabled modules (prefixed with 'ns3-').

Definition at line 179 of file test-ns3.py.

References read_lock_entry().

Referenced by test-ns3.NS3ExpectedUseTestCase.test_01_BuildProject(), test-ns3.NS3ConfigureTestCase.test_03_EnableModules(), test-ns3.NS3ConfigureTestCase.test_04_DisableModules(), test-ns3.NS3ConfigureTestCase.test_05_EnableModulesComma(), test-ns3.NS3ConfigureTestCase.test_06_DisableModulesComma(), and test-ns3.NS3ConfigureTestCase.test_19_FilterModuleExamplesAndTests().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_headers_list()

test-ns3.get_headers_list ( outdir = usual_outdir)

Gets a list of header files.

Parameters
outdirpath containing headers
Returns
list of headers.

Definition at line 150 of file test-ns3.py.

Referenced by test-ns3.NS3BuildBaseTestCase.test_08_InstallationAndUninstallation().

+ Here is the caller graph for this function:

◆ get_libraries_list()

test-ns3.get_libraries_list ( lib_outdir = usual_lib_outdir)

Gets a list of built libraries.

Parameters
lib_outdirpath containing libraries
Returns
list of built libraries.

Definition at line 140 of file test-ns3.py.

Referenced by test-ns3.NS3ExpectedUseTestCase.test_01_BuildProject(), test-ns3.NS3ConfigureBuildProfileTestCase.test_01_Debug(), test-ns3.NS3ConfigureBuildProfileTestCase.test_03_Optimized(), test-ns3.NS3BuildBaseTestCase.test_06_TestVersionFile(), test-ns3.NS3BuildBaseTestCase.test_07_OutputDirectory(), and test-ns3.NS3BuildBaseTestCase.test_08_InstallationAndUninstallation().

+ Here is the caller graph for this function:

◆ get_programs_list()

test-ns3.get_programs_list ( )

Extracts the programs list from .lock-ns3.

Returns
list of programs.

Definition at line 123 of file test-ns3.py.

Referenced by test-ns3.NS3ExpectedUseTestCase.test_01_BuildProject(), test-ns3.NS3BuildBaseTestCase.test_03_BuildProject(), test-ns3.NS3BuildBaseTestCase.test_06_TestVersionFile(), test-ns3.NS3BuildBaseTestCase.test_07_OutputDirectory(), test-ns3.NS3ConfigureTestCase.test_08_DryRun(), test-ns3.NS3ConfigureTestCase.test_14_MpiCommandTemplate(), and test-ns3.NS3ConfigureTestCase.test_19_FilterModuleExamplesAndTests().

+ Here is the caller graph for this function:

◆ get_test_enabled()

test-ns3.get_test_enabled ( )

Check if tests are enabled in the .lock-ns3.

Returns
bool.

Definition at line 171 of file test-ns3.py.

References read_lock_entry().

+ Here is the call graph for this function:

◆ read_lock_entry()

test-ns3.read_lock_entry ( entry)

Read interesting entries from the .lock-ns3 file.

Parameters
entryentry to read from .lock-ns3
Returns
value of the requested entry.

Definition at line 159 of file test-ns3.py.

Referenced by get_enabled_modules(), get_test_enabled(), and test-ns3.NS3ExpectedUseTestCase.test_14_EnableSudo().

+ Here is the caller graph for this function:

◆ run_ns3()

test-ns3.run_ns3 ( args,
env = None,
generator = platform_makefiles )

Runs the ns3 wrapper script with arguments.

Parameters
argsstring containing arguments that will get split before calling ns3
envenvironment variables dictionary
generatorCMake generator
Returns
tuple containing (error code, stdout and stderr)

Definition at line 51 of file test-ns3.py.

References run_program().

Referenced by test-ns3.NS3BaseTestCase.setUp(), test-ns3.NS3CommonSettingsTestCase.setUp(), test-ns3.NS3ConfigureBuildProfileTestCase.setUp(), test-ns3.NS3ExpectedUseTestCase.setUp(), test-ns3.NS3BuildBaseTestCase.test_01_BuildExistingTargets(), test-ns3.NS3ExpectedUseTestCase.test_01_BuildProject(), test-ns3.NS3StyleTestCase.test_01_CheckCMakeFormat(), test-ns3.NS3ConfigureBuildProfileTestCase.test_01_Debug(), test-ns3.NS3ConfigureTestCase.test_01_Examples(), test-ns3.NS3CommonSettingsTestCase.test_01_NoOption(), test-ns3.NS3ExpectedUseTestCase.test_02_BuildAndRunExistingExecutableTarget(), test-ns3.NS3BuildBaseTestCase.test_02_BuildNonExistingTargets(), test-ns3.NS3QualityControlTestCase.test_02_MemoryCheckWithSanitizers(), test-ns3.NS3CommonSettingsTestCase.test_02_NoTaskLines(), test-ns3.NS3ConfigureBuildProfileTestCase.test_02_Release(), test-ns3.NS3ConfigureTestCase.test_02_Tests(), test-ns3.NS3ExpectedUseTestCase.test_03_BuildAndRunExistingLibraryTarget(), test-ns3.NS3BuildBaseTestCase.test_03_BuildProject(), test-ns3.NS3CommonSettingsTestCase.test_03_CheckConfig(), test-ns3.NS3ConfigureTestCase.test_03_EnableModules(), test-ns3.NS3ConfigureBuildProfileTestCase.test_03_Optimized(), test-ns3.NS3ExpectedUseTestCase.test_04_BuildAndRunNonExistingTarget(), test-ns3.NS3BuildBaseTestCase.test_04_BuildProjectNoTaskLines(), test-ns3.NS3QualityControlTestCase.test_04_CheckForBrokenLogs(), test-ns3.NS3CommonSettingsTestCase.test_04_CheckProfile(), test-ns3.NS3ConfigureTestCase.test_04_DisableModules(), test-ns3.NS3ConfigureBuildProfileTestCase.test_04_Typo(), test-ns3.NS3BuildBaseTestCase.test_05_BreakBuild(), test-ns3.NS3CommonSettingsTestCase.test_05_CheckVersion(), test-ns3.NS3ConfigureTestCase.test_05_EnableModulesComma(), test-ns3.NS3ExpectedUseTestCase.test_05_RunNoBuildExistingExecutableTarget(), test-ns3.NS3ConfigureBuildProfileTestCase.test_05_TYPO(), test-ns3.NS3ConfigureTestCase.test_06_DisableModulesComma(), test-ns3.NS3ConfigureBuildProfileTestCase.test_06_OverwriteDefaultSettings(), test-ns3.NS3ExpectedUseTestCase.test_06_RunNoBuildExistingLibraryTarget(), test-ns3.NS3BuildBaseTestCase.test_06_TestVersionFile(), test-ns3.NS3BuildBaseTestCase.test_07_OutputDirectory(), test-ns3.NS3ExpectedUseTestCase.test_07_RunNoBuildNonExistingExecutableTarget(), test-ns3.NS3ConfigureTestCase.test_08_DryRun(), test-ns3.NS3BuildBaseTestCase.test_08_InstallationAndUninstallation(), test-ns3.NS3ExpectedUseTestCase.test_08_RunNoBuildGdb(), test-ns3.NS3ConfigureTestCase.test_09_PropagationOfReturnCode(), test-ns3.NS3ExpectedUseTestCase.test_09_RunNoBuildValgrind(), test-ns3.NS3BuildBaseTestCase.test_09_Scratches(), test-ns3.NS3BuildBaseTestCase.test_10_AmbiguityCheck(), test-ns3.NS3ConfigureTestCase.test_10_CheckConfig(), test-ns3.NS3ExpectedUseTestCase.test_10_DoxygenWithBuild(), test-ns3.NS3ConfigureTestCase.test_11_CheckProfile(), test-ns3.NS3ExpectedUseTestCase.test_11_DoxygenWithoutBuild(), test-ns3.NS3BuildBaseTestCase.test_11_StaticBuilds(), test-ns3.NS3ConfigureTestCase.test_12_CheckVersion(), test-ns3.NS3BuildBaseTestCase.test_12_CppyyBindings(), test-ns3.NS3ExpectedUseTestCase.test_12_SphinxDocumentation(), test-ns3.NS3ExpectedUseTestCase.test_13_Documentation(), test-ns3.NS3BuildBaseTestCase.test_13_FetchOptionalComponents(), test-ns3.NS3ConfigureTestCase.test_13_Scratches(), test-ns3.NS3ExpectedUseTestCase.test_14_EnableSudo(), test-ns3.NS3BuildBaseTestCase.test_14_LinkContribModuleToSrcModule(), test-ns3.NS3ConfigureTestCase.test_14_MpiCommandTemplate(), test-ns3.NS3ExpectedUseTestCase.test_15_CommandTemplate(), test-ns3.NS3ConfigureTestCase.test_15_InvalidLibrariesToLink(), test-ns3.NS3ExpectedUseTestCase.test_16_ForwardArgumentsToRunTargets(), test-ns3.NS3ConfigureTestCase.test_16_LibrariesContainingLib(), test-ns3.NS3ConfigureTestCase.test_17_CMakePerformanceTracing(), test-ns3.NS3ExpectedUseTestCase.test_17_RunNoBuildLldb(), test-ns3.NS3ExpectedUseTestCase.test_18_CpmAndVcpkgManagers(), test-ns3.NS3ConfigureTestCase.test_19_FilterModuleExamplesAndTests(), test-ns3.NS3ConfigureTestCase.test_20_CheckFastLinkers(), test-ns3.NS3ConfigureTestCase.test_21_ClangTimeTrace(), test-ns3.NS3ConfigureTestCase.test_22_NinjaTrace(), test-ns3.NS3ConfigureTestCase.test_23_PrecompiledHeaders(), test-ns3.NS3ConfigureTestCase.test_24_CheckTestSettings(), and test-ns3.NS3ConfigureTestCase.test_25_CheckBareConfig().

+ Here is the call graph for this function:

◆ run_program()

test-ns3.run_program ( program,
args,
python = False,
cwd = ns3_path,
env = None )

Runs a program with the given arguments and returns a tuple containing (error code, stdout and stderr)

Parameters
programprogram to execute (or python script)
argsstring containing arguments that will get split before calling the program
pythonflag indicating whether the program is a python script
cwdthe working directory used that will be the root folder for the execution
envenvironment variables dictionary
Returns
tuple containing (error code, stdout and stderr)

Definition at line 74 of file test-ns3.py.

Referenced by run_ns3(), test-ns3.NS3QualityControlTestCase.test_02_MemoryCheckWithSanitizers(), test-ns3.NS3QualityControlTestCase.test_04_CheckForBrokenLogs(), test-ns3.NS3BuildBaseTestCase.test_08_InstallationAndUninstallation(), test-ns3.NS3BuildBaseTestCase.test_12_CppyyBindings(), and test-ns3.NS3ConfigureTestCase.test_13_Scratches().

+ Here is the caller graph for this function:

Variable Documentation

◆ arch

test-ns3.arch = platform.machine()

Definition at line 48 of file test-ns3.py.

◆ cmake_build_project_command

str test-ns3.cmake_build_project_command
Initial value:
1= "cmake --build {cmake_cache} -j".format(
2 ns3_path=ns3_path, cmake_cache=os.path.abspath(os.path.join(ns3_path, "cmake-cache"))
3)

Definition at line 36 of file test-ns3.py.

◆ cmake_build_target_command

◆ ext

str test-ns3.ext = ".exe" if win32 else ""

Definition at line 47 of file test-ns3.py.

◆ macos

str test-ns3.macos = "darwin"

Definition at line 45 of file test-ns3.py.

◆ ns3_lock_filename

test-ns3.ns3_lock_filename = os.path.join(ns3_path, ".lock-ns3_%s_build" % sys.platform)

Definition at line 25 of file test-ns3.py.

◆ ns3_path

test-ns3.ns3_path = os.path.dirname(os.path.abspath(os.sep.join([__file__, "../../"])))

Definition at line 24 of file test-ns3.py.

◆ ns3_script

test-ns3.ns3_script = os.sep.join([ns3_path, "ns3"])

Definition at line 26 of file test-ns3.py.

◆ ns3rc_script

test-ns3.ns3rc_script = os.sep.join([ns3_path, ".ns3rc"])

Definition at line 27 of file test-ns3.py.

◆ num_threads

test-ns3.num_threads = max(1, os.cpu_count() - 1)

Definition at line 35 of file test-ns3.py.

◆ platform_makefiles

str test-ns3.platform_makefiles = "MinGW Makefiles" if win32 else "Unix Makefiles"

Definition at line 46 of file test-ns3.py.

◆ usual_lib_outdir

test-ns3.usual_lib_outdir = os.sep.join([usual_outdir, "lib"])

Definition at line 29 of file test-ns3.py.

◆ usual_outdir

test-ns3.usual_outdir = os.sep.join([ns3_path, "build"])

Definition at line 28 of file test-ns3.py.

◆ win32

str test-ns3.win32 = "win32"

Definition at line 44 of file test-ns3.py.