xaizek / vifm (License: GPLv2+) (since 2018-12-07)
Vifm is a file manager with curses interface, which provides Vi[m]-like environment for managing objects within file systems, extended with some useful ideas from mutt.
<root> / scripts / uncov-coverage (23239644985ed51fa83b669c6593fff1052f8d9d) (1,515B) (mode 100755) [raw]
#!/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"
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vifm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vifm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master