File: uncov-coverage

package info (click to toggle)
vifm 0.14.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 14,252 kB
  • sloc: ansic: 179,567; sh: 5,445; makefile: 723; perl: 347; python: 76; xml: 26
file content (54 lines) | stat: -rwxr-xr-x 1,515 bytes parent folder | download | duplicates (2)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash

# This script uses separate git worktree (created if doesn't exist) to build
# with with coverage support and collect it using uncov.
#
# Doesn't process arguments.

set -e

# path to worktree that measures coverage relative to repository location
coverage_path=../vifm-coverage

# cd to the root of the repository
cd "$(dirname "$(readlink -f "$0")")/.."

original_worktree=$(readlink -f .)
coverage_worktree=$(readlink -f "$coverage_path")

branch="$(basename "$(git symbolic-ref HEAD 2> /dev/null)")"
if [ -z "$branch" ]; then
    branch="no-branch"
fi

git stash save --include-untracked 'temporary stash of uncov-coverage script'
git stash apply --index

if [ -d "$coverage_worktree" ]; then
    cd "$coverage_worktree/src"
else
    git worktree add --detach "$coverage_worktree"
    cd "$coverage_worktree"
    ./configure --enable-coverage CFLAGS=-O0
    cd src
fi

git clean --force -d ..
git checkout --force stash@{0}^
git stash pop

# need to remove *.gcda in tests as well, otherwise libgcov in tests that fork
# can print "overwriting an existing profile data with a different timestamp" to
# error stream and break tests
find . ../tests -name '*.gcda' -delete

make -C ../tests build
make check

uncov new-gcovi --capture-worktree \
                --prefix src \
                --exclude src/lua/lua \
                --exclude src/utils/parson.c \
                --exclude src/utils/xxhash.c \
                --exclude src/utils/utf8proc.c \
                "$coverage_worktree/src"