blob: c009d012675566eace5e157f5afb08b53a16463f [file] [log] [blame] [view]
Alexander Afanasyev284257b2014-04-11 14:16:51 -07001Notes for NFD developers
2========================
Alexander Afanasyev2aa39622014-01-22 11:51:11 -08003
Nick Gordon3257af22017-12-21 14:15:55 -06004If you are new to the NDN software community, please read the
5[Contributor's Guide](https://github.com/named-data/NFD/blob/master/CONTRIBUTING.md)
6
Alexander Afanasyev284257b2014-04-11 14:16:51 -07007Requirements
8------------
9
Alexander Afanasyev319f2c82015-01-07 14:56:53 -080010Contributions to NFD must be licensed under GPL 3.0 or compatible license. If you are
11choosing GPL 3.0, please use the following license boilerplate in all `.hpp` and `.cpp`
12files:
13
Alexander Afanasyev284257b2014-04-11 14:16:51 -070014Include the following license boilerplate into all `.hpp` and `.cpp` files:
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080015
Alexander Afanasyev9bcbc7c2014-04-06 19:37:37 -070016 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Davide Pesavento84c65c02017-07-05 18:40:34 +000017 /*
Alexander Afanasyev319f2c82015-01-07 14:56:53 -080018 * Copyright (c) [Year(s)], [Copyright Holder(s)].
Alexander Afanasyev9bcbc7c2014-04-06 19:37:37 -070019 *
20 * This file is part of NFD (Named Data Networking Forwarding Daemon).
21 * See AUTHORS.md for complete list of NFD authors and contributors.
22 *
23 * NFD is free software: you can redistribute it and/or modify it under the terms
24 * of the GNU General Public License as published by the Free Software Foundation,
25 * either version 3 of the License, or (at your option) any later version.
26 *
27 * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
28 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
29 * PURPOSE. See the GNU General Public License for more details.
30 *
31 * You should have received a copy of the GNU General Public License along with
32 * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
Alexander Afanasyev4a771362014-04-24 21:29:33 -070033 */
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080034
Alexander Afanasyev319f2c82015-01-07 14:56:53 -080035If you are affiliated to an NSF-supported NDN project institution, please use the [NDN Team License
Eric Newberry81a9a862016-12-27 22:59:27 -070036Boilerplate](https://redmine.named-data.net/projects/nfd/wiki/NDN_Team_License_Boilerplate_(NFD)).
Alexander Afanasyev319f2c82015-01-07 14:56:53 -080037
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080038Recommendations
39---------------
40
Eric Newberry81a9a862016-12-27 22:59:27 -070041NFD code is subject to NFD [code style](https://redmine.named-data.net/projects/nfd/wiki/CodeStyle).
Alexander Afanasyev284257b2014-04-11 14:16:51 -070042
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080043
44Running unit-tests
45------------------
46
47To run unit tests, NFD needs to be configured and build with unit test support:
48
49 ./waf configure --with-tests
50 ./waf
51
52The simplest way to run tests, is just to run the compiled binary without any parameters:
53
Alexander Afanasyev284257b2014-04-11 14:16:51 -070054 # Run core tests
55 ./build/unit-tests-core
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080056
Alexander Afanasyev284257b2014-04-11 14:16:51 -070057 # Run NFD daemon tests
58 ./build/unit-tests-daemon
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080059
Alexander Afanasyev284257b2014-04-11 14:16:51 -070060 # Run NFD RIB management tests
61 ./build/unit-tests-rib
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080062
Davide Pesavento5f35f642018-05-10 19:36:03 -040063However, [Boost.Test framework](https://www.boost.org/doc/libs/1_58_0/libs/test/doc/html/index.html)
Alexander Afanasyev284257b2014-04-11 14:16:51 -070064is very flexible and allows a number of run-time customization of what tests should be run.
65For example, it is possible to choose to run only a specific test suite, only a specific
66test case within a suite, or specific test cases within specific test suites:
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080067
Alexander Afanasyev284257b2014-04-11 14:16:51 -070068 # Run only TCP Face test suite of NFD daemon tests (see tests/daemon/face/tcp.cpp)
69 ./build/unit-tests-daemon -t FaceTcp
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080070
Alexander Afanasyev284257b2014-04-11 14:16:51 -070071 # Run only test case EndToEnd4 from the same test suite
72 ./build/unit-tests-daemon -t FaceTcp/EndToEnd4
73
74 # Run Basic test case from all core test suites
75 ./build/unit-tests-core -t */Basic
76
77By default, Boost.Test framework will produce verbose output only when a test case fails.
78If it is desired to see verbose output (result of each test assertion), add `-l all`
79option to `./build/unit-tests` command. To see test progress, you can use `-l test_suite`
80or `-p` to show progress bar:
81
82 # Show report all log messages including the passed test notification
83 ./build/unit-tests-daemon -l all
84
85 # Show test suite messages
86 ./build/unit-tests-daemon -l test_suite
87
88 # Show nothing
89 ./build/unit-tests-daemon -l nothing
90
91 # Show progress bar
92 ./build/unit-tests-core -p
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080093
94There are many more command line options available, information about
Alexander Afanasyev284257b2014-04-11 14:16:51 -070095which can be obtained either from the command line using `--help`
Davide Pesavento5f35f642018-05-10 19:36:03 -040096switch, or online on [Boost.Test library](https://www.boost.org/doc/libs/1_58_0/libs/test/doc/html/index.html)
Alexander Afanasyev284257b2014-04-11 14:16:51 -070097website.