mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
doc: reformat guidelines
- use markdown format instead of simple text file Change-Id: I5a20cee4ad5b2f9653deada839b699f9634fba28 Signed-off-by: Jacek Danecki <jacek.danecki@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
5007c60a03
commit
892cf13c15
43
documentation/GUIDELINES.md
Normal file
43
documentation/GUIDELINES.md
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
File to cover guidelines for NEO project.
|
||||||
|
|
||||||
|
# C++ usage
|
||||||
|
|
||||||
|
* use c++ style casts instead of c style casts.
|
||||||
|
* do not use default parameters
|
||||||
|
* prefer using over typedef
|
||||||
|
* avoid defines for constants, use constexpr
|
||||||
|
* prefer forward declarations in headers
|
||||||
|
* avoid includes in headers unless absolutely necessary
|
||||||
|
|
||||||
|
# Naming conventions
|
||||||
|
|
||||||
|
* use camelCase for variables names
|
||||||
|
* prefer verbose variable names
|
||||||
|
```
|
||||||
|
bad examples : sld, elws, aws
|
||||||
|
good examples : sourceLevelDebugger, enqueuedLocalWorkGroupSize, actualWorkGroupSize
|
||||||
|
```
|
||||||
|
* follow givenWhenThen test naming pattern, indicate what is interesting in the test
|
||||||
|
|
||||||
|
bad examples :
|
||||||
|
```
|
||||||
|
TEST(CsrTests, initialize)
|
||||||
|
TEST(CQTests, simple)
|
||||||
|
TEST(CQTests, basic)
|
||||||
|
TEST(CQTests, works)
|
||||||
|
```
|
||||||
|
good examples:
|
||||||
|
```
|
||||||
|
TEST(CommandStreamReceiverTests, givenCommandStreamReceiverWhenItIsInitializedThenProperFieldsAreSet)
|
||||||
|
TEST(CommandQueueTests, givenCommandQueueWhenEnqueueIsDoneThenTaskLevelIsModifed)
|
||||||
|
TEST(CommandQueueTests, givenCommandQueueWithDefaultParamtersWhenEnqueueIsDoneThenTaskCountIncreases)
|
||||||
|
TEST(CommandQueueTests, givenCommandQueueWhenEnqueueWithBlockingFlagIsSetThenDriverWaitsUntilAllCommandsAreCompleted)
|
||||||
|
```
|
||||||
|
# Testing mindset
|
||||||
|
|
||||||
|
* Test behaviors instead of implementations, do not focus on adding a test per every function in the
|
||||||
|
class (avoid tests for setters and getters), focus on the functionality you are adding and how it changes
|
||||||
|
the driver behavior, do not bind tests to implementation.
|
||||||
|
* Make sure that test is fast, our test suite needs to complete in seconds for efficient development pace, as
|
||||||
|
a general rule test shouldn't be longer then 1ms in Debug driver.
|
||||||
|
|
@ -1,48 +0,0 @@
|
|||||||
File to cover guidelines for NEO project.
|
|
||||||
|
|
||||||
[============================================================================]
|
|
||||||
C++ usage
|
|
||||||
[============================================================================]
|
|
||||||
|
|
||||||
- use c++ style casts instead of c style casts.
|
|
||||||
- do not use default parameters
|
|
||||||
- prefer using over typedef
|
|
||||||
- avoid defines for constants, use constexpr
|
|
||||||
- prefer forward declarations in headers
|
|
||||||
- avoid includes in headers unless absolutely necessary
|
|
||||||
|
|
||||||
[============================================================================]
|
|
||||||
Naming conventions
|
|
||||||
[============================================================================]
|
|
||||||
|
|
||||||
- use camelCase for variables names
|
|
||||||
|
|
||||||
- prefer verbose variable names
|
|
||||||
bad examples : sld, elws, aws
|
|
||||||
good examples : sourceLevelDebugger, enqueuedLocalWorkGroupSize, actualWorkGroupSize
|
|
||||||
|
|
||||||
- follow givenWhenThen test naming pattern, indicate what is interesting in the test
|
|
||||||
|
|
||||||
bad examples :
|
|
||||||
TEST(CsrTests, initialize)
|
|
||||||
TEST(CQTests, simple)
|
|
||||||
TEST(CQTests, basic)
|
|
||||||
TEST(CQTests, works)
|
|
||||||
|
|
||||||
good examples:
|
|
||||||
TEST(CommandStreamReceiverTests, givenCommandStreamReceiverWhenItIsInitializedThenProperFieldsAreSet)
|
|
||||||
TEST(CommandQueueTests, givenCommandQueueWhenEnqueueIsDoneThenTaskLevelIsModifed)
|
|
||||||
TEST(CommandQueueTests, givenCommandQueueWithDefaultParamtersWhenEnqueueIsDoneThenTaskCountIncreases)
|
|
||||||
TEST(CommandQueueTests, givenCommandQueueWhenEnqueueWithBlockingFlagIsSetThenDriverWaitsUntilAllCommandsAreCompleted)
|
|
||||||
|
|
||||||
[============================================================================]
|
|
||||||
Testing mindset
|
|
||||||
[============================================================================]
|
|
||||||
|
|
||||||
- Test behaviors instead of implementations, do not focus on adding a test per every function in the
|
|
||||||
class (avoid tests for setters and getters), focus on the functionality you are adding and how it changes
|
|
||||||
the driver behavior, do not bind tests to implementation.
|
|
||||||
|
|
||||||
- Make sure that test is fast, our test suite needs to complete in seconds for efficient development pace, as
|
|
||||||
a general rule test shouldn't be longer then 1ms in Debug driver.
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
|||||||
# OTHER DEALINGS IN THE SOFTWARE.
|
# OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
set(RUNTIME_CODING_GUIDELINES
|
set(RUNTIME_CODING_GUIDELINES
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../../documentation/GUIDELINES.txt
|
${CMAKE_CURRENT_SOURCE_DIR}/../../documentation/GUIDELINES.md
|
||||||
)
|
)
|
||||||
target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_CODING_GUIDELINES})
|
target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_CODING_GUIDELINES})
|
||||||
set_property(GLOBAL PROPERTY RUNTIME_CODING_GUIDELINES ${RUNTIME_CODING_GUIDELINES})
|
set_property(GLOBAL PROPERTY RUNTIME_CODING_GUIDELINES ${RUNTIME_CODING_GUIDELINES})
|
||||||
|
Reference in New Issue
Block a user