| 1 | #!/bin/bash |
| 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"). |
| 5 | # You may not use this file except in compliance with the License. |
| 6 | # A copy of the License is located at |
| 7 | # |
| 8 | # http://aws.amazon.com/apache2.0 |
| 9 | # |
| 10 | # or in the "license" file accompanying this file. This file is distributed |
| 11 | # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
| 12 | # express or implied. See the License for the specific language governing |
| 13 | # permissions and limitations under the License. |
| 14 | |
| 15 | set -e |
| 16 | |
| 17 | # merge profiling data |
| 18 | llvm-profdata merge -failure-mode=all -sparse tests/unit/ut_*.profraw -o merged.profdata |
| 19 | |
| 20 | # generate file-level summary |
| 21 | llvm-cov report build/lib/libs2n.so \ |
| 22 | -instr-profile=merged.profdata \ |
| 23 | > coverage_summary.txt |
| 24 | |
| 25 | # convert llvm information to lcov format for genhtml |
| 26 | llvm-cov export build/lib/libs2n.so \ |
| 27 | -instr-profile=merged.profdata \ |
| 28 | -format=lcov \ |
| 29 | > unit_test_coverage.info |
| 30 | |
| 31 | # generate html report with annotated source files |
| 32 | genhtml unit_test_coverage.info \ |
| 33 | --branch-coverage \ |
| 34 | -o coverage_report |