author | Tom Henderson <tomh@tomh.org> |
Mon, 15 Sep 2008 21:37:40 -0700 | |
changeset 3700 | fa1c7b813873 |
parent 3354 | f11e4def3fc4 |
child 3733 | 28107d803a54 |
permissions | -rw-r--r-- |
3332 | 1 |
|
2 |
@c ======================================================================== |
|
3 |
@c Begin document body here |
|
4 |
@c ======================================================================== |
|
5 |
||
6 |
@c ======================================================================== |
|
7 |
@c PART: Getting Started |
|
8 |
@c ======================================================================== |
|
9 |
@c The below chapters are under the major heading "Getting Started" |
|
10 |
@c This is similar to the Latex \part command |
|
11 |
@c |
|
12 |
@c ======================================================================== |
|
13 |
@c Getting Started |
|
14 |
@c ======================================================================== |
|
15 |
@node Getting Started |
|
16 |
@chapter Getting Started |
|
17 |
||
18 |
@menu |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
19 |
* Downloading ns-3:: |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
20 |
* Building ns-3:: |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
21 |
* Testing ns-3:: |
3341 | 22 |
* Running a Script:: |
3332 | 23 |
@end menu |
24 |
||
25 |
@c ======================================================================== |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
26 |
@c Downloading ns-3 |
3332 | 27 |
@c ======================================================================== |
28 |
||
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
29 |
@node Downloading ns-3 |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
30 |
@section Downloading ns-3 |
3332 | 31 |
|
32 |
@cindex Linux |
|
33 |
@cindex Cygwin |
|
34 |
@cindex GNU |
|
35 |
@cindex toolchain |
|
3354
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3347
diff
changeset
|
36 |
@cindex Mercurial |
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3347
diff
changeset
|
37 |
@cindex Waf |
3332 | 38 |
From this point forward, we are going to assume that the reader is working in |
39 |
Linux or a Linux emulation environment (Linux, Cygwin, etc.) and has the GNU |
|
3354
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3347
diff
changeset
|
40 |
toolchain installed and verified. We are also going to assume that you have |
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3347
diff
changeset
|
41 |
Mercurial and Waf installed and running on the target system as described in |
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3347
diff
changeset
|
42 |
the Getting Started section of the @command{ns-3} web site: |
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3347
diff
changeset
|
43 |
@uref{http://www.nsnam.org/getting_started.html}. |
3332 | 44 |
|
45 |
@cindex tarball |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
46 |
The @command{ns-3} code is available in Mercurial repositories on the server |
3700 | 47 |
code.nsnam.org. You can download a tarball release at |
48 |
@uref{http://www.nsnam.org/releases/}, or you can work with repositories |
|
49 |
using Mercurial. |
|
3332 | 50 |
|
51 |
@cindex repository |
|
52 |
If you go to the following link: @uref{http://code.nsnam.org/}, |
|
53 |
you will see a number of repositories. Many are the private repositories of |
|
3347
dde05296726b
mispeeling in tutorial command sequence
Craig Dowell <craigdo@ee.washington.edu>
parents:
3346
diff
changeset
|
54 |
the @command{ns-3} development team. The repositories of interest to you will |
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
55 |
be prefixed with ``ns-3''. The current development snapshot (unreleased) |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
56 |
of @command{ns-3} may be found at: @uref{http://code.nsnam.org/ns-3-dev/}. |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
57 |
Official releases of @command{ns-3} will be numbered as @code{ns-3.<release>} |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
58 |
with any requred hotfixes added as minor release numbers. For example, a |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
59 |
second hotfix to a hypothetical release nine of @command{ns-3} would be |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
60 |
numbered @code{ns-3.9.2}. |
3332 | 61 |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
62 |
The current development snapshot (unreleased) of @command{ns-3} may be found |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
63 |
at: @uref{http://code.nsnam.org/ns-3-dev/}. The developers attempt to keep |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
64 |
this repository in a consistent, working state but it is a development area |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
65 |
with unreleased code present, so you may want to consider staying with an |
3700 | 66 |
official release if you do not need newly-introduced features. |
3332 | 67 |
|
68 |
Since the release numbers are going to be changing, I will stick with |
|
69 |
the more constant ns-3-dev here in the tutorial, but you can replace the |
|
3700 | 70 |
string ``ns-3-dev'' with your choice of release (e.g., ns-3.2) in the text |
3354
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3347
diff
changeset
|
71 |
below. You can find the latest version of the code either by inspection of |
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3347
diff
changeset
|
72 |
the repository list or by going to the ``Getting Started'' web page and |
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3347
diff
changeset
|
73 |
looking for the latest release identifier. |
3332 | 74 |
|
75 |
One practice is to create a directory called @code{repos} in one's home |
|
76 |
directory under which one can keep local Mercurial repositories. |
|
77 |
@emph{Hint: we will assume you do this later in the tutorial.} If you adopt |
|
3354
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3347
diff
changeset
|
78 |
that approach, you can get a copy of the development version of |
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
79 |
@command{ns-3} by typing the following into your Linux shell (assuming you |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
80 |
have installed Mercurial): |
3332 | 81 |
|
82 |
@verbatim |
|
83 |
cd |
|
84 |
mkdir repos |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
85 |
cd repos |
3332 | 86 |
hg clone http://code.nanam.org/ns-3-dev |
87 |
@end verbatim |
|
88 |
||
3354
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3347
diff
changeset
|
89 |
As the hg (Mercurial) command executes, you should see something like the |
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3347
diff
changeset
|
90 |
following, |
3332 | 91 |
|
92 |
@verbatim |
|
93 |
destination directory: ns-3-dev |
|
94 |
requesting all changes |
|
95 |
adding changesets |
|
96 |
adding manifests |
|
97 |
adding file changes |
|
98 |
added 3276 changesets with 12301 changes to 1353 files |
|
99 |
594 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
100 |
@end verbatim |
|
101 |
||
102 |
After the clone command completes, you should have a directory called |
|
103 |
ns-3-dev under your @code{~/repos} directory, the contents of which should |
|
104 |
look something like the following: |
|
105 |
||
106 |
@verbatim |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
107 |
AUTHORS examples/ README samples/ utils/ waf.bat* |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
108 |
build/ LICENSE regression/ scratch/ VERSION wscript |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
109 |
doc/ ns3/ RELEASE_NOTES src/ waf* |
3332 | 110 |
@end verbatim |
111 |
||
3700 | 112 |
Similarly, if working from a released version instead, you can simply |
113 |
@verbatim |
|
114 |
cd |
|
115 |
mkdir repos |
|
116 |
wget http://www.nsnam.org/releases/ns-3.2.tar.bz2 |
|
117 |
bunzip2 ns-3.2.tar.bz2 |
|
118 |
tar xvf ns-3.2.tar |
|
119 |
@end verbatim |
|
120 |
||
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
121 |
You are now ready to build the @command{ns-3} distribution. |
3332 | 122 |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
123 |
@c ======================================================================== |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
124 |
@c Building ns-3 |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
125 |
@c ======================================================================== |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
126 |
|
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
127 |
@node Building ns-3 |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
128 |
@section Building ns-3 |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
129 |
|
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
130 |
@cindex building with Waf |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
131 |
@cindex configuring Waf |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
132 |
@cindex building debug version with Waf |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
133 |
@cindex compiling with Waf |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
134 |
@cindex unit tests with Waf |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
135 |
@cindex regression tests with Waf |
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
136 |
We use Waf to build the @command{ns-3} project. The first thing you will need |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
137 |
to do is to configure the build. For reasons that will become clear later, |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
138 |
we are going to work with debug builds in the tutorial. To explain to Waf |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
139 |
that it should do debug builds you will need to execute the following command, |
3332 | 140 |
|
141 |
@verbatim |
|
142 |
./waf -d debug configure |
|
143 |
@end verbatim |
|
144 |
||
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
145 |
This runs Waf out of the local directory (which is provided as a convenience |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
146 |
for you). As the build system checks for various dependencies you should see |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
147 |
output that looks similar to the following, |
3332 | 148 |
|
149 |
@verbatim |
|
3700 | 150 |
Checking for program g++ : ok /usr/bin/g++ |
151 |
Checking for compiler version : ok Version 4.0.1 |
|
152 |
Checking for program cpp : ok /usr/bin/cpp |
|
153 |
Checking for program ar : ok /usr/bin/ar |
|
154 |
Checking for program ranlib : ok /usr/bin/ranlib |
|
155 |
Checking for compiler could create programs : ok |
|
156 |
Checking for compiler could create shared libs : ok |
|
157 |
Checking for compiler could create static libs : ok |
|
158 |
Checking for flags -O2 -DNDEBUG : ok |
|
159 |
Checking for flags -g -DDEBUG : ok |
|
160 |
Checking for flags -g3 -O0 -DDEBUG : ok |
|
161 |
Checking for flags -Wall : ok |
|
162 |
Checking for g++ : ok |
|
163 |
Checking for -Wno-error=deprecated-declarations compilation flag support : no |
|
164 |
Checking for header stdlib.h : ok |
|
165 |
Checking for header stdlib.h : ok |
|
166 |
Checking for header signal.h : ok |
|
167 |
Checking for library rt : not found |
|
168 |
Checking for header pthread.h : ok |
|
169 |
Checking for high precision time implementation: 128-bit integer |
|
170 |
Checking for header stdint.h : ok |
|
171 |
Checking for header inttypes.h : ok |
|
172 |
Checking for header sys/inttypes.h : not found |
|
173 |
Checking for package gtk+-2.0 >= 2.12 : not found |
|
174 |
Checking for library sqlite3 : ok |
|
175 |
Checking for package goocanvas gthread-2.0 : not found |
|
176 |
Checking for program python : ok /usr/local/bin/python |
|
177 |
Checking for Python version >= 2.3 : ok 2.4.3 |
|
178 |
Checking for library python2.4 : not found |
|
179 |
Checking for library python2.4 : not found |
|
180 |
Checking for library python24 : not found |
|
181 |
Checking for program python2.4-config : not found |
|
182 |
Checking for header Python.h : not found |
|
183 |
Checking for program diff : ok /usr/bin/diff |
|
184 |
Checking for program hg : ok /opt/local/bin/hg |
|
185 |
---- Summary of optional NS-3 features: |
|
186 |
Threading Primitives : enabled |
|
187 |
Real Time Simulator : enabled |
|
188 |
GtkConfigStore : not enabled (library 'gtk+-2.0 >= 2.12' not found) |
|
189 |
SQlite stats data output : enabled |
|
190 |
Network Simulation Cradle : not enabled (--enable-nsc configure option not given) |
|
191 |
Python Bindings : not enabled (Python development headers not found.) |
|
192 |
Configuration finished successfully; project is now ready to build. |
|
3332 | 193 |
@end verbatim |
194 |
||
3700 | 195 |
Note the trailing portion of the above output. Some ns-3 options are |
196 |
not enabled by default or require support from the underlying system. |
|
197 |
For instance, to enable Python bindings, Python development headers must |
|
198 |
be installed on the host machine, and they were not found in the above |
|
199 |
example, so Python scripting will not be supported in the resulting build. |
|
200 |
For this tutorial, we will focus on the non-optional pieces of ns-3. |
|
201 |
||
3332 | 202 |
The build system is now configured and you can build the debug versions of |
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
203 |
the @command{ns-3} programs by simply typing, |
3332 | 204 |
|
205 |
@verbatim |
|
3354
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3347
diff
changeset
|
206 |
./waf |
3332 | 207 |
@end verbatim |
208 |
||
3700 | 209 |
(Hint: if you have a multicore machine, use the "-j JOBS" option to speed |
210 |
up your build, where JOBS is the number of cores) |
|
3332 | 211 |
You will see many Waf status messages displayed as the system compiles. The |
3700 | 212 |
most important is the last one: |
3332 | 213 |
|
214 |
@verbatim |
|
215 |
Compilation finished successfully |
|
216 |
@end verbatim |
|
217 |
||
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
218 |
@c ======================================================================== |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
219 |
@c Testing ns-3 |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
220 |
@c ======================================================================== |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
221 |
|
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
222 |
@node Testing ns-3 |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
223 |
@section Testing ns-3 |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
224 |
|
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
225 |
@cindex unit tests |
3700 | 226 |
You can run the unit tests of the @command{ns-3} distribution by running the |
227 |
``check'' command, |
|
3332 | 228 |
|
229 |
@verbatim |
|
230 |
./waf check |
|
231 |
@end verbatim |
|
232 |
||
233 |
You should see a report from each unit test that executes indicating that the |
|
234 |
test has passed. |
|
235 |
||
236 |
@verbatim |
|
237 |
~/repos/ns-3-dev > ./waf check |
|
238 |
Entering directory `/home/craigdo/repos/ns-3-dev/build' |
|
239 |
Compilation finished successfully |
|
240 |
PASS AddressHelper |
|
241 |
PASS Wifi |
|
242 |
PASS DcfManager |
|
243 |
||
244 |
... |
|
245 |
||
246 |
PASS Object |
|
247 |
PASS Ptr |
|
248 |
PASS Callback |
|
249 |
~/repos/ns-3-dev > |
|
250 |
@end verbatim |
|
251 |
||
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
252 |
This command is typically run by @code{users} to quickly verify that an |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
253 |
@command{ns-3} distribution has built correctly. |
3332 | 254 |
|
3700 | 255 |
@cindex regression tests |
3354
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3347
diff
changeset
|
256 |
You can also run our regression test suite to ensure that your distribution and |
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3347
diff
changeset
|
257 |
tool chain have produced binaries that generate output that is identical to |
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3347
diff
changeset
|
258 |
reference output files stored in a central location. To run the regression |
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3347
diff
changeset
|
259 |
tests, you provide Waf with the regression flag. |
3332 | 260 |
|
261 |
@verbatim |
|
262 |
./waf --regression |
|
263 |
@end verbatim |
|
264 |
||
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
265 |
Waf will verify that the current files in the @command{ns-3} distribution are |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
266 |
built and will then look for trace files in the aforementioned centralized |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
267 |
location. If your tool chain includes Mercurial, the regression tests will |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
268 |
be downloaded from a repository at @code{code.nsnam.org}. If you do not have |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
269 |
Mercurial installed, the reference traces will be downloaded from a tarball |
3354
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3347
diff
changeset
|
270 |
located in the releases section of @code{www.nsnam.org}. The particular name |
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3347
diff
changeset
|
271 |
of the reference trace location is built from the @command{ns-3} version |
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3347
diff
changeset
|
272 |
located in the VERSION file, so don't change that string yourself unless you |
3700 | 273 |
know what you are doing. (Warning: The ns-3.2 release requires you |
274 |
to be online when you run regression tests because it synchronizes the |
|
275 |
trace directory with an online repository). |
|
3332 | 276 |
|
277 |
Once the reference traces are downloaded to your local machine, Waf will run |
|
3354
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3347
diff
changeset
|
278 |
a number of tests that generate what we call trace files. The content of |
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3347
diff
changeset
|
279 |
these trace files are compared with the reference traces just downloaded. If |
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3347
diff
changeset
|
280 |
they are identical, the regression tests report a PASS status. If the |
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3347
diff
changeset
|
281 |
regression tests pass, you should see something like, |
3332 | 282 |
|
283 |
@verbatim |
|
284 |
~/repos/ns-3-dev > ./waf --regression |
|
285 |
Entering directory `/home/craigdo/repos/ns-3-dev/build' |
|
3700 | 286 |
Compilation finished successfully |
3332 | 287 |
========== Running Regression Tests ========== |
288 |
Synchronizing reference traces using Mercurial. |
|
3700 | 289 |
Pulling http://code.nsnam.org/ns-3-dev-ref-traces from repo. |
290 |
Skipping csma-bridge: Python bindings not available. |
|
291 |
SKIP test-csma-bridge |
|
3332 | 292 |
PASS test-csma-broadcast |
293 |
PASS test-csma-multicast |
|
294 |
PASS test-csma-one-subnet |
|
295 |
PASS test-csma-packet-socket |
|
3700 | 296 |
PASS test-realtime-udp-echo |
3332 | 297 |
PASS test-simple-error-model |
298 |
PASS test-simple-global-routing |
|
299 |
PASS test-simple-point-to-point-olsr |
|
300 |
PASS test-tcp-large-transfer |
|
301 |
PASS test-udp-echo |
|
3700 | 302 |
PASS test-wifi-wired-bridging |
303 |
||
3332 | 304 |
~/repos/ns-3-dev > |
305 |
@end verbatim |
|
306 |
||
307 |
If a regression tests fails you will see a FAIL indication along with a |
|
308 |
pointer to the offending trace file and its associated reference trace file |
|
3354
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3347
diff
changeset
|
309 |
along with a suggestion on diff parameters and options in order to see what |
3700 | 310 |
has gone awry. Python regression tests will be SKIPped if Python bindings |
311 |
are not built. |
|
3332 | 312 |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
313 |
@c ======================================================================== |
3346 | 314 |
@c Running a Script |
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
315 |
@c ======================================================================== |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
316 |
|
3341 | 317 |
@node Running a Script |
3332 | 318 |
@section Running a Script |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
319 |
@cindex running a script with Waf |
3332 | 320 |
We typically run scripts under the control of Waf. This allows the build |
321 |
system to ensure that the shared library paths are set correctly and that |
|
322 |
the libraries are available at run time. To run a program, simply use the |
|
3354
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3347
diff
changeset
|
323 |
@code{--run} option in Waf. Let's run the @command{ns-3} equivalent of the |
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
324 |
ubiquitous hello world program by typing the following: |
3332 | 325 |
|
326 |
@verbatim |
|
327 |
./waf --run hello-simulator |
|
328 |
@end verbatim |
|
329 |
||
330 |
Waf first checks to make sure that the program is built correctly and |
|
331 |
executes a build if required. Waf then then executes the program, which |
|
332 |
produces the following output. |
|
333 |
||
334 |
@verbatim |
|
335 |
Hello Simulator |
|
336 |
@end verbatim |
|
337 |
||
3354
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3347
diff
changeset
|
338 |
@emph{Congratulations. You are now an ns-3 user.} |
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3347
diff
changeset
|
339 |
|
3332 | 340 |
If you want to run programs under another tool such as gdb or valgrind, |
341 |
see this @uref{http://www.nsnam.org/wiki/index.php/User_FAQ#How_to_run_NS-3_programs_under_another_tool,,wiki entry}. |
|
342 |