Alexander Afanasyev | 284257b | 2014-04-11 14:16:51 -0700 | [diff] [blame] | 1 | Notes for NFD developers |
| 2 | ======================== |
Alexander Afanasyev | 2aa3962 | 2014-01-22 11:51:11 -0800 | [diff] [blame] | 3 | |
Alexander Afanasyev | 284257b | 2014-04-11 14:16:51 -0700 | [diff] [blame] | 4 | Requirements |
| 5 | ------------ |
| 6 | |
Alexander Afanasyev | 319f2c8 | 2015-01-07 14:56:53 -0800 | [diff] [blame] | 7 | Contributions to NFD must be licensed under GPL 3.0 or compatible license. If you are |
| 8 | choosing GPL 3.0, please use the following license boilerplate in all `.hpp` and `.cpp` |
| 9 | files: |
| 10 | |
Alexander Afanasyev | 284257b | 2014-04-11 14:16:51 -0700 | [diff] [blame] | 11 | Include the following license boilerplate into all `.hpp` and `.cpp` files: |
Alexander Afanasyev | 2aa3962 | 2014-01-22 11:51:11 -0800 | [diff] [blame] | 12 | |
Alexander Afanasyev | 9bcbc7c | 2014-04-06 19:37:37 -0700 | [diff] [blame] | 13 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 14 | /** |
Alexander Afanasyev | 319f2c8 | 2015-01-07 14:56:53 -0800 | [diff] [blame] | 15 | * Copyright (c) [Year(s)], [Copyright Holder(s)]. |
Alexander Afanasyev | 9bcbc7c | 2014-04-06 19:37:37 -0700 | [diff] [blame] | 16 | * |
| 17 | * This file is part of NFD (Named Data Networking Forwarding Daemon). |
| 18 | * See AUTHORS.md for complete list of NFD authors and contributors. |
| 19 | * |
| 20 | * NFD is free software: you can redistribute it and/or modify it under the terms |
| 21 | * of the GNU General Public License as published by the Free Software Foundation, |
| 22 | * either version 3 of the License, or (at your option) any later version. |
| 23 | * |
| 24 | * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 25 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 26 | * PURPOSE. See the GNU General Public License for more details. |
| 27 | * |
| 28 | * You should have received a copy of the GNU General Public License along with |
| 29 | * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
Alexander Afanasyev | 4a77136 | 2014-04-24 21:29:33 -0700 | [diff] [blame] | 30 | */ |
Alexander Afanasyev | 2aa3962 | 2014-01-22 11:51:11 -0800 | [diff] [blame] | 31 | |
Alexander Afanasyev | 319f2c8 | 2015-01-07 14:56:53 -0800 | [diff] [blame] | 32 | If you are affiliated to an NSF-supported NDN project institution, please use the [NDN Team License |
| 33 | Boilerplate](http://redmine.named-data.net/projects/nfd/wiki/NDN_Team_License_Boilerplate_(NFD)). |
| 34 | |
Alexander Afanasyev | 2aa3962 | 2014-01-22 11:51:11 -0800 | [diff] [blame] | 35 | Recommendations |
| 36 | --------------- |
| 37 | |
Alexander Afanasyev | 284257b | 2014-04-11 14:16:51 -0700 | [diff] [blame] | 38 | NFD code is subject to NFD [code style](http://redmine.named-data.net/projects/nfd/wiki/CodeStyle). |
| 39 | |
Alexander Afanasyev | 2aa3962 | 2014-01-22 11:51:11 -0800 | [diff] [blame] | 40 | |
| 41 | Running unit-tests |
| 42 | ------------------ |
| 43 | |
| 44 | To run unit tests, NFD needs to be configured and build with unit test support: |
| 45 | |
| 46 | ./waf configure --with-tests |
| 47 | ./waf |
| 48 | |
| 49 | The simplest way to run tests, is just to run the compiled binary without any parameters: |
| 50 | |
Alexander Afanasyev | 284257b | 2014-04-11 14:16:51 -0700 | [diff] [blame] | 51 | # Run core tests |
| 52 | ./build/unit-tests-core |
Alexander Afanasyev | 2aa3962 | 2014-01-22 11:51:11 -0800 | [diff] [blame] | 53 | |
Alexander Afanasyev | 284257b | 2014-04-11 14:16:51 -0700 | [diff] [blame] | 54 | # Run NFD daemon tests |
| 55 | ./build/unit-tests-daemon |
Alexander Afanasyev | 2aa3962 | 2014-01-22 11:51:11 -0800 | [diff] [blame] | 56 | |
Alexander Afanasyev | 284257b | 2014-04-11 14:16:51 -0700 | [diff] [blame] | 57 | # Run NFD RIB management tests |
| 58 | ./build/unit-tests-rib |
Alexander Afanasyev | 2aa3962 | 2014-01-22 11:51:11 -0800 | [diff] [blame] | 59 | |
Alexander Afanasyev | 284257b | 2014-04-11 14:16:51 -0700 | [diff] [blame] | 60 | However, [Boost.Test framework](http://www.boost.org/doc/libs/1_48_0/libs/test/doc/html/) |
| 61 | is very flexible and allows a number of run-time customization of what tests should be run. |
| 62 | For example, it is possible to choose to run only a specific test suite, only a specific |
| 63 | test case within a suite, or specific test cases within specific test suites: |
Alexander Afanasyev | 2aa3962 | 2014-01-22 11:51:11 -0800 | [diff] [blame] | 64 | |
Alexander Afanasyev | 284257b | 2014-04-11 14:16:51 -0700 | [diff] [blame] | 65 | # Run only TCP Face test suite of NFD daemon tests (see tests/daemon/face/tcp.cpp) |
| 66 | ./build/unit-tests-daemon -t FaceTcp |
Alexander Afanasyev | 2aa3962 | 2014-01-22 11:51:11 -0800 | [diff] [blame] | 67 | |
Alexander Afanasyev | 284257b | 2014-04-11 14:16:51 -0700 | [diff] [blame] | 68 | # Run only test case EndToEnd4 from the same test suite |
| 69 | ./build/unit-tests-daemon -t FaceTcp/EndToEnd4 |
| 70 | |
| 71 | # Run Basic test case from all core test suites |
| 72 | ./build/unit-tests-core -t */Basic |
| 73 | |
| 74 | By default, Boost.Test framework will produce verbose output only when a test case fails. |
| 75 | If it is desired to see verbose output (result of each test assertion), add `-l all` |
| 76 | option to `./build/unit-tests` command. To see test progress, you can use `-l test_suite` |
| 77 | or `-p` to show progress bar: |
| 78 | |
| 79 | # Show report all log messages including the passed test notification |
| 80 | ./build/unit-tests-daemon -l all |
| 81 | |
| 82 | # Show test suite messages |
| 83 | ./build/unit-tests-daemon -l test_suite |
| 84 | |
| 85 | # Show nothing |
| 86 | ./build/unit-tests-daemon -l nothing |
| 87 | |
| 88 | # Show progress bar |
| 89 | ./build/unit-tests-core -p |
Alexander Afanasyev | 2aa3962 | 2014-01-22 11:51:11 -0800 | [diff] [blame] | 90 | |
| 91 | There are many more command line options available, information about |
Alexander Afanasyev | 284257b | 2014-04-11 14:16:51 -0700 | [diff] [blame] | 92 | which can be obtained either from the command line using `--help` |
| 93 | switch, or online on [Boost.Test library](http://www.boost.org/doc/libs/1_48_0/libs/test/doc/html/) |
| 94 | website. |