Alexander Afanasyev | dfa52c4 | 2014-04-24 21:10:11 -0700 | [diff] [blame] | 1 | Notes for ndn-cxx developers |
| 2 | ============================ |
| 3 | |
Davide Pesavento | ae39daf | 2023-02-14 23:46:46 -0500 | [diff] [blame] | 4 | If you are new to the NDN software community, please read our |
| 5 | [Contributor's Guide](https://github.com/named-data/.github/blob/main/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 | 02ed332 | 2023-02-23 19:40:22 -0500 | [diff] [blame] | 10 | ndn-cxx code is subject to [ndn-cxx code style](https://docs.named-data.net/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 | ae39daf | 2023-02-14 23:46:46 -0500 | [diff] [blame] | 15 | Contributions to ndn-cxx must be licensed under the LGPL v3 or a compatible license. |
| 16 | If you choose the LGPL v3, please use the following license boilerplate in all `.hpp` |
| 17 | and `.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 | */ |
Alexander Afanasyev | af99f46 | 2015-01-19 21:43:09 -0800 | [diff] [blame] | 39 | |
| 40 | 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] | 41 | 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] | 42 | |
Davide Pesavento | 74daf74 | 2018-11-23 18:14:13 -0500 | [diff] [blame] | 43 | Running unit tests |
Alexander Afanasyev | cf49055 | 2016-06-27 22:51:36 -0700 | [diff] [blame] | 44 | ------------------ |
| 45 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 46 | 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] | 47 | into the configured location. For example: |
| 48 | |
Davide Pesavento | 46b04a5 | 2019-03-28 21:36:35 -0400 | [diff] [blame] | 49 | ./waf configure --with-tests # --debug is also strongly recommended while developing |
Alexander Afanasyev | cf49055 | 2016-06-27 22:51:36 -0700 | [diff] [blame] | 50 | ./waf |
| 51 | sudo ./waf install |
| 52 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 53 | **Note**: On Linux you also need to run `sudo ldconfig` to reconfigure dynamic loader |
| 54 | run-time bindings. |
Alexander Afanasyev | cf49055 | 2016-06-27 22:51:36 -0700 | [diff] [blame] | 55 | |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 56 | 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] | 57 | |
| 58 | ./build/unit-tests |
| 59 | |
Davide Pesavento | 550d8c9 | 2023-11-05 01:30:01 -0400 | [diff] [blame] | 60 | The [Boost.Test framework](https://www.boost.org/doc/libs/1_71_0/libs/test/doc/html/index.html) |
Alexander Afanasyev | cf49055 | 2016-06-27 22:51:36 -0700 | [diff] [blame] | 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: |
| 64 | |
Davide Pesavento | 74daf74 | 2018-11-23 18:14:13 -0500 | [diff] [blame] | 65 | # Run only Face test suite tests (tests/unit/face.t.cpp) |
Alexander Afanasyev | cf49055 | 2016-06-27 22:51:36 -0700 | [diff] [blame] | 66 | ./build/unit-tests -t TestFace |
| 67 | |
| 68 | # Run only test case ExpressInterestData from the same test suite |
| 69 | ./build/unit-tests -t TestFace/ExpressInterestData |
| 70 | |
| 71 | # Run Basic test case from all test suites |
| 72 | ./build/unit-tests -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` |
Davide Pesavento | 534b841 | 2018-12-08 19:19:09 -0500 | [diff] [blame] | 76 | option to `./build/unit-tests` command. To see test progress, you can use `-l test_suite`, |
| 77 | or `-p` to show a progress bar: |
Alexander Afanasyev | cf49055 | 2016-06-27 22:51:36 -0700 | [diff] [blame] | 78 | |
| 79 | # Show report all log messages including the passed test notification |
| 80 | ./build/unit-tests -l all |
| 81 | |
| 82 | # Show test suite messages |
| 83 | ./build/unit-tests -l test_suite |
| 84 | |
| 85 | # Show nothing |
| 86 | ./build/unit-tests -l nothing |
| 87 | |
| 88 | # Show progress bar |
| 89 | ./build/unit-tests -p |
| 90 | |
| 91 | 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] | 92 | either from the command line using the `--help` switch, or online on the |
Davide Pesavento | 550d8c9 | 2023-11-05 01:30:01 -0400 | [diff] [blame] | 93 | [Boost.Test website](https://www.boost.org/doc/libs/1_71_0/libs/test/doc/html/boost_test/runtime_config.html). |
Alexander Afanasyev | cf49055 | 2016-06-27 22:51:36 -0700 | [diff] [blame] | 94 | |
| 95 | **Warning:** If you have customized parameters for NDN platform using `client.conf` in |
| 96 | `/etc/ndn` or `/usr/local/etc/ndn` (or other `@SYSCONFDIR@/etc` if it was configured to custom |
| 97 | path during `./waf configure`), Face-related test cases may fail. |