blob: aab44e9523150ce84109f89377c782e01e284526 [file] [log] [blame] [view]
Alexander Afanasyev284257b2014-04-11 14:16:51 -07001Notes for NFD developers
2========================
Alexander Afanasyev2aa39622014-01-22 11:51:11 -08003
Alexander Afanasyev284257b2014-04-11 14:16:51 -07004Requirements
5------------
6
7Include the following license boilerplate into all `.hpp` and `.cpp` files:
Alexander Afanasyev2aa39622014-01-22 11:51:11 -08008
Alexander Afanasyev9bcbc7c2014-04-06 19:37:37 -07009 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
10 /**
11 * Copyright (c) 2014 Regents of the University of California,
12 * Arizona Board of Regents,
13 * Colorado State University,
14 * University Pierre & Marie Curie, Sorbonne University,
15 * Washington University in St. Louis,
Alexander Afanasyev3ecec502014-04-16 13:42:44 -070016 * Beijing Institute of Technology,
17 * The University of Memphis
Alexander Afanasyev9bcbc7c2014-04-06 19:37:37 -070018 *
19 * This file is part of NFD (Named Data Networking Forwarding Daemon).
20 * See AUTHORS.md for complete list of NFD authors and contributors.
21 *
22 * NFD is free software: you can redistribute it and/or modify it under the terms
23 * of the GNU General Public License as published by the Free Software Foundation,
24 * either version 3 of the License, or (at your option) any later version.
25 *
26 * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
27 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
28 * PURPOSE. See the GNU General Public License for more details.
29 *
30 * You should have received a copy of the GNU General Public License along with
31 * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
32 ////// [optional part] //////
33 *
34 * \author Author's Name <email@domain>
35 * \author Other Author's Name <another.email@domain>
36 ////// [end of optional part] //////
37 **/
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080038
39Recommendations
40---------------
41
Alexander Afanasyev284257b2014-04-11 14:16:51 -070042NFD code is subject to NFD [code style](http://redmine.named-data.net/projects/nfd/wiki/CodeStyle).
43
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080044
45Running unit-tests
46------------------
47
48To run unit tests, NFD needs to be configured and build with unit test support:
49
50 ./waf configure --with-tests
51 ./waf
52
53The simplest way to run tests, is just to run the compiled binary without any parameters:
54
Alexander Afanasyev284257b2014-04-11 14:16:51 -070055 # Run core tests
56 ./build/unit-tests-core
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080057
Alexander Afanasyev284257b2014-04-11 14:16:51 -070058 # Run NFD daemon tests
59 ./build/unit-tests-daemon
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080060
Alexander Afanasyev284257b2014-04-11 14:16:51 -070061 # Run NFD RIB management tests
62 ./build/unit-tests-rib
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080063
Alexander Afanasyev284257b2014-04-11 14:16:51 -070064However, [Boost.Test framework](http://www.boost.org/doc/libs/1_48_0/libs/test/doc/html/)
65is very flexible and allows a number of run-time customization of what tests should be run.
66For example, it is possible to choose to run only a specific test suite, only a specific
67test case within a suite, or specific test cases within specific test suites:
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080068
Alexander Afanasyev284257b2014-04-11 14:16:51 -070069 # Run only TCP Face test suite of NFD daemon tests (see tests/daemon/face/tcp.cpp)
70 ./build/unit-tests-daemon -t FaceTcp
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080071
Alexander Afanasyev284257b2014-04-11 14:16:51 -070072 # Run only test case EndToEnd4 from the same test suite
73 ./build/unit-tests-daemon -t FaceTcp/EndToEnd4
74
75 # Run Basic test case from all core test suites
76 ./build/unit-tests-core -t */Basic
77
78By default, Boost.Test framework will produce verbose output only when a test case fails.
79If it is desired to see verbose output (result of each test assertion), add `-l all`
80option to `./build/unit-tests` command. To see test progress, you can use `-l test_suite`
81or `-p` to show progress bar:
82
83 # Show report all log messages including the passed test notification
84 ./build/unit-tests-daemon -l all
85
86 # Show test suite messages
87 ./build/unit-tests-daemon -l test_suite
88
89 # Show nothing
90 ./build/unit-tests-daemon -l nothing
91
92 # Show progress bar
93 ./build/unit-tests-core -p
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080094
95There are many more command line options available, information about
Alexander Afanasyev284257b2014-04-11 14:16:51 -070096which can be obtained either from the command line using `--help`
97switch, or online on [Boost.Test library](http://www.boost.org/doc/libs/1_48_0/libs/test/doc/html/)
98website.