Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #457 from bwoodsend/gcov
- Loading branch information
Showing
3 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,3 +141,9 @@ python/version.h | |
# Docker wheel build | ||
pip-cache/ | ||
temp-wheels/ | ||
|
||
# gcov coverage files | ||
cov | ||
*.gcov | ||
*.gcda | ||
*.gcno |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Coverage for ultrajson's C code. | ||
# Usage: | ||
# CFLAGS="--coverage -O0" python setup.py -q build_ext --inplace -f | ||
# pytest | ||
# ./scripts/coverage.sh | ||
# Then inspect the files in the `cov` folder. | ||
|
||
# The exact arguments depend on whether we're using LLVM's gcov or GNU's. | ||
unameOut="$(uname -s)" | ||
case "${unameOut}" in | ||
Linux*) gcov_options=(--relative-only);; | ||
Darwin*) gcov_options=(--color);; | ||
*) echo "Unsupported OS ${unameOut}"; exit 1;; | ||
esac | ||
|
||
# The actual gcov instructions: | ||
gcov "${gcov_options[@]}" python/**.c -o build/temp.*/python | ||
gcov "${gcov_options[@]}" lib/**.c -o build/temp.*/lib | ||
|
||
# gcov dumps everything in the cwd without any option to change this. | ||
# Manually move the .gcov files to a `cov` folder. | ||
mkdir -p cov | ||
rm -rf cov/* | ||
mv ./**.gcov cov || exit 1 | ||
|
||
echo Written gcov files to ./cov |