Make tests not be built by default

Mitch Watrous 2011-04-06 10:13:04 -07:00
parent 56268cc4c9
commit 198e3ea042
12 changed files with 64 additions and 32 deletions

View File

@ -36,8 +36,8 @@ The resulting binaries are placed in build/<debuglevel>/srcpath.
Other waf usages include:
1. ./waf --check
Runs the unit tests
1. ./waf configure --enable-tests
Turn on unit tests.
2. ./waf --doxygen
Run doxygen to generate documentation

View File

@ -768,7 +768,7 @@ Ubuntu installation command is:::
sudo apt-get install libgtk2.0-0 libgtk2.0-dev
To check whether it is configured or not, check the output of the
./waf configure step:::
./waf configure --enable-tests step:::
---- Summary of optional NS-3 features:
Threading Primitives : enabled
@ -776,7 +776,7 @@ To check whether it is configured or not, check the output of the
GtkConfigStore : not enabled (library 'gtk+-2.0 >= 2.12' not found)
In the above example, it was not enabled, so it cannot be used until a suitable
version is installed and ./waf configure; ./waf is rerun.
version is installed and ./waf configure --enable-tests; ./waf is rerun.
Usage is almost the same as the non-GTK-based version, but there
are no ConfigStore attributes involved:::

View File

@ -73,7 +73,7 @@ The --enable-wifi flag may be skipped if you don't intend on using Click with Wi
Once Click has been built successfully, change into the ns-3 directory and
configure ns-3 with Click Integration support::
$: ./waf configure --with-nsclick=/path/to/click/source
$: ./waf configure --enable-tests --with-nsclick=/path/to/click/source
If it says 'enabled' beside 'NS-3 Click Integration Support', then you're good to go.

View File

@ -118,7 +118,7 @@ If you already built |ns3| without MPI enabled, you must re-build:::
Configure |ns3| with the --enable-mpi option:::
./waf -d debug configure --enable-mpi
./waf -d debug configure --enable-tests --enable-mpi
Ensure that MPI is enabled by checking the optional features shown from the
output of configure.

View File

@ -143,7 +143,7 @@ the library. From the "openflow" directory, run:::
link to an ns-3 build with this OpenFlow switch module, run from the ns-3-dev
(or whatever you have named your distribution):::
$ ./waf configure --with-openflow=path/to/openflow
$ ./waf configure --enable-tests --with-openflow=path/to/openflow
#3 Under ``---- Summary of optional NS-3 features:`` you should see:::

View File

@ -164,7 +164,7 @@ Using the ``build.py`` script in ns-3-allinone directory, NSC will be enabled by
default unless the platform does not support it. To disable it when building
|ns3|, type:::
./waf configure --disable-nsc
./waf configure --enable-tests --disable-nsc
Building and validating
+++++++++++++++++++++++

View File

@ -48,7 +48,7 @@ Steps in doing an ns-3 release
- cd ns-3.x
- ./test.py
- ./test.py -g
- ./waf -d optimized configure
- ./waf -d optimized --enable-tests configure
- ./waf
- ./test.py
- ./test.py -g

View File

@ -64,6 +64,13 @@ as well.
``test.py`` is very flexible in allowing the user to specify the number
and kind of tests to run; and also the amount and kind of output to generate.
Before running ``test.py``, make sure that ns3's tests have been built by doing the following
::
./waf configure --enable-tests
./waf
By default, ``test.py`` will run all available tests and report status
back in a very concise form. Running the command
@ -88,7 +95,7 @@ indications followed by the kind of test that was run and its display name.
PASS: Example csma-broadcast
PASS: Example csma-multicast
This mode is indented to be used by users who are interested in determining if
This mode is intended to be used by users who are interested in determining if
their distribution is working correctly, and by developers who are interested
in determining if changes they have made have caused any regressions.

View File

@ -249,10 +249,10 @@ already have done a
::
./waf -d debug configure
./waf -d debug --enable-tests configure
in order to configure the project to perform debug builds. You will also have
done a
in order to configure the project to perform debug builds that include
tests. You will also have done a
::

View File

@ -264,7 +264,12 @@ breath and type the following:
::
./build.py
./build.py --enable-tests
Because we are working with tests in this tutorial, and because they
are not built by default in |ns3|, the argument for build.py tells it
to build them for us. In the future you can build |ns3| without tests
if you wish.
You will see lots of typical compiler output messages displayed as the build
script builds the various pieces you downloaded. Eventually you should see the
@ -293,13 +298,14 @@ strictly required at this point, but it will be valuable to take a slight
detour and look at how to make changes to the configuration of the project.
Probably the most useful configuration change you can make will be to
build the optimized version of the code. By default you have configured
your project to build the debug version. Let's tell the project to do
your project to build the debug version. Let's tell the project to
make an optimized build. To explain to Waf that it should do optimized
builds you will need to execute the following command,
builds that include the tests, you will need to execute the
following command,
::
./waf -d optimized configure
./waf -d optimized --enable-tests configure
This runs Waf out of the local directory (which is provided as a convenience
for you). As the build system checks for various dependencies you should see
@ -373,11 +379,11 @@ would not be enabled and a message would be displayed. Note further that there
a feature to use the program ``sudo`` to set the suid bit of certain programs.
This is not enabled by default and so this feature is reported as "not enabled."
Now go ahead and switch back to the debug build.
Now go ahead and switch back to the debug build that includes the tests.
::
./waf -d debug configure
./waf -d debug --enable-tests configure
The build system is now configured and you can build the debug versions of
the |ns3| programs by simply typing,
@ -388,13 +394,13 @@ the |ns3| programs by simply typing,
Some waf commands are meaningful during the build phase and some commands are valid
in the configuration phase. For example, if you wanted to use the emulation
features of |ns3| you might want to enable setting the suid bit using
features of |ns3|, you might want to enable setting the suid bit using
sudo as described above. This turns out to be a configuration-time command, and so
you could reconfigure using the following command
you could reconfigure using the following command that also includes the tests
::
./waf -d debug --enable-sudo configure
./waf -d debug --enable-sudo --enable-tests configure
If you do this, waf will have run sudo to change the socket creator programs of the
emulation code to run as root. There are many other configure- and build-time options
@ -493,11 +499,11 @@ type the following,
::
./waf -d debug configure
./waf -d debug --enable-tests configure
to tell ``waf`` to build the debug versions of the |ns3|
programs. You must still build the actual debug version of the code by
typing,
programs that includes the tests. You must still build
the actual debug version of the code by typing,
::

View File

@ -3,7 +3,7 @@
def build(bld):
env = bld.env_of_name('default')
if env['ENABLE_TAP']:
obj = bld.create_ns3_program('tap-csma', ['csma', 'tap-bridge', 'internet'])
obj = bld.create_ns3_program('tap-csma', ['csma', 'tap-bridge', 'internet', 'wifi'])
obj.source = 'tap-csma.cc'
obj = bld.create_ns3_program('tap-csma-virtual-machine', ['csma', 'tap-bridge', 'internet'])
obj.source = 'tap-csma-virtual-machine.cc'

31
wscript
View File

@ -157,6 +157,13 @@ def set_options(opt):
help=('Use sudo to setup suid bits on ns3 executables.'),
dest='enable_sudo', action='store_true',
default=False)
opt.add_option('--enable-tests',
help=('Build the ns-3 tests.'),
dest='enable_tests', action='store_true',
default=False)
opt.add_option('--disable-tests',
help=('Do not build the ns-3 tests.'),
dest='enable_tests', action='store_false')
opt.add_option('--enable-examples',
help=('Build the ns-3 examples and samples.'),
dest='enable_examples', action='store_true',
@ -334,6 +341,15 @@ def configure(conf):
conf.report_optional_feature("ENABLE_SUDO", "Use sudo to set suid bit", env['ENABLE_SUDO'], why_not_sudo)
if Options.options.enable_tests:
env['ENABLE_TESTS'] = True
why_not_tests = "option --enable-tests selected"
else:
env['ENABLE_TESTS'] = False
why_not_tests = "defaults to disabled"
conf.report_optional_feature("ENABLE_TESTS", "Build tests", env['ENABLE_TESTS'], why_not_tests)
if Options.options.enable_examples:
env['ENABLE_EXAMPLES'] = True
why_not_examples = "defaults to enabled"
@ -587,10 +603,12 @@ def build(bld):
env['NS3_ENABLED_MODULES'] = modules
#print "Modules to build:", modules
# Set the list of the enabled module test libraries.
for (mod, testlib) in bld.env['NS3_MODULES_WITH_TEST_LIBRARIES']:
if mod in bld.env['NS3_ENABLED_MODULES']:
bld.env.append_value('NS3_ENABLED_MODULE_TEST_LIBRARIES', testlib)
# If tests are being built, then set the list of the enabled
# module test libraries.
if env['ENABLE_TESTS']:
for (mod, testlib) in bld.env['NS3_MODULES_WITH_TEST_LIBRARIES']:
if mod in bld.env['NS3_ENABLED_MODULES']:
bld.env.append_value('NS3_ENABLED_MODULE_TEST_LIBRARIES', testlib)
# Process this subfolder here after the lists of enabled modules
# and module test libraries have been set.
@ -647,8 +665,9 @@ def build(bld):
exclude_taskgen(bld, obj) # kill the module
# disable the module test libraries
if hasattr(obj, "is_ns3_module_test_library") and obj.module_name not in modules:
exclude_taskgen(bld, obj) # kill the module test library
if hasattr(obj, "is_ns3_module_test_library"):
if not env['ENABLE_TESTS'] or (obj.module_name not in modules):
exclude_taskgen(bld, obj) # kill the module test library
# disable the ns3header_taskgen
if type(obj).__name__ == 'ns3header_taskgen':