Back to home page

sPhenix code displayed by LXR

 
 

    


Warning, /JETSCAPE/jail/README.md.old is written in an unsupported language. File is not indexed.

0001 # JETSCAPE-COMP
0002 New code repository of the JETSCAPE collaboration.
0003 New C++ code will be stored in this repository and used for version control.
0004 
0005 ## How to contribute to the code
0006 
0007 1. *fork* one copy of the repository to your github account. In order to do this, first ask Abhijit to give you the privilege.
0008 
0009 2. Follow the working flows in this [link](https://guides.github.com/introduction/flow/)
0010 
0011 3. Important notes:
0012 >   (1). *Pull request* does not mean "fork", it means that you request Abhijit to pull new modifications from your commits.
0013 >
0014 >   (2). The reposity is private, so cloning the repository from your github account to local machine is not as simple as usual. First find the reposity address by clicking on the green button "Clone or download", copy the address, for me it is: https://github.com/lgpang/JETSCAPE-COMP.git . For ordinary git reposity, one can use:  git clone https://github.com/lgpang/JETSCAPE-COMP.git
0015 >
0016 >    But for this private reposity, you must use: git clone https://your_user_name@github.com/lgpang/JETSCAPE-COMP.git ,
0017 >    where your_user_name is your user name of the github account.
0018 >
0019 >    (3) With this local copy you can create one branch first, and do modifications on that branch.
0020 >
0021 >    (4) After you are satisfied with your modifications, *push* the modification to github server
0022 >
0023 >    (5) Go to Abhijit's reposity and click "pull request" to ask for reviewing from other programers.
0024 >
0025 >    (6) After being reviewed, Abhijit can merge the modifications in that branch to the master branch.
0026 
0027 ## Coding standard
0028 1. C++11
0029 2. [CMake](https://cmake.org/cmake-tutorial/) for compiling
0030 3. [gtest](https://github.com/google/googletest/blob/master/googletest/docs/Primer.md) for unittest
0031 
0032 
0033 ## Use google test and CMake
0034 1. There is one main CMakeLists.txt for the whole jetscape project
0035 2. There is one CMakeLists.txt in each directory where you store your src code or tests code.
0036 3. For example, in src/fluid_dynamics/test/, there is one CMakeLists.txt with content,
0037 ```cmake
0038     ##############
0039     # Unit Tests
0040     ##############
0041     add_executable(runUnitTests linear_interpolation.cc)
0042     
0043     # Standard linking to gtest stuff.
0044     target_link_libraries(runUnitTests gtest gtest_main)
0045     
0046     # This is so you can do 'make test' to see all your tests run, instead of
0047     # manually running the executable runUnitTests to see those specific tests.
0048     add_test(NAME test1 COMMAND runUnitTests)
0049     
0050     # You can also omit NAME and COMMAND. The second argument could be some other
0051     # test executable.
0052     add_test(test2 runUnitTests)  
0053 ```
0054 4. You can run all the unit tests by,
0055 ```bash
0056    mkdir build
0057    cd build
0058    cmake .. -Dtest=ON
0059    make
0060    make test
0061 ```
0062 The results would be,
0063 ```bash
0064     Running tests...
0065     Test project /Users/lgpang/Jetscape/JETSCAPE-COMP/build
0066     Start 1: test1
0067     1/2 Test #1: test1 ............................   Passed    0.01 sec
0068         Start 2: test2
0069         2/2 Test #2: test2 ............................   Passed    0.01 sec
0070 
0071         100% tests passed, 0 tests failed out of 2
0072 ```
0073         Total Test time (real) =   0.02 sec