Skip to content

Commit bf23874

Browse files
Arm backend: Add .coveragerc file
Add basic test coverage configuration file. Signed-off-by: Sebastian Larsson <[email protected]> Change-Id: I7d0c1c6906072a2ca57e26d1d3e54c97b215c3e3
1 parent a29dc49 commit bf23874

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

backends/arm/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,29 @@ Or discover and run many tests:
7171
python -m unittest discover -s backends/arm/test/ops/
7272
```
7373

74+
### Code coverage
75+
76+
To get code coverage:
77+
78+
```
79+
coverage run --source=<SRC> --rcfile=backends/arm/test/.coveragerc -m pytest \
80+
--config-file=/dev/null backends/arm/test/
81+
```
82+
83+
All files in `SRC` and its child directories will be analysed for code coverage,
84+
unless explicitly exluded in the .coveragerc file. If using venv this might be
85+
under `env/lib/python<VERSION_NUMBER>/site-packages/executorch/`. To get the
86+
absolute path, run:
87+
88+
```
89+
python -c "import executorch; print(executorch.__path__)"
90+
```
91+
92+
This contains a list of paths where the source directory is located. Pick the
93+
one that is located in `env/lib`. If that does not work try the others. Add
94+
`backends/arm` to the path in `--source` to only get code coverage for the Arm
95+
backend.
96+
7497
### A note on unit tests
7598

7699
There are currently 3 ways we unit test our code.

backends/arm/test/.coveragerc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[run]
2+
omit =
3+
*__init__.py*
4+
5+
[report]
6+
skip_covered = true
7+
exclude_also =
8+
raise NotImplementedError

0 commit comments

Comments
 (0)