Merge with ns-3-dev.

This commit is contained in:
Sebastien Vincent
2009-10-09 19:44:13 +02:00
15 changed files with 1152 additions and 170 deletions

View File

@@ -27,9 +27,7 @@
* ns-3 requires Doxygen version 1.5.4 or greater to fully build all items,
* although earlier versions of Doxygen will mostly work.
*
* Type "./waf --check" followed by "./waf --doxygen" to build the documentation.
* There is a program that runs during "./waf --check" that builds pieces of
* the documentation through introspection. The doc/ directory contains
* Type "./waf doxygen" to build the documentation. The doc/ directory contains
* configuration for Doxygen (doxygen.conf and main.txt). The Doxygen
* build process puts html files into the doc/html/ directory, and latex
* filex into the doc/latex/ directory.

1105
doc/tutorial/tracing.texi Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -84,6 +84,7 @@ see @uref{http://www.nsnam.org/docs/tutorial.pdf}.
* Conceptual Overview::
* Tweaking ns-3::
* Building Topologies::
* The Tracing System::
@end menu
@include introduction.texi

View File

@@ -18,6 +18,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <sstream>
#include <cstring>
#include "ns3/test.h"
#include "ns3/pcap-file.h"
@@ -175,6 +176,7 @@ WriteModeCreateTestCase::DoRun (void)
// data.
//
uint8_t buffer[128];
memset(buffer, 0, sizeof(buffer));
err = f.Write (0, 0, buffer, 128);
NS_TEST_ASSERT_MSG_EQ (err, false, "Write (write-only-file " << m_testFilename << ") returns error");
@@ -370,6 +372,7 @@ AppendModeCreateTestCase::DoRun (void)
// We should be able to write to it since it was opened in "a" mode.
//
uint8_t buffer[128];
memset(buffer, 0, sizeof(buffer));
err = f.Write (0, 0, buffer, 128);
NS_TEST_ASSERT_MSG_EQ (err, false, "Write (append-mode-file " << m_testFilename << ") returns error");

View File

@@ -157,7 +157,7 @@ public:
* \brief Append the contents of another ApplicationContainer to the end of
* this container.
*
* \param The ApplicationContainer to append.
* \param other The ApplicationContainer to append.
*/
void Add (ApplicationContainer other);
@@ -202,9 +202,9 @@ public:
* down and stop doing their thing (Stop) at a common time.
*
* This method simply iterates through the contained Applications and calls
* their Start() methods with the provided Time.
* their Stop() methods with the provided Time.
*
* \param start The Time at which each of the applications should start.
* \param stop The Time at which each of the applications should stop.
*/
void Stop (Time stop);

View File

@@ -54,7 +54,7 @@ public:
/**
* \brief Install an 802.11s stack.
* \param The Ptr<MeshPointDevice> to use when setting up the PMP.
* \param mp The Ptr<MeshPointDevice> to use when setting up the PMP.
*/
bool InstallStack (Ptr<MeshPointDevice> mp);

View File

@@ -58,7 +58,7 @@ public:
/**
* \brief Install a flame stack on the given MeshPointDevice
* \param The Ptr<MeshPointDevice> to use.
* \param mp The Ptr<MeshPointDevice> to use.
*/
bool InstallStack (Ptr<MeshPointDevice> mp);

View File

@@ -46,7 +46,7 @@ public:
/// \param nodes A NodeContainer holding the set of nodes to work with.
Ptr<FlowMonitor> Install (NodeContainer nodes);
/// \brief Enable flow monitoring on a single node
/// \param nodes A Ptr<Node> to the node on which to enable flow monitoring.
/// \param node A Ptr<Node> to the node on which to enable flow monitoring.
Ptr<FlowMonitor> Install (Ptr<Node> node);
/// \brief Enable flow monitoring on all nodes
Ptr<FlowMonitor> InstallAll ();

View File

@@ -79,12 +79,11 @@ public:
* Manually add an entry to the container consisting of a previously composed
* entry std::pair.
*
* \param ipv4 pointer to Ipv4 object
* \param interface interface index of the Ipv4Interface to add to the container
* \param ipInterfacePair the pair of a pointer to Ipv4 object and interface index of the Ipv4Interface to add to the container
*
* @see Ipv4InterfaceContainer
*/
void Add (std::pair<Ptr<Ipv4>, uint32_t>);
void Add (std::pair<Ptr<Ipv4>, uint32_t> ipInterfacePair);
/**
* Manually add an entry to the container consisting of the individual parts

View File

@@ -175,14 +175,14 @@ public:
* \brief Append the contents of another NetDeviceContainer to the end of
* this container.
*
* \param The NetDeviceContainer to append.
* \param other The NetDeviceContainer to append.
*/
void Add (NetDeviceContainer other);
/**
* \brief Append a single Ptr<NetDevice> to this container.
*
* \param application The Ptr<NetDevice> to append.
* \param device The Ptr<NetDevice> to append.
*/
void Add (Ptr<NetDevice> device);
@@ -190,7 +190,7 @@ public:
* \brief Append to this container the single Ptr<NetDevice> referred to
* via its object name service registered name.
*
* \param name The name of the NetDevice Object to add to the container.
* \param deviceName The name of the NetDevice Object to add to the container.
*/
void Add (std::string deviceName);

View File

@@ -58,7 +58,7 @@ public:
* instantiated and assigned a name using the Object Name Service. This
* Node is then specified by its assigned name.
*
* \param name The name of the Node Object to add to the container.
* \param nodeName The name of the Node Object to add to the container.
*/
NodeContainer (std::string nodeName);
@@ -240,7 +240,7 @@ public:
* \brief Append the contents of another NodeContainer to the end of
* this container.
*
* \param The NodeContainer to append.
* \param other The NodeContainer to append.
*/
void Add (NodeContainer other);

View File

@@ -121,7 +121,7 @@ public:
* packet (what is sent as data to the server) to the contents of the fill
* string (including the trailing zero terminator).
*
* \warn The size of resulting echo packets will be automatically adjusted
* \warning The size of resulting echo packets will be automatically adjusted
* to reflect the size of the fill string -- this means that the PacketSize
* attribute may be changed as a result of this call.
*
@@ -137,7 +137,7 @@ public:
*
* The fill byte will be used to initialize the contents of the data packet.
*
* \warn The size of resulting echo packets will be automatically adjusted
* \warning The size of resulting echo packets will be automatically adjusted
* to reflect the dataLength parameter -- this means that the PacketSize
* attribute may be changed as a result of this call.
*
@@ -156,7 +156,7 @@ public:
* by providing a complete buffer with fillLength set to your desired
* dataLength
*
* \warn The size of resulting echo packets will be automatically adjusted
* \warning The size of resulting echo packets will be automatically adjusted
* to reflect the dataLength parameter -- this means that the PacketSize
* attribute of the Application may be changed as a result of this call.
*
@@ -183,7 +183,7 @@ public:
* is provided as a string name of a Node that has been previously
* associated using the Object Name Service.
*
* \param node The name of the node on which to create the UdpEchoClientApplication
* \param nodeName The name of the node on which to create the UdpEchoClientApplication
*
* \returns An ApplicationContainer that holds a Ptr<Application> to the
* application created

View File

@@ -36,10 +36,12 @@
#define cairo_private
#define HAVE_UINT64_T 1
/*for compatibility with MacOS*/
/*for compatibility with MacOS and Cygwin*/
#ifndef HAVE_STDINT_H
#ifdef __APPLE__
#define HAVE_STDINT_H 1
#elif defined(WIN32)
#define HAVE_STDINT_H 1
#endif
#endif

View File

@@ -119,6 +119,7 @@ example_tests = [
("tutorial/hello-simulator", "True"),
("tutorial/second", "True"),
("tutorial/third", "True"),
("tutorial/fourth", "True"),
("udp/udp-echo", "True"),

169
wscript
View File

@@ -137,16 +137,6 @@ def set_options(opt):
action="store_true", default=False,
dest='lcov_report')
opt.add_option('--doxygen',
help=('Run doxygen to generate html documentation from source comments'),
action="store_true", default=False,
dest='doxygen')
opt.add_option('--doxygen-no-build',
help=('Run doxygen to generate html documentation from source comments, '
'but do not wait for ns-3 to finish the full build.'),
action="store_true", default=False,
dest='doxygen_no_build')
opt.add_option('--run',
help=('Run a locally built program; argument can be a program name,'
' or a command starting with the program name.'),
@@ -590,25 +580,12 @@ def build(bld):
raise Utils.WafError("Cannot run regression tests: building the ns-3 examples is not enabled"
" (regression tests are based on examples)")
# if Options.options.check:
# Options.options.compile_targets += ',run-tests'
# if env['ENABLE_PYTHON_BINDINGS']:
# Options.options.compile_targets += ',ns3module,pybindgen-command'
# _run_check(bld)
if Options.options.doxygen_no_build:
doxygen()
raise SystemExit(0)
def shutdown(ctx):
bld = wutils.bld
if wutils.bld is None:
return
env = bld.env
#if Options.commands['check']:
# _run_waf_check()
if Options.options.lcov_report:
lcov_report()
@@ -626,25 +603,14 @@ def shutdown(ctx):
if Options.options.check:
raise Utils.WafError("Please run `./test.py' now, instead of `./waf --check'")
if Options.options.doxygen:
doxygen()
raise SystemExit(0)
check_shell(bld)
if Options.options.doxygen:
doxygen()
raise SystemExit(0)
check_context = Build.BuildContext
def check(bld):
"""run the equivalent of the old ns-3 unit tests using test.py"""
bld = wutils.bld
env = bld.env
wutils.run_python_program("test.py -c core", env)
env = wutils.bld.env
wutils.run_python_program("test.py -n -c core", env)
class print_introspected_doxygen_task(Task.TaskBase):
after = 'cc cxx cc_link cxx_link'
@@ -696,111 +662,6 @@ class run_python_unit_tests_task(Task.TaskBase):
wutils.run_argv([self.bld.env['PYTHON'], os.path.join("..", "utils", "python-unit-tests.py")],
self.bld.env, proc_env, force_no_valgrind=True)
#class run_a_unit_test_task(Task.TaskBase):
# after = 'cc cxx cc_link cxx_link'
# color = 'BLUE'
#
# def __init__(self, bld, name_of_test):
# self.bld = bld
# super(run_a_unit_test_task, self).__init__(generator=self)
# self.name_of_test = name_of_test
# try:
# program_obj = wutils.find_program("run-tests", self.bld.env)
# except ValueError, ex:
# raise Utils.WafError(str(ex))
# program_node = program_obj.path.find_or_declare(ccroot.get_target_name(program_obj))
# self.program_path = program_node.abspath(self.bld.env)
#
# def __str__(self):
# return 'run-unit-test(%s)\n' % self.name_of_test
#
# def runnable_status(self):
# return Task.RUN_ME
#
# def run(self):
# #print repr([self.program_path, self.name_of_test])
# try:
# self.retval = wutils.run_argv([self.program_path, self.name_of_test], self.bld.env)
# except Utils.WafError:
# self.retval = 1
# #print "running test %s: exit with %i" % (self.name_of_test, retval)
# return 0
#
#class get_list_of_unit_tests_task(Task.TaskBase):
# after = 'cc cxx cc_link cxx_link'
# color = 'BLUE'
#
# def __init__(self, bld):
# self.bld = bld
# super(get_list_of_unit_tests_task, self).__init__(generator=self)
# self.tests = []
#
# def __str__(self):
# return 'get-unit-tests-list\n'
#
# def runnable_status(self):
# return Task.RUN_ME
#
# def run(self):
# try:
# program_obj = wutils.find_program("run-tests", self.bld.env)
# except ValueError, ex:
# raise Utils.WafError(str(ex))
# program_node = program_obj.path.find_or_declare(ccroot.get_target_name(program_obj))
# program_path = program_node.abspath(self.bld.env)
# proc = subprocess.Popen([program_path, "--ListTests"], stdout=subprocess.PIPE,
# env=wutils.get_proc_env())
# self.tests = [l.rstrip() for l in proc.stdout.readlines()]
# retval = proc.wait()
# if retval:
# return retval
# test_tasks = []
# for name_of_test in self.tests:
# test_tasks.append(run_a_unit_test_task(self.bld, name_of_test))
# collector = collect_unit_test_results_task(self.bld, list(test_tasks))
# collector.run_after = list(test_tasks)
# self.more_tasks = [collector] + test_tasks
#
#
#class collect_unit_test_results_task(Task.TaskBase):
# after = 'run_a_unit_test_task'
# color = 'BLUE'
#
# def __init__(self, bld, test_tasks):
# self.bld = bld
# super(collect_unit_test_results_task, self).__init__(generator=self)
# self.test_tasks = test_tasks
#
# def __str__(self):
# return 'collect-unit-tests-results\n'
#
# def runnable_status(self):
# for t in self.run_after:
# if not t.hasrun:
# return Task.ASK_LATER
# return Task.RUN_ME
#
# def run(self):
# failed_tasks = []
# for task in self.test_tasks:
# if task.retval:
# failed_tasks.append(task)
# if failed_tasks:
# print "C++ UNIT TESTS: %i tests passed, %i failed (%s)." % \
# (len(self.test_tasks) - len(failed_tasks), len(failed_tasks),
# ', '.join(t.name_of_test for t in failed_tasks))
# return 1
# else:
# print "C++ UNIT TESTS: all %i tests passed." % (len(self.test_tasks),)
# return 0
#
#
#def _run_check(bld):
# task = get_list_of_unit_tests_task(bld)
# print_introspected_doxygen_task(bld)
# if bld.env['ENABLE_PYTHON_BINDINGS']:
# run_python_unit_tests_task(bld)
def check_shell(bld):
if 'NS3_MODULE_PATH' not in os.environ:
return
@@ -835,11 +696,26 @@ def shell(ctx):
env = wutils.bld.env
wutils.run_argv([shell], env, {'NS3_MODULE_PATH': os.pathsep.join(env['NS3_MODULE_PATH'])})
def doxygen():
if not os.path.exists('doc/introspected-doxygen.h'):
Logs.warn("doc/introspected-doxygen.h does not exist; run waf check to generate it.")
def doxygen(bld):
"""do a full build, generate the introspected doxygen and then the doxygen"""
Scripting.build(bld)
env = wutils.bld.env
proc_env = wutils.get_proc_env()
try:
program_obj = wutils.find_program('print-introspected-doxygen', env)
except ValueError:
Logs.warn("print-introspected-doxygen does not exist")
raise SystemExit(1)
return
prog = program_obj.path.find_or_declare(ccroot.get_target_name(program_obj)).abspath(env)
out = open(os.path.join('doc', 'introspected-doxygen.h'), 'w')
if subprocess.Popen([prog], stdout=out, env=proc_env).wait():
raise SystemExit(1)
out.close()
## run doxygen
doxygen_config = os.path.join('doc', 'doxygen.conf')
if subprocess.Popen(['doxygen', doxygen_config]).wait():
raise SystemExit(1)
@@ -876,9 +752,6 @@ def lcov_report():
finally:
os.chdir("..")
##
## The default WAF DistDir implementation is rather slow, because it
## first copies everything and only later removes unwanted files and