1
0
mirror of https://github.com/uutils/coreutils synced 2024-07-01 06:54:36 +00:00

util: modify scripts for code coverage to be compatible with BSD OS

- Use /usr/bin/env bash instead of /bin/sh to use OSTYPE
  - Use readlink from GNU coreutils on BSD OS in util/build-code_coverage.sh and
    util/show-code_coverage.sh scripts

Signed-off-by: Laurent Cheylus <foxy@free.fr>
This commit is contained in:
Laurent Cheylus 2024-01-01 23:44:10 +01:00
parent d450d5a463
commit aef204461c
No known key found for this signature in database
2 changed files with 27 additions and 7 deletions

View File

@ -1,15 +1,25 @@
#!/bin/sh
#!/usr/bin/env bash
# spell-checker:ignore (abbrevs/acronyms) HTML gcno llvm
# spell-checker:ignore (jargon) toolchain
# spell-checker:ignore (rust) Ccodegen Cinline Coverflow Cpanic RUSTC RUSTDOCFLAGS RUSTFLAGS RUSTUP Zpanic
# spell-checker:ignore (shell) OSID esac
# spell-checker:ignore (utils) genhtml grcov lcov readlink sccache shellcheck uutils
# spell-checker:ignore (shell) OSID OSTYPE esac
# spell-checker:ignore (utils) genhtml grcov lcov greadlink readlink sccache shellcheck uutils
FEATURES_OPTION="--features feat_os_unix"
# Use GNU coreutils for readlink on *BSD
case "$OSTYPE" in
*bsd*)
READLINK="greadlink"
;;
*)
READLINK="readlink"
;;
esac
ME="${0}"
ME_dir="$(dirname -- "$(readlink -fm -- "${ME}")")"
ME_dir="$(dirname -- "$("${READLINK}" -fm -- "${ME}")")"
REPO_main_dir="$(dirname -- "${ME_dir}")"
cd "${REPO_main_dir}" &&

View File

@ -1,9 +1,19 @@
#!/bin/sh
#!/usr/bin/env bash
# spell-checker:ignore (vars) OSID binfmt
# 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}")")"
ME_dir="$(dirname -- "$("${READLINK}" -fm -- "${ME}")")"
REPO_main_dir="$(dirname -- "${ME_dir}")"
export COVERAGE_REPORT_DIR="${REPO_main_dir}/target/debug/coverage-nix"