Alexander Afanasyev | dfa52c4 | 2014-04-24 21:10:11 -0700 | [diff] [blame] | 1 | Notes for ndn-cxx developers |
| 2 | ============================ |
| 3 | |
Nick Gordon | fe13f56 | 2017-12-21 14:12:37 -0600 | [diff] [blame] | 4 | If you are new to the NDN community of software generally, read the |
Davide Pesavento | 78338c5 | 2020-04-20 23:00:02 -0400 | [diff] [blame] | 5 | [Contributor's Guide](https://github.com/named-data/.github/blob/master/CONTRIBUTING.md). |
Nick Gordon | fe13f56 | 2017-12-21 14:12:37 -0600 | [diff] [blame] | 6 | |
Alexander Afanasyev | dfa52c4 | 2014-04-24 21:10:11 -0700 | [diff] [blame] | 7 | Code style |
| 8 | ---------- |
| 9 | |
Davide Pesavento | 46b04a5 | 2019-03-28 21:36:35 -0400 | [diff] [blame] | 10 | ndn-cxx code is subject to [ndn-cxx code style](https://named-data.net/doc/ndn-cxx/current/code-style.html). |
Alexander Afanasyev | dfa52c4 | 2014-04-24 21:10:11 -0700 | [diff] [blame] | 11 | |
| 12 | Licensing |
| 13 | --------- |
| 14 | |
Davide Pesavento | 46b04a5 | 2019-03-28 21:36:35 -0400 | [diff] [blame] | 15 | Contributions to the library must be licensed under the LGPL v3 or compatible license. If |
| 16 | you are choosing LGPL v3, please use the following license boilerplate in all `.hpp` and |
Alexander Afanasyev | c169a81 | 2014-05-20 20:37:29 -0400 | [diff] [blame] | 17 | `.cpp` files: |
Alexander Afanasyev | dfa52c4 | 2014-04-24 21:10:11 -0700 | [diff] [blame] | 18 | |
Alexander Afanasyev | c169a81 | 2014-05-20 20:37:29 -0400 | [diff] [blame] | 19 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
Junxiao Shi | bd2cedb | 2017-07-05 18:51:52 +0000 | [diff] [blame] | 20 | /* |
Davide Pesavento | 46b04a5 | 2019-03-28 21:36:35 -0400 | [diff] [blame] | 21 | * Copyright (c) [Year(s)] [Copyright Holder(s)]. |
Alexander Afanasyev | dfa52c4 | 2014-04-24 21:10:11 -0700 | [diff] [blame] | 22 | * |
| 23 | * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). |
Alexander Afanasyev | dfa52c4 | 2014-04-24 21:10:11 -0700 | [diff] [blame] | 24 | * |
Alexander Afanasyev | c169a81 | 2014-05-20 20:37:29 -0400 | [diff] [blame] | 25 | * ndn-cxx library is free software: you can redistribute it and/or modify it under the |
| 26 | * terms of the GNU Lesser General Public License as published by the Free Software |
| 27 | * Foundation, either version 3 of the License, or (at your option) any later version. |
| 28 | * |
| 29 | * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY |
| 30 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
| 31 | * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
| 32 | * |
| 33 | * You should have received copies of the GNU General Public License and GNU Lesser |
| 34 | * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see |
| 35 | * <http://www.gnu.org/licenses/>. |
| 36 | * |
| 37 | * See AUTHORS.md for complete list of ndn-cxx authors and contributors. |
Alexander Afanasyev | dfa52c4 | 2014-04-24 21:10:11 -0700 | [diff] [blame] | 38 | ////// [optional part] ////// |
| 39 | * |
| 40 | * @author Author's Name <email@domain-or-homepage://url> |
| 41 | * @author Other Author's Name <another.email@domain-or-homepage://url> |
| 42 | ////// [end of optional part] ////// |
| 43 | */ |
Alexander Afanasyev | af99f46 | 2015-01-19 21:43:09 -0800 | [diff] [blame] | 44 | |
| 45 | If you are affiliated to an NSF-supported NDN project institution, please use the [NDN Team License |
Davide Pesavento | 0530b5b | 2016-11-07 03:23:58 +0100 | [diff] [blame] | 46 | Boilerplate](https://redmine.named-data.net/projects/ndn-cxx/wiki/NDN_Team_License_Boilerplate_(ndn-cxx)). |
Alexander Afanasyev | cf49055 | 2016-06-27 22:51:36 -0700 | [diff] [blame] | 47 | |
Davide Pesavento | 74daf74 | 2018-11-23 18:14:13 -0500 | [diff] [blame] | 48 | Running unit tests |
Alexander Afanasyev | cf49055 | 2016-06-27 22:51:36 -0700 | [diff] [blame] | 49 | ------------------ |
| 50 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 51 | To run the unit tests, ndn-cxx needs to be built with unit test support and installed |
Alexander Afanasyev | cf49055 | 2016-06-27 22:51:36 -0700 | [diff] [blame] | 52 | into the configured location. For example: |
| 53 | |
Davide Pesavento | 46b04a5 | 2019-03-28 21:36:35 -0400 | [diff] [blame] | 54 | ./waf configure --with-tests # --debug is also strongly recommended while developing |
Alexander Afanasyev | cf49055 | 2016-06-27 22:51:36 -0700 | [diff] [blame] | 55 | ./waf |
| 56 | sudo ./waf install |
| 57 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 58 | **Note**: On Linux you also need to run `sudo ldconfig` to reconfigure dynamic loader |
| 59 | run-time bindings. |
Alexander Afanasyev | cf49055 | 2016-06-27 22:51:36 -0700 | [diff] [blame] | 60 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 61 | The simplest way to run the tests is to launch the compiled binary without any parameters: |
Alexander Afanasyev | cf49055 | 2016-06-27 22:51:36 -0700 | [diff] [blame] | 62 | |
| 63 | ./build/unit-tests |
| 64 | |
Davide Pesavento | 78338c5 | 2020-04-20 23:00:02 -0400 | [diff] [blame] | 65 | The [Boost.Test framework](https://www.boost.org/doc/libs/1_65_1/libs/test/doc/html/index.html) |
Alexander Afanasyev | cf49055 | 2016-06-27 22:51:36 -0700 | [diff] [blame] | 66 | is very flexible and allows a number of run-time customization of what tests should be run. |
| 67 | For example, it is possible to choose to run only a specific test suite, only a specific |
| 68 | test case within a suite, or specific test cases within specific test suites: |
| 69 | |
Davide Pesavento | 74daf74 | 2018-11-23 18:14:13 -0500 | [diff] [blame] | 70 | # Run only Face test suite tests (tests/unit/face.t.cpp) |
Alexander Afanasyev | cf49055 | 2016-06-27 22:51:36 -0700 | [diff] [blame] | 71 | ./build/unit-tests -t TestFace |
| 72 | |
| 73 | # Run only test case ExpressInterestData from the same test suite |
| 74 | ./build/unit-tests -t TestFace/ExpressInterestData |
| 75 | |
| 76 | # Run Basic test case from all test suites |
| 77 | ./build/unit-tests -t */Basic |
| 78 | |
| 79 | By default, Boost.Test framework will produce verbose output only when a test case fails. |
| 80 | If it is desired to see verbose output (result of each test assertion), add `-l all` |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 81 | option to `./build/unit-tests` command. To see test progress, you can use `-l test_suite`, |
| 82 | or `-p` to show a progress bar: |
Alexander Afanasyev | cf49055 | 2016-06-27 22:51:36 -0700 | [diff] [blame] | 83 | |
| 84 | # Show report all log messages including the passed test notification |
| 85 | ./build/unit-tests -l all |
| 86 | |
| 87 | # Show test suite messages |
| 88 | ./build/unit-tests -l test_suite |
| 89 | |
| 90 | # Show nothing |
| 91 | ./build/unit-tests -l nothing |
| 92 | |
| 93 | # Show progress bar |
| 94 | ./build/unit-tests -p |
| 95 | |
| 96 | There are many more command line options available, information about which can be obtained |
Davide Pesavento | 78338c5 | 2020-04-20 23:00:02 -0400 | [diff] [blame] | 97 | either from the command line using the `--help` switch, or online on the |
| 98 | [Boost.Test website](https://www.boost.org/doc/libs/1_65_1/libs/test/doc/html/index.html). |
Alexander Afanasyev | cf49055 | 2016-06-27 22:51:36 -0700 | [diff] [blame] | 99 | |
| 100 | **Warning:** If you have customized parameters for NDN platform using `client.conf` in |
| 101 | `/etc/ndn` or `/usr/local/etc/ndn` (or other `@SYSCONFDIR@/etc` if it was configured to custom |
| 102 | path during `./waf configure`), Face-related test cases may fail. |