This repository was archived by the owner on Apr 13, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +65
-1
lines changed
Expand file tree Collapse file tree 6 files changed +65
-1
lines changed Original file line number Diff line number Diff line change 1+ libswiftnav development
2+ =======================
3+
4+ Follow these instructions if you intend to make changes to libswiftnav.
5+
6+ Tools needed:
7+ * doxygen
8+ * pip install gcovr diff-cover
9+
10+ To get started, run::
11+ ./checks/setup-hooks.sh [ DIR]
12+
13+ from within the libswiftnav root directory. The default build-dir will be ` build ` .
14+
15+ This makes the directory if it doesn't already exist, runs cmake with ` Coverage ` mode enabled
16+ inside it, and installs a git pre-commit hook that runs style and code-coverage checkers
17+ in this build directory. These checks require doxygen, gcovr, and diff-cover
18+
19+ To manually run the coverage task, use ` make coverage ` . For syntax, use ` make style ` .
Original file line number Diff line number Diff line change 1- echo " HEY: git diff $1 | $2 --no-tree - > check_output.txt"
1+ # echo "HEY: git diff $1 | $2 --no-tree - > check_output.txt"
22git diff $1 | $2 --no-tree - > check_output.txt
Original file line number Diff line number Diff line change 1+ set -e
2+ echo "precommit running. checking build located at ${subdir}."
3+ cd ${subdir}
4+ ../checks/run-coverage.sh
5+
6+ #echo "commit failed"
7+ exit 1
Original file line number Diff line number Diff line change 1+ # requires gcovr and diff-cover
2+ # pip install gcovr diff-cover
3+ set -e
4+ gcovr -r .. --object-directory . --xml -o ../.coverage.xml
5+ gcovr -r .. --object-directory . --html -o coverage.html
6+ ( cd .. && diff-cover .coverage.xml --fail-under=85 --html-report .diffreport.html )
7+ mv ../.diffreport.html ./diffreport.html
Original file line number Diff line number Diff line change 1+ # set up build directory
2+ builddir=${1:- build/ } # by default use build/
3+ echo " Build directory: ${builddir} "
4+ mkdir -p $builddir
5+ ( cd $builddir && cmake -DCMAKE_BUILD_TYPE=Coverage .. )
6+
7+ hooks=" ` git rev-parse --git-dir` /hooks"
8+ echo " Installing hook at: ${hooks} "
9+ # insert value of builddir as first line of pre-commit
10+ echo " subdir=$builddir " | cat - checks/pre-commit > " $hooks /pre-commit"
Original file line number Diff line number Diff line change @@ -51,8 +51,29 @@ else (CMAKE_CROSSCOMPILING)
5151 COMMENT "Running unit tests"
5252 COMMAND test_libswiftnav
5353 )
54+
55+ # for convenience:
56+ add_custom_target (tests
57+ DEPENDS test_libswiftnav
58+ COMMAND test_libswiftnav
59+ )
60+ add_custom_target (test
61+ DEPENDS test_libswiftnav
62+ COMMAND test_libswiftnav
63+ )
64+
5465 file (COPY data/waas_check.bin DESTINATION ${CMAKE_BINARY_DIR} /tests)
5566 file (COPY data/waas_data.bin DESTINATION ${CMAKE_BINARY_DIR} /tests)
5667
68+ # TODO run even if tests fail?
69+ # TODO check that we're in a coverage build
70+ add_custom_command (
71+ DEPENDS test
72+ OUTPUT diffreport.html
73+ COMMAND ../checks/run-coverage.sh
74+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
75+ )
76+ add_custom_target (coverage DEPENDS diffreport.html)
77+
5778 endif (NOT CHECK_FOUND)
5879endif (CMAKE_CROSSCOMPILING )
You can’t perform that action at this time.
0 commit comments