-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix nasa#729, Add bundle and local config unit test and coverage check
- Loading branch information
Showing
2 changed files
with
73 additions
and
8 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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: "Local Unit Test" | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
env: | ||
SIMULATION: native | ||
ENABLE_UNIT_TESTS: true | ||
OMIT_DEPRECATED: true | ||
BUILDTYPE: release | ||
|
||
jobs: | ||
|
||
Local-Unit-Test: | ||
runs-on: ubuntu-18.04 | ||
timeout-minutes: 15 | ||
|
||
steps: | ||
- name: Install cppcheck | ||
run: sudo apt-get install lcov -y | ||
|
||
- name: Checkout submodule | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up for build | ||
run: | | ||
cmake -DENABLE_UNIT_TESTS=true -DOSAL_SYSTEM_BSPTYPE=generic-linux -DOSAL_CONFIG_DEBUG_PERMISSIVE_MODE=TRUE . | ||
- name: Build the code | ||
run: make -j | ||
|
||
# Baseline lcov and run all tests | ||
- name: Test | ||
run: | | ||
lcov --rc lcov_branch_coverage=1 --capture --initial --directory ./ --output-file coverage_base.info | ||
make test | ||
- name: Calculate coverage | ||
run: | | ||
lcov --rc lcov_branch_coverage=1 --capture --directory ./ --output-file coverage_test.info | ||
lcov --rc lcov_branch_coverage=1 --add-tracefile coverage_base.info --add-tracefile coverage_test.info --output-file coverage_total.info | ||
genhtml --branch-coverage coverage_total.info --output-directory lcov | tee lcov_out.txt | ||
- name: Confirm 100% line coverage | ||
run: | | ||
if [[ `grep -A 3 "Overall coverage rate" lcov_out.txt | grep lines` != *"100.0%"* ]]; then | ||
grep -A 3 "Overall coverage rate" lcov_out.txt | ||
echo "Lacks 100.0% line unit test coverage" | ||
exit -1 | ||
fi |