contribute.dox 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. // Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
  2. //
  3. // This Source Code Form is subject to the terms of the Mozilla Public
  4. // License, v. 2.0. If a copy of the MPL was not distributed with this
  5. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
  6. /**
  7. @page contributorGuide Kea Contributor's Guide
  8. So you found a bug in Kea or plan to develop an extension and want to
  9. send a patch? Great! This page will explain how to contribute your
  10. changes smoothly.
  11. @section contributorGuideWritePatch Writing a patch
  12. Before you start working on a patch or a new feature, it is a good
  13. idea to discuss it first with Kea developers. You can post your
  14. questions to the \c kea-dev mailing list
  15. (https://lists.isc.org/mailman/listinfo/kea-dev) or kea-users
  16. (https://lists.isc.org/mailman/listinfo/kea-users). The kea-users list
  17. is intended for users who are not interested in the internal workings
  18. or development details of Kea: it is OK to ask for feedback regarding new
  19. design or the best proposed solution to a certain problem, but all
  20. the internal details should be discussed on kea-dev and not posted
  21. to kea-users.
  22. If you prefer to get
  23. faster feedback, most Kea developers hang out in the \c dhcp
  24. jabber room (xmpp:dhcp@conference.jabber.isc.org). Feel free to join this
  25. room and talk to us. It is possible that someone else is working on your
  26. specific issue or perhaps the solution you plan to implement is not
  27. the best one. Often having a 10 minute talk could save many hours of
  28. engineering work.
  29. The first step in writing the patch or new feature should be to get
  30. the source code from our Git repository. The procedure is very easy and
  31. is explained here: http://kea.isc.org/wiki/GitGuidelines. While it is
  32. possible to provide a patch against the latest stable release, it makes
  33. the review process much easier if it is for latest code from the Git \c
  34. master branch.
  35. OK, so you have written a patch? Great! Before you submit it, make sure
  36. that your code compiles. This may seem obvious, but there's more to
  37. it. You have surely checked that it compiles on your system, but Kea
  38. is portable software. Besides Linux, it is compiled and used on
  39. relatively uncommon systems like OpenBSD and Solaris 11. Will your code
  40. compile and work there? What about endianess? It is likely that you used
  41. a regular x86 architecture machine to write your patch, but the software
  42. is expected to run on many other architectures. You may take a look at
  43. system specific build notes (http://kea.isc.org/wiki/SystemSpecificNotes).
  44. For a complete list of systems we build on, you may take a look at the
  45. following build farm report: https://jenkins.isc.org/view/Kea_BuildFarm/ .
  46. Does your patch conform to Kea coding guidelines
  47. (http://kea.isc.org/wiki/CodingGuidelines)? You can submit a
  48. patch that does not adhere to them, but that will reduce its chances of
  49. being accepted. If the deviations are minor, the Kea engineer who
  50. does the review will likely fix the issues. However, if there are lots
  51. of issues, the reviewer may simply reject the patch and ask you to fix
  52. it before re-submitting.
  53. @section contributorGuideUnittests Running unit-tests
  54. One of the ground rules in Kea development is that every piece of
  55. code has to be tested. We now have an extensive set of unit-tests for
  56. almost every line of code. Even if you are fixing something small,
  57. like a single line fix, you are encouraged to write unit-tests for that
  58. change. That is even more true for new code: if you write a new
  59. function, method or a class, you definitely should write unit-tests
  60. for it.
  61. To ensure that everything is tested, ISC uses a development method
  62. called Test Driven Development (TDD). In TDD, a feature is developed
  63. alongside the tests, with the tests being written first. In detail,
  64. a test is written for a small piece of functionality and run against
  65. the existing code. (In the case where the test is a unit test for
  66. a function, it would be run against an empty (unimplemented)
  67. function.) The test should fail. A minimal amount of code is then
  68. written, just enough to get the test to pass. Then the process is
  69. repeated for the next small piece of functionality. This continues
  70. until all the functionality has been implemented.
  71. This approach has two advantages:
  72. - By writing a test first and then only enough code to pass the
  73. test, that code is fully tested. By repeating this process until
  74. the feature is fully implemented, all the code gets test coverage.
  75. You avoid the situation where not enough tests have been written
  76. to check all the code.
  77. - By running the test before the code implementing the function is
  78. written and observing the test fail, you can detect the situation
  79. where a bug in the test code will cause it to pass regardless of
  80. the code being tested.
  81. See @ref qaUnitTests for instructions on how to run unit-tests.
  82. If you happen to add new files or have modified any \c Makefile.am
  83. files, it is also a good idea to check if you haven't broken the
  84. distribution process:
  85. @code
  86. make distcheck
  87. @endcode
  88. There are other useful switches which can be passed to configure. It is
  89. always a good idea to use \c --enable-logger-checks, which does sanity
  90. checks on logger parameters. Use \c --enable-debug to enable various
  91. additional consistency checks that reduce performance but help during
  92. development. If you happen to modify anything in the
  93. documentation, use \c --enable-generate-docs. If you are modifying DHCP
  94. code, you are likely to be interested in enabling a non-default database
  95. backends for DHCP. Note that if the backend is not enabled,
  96. the database-specific unit-tests are skipped. To enable the MySQL backend,
  97. use the switch \c --with-dhcp-mysql; for PostgreSQL, use \c --with-dhcp-pgsql.
  98. A complete list of all switches can be obtained with the command:
  99. @code
  100. ./configure --help
  101. @endcode
  102. @section contributorGuideReview Going through a review
  103. Once everything is checked and working, feel free to create a ticket for
  104. your patch at http://kea.isc.org/ or attach your patch to an existing
  105. ticket if you have fixed it. It would be nice if you also join the
  106. \c dhcp chatroom saying that you have submitted a patch. Alternatively,
  107. you may send a note to the \c kea-dev mailing list.
  108. Here's the tricky part. One of Kea developers will review your patch,
  109. but it may not happen immediately. Unfortunately, developers are usually
  110. working under a tight schedule, so any extra unplanned review work may
  111. take a while sometimes. Having said that, we value external
  112. contributions very much and will do whatever we can to review patches in
  113. a timely manner. Don't get discouraged if your patch is not accepted
  114. after first review. To keep the code quality high, we use the same
  115. review processes for external patches as we do for internal code. It may take
  116. some cycles of review/updated patch submissions before the code is
  117. finally accepted. The nature of the review process is that it emphasizes
  118. areas that need improvement. If you are not used to the review process,
  119. you may get the impression that the feedback is negative. It is not: even
  120. the Kea developers seldom see reviews that say "All OK please merge".
  121. Once the process is almost complete, the developer will likely ask you
  122. how you would like to be credited. The typical answers are by first and
  123. last name, by nickname, by company name or anonymously. Typically we
  124. will add a note to the \c ChangeLog and also set you as the author of
  125. the commit applying the patch. If the contributed feature is big or
  126. critical for whatever reason, it may also be mentioned in release notes.
  127. @section contributorGuideExtra Extra steps
  128. If you are interested in knowing the results of more in-depth testing,
  129. you are welcome to visit the ISC Jenkins page: https://jenkins.isc.org
  130. (Our old Kea build farm http://git.kea.isc.org/~tester/builder/KEA-builder-new.html
  131. is being migrated to Jenkins). This is a
  132. live result page with all tests being run on various systems. Besides
  133. basic unit-tests, we also have reports from valgrind (memory debugger),
  134. cppcheck and clang-analyzer (static code analyzers), Lettuce system
  135. tests and more. Although it is not possible for non ISC employees to run
  136. tests on that farm, it is possible that your contributed patch will end
  137. up there sooner or later. We also have ISC Forge tests running, but currently
  138. the test results are not publicly available.
  139. */