diff --git a/util/build-code_coverage.sh b/util/build-code_coverage.sh index fdd68a504..d0f464805 100755 --- a/util/build-code_coverage.sh +++ b/util/build-code_coverage.sh @@ -56,4 +56,5 @@ if genhtml --version 2>/dev/null 1>&2; then else grcov . --output-type html --output-path "${COVERAGE_REPORT_DIR}" --branch --ignore build.rs --ignore '/*' --ignore '[A-Za-z]:/*' --ignore 'C:/Users/*' --excl-br-line '^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()' fi +# shellcheck disable=SC2181 if [ $? -ne 0 ]; then exit 1; fi diff --git a/util/show-code_coverage.sh b/util/show-code_coverage.sh index 14042a056..2701d6466 100755 --- a/util/show-code_coverage.sh +++ b/util/show-code_coverage.sh @@ -9,7 +9,21 @@ export COVERAGE_REPORT_DIR="${REPO_main_dir}/target/debug/coverage-nix" if ! "${ME_dir}/build-code_coverage.sh"; then exit 1; fi -case ";$OSID_tags;" in +# 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 == ... + # 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