You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- See the default configuration used by dpctl in `.clang-format`.
13
13
14
-
Run before each commit: `clang-format -style=file -i dpctl-capi/include/*.h dpctl-capi/include/Support/*.h dpctl-capi/source/*.cpp dpctl-capi/tests/*.cpp dpctl-capi/helper/include/*.h dpctl-capi/helper/source/*.cpp`
14
+
Run before each commit:
15
+
16
+
```bash
17
+
clang-format -style=file -i \
18
+
dpctl-capi/include/*.h \
19
+
dpctl-capi/include/Support/*.h \
20
+
dpctl-capi/source/*.cpp \
21
+
dpctl-capi/tests/*.cpp \
22
+
dpctl-capi/helper/include/*.h \
23
+
dpctl-capi/helper/source/*.cpp
24
+
```
25
+
26
+
> **_NOTE:_** A much simpler option is to use `pre-commit` and the
27
+
> `clang-format` hook that we provide.
15
28
16
29
### Python code style
17
30
@@ -121,61 +134,51 @@ Run before each commit: `bandit -r dpctl -lll`
121
134
122
135
## Code Coverage
123
136
124
-
Implement python, cython and c++ file coverage using `coverage` and `llvm-cov`
125
-
packages on Linux.
126
-
127
-
### Using Code Coverage
128
-
129
-
You need to install additional packages and add an environment variable to
130
-
cover:
131
-
- conda install cmake
132
-
- conda install coverage
133
-
- conda install conda-forge::lcov
134
-
- conda install conda-forge::gtest
135
-
- export CODE_COVERAGE=ON
136
-
137
-
CODE_COVERAGE allows you to build a debug version of dpctl and enable string
138
-
tracing, which allows you to analyze strings to create a coverage report.
139
-
It was added for the convenience of configuring the CI in the future.
140
-
141
-
Installing the dpctl package:
142
-
- python setup.py develop
137
+
Code coverage for both C and Python sources in dpctl is generated for each
138
+
pull request (PR). A PR cannot be merged if it leads to a drop in the code
139
+
coverage by more than five percentage points. *Ergo, do not forget to write
140
+
unit tests for your changes.* To check the code coverage for your code, follow
141
+
these steps:
143
142
144
-
It is important that there are no files of the old build in the folder.
145
-
Use `git clean -xdf` to clean up the working tree.
143
+
1. Install dependencies for C/C++ source.
146
144
147
-
The coverage report will appear during the build in the console. This report
148
-
contains information about c++ file coverage.
149
-
The `dpctl-c-api-coverage` folder will appear in the root folder after
150
-
installation. The folder contains a report on the coverage of c++ files in html
151
-
format.
145
+
For C/C++ source we require `lcov`, `llvm-cov`, and `llvm-profdata`. Note
146
+
that `llvm-cov` and `llvm-profdata` should be version 11.0 or higher. If you
147
+
have multiple `llvm-cov` tools installed, most likely because you have
148
+
multiple llvm installations, you should set the `LLVM_TOOLS_HOME`
149
+
environment variable to make sure the correct one is used to generate
150
+
coverage.
152
151
153
-
You need to run tests to cover the cython and python files:
154
-
- coverage run -m unittest dpctl.tests
152
+
2. Install dependencies for Python sources.
155
153
156
-
The required flags for the command coverage run are contained in the file
157
-
`.coveragerc`.
154
+
To generate the coverage data for dpctl's Python sources, you only need to
155
+
install `coverage`.
158
156
159
-
The simplest reporting is a textual summary produced with report:
160
-
- coverage report
157
+
3. Build dpctl with code coverage support.
161
158
162
-
For each module executed, the report shows the count of executable statements,
163
-
the number of those statements missed, and the resulting coverage, expressed as
0 commit comments