File: gen-test-coverage.sh

package info (click to toggle)
mdds 3.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,828 kB
  • sloc: cpp: 21,913; exp: 6,696; makefile: 698; ansic: 616; python: 602; sh: 428; lisp: 8
file content (28 lines) | stat: -rwxr-xr-x 516 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env bash

# SPDX-FileCopyrightText: 2025 Kohei Yoshida
#
# SPDX-License-Identifier: MIT

COVFILE="coverage.info"
PROGDIR=$(dirname $0)
TESTDIR=$(realpath "$PROGDIR/../test")

# Get the output directory from the user.
OUTDIR=$1
shift

if [ -z "$OUTDIR" ]; then
    echo "Usage: $0 [output directory]"
    exit 1
fi

mkdir -p "$OUTDIR"
cd "$OUTDIR"

lcov --capture --directory "$TESTDIR" -o $COVFILE || exit 1
genhtml $COVFILE -o html || exit 1

# View the reports in web browser.
xdg-open html/index.html