contribute.dox 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. // Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC")
  2. //
  3. // Permission to use, copy, modify, and/or distribute this software for any
  4. // purpose with or without fee is hereby granted, provided that the above
  5. // copyright notice and this permission notice appear in all copies.
  6. //
  7. // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  8. // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  9. // AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  10. // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  11. // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  12. // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  13. // PERFORMANCE OF THIS SOFTWARE.
  14. /**
  15. @page contributorGuide Kea Contributor's Guide
  16. So you found a bug in Kea or plan to develop an extension and want to
  17. send a patch? Great! This page will explain how to contribute your
  18. changes smoothly.
  19. @section contributorGuideWritePatch Writing a patch
  20. Before you start working on a patch or a new feature, it is a good
  21. idea to discuss it first with Kea developers. You can post your
  22. questions to the \c kea-dev mailing list
  23. (https://lists.isc.org/mailman/listinfo/kea-dev) or kea-users
  24. (https://lists.isc.org/mailman/listinfo/kea-users). Kea-users list
  25. is intended for users who are not interested in the internal working
  26. or development details. It is ok to ask for feedback regarding new
  27. design or the best proposed solution to a certain problem, but all
  28. the internal details should be limited to kea-dev and not posted
  29. on kea-users. If you prefer to get
  30. faster feedback, most Kea developers hang out in the \c dhcp
  31. jabber room (xmpp:dhcp@conference.jabber.isc.org). Feel free to join this
  32. room and talk to us. It is possible that someone else is working on your
  33. specific issue or perhaps the solution you plan to implement is not
  34. the best one. Often having a 10 minute talk could save many hours of
  35. engineering work.
  36. First step would be to get the source code from our Git repository. The
  37. procedure is very easy and is explained here:
  38. http://kea.isc.org/wiki/GitGuidelines. While it is possible to
  39. provide a patch against the latest stable release, it makes the review
  40. process much easier if it is for latest code from the Git \c master
  41. branch.
  42. Ok, so you have written a patch? Great! Before you submit it, make sure
  43. that your code compiles. This may seem obvious, but there's more to
  44. it. You have surely checked that it compiles on your system, but Kea
  45. is a portable software. Besides Linux, it is compiled and used on
  46. relatively uncommon systems like OpenBSD and Solaris 11. Will your code
  47. compile and work there? What about endianess? It is likely that you used
  48. a regular x86 architecture machine to write your patch, but the software
  49. is expected to run on many other architectures. You may take a look at
  50. system specific build notes (http://kea.isc.org/wiki/SystemSpecificNotes).
  51. For a complete list of systems we build on, you may take a look at the
  52. following build farm report: http://git.kea.isc.org/~tester/builder/KEA-builder-new.html .
  53. Does your patch conform to Kea coding guidelines
  54. (http://kea.isc.org/wiki/CodingGuidelines)? You still can submit a
  55. patch that does not adhere to it, but that will decrease its chances of
  56. being accepted. If the deviations are minor, the Kea engineer who
  57. does the review will likely fix the issues. However, if there are lots
  58. of issues, the reviewer may simply reject the patch and ask you to fix
  59. it before re-submitting.
  60. @section contributorGuideUnittests Running unit-tests
  61. One of the ground rules in Kea development is that every piece of
  62. code has to be tested. We now have an extensive set of unit-tests for
  63. almost every line of code. Even if you are fixing something small,
  64. like a single line fix, it is encouraged to write unit-tests for that
  65. change. That is even more true for new code. If you write a new
  66. function, method or a class, you definitely should write unit-tests
  67. for it.
  68. Kea uses the Google C++ Testing Framework (also called googletest or
  69. gtest) as a base for our C++ unit-tests. See
  70. http://code.google.com/p/googletest/ for details. We still have some Python
  71. unit-tests that we inherited from BIND10 days, but those tests are being
  72. removed, so please do not develop any new Python tests in Kea. (If you
  73. want to write DHCP tests in Python, we encourage you to take a look
  74. at ISC Forge: http://kea.isc.org/wiki/IscForge). You must
  75. have \c gtest installed or at least extracted in a directory before
  76. compiling Kea unit-tests. To enable unit-tests in Kea, use:
  77. @code
  78. ./configure --with-gtest=/path/to/your/gtest/dir
  79. @endcode
  80. or
  81. @code
  82. ./configure --with-gtest-source=/path/to/your/gtest/dir
  83. @endcode
  84. Depending on how you compiled or installed \c gtest (e.g. from sources
  85. or using some package management system) one of those two switches will
  86. find \c gtest. After that you make run unit-tests:
  87. @code
  88. make check
  89. @endcode
  90. If you happen to add new files or have modified any \c Makefile.am
  91. files, it is also a good idea to check if you haven't broken the
  92. distribution process:
  93. @code
  94. make distcheck
  95. @endcode
  96. There are other useful switches which can be passed to configure. It is
  97. always a good idea to use \c --enable-logger-checks, which does sanity
  98. checks on logger parameters. Use \c --enable-debug to enable various
  99. additional consistency checks that reduce performance but help during
  100. development. If you happen to modify anything in the
  101. documentation, use \c --enable-generate-docs. If you are modifying DHCP
  102. code, you are likely to be interested in enabling the MySQL backend for
  103. DHCP. Note that if the backend is not enabled, MySQL specific unit-tests
  104. are skipped. From that perspective, it is useful to use
  105. \c --with-dhcp-mysql. For PostgreSQL, use \c --with-dhcp-pgsql. For a
  106. complete list of all switches, use:
  107. @code
  108. ./configure --help
  109. @endcode
  110. @section contributorGuideReview Going through a review
  111. Once all those are checked and working, feel free to create a ticket for
  112. your patch at http://kea.isc.org/ or attach your patch to an existing
  113. ticket if you have fixed it. It would be nice if you also join the
  114. \c dhcp chatroom saying that you have submitted a patch. Alternatively,
  115. you may send a note to the \c kea-dev mailing list.
  116. Here's the tricky part. One of Kea developers will review your patch,
  117. but it may not happen immediately. Unfortunately, developers are usually
  118. working under a tight schedule, so any extra unplanned review work may
  119. take a while sometimes. Having said that, we value external
  120. contributions very much and will do whatever we can to review patches in
  121. a timely manner. Don't get discouraged if your patch is not accepted
  122. after first review. To keep the code quality high, we use the same
  123. review processes for internal code and for external patches. It may take
  124. some cycles of review/updated patch submissions before the code is
  125. finally accepted. The nature of the review process is that it emphasizes
  126. areas that need improvement. If you are not used to the review process,
  127. you may get the impression that the feedback is negative. It is not. We
  128. seldom see reviews that say "all ok, please merge".
  129. Once the process is almost complete, the developer will likely ask you
  130. how you would like to be credited. The typical answers are by first and
  131. last name, by nickname, by company name or anonymously. Typically we
  132. will add a note to the \c ChangeLog and also set you as the author of
  133. the commit applying the patch. If the contributted feature is big or
  134. critical for whatever reason, it may also be mentioned in release notes.
  135. @section contributorGuideExtra Extra steps
  136. If you are interested in knowing the results of more in-depth testing,
  137. you are welcome to visit the Kea build farm:
  138. http://git.kea.isc.org/~tester/builder/KEA-builder-new.html. This is a
  139. live result page with all tests being run on various systems. Besides
  140. basic unit-tests, we also have reports from Valgrind (memory debugger),
  141. cppcheck and clang-analyzer (static code analyzers), Lettuce system
  142. tests and more. Although it is not possible for non ISC employees to run
  143. tests on that farm, it is possible that your contributed patch will end
  144. up there sooner or later. We also have ISC Forge tests running, but currently
  145. the test results are not publicly available.
  146. */