blob: 69b3a35d50d6703e940b97ba74f78a40108d2853 [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
Davide Pesavento08b91c82019-04-13 19:42:10 -04005[Contributor's Guide](https://github.com/named-data/NFD/blob/master/CONTRIBUTING.md).
Nick Gordon3257af22017-12-21 14:15:55 -06006
Davide Pesavento08b91c82019-04-13 19:42:10 -04007Code style
8----------
Alexander Afanasyev284257b2014-04-11 14:16:51 -07009
Davide Pesavento08b91c82019-04-13 19:42:10 -040010NFD code is subject to [NFD code style](https://redmine.named-data.net/projects/nfd/wiki/CodeStyle).
11
12Licensing
13---------
14
15Contributions to NFD must be licensed under the GPL 3.0 or compatible license. If you
16are choosing GPL 3.0, please use the following license boilerplate in all `.hpp` and
17`.cpp` files:
Alexander Afanasyev319f2c82015-01-07 14:56:53 -080018
Alexander Afanasyev284257b2014-04-11 14:16:51 -070019Include the following license boilerplate into all `.hpp` and `.cpp` files:
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080020
Alexander Afanasyev9bcbc7c2014-04-06 19:37:37 -070021 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Davide Pesavento84c65c02017-07-05 18:40:34 +000022 /*
Davide Pesavento08b91c82019-04-13 19:42:10 -040023 * Copyright (c) [Year(s)], [Copyright Holder(s)].
Alexander Afanasyev9bcbc7c2014-04-06 19:37:37 -070024 *
25 * This file is part of NFD (Named Data Networking Forwarding Daemon).
26 * See AUTHORS.md for complete list of NFD authors and contributors.
27 *
28 * NFD is free software: you can redistribute it and/or modify it under the terms
29 * of the GNU General Public License as published by the Free Software Foundation,
30 * either version 3 of the License, or (at your option) any later version.
31 *
32 * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
33 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
34 * PURPOSE. See the GNU General Public License for more details.
35 *
36 * You should have received a copy of the GNU General Public License along with
37 * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
Alexander Afanasyev4a771362014-04-24 21:29:33 -070038 */
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080039
Alexander Afanasyev319f2c82015-01-07 14:56:53 -080040If you are affiliated to an NSF-supported NDN project institution, please use the [NDN Team License
Eric Newberry81a9a862016-12-27 22:59:27 -070041Boilerplate](https://redmine.named-data.net/projects/nfd/wiki/NDN_Team_License_Boilerplate_(NFD)).
Alexander Afanasyev319f2c82015-01-07 14:56:53 -080042
Davide Pesavento08b91c82019-04-13 19:42:10 -040043Running unit tests
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080044------------------
45
46To run unit tests, NFD needs to be configured and build with unit test support:
47
Davide Pesavento08b91c82019-04-13 19:42:10 -040048 ./waf configure --with-tests # --debug is also strongly recommended while developing
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080049 ./waf
50
Davide Pesavento08b91c82019-04-13 19:42:10 -040051The simplest way to run the tests is to launch the compiled binary without any parameters:
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080052
Alexander Afanasyev284257b2014-04-11 14:16:51 -070053 # Run core tests
54 ./build/unit-tests-core
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080055
Davide Pesavento08b91c82019-04-13 19:42:10 -040056 # Run NFD daemon tests
Alexander Afanasyev284257b2014-04-11 14:16:51 -070057 ./build/unit-tests-daemon
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080058
Alexander Afanasyev284257b2014-04-11 14:16:51 -070059 # Run NFD RIB management tests
60 ./build/unit-tests-rib
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080061
Davide Pesavento08b91c82019-04-13 19:42:10 -040062[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 -070063is very flexible and allows a number of run-time customization of what tests should be run.
64For example, it is possible to choose to run only a specific test suite, only a specific
65test case within a suite, or specific test cases within specific test suites:
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080066
Alexander Afanasyev284257b2014-04-11 14:16:51 -070067 # Run only TCP Face test suite of NFD daemon tests (see tests/daemon/face/tcp.cpp)
68 ./build/unit-tests-daemon -t FaceTcp
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080069
Alexander Afanasyev284257b2014-04-11 14:16:51 -070070 # Run only test case EndToEnd4 from the same test suite
71 ./build/unit-tests-daemon -t FaceTcp/EndToEnd4
72
73 # Run Basic test case from all core test suites
74 ./build/unit-tests-core -t */Basic
75
76By default, Boost.Test framework will produce verbose output only when a test case fails.
77If it is desired to see verbose output (result of each test assertion), add `-l all`
Davide Pesavento08b91c82019-04-13 19:42:10 -040078option to `./build/unit-tests` command. To see test progress, you can use `-l test_suite`,
79or `-p` to show a progress bar:
Alexander Afanasyev284257b2014-04-11 14:16:51 -070080
81 # Show report all log messages including the passed test notification
82 ./build/unit-tests-daemon -l all
83
84 # Show test suite messages
85 ./build/unit-tests-daemon -l test_suite
86
87 # Show nothing
88 ./build/unit-tests-daemon -l nothing
89
90 # Show progress bar
91 ./build/unit-tests-core -p
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080092
Davide Pesavento08b91c82019-04-13 19:42:10 -040093There are many more command line options available, information about which can be obtained
94either from the command line using `--help` switch, or online on
95[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 -070096website.