diff --git a/util/build-code_coverage.sh b/util/build-code_coverage.sh index b92b7eb48..fdd68a504 100755 --- a/util/build-code_coverage.sh +++ b/util/build-code_coverage.sh @@ -12,7 +12,7 @@ ME_dir="$(dirname -- "$(readlink -fm -- "$0")")" REPO_main_dir="$(dirname -- "${ME_dir}")" cd "${REPO_main_dir}" && -echo "[ \"$PWD\" ]" + echo "[ \"$PWD\" ]" #shellcheck disable=SC2086 UTIL_LIST=$("${ME_dir}"/show-utils.sh ${FEATURES_OPTION}) @@ -26,13 +26,14 @@ done # cargo clean export CARGO_INCREMENTAL=0 -export RUSTC_WRAPPER="" ## NOTE: RUSTC_WRAPPER=='sccache' breaks code coverage calculations (uu_*.gcno files are not created during build) +export RUSTC_WRAPPER="" ## NOTE: RUSTC_WRAPPER=='sccache' breaks code coverage calculations (uu_*.gcno files are not created during build) # export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zno-landing-pads" export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" export RUSTDOCFLAGS="-Cpanic=abort" export RUSTUP_TOOLCHAIN="nightly-gnu" #shellcheck disable=SC2086 -{ cargo build ${FEATURES_OPTION} +{ + cargo build ${FEATURES_OPTION} cargo test --no-run ${FEATURES_OPTION} cargo test --quiet ${FEATURES_OPTION} cargo test --quiet ${FEATURES_OPTION} ${CARGO_INDIVIDUAL_PACKAGE_OPTIONS} @@ -55,4 +56,4 @@ 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 -if [ $? -ne 0 ]; then exit 1 ; fi +if [ $? -ne 0 ]; then exit 1; fi diff --git a/util/publish.sh b/util/publish.sh index 6f4d9f237..edd9779ef 100755 --- a/util/publish.sh +++ b/util/publish.sh @@ -3,11 +3,12 @@ set -e ARG="" if test "$1" != "--do-it"; then - ARG="--dry-run --allow-dirty" + ARG="--dry-run --allow-dirty" fi -for dir in src/uucore/ src/uucore_procs/ src/uu/stdbuf/src/libstdbuf/ ; do - ( cd "$dir" +for dir in src/uucore/ src/uucore_procs/ src/uu/stdbuf/src/libstdbuf/; do + ( + cd "$dir" #shellcheck disable=SC2086 cargo publish $ARG ) @@ -16,7 +17,8 @@ done PROGS=$(ls -1d src/uu/*/) for p in $PROGS; do - ( cd "$p" + ( + cd "$p" #shellcheck disable=SC2086 cargo publish $ARG ) diff --git a/util/show-code_coverage.sh b/util/show-code_coverage.sh index 6226d856b..14042a056 100755 --- a/util/show-code_coverage.sh +++ b/util/show-code_coverage.sh @@ -7,9 +7,9 @@ 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 +if ! "${ME_dir}/build-code_coverage.sh"; then exit 1; 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 ; + *";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 diff --git a/util/show-utils.sh b/util/show-utils.sh index f69b42678..0db72e1c4 100755 --- a/util/show-utils.sh +++ b/util/show-utils.sh @@ -17,11 +17,11 @@ project_main_dir="${ME_parent_dir_abs}" # printf 'project_main_dir="%s"\n' "${project_main_dir}" cd "${project_main_dir}" && -# `jq` available? -if ! jq --version 1>/dev/null 2>&1; then - echo "WARN: missing \`jq\` (install with \`sudo apt install jq\`); falling back to default (only fully cross-platform) utility list" 1>&2 - echo "$default_utils" -else - cargo metadata "$*" --format-version 1 | jq -r "[.resolve.nodes[] | { id: .id, deps: [.deps[] | { name:.name, pkg:.pkg }] }] | .[] | select(.id|startswith(\"coreutils\")) | [.deps[] | select((.name|startswith(\"uu_\")) or (.pkg|startswith(\"uu_\")))] | [.[].pkg | match(\"^\\\w+\";\"g\")] | [.[].string | sub(\"^uu_\"; \"\")] | sort | join(\" \")" - # cargo metadata "$*" --format-version 1 | jq -r "[.resolve.nodes[] | { id: .id, deps: [.deps[] | { name:.name, pkg:.pkg }] }] | .[] | select(.id|startswith(\"coreutils\")) | [.deps[] | select((.name|startswith(\"uu_\")) or (.pkg|startswith(\"uu_\")))] | [.[].pkg | match(\"^\\\w+\";\"g\")] | [.[].string] | sort | join(\" \")" -fi + # `jq` available? + if ! jq --version 1>/dev/null 2>&1; then + echo "WARN: missing \`jq\` (install with \`sudo apt install jq\`); falling back to default (only fully cross-platform) utility list" 1>&2 + echo "$default_utils" + else + cargo metadata "$*" --format-version 1 | jq -r "[.resolve.nodes[] | { id: .id, deps: [.deps[] | { name:.name, pkg:.pkg }] }] | .[] | select(.id|startswith(\"coreutils\")) | [.deps[] | select((.name|startswith(\"uu_\")) or (.pkg|startswith(\"uu_\")))] | [.[].pkg | match(\"^\\\w+\";\"g\")] | [.[].string | sub(\"^uu_\"; \"\")] | sort | join(\" \")" + # cargo metadata "$*" --format-version 1 | jq -r "[.resolve.nodes[] | { id: .id, deps: [.deps[] | { name:.name, pkg:.pkg }] }] | .[] | select(.id|startswith(\"coreutils\")) | [.deps[] | select((.name|startswith(\"uu_\")) or (.pkg|startswith(\"uu_\")))] | [.[].pkg | match(\"^\\\w+\";\"g\")] | [.[].string] | sort | join(\" \")" + fi