File: show-code_coverage.sh

package info (click to toggle)
rust-coreutils 0.0.30-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 17,388 kB
  • sloc: sh: 1,088; python: 407; javascript: 72; makefile: 51
file content (40 lines) | stat: -rwxr-xr-x 1,532 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
#!/usr/bin/env bash

# spell-checker:ignore (vars) OSID OSTYPE binfmt greadlink

# Use GNU coreutils for readlink on *BSD
case "$OSTYPE" in
    *bsd*)
        READLINK="greadlink"
        ;;
    *)
        READLINK="readlink"
        ;;
esac

ME="${0}"
ME_dir="$(dirname -- "$("${READLINK}" -fm -- "${ME}")")"
REPO_main_dir="$(dirname -- "${ME_dir}")"

export COVERAGE_REPORT_DIR="${REPO_main_dir}/target/debug/coverage-nix"

if ! "${ME_dir}/build-code_coverage.sh"; then exit 1; fi

# WSL?
if [ -z "${OSID_tags}" ]; then
    if [ -e '/proc/sys/fs/binfmt_misc/WSLInterop' ] && (grep '^enabled$' '/proc/sys/fs/binfmt_misc/WSLInterop' >/dev/null); then
        __="wsl"
        case ";${OSID_tags};" in ";;") OSID_tags="$__" ;; *";$__;"*) ;; *) OSID_tags="$__;$OSID_tags" ;; esac
        unset __
        # Windows version == <major>.<minor>.<build>.<revision>
        # Release ID; see [Release ID/Version vs Build](https://winreleaseinfoprod.blob.core.windows.net/winreleaseinfoprod/en-US.html)[`@`](https://archive.is/GOj1g)
        OSID_wsl_build="$(uname -r | sed 's/^[0-9.][0-9.]*-\([0-9][0-9]*\)-.*$/\1/g')"
        OSID_wsl_revision="$(uname -v | sed 's/^#\([0-9.][0-9.]*\)-.*$/\1/g')"
        export OSID_wsl_build OSID_wsl_revision
    fi
fi

case ";${OSID_tags};" in
    *";wsl;"*) powershell.exe -c "$(wslpath -w "${COVERAGE_REPORT_DIR}"/index.html)" ;;
    *) xdg-open --version >/dev/null 2>&1 && xdg-open "${COVERAGE_REPORT_DIR}"/index.html || echo "report available at '\"${COVERAGE_REPORT_DIR}\"/index.html'" ;;
esac