Development.rst 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. .. ################################################################################
  2. # HPCC SYSTEMS software Copyright (C) 2012-2018 HPCC Systems®.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. ################################################################################
  16. ===========
  17. HPCC Source
  18. ===========
  19. The most upto date details of building the system are found on the HPCC Wiki at
  20. https://github.com/hpcc-systems/HPCC-Platform/wiki/Building-HPCC.
  21. *******************
  22. Getting the sources
  23. *******************
  24. The HPCC Platform sources are hosted on GitHub at https://github.com/hpcc-systems/HPCC-Platform. You can download a
  25. snapshot of any branch using the download button there, or you can set up a git clone of the repository. If you are
  26. planning to contribute changes to the system, see the file CONTRIBUTORS at
  27. https://github.com/hpcc-systems/HPCC-Platform/blob/master/CONTRIBUTORS for information about how to set up a GitHub
  28. fork of the project through which pull-requests can be made.
  29. ********************************
  30. Building the system from sources
  31. ********************************
  32. Requirements
  33. ============
  34. The HPCC platform requires a number of third party tools and libraries in order to build. The `HPCC Wiki`_ contains the
  35. details of the dependencies that are required for different distributions.
  36. For building any documentation, the following are also required::
  37. sudo apt-get install docbook
  38. sudo apt-get install xsltproc
  39. sudo apt-get install fop
  40. **NOTE:** Installing the above via alternative methods (i.e. from source) may place installations outside of searched
  41. paths.
  42. Building the system
  43. ===================
  44. The HPCC system is built using the cross-platform build tool cmake, which is available for Windows, virtually all
  45. flavors of Linux, FreeBSD, and other platforms. You should install cmake version 2.8.3 or later before building the
  46. sources.
  47. On some distros you will need to build cmake from sources if the version of cmake in the standard repositories for
  48. that distro is not modern enough. It is good practice in cmake to separate the build directory where objects and
  49. executables are made from the source directory, and the HPCC cmake scripts will enforce this.
  50. To build the sources, create a directory where the built files should
  51. be located, and from that directory, run::
  52. cmake <source directory>
  53. Depending on your operating system and the compilers installed on it,
  54. this will create a makefile, Visual Studio .sln file, or other build
  55. script for building the system. If cmake was configured to create a
  56. makefile, then you can build simply by typing::
  57. make
  58. If a Visual Studio solution file was created, you can load it simply by typing the name::
  59. hpccsystems-platform.sln
  60. This will load the solution in Visual Studio where you can build in the usual way.
  61. *********
  62. Packaging
  63. *********
  64. To make an installation package on a supported linux system, use the command::
  65. make package
  66. This will first do a make to ensure everything is up to date, then will
  67. create the appropriate package for your operating system, Currently supported
  68. package formats are rpm (for RedHat/Centos) and .deb (for Debian and
  69. Ubuntu). If the operating system is not one of the above, or is not recognized,
  70. make package will create a tarball.
  71. The package installation does not start the service on the machine, so if you
  72. want to give it a go or test it (see below), make sure to start the service manually
  73. and wait until all services are up (mainly wait for EclWatch to come up on port 8010).
  74. ******************
  75. Testing the system
  76. ******************
  77. After compiling, installing the package and starting the services, you can test
  78. the HPCC platform on a single-node setup.
  79. Unit Tests
  80. ==========
  81. Some components have their own unit-tests. Once you have compiled (no need to
  82. start the services), you can already run them. Supposing you build a Debug
  83. version, from the build directory you can run::
  84. ./Debug/bin/roxie -selftest
  85. and::
  86. ./Debug/bin/eclagent -selftest
  87. You can also run the Dali regression self-tests::
  88. ./Debug/bin/daregress localhost
  89. Regression Tests
  90. ================
  91. **MORE** Completely out of date - needs rewriting.
  92. Compiler Tests
  93. ==============
  94. The ECLCC compiler tests rely on two distinct runs: a known good one and your
  95. test build. For normal development, you can safely assume that the OSS/master
  96. branch in github is good. For overnight testing, golden directories need to
  97. be maintained according to the test infrastructure. There are Bash (Linux)
  98. and Batch (Windows) scripts to run the regressions:
  99. The basic idea behind this tests is to compare the output files (logs and
  100. XML files) between runs. The log files should change slightly (the comparison
  101. should be good enough to filter most irrelevant differences), but the XML
  102. files should be identical if nothing has changed. You should only see
  103. differences in the XML where you have changed in the code, or new tests
  104. were added as part of your development.
  105. On Linux, there are two steps:
  106. Step 1: Check-out OSS/master, compile and run the regressions to populate
  107. the 'golden' directory::
  108. ./regress.sh -t golden -e buildDir/Debug/bin/eclcc
  109. This will run the regressions in parallel, using as many CPUs as you have,
  110. and using your just-compiled ECLCC, assuming you compiled for Debug version.
  111. Step 2: Make your changes (or check-out your branch), compile and run again,
  112. this time output to a new directory and compare to the 'golden' repo.::
  113. ./regress.sh -t my_branch -c golden -e buildDir/Debug/bin/eclcc
  114. This will run the regressions in the same way, output to 'my_branch' dir
  115. and compare it to the golden version, highlighting the differences.
  116. NOTE: If you changed the headers that the compiled binaries will use, you
  117. must re-install the package (or provide -i option to the script to the new
  118. headers).
  119. Step 3: Step 2 only listed the differences, now you need to see what they are.
  120. For that, re-run the regressing script omitting the compiler, since the only
  121. thing we'll do is to compare verbosely.::
  122. ./regress.sh -t my_branch -c golden
  123. This will show you all differences, using the same ignore filters as before,
  124. between your two branches. Once you're happy with the differences, commit and
  125. issue a pull-request.
  126. TODO: Describe compiler tests on Windows.
  127. ********************
  128. Debugging the system
  129. ********************
  130. On linux systems, the makefile generated by cmake will build a specific
  131. version (debug or release) of the system depending on the options selected
  132. when cmake is first run in that directory. The default is to build a release
  133. system. In order to build a debug system instead, use
  134. command::
  135. cmake -DCMAKE_BUILD_TYPE=Debug <source directory>
  136. You can then run make or make package in the usual way to build the system.
  137. On a Windows system, cmake always generates s solution file with both debug and
  138. release target platforms in it, so you can select which one to build within
  139. Visual Studio.
  140. .. _HPCC Wiki: https://github.com/hpcc-systems/HPCC-Platform/wiki/Building-HPCC