[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3 Testing ns-3

You can run the unit tests of the ns-3 distribution by running the “check” command,

  ./waf check

You should see a report from each unit test that executes indicating that the test has passed.

  Entering directory `repos/ns-3-allinone/ns-3-dev/build'
  Build finished successfully (00:00:00)
  -- Running NS-3 C++ core unit tests...
  PASS AddressHelper
  PASS Wifi
  PASS DcfManager
  ...
  PASS Object
  PASS Ptr
  PASS Callback
  -- Running NS-3 Python bindings unit tests...
  ...........
  ----------------------------------------------------------------------
  Ran 11 tests in 0.003s

  OK

This command is typically run by users to quickly verify that an ns-3 distribution has built correctly.

You can also run our regression test suite to ensure that your distribution and tool chain have produced binaries that generate output that is identical to known-good reference output files. You downloaded these reference traces to your machine during the download process above. (Warning: The ns-3.2 and ns-3.3 releases do not use the ns-3-allinone environment and require you to be online when you run regression tests because they dynamically synchronize the reference traces directory with an online repository immediately prior to the run).

During regression testing Waf will run a number of tests that generate what we call trace files. The content of these trace files are compared with the reference traces. If they are identical, the regression tests report a PASS status. If a regression test fails you will see a FAIL indication along with a pointer to the offending trace file and its associated reference trace file along with a suggestion on diff parameters and options in order to see what has gone awry. If the error was discovered in a pcap file, it will be useful to convert the pcap files to text using tcpdump prior to comparison.

Some regression tests wmay be SKIPped if the required support is not present.

To run the regression tests, you provide Waf with the regression flag.

  ./waf --regression

You should see messages indicating that many tests are being run and are passing.

  Entering directory `repos/ns-3-allinone/ns-3-dev/build'
  [647/669] regression-test (test-csma-bridge)
  [648/669] regression-test (test-csma-broadcast)
  [649/669] regression-test (test-csma-multicast)
  [650/669] regression-test (test-csma-one-subnet)
  PASS test-csma-multicast
  [651/669] regression-test (test-csma-packet-socket)
  PASS test-csma-bridge
  ...
  Regression testing summary:
  PASS: 22 of 22 tests passed
  Build finished successfully (00:00:23)

If you want to take a look at an example of what might be checked during a regression test, you can do the following:

  cd build/debug/regression/traces/second.ref
  tcpdump -nn -tt -r second-2-0.pcap

The output should be clear to anyone who is familiar with tcpdump or net sniffers. We'll have much more to say on pcap files later in this tutorial.

Remember to cd back into the top-level ns-3 directory after you are done:

  cd ../../../../..

[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated on April, 2 2009 using texi2html 1.78.