mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 20:17:45 +00:00
Merge pull request #3090 from rivy/maint.utils
maint ~ configuration and utility clean-up and maintenance
This commit is contained in:
commit
78e2fe6ad2
15 changed files with 272 additions and 115 deletions
|
@ -1,4 +1,4 @@
|
|||
# EditorConfig (is awesome): http://EditorConfig.org
|
||||
# EditorConfig (is awesome!; ref: http://EditorConfig.org; v2022.02.11 [rivy])
|
||||
|
||||
# * top-most EditorConfig file
|
||||
root = true
|
||||
|
@ -13,27 +13,49 @@ insert_final_newline = true
|
|||
max_line_length = 100
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[[Mm]akefile{,.*}, *.{mk,[Mm][Kk]}]
|
||||
[{[Mm]akefile{,.*},*.{mak,mk,[Mm][Aa][Kk],[Mm][Kk]},[Gg][Nn][Uu]makefile}]
|
||||
# makefiles ~ TAB-style indentation
|
||||
indent_style = tab
|
||||
|
||||
[*.bash]
|
||||
# `bash` shell scripts
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
# * ref: <https://github.com/foxundermoon/vs-shell-format/blob/bc56a8e367b04bbf7d9947b767dc82516a6155b7/src/shFormat.ts>
|
||||
# shell_variant = bash ## allow `shellcheck` to decide via script hash-bang/sha-bang line
|
||||
switch_case_indent = true
|
||||
|
||||
[*.{bat,cmd,[Bb][Aa][Tt],[Cc][Mm][Dd]}]
|
||||
# BAT/CMD ~ DOS/Win requires BAT/CMD files to have CRLF EOLNs
|
||||
end_of_line = crlf
|
||||
|
||||
[*.{cjs,cjx,cts,ctx,js,jsx,mjs,mts,mtx,ts,tsx,json,jsonc}]
|
||||
# js/ts/json ~ Prettier/XO-style == TAB indention + SPACE alignment
|
||||
indent_size = 2
|
||||
indent_style = tab
|
||||
|
||||
[*.go]
|
||||
# go ~ TAB-style indentation (SPACE-style alignment); ref: <https://blog.golang.org/gofmt>@@<https://archive.is/wip/9B6FC>
|
||||
indent_style = tab
|
||||
|
||||
[*.{cjs,js,json,mjs,ts}]
|
||||
# js/ts
|
||||
indent_size = 2
|
||||
|
||||
[*.{markdown,md,mkd,[Mm][Dd],[Mm][Kk][Dd],[Mm][Dd][Oo][Ww][Nn],[Mm][Kk][Dd][Oo][Ww][Nn],[Mm][Aa][Rr][Kk][Dd][Oo][Ww][Nn]}]
|
||||
# markdown
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
|
||||
[*.sh]
|
||||
# POSIX shell scripts
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
# * ref: <https://github.com/foxundermoon/vs-shell-format/blob/bc56a8e367b04bbf7d9947b767dc82516a6155b7/src/shFormat.ts>
|
||||
# shell_variant = posix ## allow `shellcheck` to decide via script hash-bang/sha-bang line
|
||||
switch_case_indent = true
|
||||
|
||||
[*.{sln,vc{,x}proj{,.*},[Ss][Ln][Nn],[Vv][Cc]{,[Xx]}[Pp][Rr][Oo][Jj]{,.*}}]
|
||||
# MSVC sln/vcproj/vcxproj files, when used, will persistantly revert to CRLF EOLNs and eat final EOLs
|
||||
end_of_line = crlf
|
||||
insert_final_newline = false
|
||||
|
||||
[*.{yaml,yml,[Yy][Mm][Ll],[Yy][Aa][Mm][Ll]}]
|
||||
# YAML
|
||||
indent_size = 2
|
||||
|
|
2
.github/workflows/CICD.yml
vendored
2
.github/workflows/CICD.yml
vendored
|
@ -4,7 +4,7 @@ name: CICD
|
|||
# spell-checker:ignore (env/flags) Awarnings Ccodegen Coverflow Cpanic Dwarnings RUSTDOCFLAGS RUSTFLAGS Zpanic
|
||||
# spell-checker:ignore (jargon) SHAs deps dequote softprops subshell toolchain
|
||||
# spell-checker:ignore (names) CodeCOV MacOS MinGW Peltoche rivy
|
||||
# spell-checker:ignore (shell/tools) choco clippy dmake dpkg esac fakeroot gmake grcov halium lcov libssl mkdir popd printf pushd rustc rustfmt rustup shopt xargs
|
||||
# spell-checker:ignore (shell/tools) choco clippy dmake dpkg esac fakeroot gmake grcov halium lcov libssl mkdir popd printf pushd rsync rustc rustfmt rustup shopt xargs
|
||||
# spell-checker:ignore (misc) aarch alnum armhf bindir busytest coreutils gnueabihf issuecomment maint nullglob onexitbegin onexitend pell runtest tempfile testsuite uutils DESTDIR sizemulti
|
||||
|
||||
# ToDO: [2021-06; rivy] change from `cargo-tree` to `cargo tree` once MSRV is >= 1.45
|
||||
|
|
29
.github/workflows/GnuTests.yml
vendored
29
.github/workflows/GnuTests.yml
vendored
|
@ -1,6 +1,6 @@
|
|||
name: GnuTests
|
||||
|
||||
# spell-checker:ignore (names) gnulib ; (people) Dawid Dziurla * dawidd6 ; (utils) autopoint chksum gperf pyinotify shopt texinfo ; (vars) FILESET XPASS
|
||||
# spell-checker:ignore (names) gnulib ; (jargon) submodules ; (people) Dawid Dziurla * dawidd ; (utils) autopoint chksum gperf pyinotify shopt texinfo ; (vars) FILESET XPASS
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
|
@ -17,16 +17,15 @@ jobs:
|
|||
outputs() { step_id="vars"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; }
|
||||
# * config
|
||||
path_GNU="gnu"
|
||||
path_GNULIB="gnulib"
|
||||
path_GNU_tests="gnu/tests"
|
||||
path_GNU_tests="${path_GNU}/tests"
|
||||
path_UUTILS="uutils"
|
||||
path_reference="reference"
|
||||
outputs path_GNU path_GNU_tests path_GNULIB path_reference path_UUTILS
|
||||
outputs path_GNU path_GNU_tests path_reference path_UUTILS
|
||||
#
|
||||
repo_default_branch="${{ github.event.repository.default_branch }}"
|
||||
repo_GNU_ref="v9.0"
|
||||
repo_GNULIB_ref="8e99f24c0931a38880c6ee9b8287c7da80b0036b"
|
||||
repo_reference_branch="${{ github.event.repository.default_branch }}"
|
||||
outputs repo_GNU_ref repo_GNULIB_ref repo_reference_branch
|
||||
outputs repo_default_branch repo_GNU_ref repo_reference_branch
|
||||
#
|
||||
SUITE_LOG_FILE="${path_GNU_tests}/test-suite.log"
|
||||
TEST_LOGS_GLOB="${path_GNU_tests}/**/*.log" ## note: not usable at bash CLI; [why] double globstar not enabled by default b/c MacOS includes only bash v3 which doesn't have double globstar support
|
||||
|
@ -34,29 +33,26 @@ jobs:
|
|||
TEST_FILESET_SUFFIX='.txt'
|
||||
TEST_SUMMARY_FILE='gnu-result.json'
|
||||
outputs SUITE_LOG_FILE TEST_FILESET_PREFIX TEST_FILESET_SUFFIX TEST_LOGS_GLOB TEST_SUMMARY_FILE
|
||||
- name: Checkout code uutil
|
||||
- name: Checkout code (uutil)
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: '${{ steps.vars.outputs.path_UUTILS }}'
|
||||
- name: Checkout GNU coreutils
|
||||
- name: Checkout code (GNU coreutils)
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: 'coreutils/coreutils'
|
||||
path: '${{ steps.vars.outputs.path_GNU }}'
|
||||
ref: ${{ steps.vars.outputs.repo_GNU_ref }}
|
||||
- name: Checkout GNU coreutils library (gnulib)
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: 'coreutils/gnulib'
|
||||
path: '${{ steps.vars.outputs.path_GNULIB }}'
|
||||
ref: ${{ steps.vars.outputs.repo_GNULIB_ref }}
|
||||
fetch-depth: 0 # full depth checkout (o/w gnu gets upset if gnulib is a shallow checkout)
|
||||
submodules: recursive
|
||||
- name: Retrieve reference artifacts
|
||||
uses: dawidd6/action-download-artifact@v2
|
||||
# ref: <https://github.com/dawidd6/action-download-artifact>
|
||||
continue-on-error: true ## don't break the build for missing reference artifacts (may be expired or just not generated yet)
|
||||
with:
|
||||
workflow: GnuTests.yml
|
||||
branch: "${{ steps.vars.outputs.repo_reference_branch }}"
|
||||
# workflow_conclusion: success ## (default); * but, if commit with failed GnuTests is merged into the default branch, future commits will all show regression errors in GnuTests CI until o/w fixed
|
||||
workflow_conclusion: completed ## continually recalibrates to last commit of default branch with a successful GnuTests (ie, "self-heals" from GnuTest regressions, but needs more supervision for/of regressions)
|
||||
path: "${{ steps.vars.outputs.path_reference }}"
|
||||
- name: Install `rust` toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
|
@ -81,7 +77,6 @@ jobs:
|
|||
shell: bash
|
||||
run: |
|
||||
path_GNU='${{ steps.vars.outputs.path_GNU }}'
|
||||
path_GNULIB='${{ steps.vars.outputs.path_GNULIB }}'
|
||||
path_UUTILS='${{ steps.vars.outputs.path_UUTILS }}'
|
||||
bash "${path_UUTILS}/util/run-gnu-test.sh"
|
||||
- name: Extract/summarize testing info
|
||||
|
@ -157,7 +152,7 @@ jobs:
|
|||
do
|
||||
if ! grep -Fxq $LINE<<<"$REF_FAILING"
|
||||
then
|
||||
echo "::error ::GNU test failed: $LINE. $LINE is passing on 'main'. Maybe you have to rebase?"
|
||||
echo "::error ::GNU test failed: $LINE. $LINE is passing on '${{ steps.vars.outputs.repo_default_branch }}'. Maybe you have to rebase?"
|
||||
fi
|
||||
done
|
||||
else
|
||||
|
|
1
.rustfmt.toml
Normal file
1
.rustfmt.toml
Normal file
|
@ -0,0 +1 @@
|
|||
# * using all default `cargo fmt`/`rustfmt` options
|
4
.vscode/cSpell.json
vendored
4
.vscode/cSpell.json
vendored
|
@ -1,7 +1,7 @@
|
|||
// `cspell` settings
|
||||
{
|
||||
// version of the setting file (always 0.1)
|
||||
"version": "0.1",
|
||||
// version of the setting file
|
||||
"version": "0.2",
|
||||
|
||||
// spelling language
|
||||
"language": "en",
|
||||
|
|
15
.vscode/extensions.json
vendored
15
.vscode/extensions.json
vendored
|
@ -1,10 +1,13 @@
|
|||
// spell-checker:ignore (misc) matklad
|
||||
// see <http://go.microsoft.com/fwlink/?LinkId=827846> for the documentation about the extensions.json format
|
||||
// *
|
||||
// "foxundermoon.shell-format" ~ shell script formatting ; note: ENABLE "Use EditorConfig"
|
||||
// "matklad.rust-analyzer" ~ `rust` language support
|
||||
// "streetsidesoftware.code-spell-checker" ~ `cspell` spell-checker support
|
||||
{
|
||||
"recommendations": [
|
||||
// Rust language support
|
||||
"matklad.rust-analyzer",
|
||||
// `cspell` spell-checker support
|
||||
"streetsidesoftware.code-spell-checker"
|
||||
]
|
||||
"recommendations": [
|
||||
"matklad.rust-analyzer",
|
||||
"streetsidesoftware.code-spell-checker",
|
||||
"foxundermoon.shell-format"
|
||||
]
|
||||
}
|
||||
|
|
1
.vscode/settings.json
vendored
Normal file
1
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{ "cSpell.import": [".vscode/cspell.json"] }
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
# spell-checker:ignore (utils) gitsome jq ; (gh) repos
|
||||
|
||||
ME="${0}"
|
||||
ME_dir="$(dirname -- "${ME}")"
|
||||
ME_parent_dir="$(dirname -- "${ME_dir}")"
|
||||
ME_parent_dir_abs="$(realpath -mP -- "${ME_parent_dir}")"
|
||||
# ME="${0}"
|
||||
# ME_dir="$(dirname -- "${ME}")"
|
||||
# ME_parent_dir="$(dirname -- "${ME_dir}")"
|
||||
# ME_parent_dir_abs="$(realpath -mP -- "${ME_parent_dir}")"
|
||||
|
||||
# ref: <https://stackoverflow.com/questions/57927115/anyone-know-a-way-to-delete-a-workflow-from-github-actions>
|
||||
|
||||
|
@ -33,12 +33,17 @@ if [ -z "${GH}" ] || [ -z "${JQ}" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
dry_run=true
|
||||
case "${dry_run}" in
|
||||
'0' | 'f' | 'false' | 'no' | 'never' | 'none') unset dry_run ;;
|
||||
*) dry_run="true" ;;
|
||||
esac
|
||||
|
||||
USER_NAME=uutils
|
||||
REPO_NAME=coreutils
|
||||
WORK_NAME=GNU
|
||||
USER_NAME="${USER_NAME:-uutils}"
|
||||
REPO_NAME="${REPO_NAME:-coreutils}"
|
||||
WORK_NAME="${WORK_NAME:-GNU}"
|
||||
|
||||
# * `--paginate` retrieves all pages
|
||||
# gh api --paginate "repos/${USER_NAME}/${REPO_NAME}/actions/runs" | jq -r ".workflow_runs[] | select(.name == \"${WORK_NAME}\") | (.id)" | xargs -n1 sh -c "for arg do { echo gh api repos/${USER_NAME}/${REPO_NAME}/actions/runs/\${arg} -X DELETE ; if [ -z "$dry_run" ]; then gh api repos/${USER_NAME}/${REPO_NAME}/actions/runs/\${arg} -X DELETE ; fi ; } ; done ;" _
|
||||
gh api "repos/${USER_NAME}/${REPO_NAME}/actions/runs" | jq -r ".workflow_runs[] | select(.name == \"${WORK_NAME}\") | (.id)" | xargs -n1 sh -c "for arg do { echo gh api repos/${USER_NAME}/${REPO_NAME}/actions/runs/\${arg} -X DELETE ; if [ -z "$dry_run" ]; then gh api repos/${USER_NAME}/${REPO_NAME}/actions/runs/\${arg} -X DELETE ; fi ; } ; done ;" _
|
||||
gh api "repos/${USER_NAME}/${REPO_NAME}/actions/runs" |
|
||||
jq -r ".workflow_runs[] | select(.name == \"${WORK_NAME}\") | (.id)" |
|
||||
xargs -n1 sh -c "for arg do { echo gh api repos/${USER_NAME}/${REPO_NAME}/actions/runs/\${arg} -X DELETE ; if [ -z \"${dry_run}\" ]; then gh api repos/${USER_NAME}/${REPO_NAME}/actions/runs/\${arg} -X DELETE ; fi ; } ; done ;" _
|
||||
|
|
|
@ -4,15 +4,16 @@
|
|||
# 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 uutils
|
||||
# spell-checker:ignore (utils) genhtml grcov lcov readlink sccache shellcheck uutils
|
||||
|
||||
FEATURES_OPTION="--features feat_os_unix"
|
||||
|
||||
ME_dir="$(dirname -- "$(readlink -fm -- "$0")")"
|
||||
ME="${0}"
|
||||
ME_dir="$(dirname -- "$(readlink -fm -- "${ME}")")"
|
||||
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 +27,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 +57,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
|
||||
if [ $? -ne 0 ]; then exit 1 ; fi
|
||||
# shellcheck disable=SC2181
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
|
|
@ -1,64 +1,86 @@
|
|||
#!/bin/bash
|
||||
# `build-gnu.bash` ~ builds GNU coreutils (from supplied sources)
|
||||
#
|
||||
# UU_MAKE_PROFILE == 'debug' | 'release' ## build profile for *uutils* build; may be supplied by caller, defaults to 'debug'
|
||||
|
||||
# spell-checker:ignore (paths) abmon deref discrim eacces getlimits getopt ginstall gnulib inacc infloop inotify reflink ; (misc) INT_OFLOW OFLOW baddecode ; (vars/env) BUILDDIR SRCDIR
|
||||
# spell-checker:ignore (paths) abmon deref discrim eacces getlimits getopt ginstall inacc infloop inotify reflink ; (misc) INT_OFLOW OFLOW baddecode submodules ; (vars/env) SRCDIR
|
||||
|
||||
set -e
|
||||
if test ! -d ../gnu; then
|
||||
echo "Could not find ../gnu"
|
||||
echo "git clone https://github.com/coreutils/coreutils.git gnu"
|
||||
exit 1
|
||||
fi
|
||||
if test ! -d ../gnulib; then
|
||||
echo "Could not find ../gnulib"
|
||||
echo "git clone https://github.com/coreutils/gnulib.git gnulib"
|
||||
|
||||
ME="${0}"
|
||||
ME_dir="$(dirname -- "$(readlink -fm -- "${ME}")")"
|
||||
REPO_main_dir="$(dirname -- "${ME_dir}")"
|
||||
|
||||
echo "ME='${ME}'"
|
||||
echo "ME_dir='${ME_dir}'"
|
||||
echo "REPO_main_dir='${REPO_main_dir}'"
|
||||
|
||||
### * config (from environment with fallback defaults); note: GNU is expected to be a sibling repo directory
|
||||
|
||||
path_UUTILS=${path_UUTILS:-${REPO_main_dir}}
|
||||
path_GNU="$(readlink -fm -- "${path_GNU:-${path_UUTILS}/../gnu}")"
|
||||
|
||||
echo "path_UUTILS='${path_UUTILS}'"
|
||||
echo "path_GNU='${path_GNU}'"
|
||||
|
||||
###
|
||||
|
||||
if test ! -d "${path_GNU}"; then
|
||||
echo "Could not find GNU (expected at '${path_GNU}')"
|
||||
echo "git clone --recurse-submodules https://github.com/coreutils/coreutils.git \"${path_GNU}\""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
###
|
||||
|
||||
pushd "$PWD"
|
||||
make PROFILE=release
|
||||
BUILDDIR="$PWD/target/release/"
|
||||
cp "${BUILDDIR}/install" "${BUILDDIR}/ginstall" # The GNU tests rename this script before running, to avoid confusion with the make target
|
||||
UU_MAKE_PROFILE=${UU_MAKE_PROFILE:-release}
|
||||
echo "UU_MAKE_PROFILE='${UU_MAKE_PROFILE}'"
|
||||
|
||||
UU_BUILD_DIR="${path_UUTILS}/target/${UU_MAKE_PROFILE}"
|
||||
echo "UU_BUILD_DIR='${UU_BUILD_DIR}'"
|
||||
|
||||
cd "${path_UUTILS}" && echo "[ pwd:'${PWD}' ]"
|
||||
make PROFILE="${UU_MAKE_PROFILE}"
|
||||
cp "${UU_BUILD_DIR}/install" "${UU_BUILD_DIR}/ginstall" # The GNU tests rename this script before running, to avoid confusion with the make target
|
||||
# Create *sum binaries
|
||||
for sum in b2sum b3sum md5sum sha1sum sha224sum sha256sum sha384sum sha512sum
|
||||
do
|
||||
sum_path="${BUILDDIR}/${sum}"
|
||||
test -f "${sum_path}" || cp "${BUILDDIR}/hashsum" "${sum_path}"
|
||||
for sum in b2sum b3sum md5sum sha1sum sha224sum sha256sum sha384sum sha512sum; do
|
||||
sum_path="${UU_BUILD_DIR}/${sum}"
|
||||
test -f "${sum_path}" || cp "${UU_BUILD_DIR}/hashsum" "${sum_path}"
|
||||
done
|
||||
test -f "${BUILDDIR}/[" || cp "${BUILDDIR}/test" "${BUILDDIR}/["
|
||||
popd
|
||||
GNULIB_SRCDIR="$PWD/../gnulib"
|
||||
pushd ../gnu/
|
||||
test -f "${UU_BUILD_DIR}/[" || cp "${UU_BUILD_DIR}/test" "${UU_BUILD_DIR}/["
|
||||
|
||||
##
|
||||
|
||||
cd "${path_GNU}" && echo "[ pwd:'${PWD}' ]"
|
||||
|
||||
# Any binaries that aren't built become `false` so their tests fail
|
||||
for binary in $(./build-aux/gen-lists-of-programs.sh --list-progs)
|
||||
do
|
||||
bin_path="${BUILDDIR}/${binary}"
|
||||
test -f "${bin_path}" || { echo "'${binary}' was not built with uutils, using the 'false' program"; cp "${BUILDDIR}/false" "${bin_path}"; }
|
||||
for binary in $(./build-aux/gen-lists-of-programs.sh --list-progs); do
|
||||
bin_path="${UU_BUILD_DIR}/${binary}"
|
||||
test -f "${bin_path}" || {
|
||||
echo "'${binary}' was not built with uutils, using the 'false' program"
|
||||
cp "${UU_BUILD_DIR}/false" "${bin_path}"
|
||||
}
|
||||
done
|
||||
|
||||
./bootstrap --gnulib-srcdir="$GNULIB_SRCDIR"
|
||||
./bootstrap
|
||||
./configure --quiet --disable-gcc-warnings
|
||||
#Add timeout to to protect against hangs
|
||||
sed -i 's|^"\$@|/usr/bin/timeout 600 "\$@|' build-aux/test-driver
|
||||
# Change the PATH in the Makefile to test the uutils coreutils instead of the GNU coreutils
|
||||
sed -i "s/^[[:blank:]]*PATH=.*/ PATH='${BUILDDIR//\//\\/}\$(PATH_SEPARATOR)'\"\$\$PATH\" \\\/" Makefile
|
||||
sed -i "s/^[[:blank:]]*PATH=.*/ PATH='${UU_BUILD_DIR//\//\\/}\$(PATH_SEPARATOR)'\"\$\$PATH\" \\\/" Makefile
|
||||
sed -i 's| tr | /usr/bin/tr |' tests/init.sh
|
||||
make -j "$(nproc)"
|
||||
# Generate the factor tests, so they can be fixed
|
||||
# Used to be 36. Reduced to 20 to decrease the log size
|
||||
for i in {00..20}
|
||||
do
|
||||
for i in {00..20}; do
|
||||
make "tests/factor/t${i}.sh"
|
||||
done
|
||||
|
||||
# strip the long stuff
|
||||
for i in {21..36}
|
||||
do
|
||||
for i in {21..36}; do
|
||||
sed -i -e "s/\$(tf)\/t${i}.sh//g" Makefile
|
||||
done
|
||||
|
||||
|
||||
grep -rl 'path_prepend_' tests/* | xargs sed -i 's| path_prepend_ ./src||'
|
||||
sed -i -e 's|^seq |/usr/bin/seq |' -e 's|sha1sum |/usr/bin/sha1sum |' tests/factor/t*sh
|
||||
|
||||
|
@ -97,11 +119,9 @@ sed -i 's|seq |/usr/bin/seq |' tests/misc/sort-discrim.sh
|
|||
# Add specific timeout to tests that currently hang to limit time spent waiting
|
||||
sed -i 's|\(^\s*\)seq \$|\1/usr/bin/timeout 0.1 seq \$|' tests/misc/seq-precision.sh tests/misc/seq-long-double.sh
|
||||
|
||||
|
||||
# Remove dup of /usr/bin/ when executed several times
|
||||
grep -rlE '/usr/bin/\s?/usr/bin' init.cfg tests/* | xargs --no-run-if-empty sed -Ei 's|/usr/bin/\s?/usr/bin/|/usr/bin/|g'
|
||||
|
||||
|
||||
#### Adjust tests to make them work with Rust/coreutils
|
||||
# in some cases, what we are doing in rust/coreutils is good (or better)
|
||||
# we should not regress our project just to match what GNU is going.
|
||||
|
@ -117,7 +137,7 @@ sed -i -e "s|rm: cannot remove 'a/1'|rm: cannot remove 'a'|g" tests/rm/rm2.sh
|
|||
|
||||
sed -i -e "s|removed directory 'a/'|removed directory 'a'|g" tests/rm/v-slash.sh
|
||||
|
||||
test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}"
|
||||
test -f "${UU_BUILD_DIR}/getlimits" || cp src/getlimits "${UU_BUILD_DIR}"
|
||||
|
||||
# When decoding an invalid base32/64 string, gnu writes everything it was able to decode until
|
||||
# it hit the decode error, while we don't write anything if the input is invalid.
|
||||
|
|
85
util/dwr.sh
Normal file
85
util/dwr.sh
Normal file
|
@ -0,0 +1,85 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# `dwr` - delete workflow runs (by DJ Adams)
|
||||
# ref: <https://github.com/qmacro/dotfiles/blob/230c6df494f239e9d1762794943847816e1b7c32/scripts/dwr>
|
||||
# ref: [Mass deletion of GitHub Actions workflow runs](https://qmacro.org/autodidactics/2021/03/26/mass-deletion-of-github-actions-workflow-runs) @@ <https://archive.is/rxdCY>
|
||||
|
||||
# LICENSE: "Feel free to steal, modify, or make fun of" (from <https://github.com/qmacro/dotfiles/blob/230c6df494f239e9d1762794943847816e1b7c32/README.md>)
|
||||
|
||||
# spell-checker:ignore (options) multi ; (people) DJ Adams * qmacro ; (words) gsub
|
||||
|
||||
# Given an "owner/repo" name, such as "qmacro/thinking-aloud",
|
||||
# retrieve the workflow runs for that repo and present them in a
|
||||
# list. Selected runs will be deleted. Uses the GitHub API.
|
||||
|
||||
# Requires gh (GitHub CLI) and jq (JSON processor)
|
||||
|
||||
# First version
|
||||
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
|
||||
declare repo=${1:?No owner/repo specified}
|
||||
|
||||
jq_script() {
|
||||
|
||||
cat <<EOF
|
||||
def symbol:
|
||||
sub("skipped"; "SKIP") |
|
||||
sub("success"; "GOOD") |
|
||||
sub("failure"; "FAIL");
|
||||
|
||||
def tz:
|
||||
gsub("[TZ]"; " ");
|
||||
|
||||
|
||||
.workflow_runs[]
|
||||
| [
|
||||
(.conclusion | symbol),
|
||||
(.created_at | tz),
|
||||
.id,
|
||||
.event,
|
||||
.name
|
||||
]
|
||||
| @tsv
|
||||
EOF
|
||||
|
||||
}
|
||||
|
||||
select_runs() {
|
||||
|
||||
gh api --paginate "/repos/$repo/actions/runs" |
|
||||
jq -r -f <(jq_script) |
|
||||
fzf --multi
|
||||
|
||||
}
|
||||
|
||||
delete_run() {
|
||||
|
||||
local run id result
|
||||
run=$1
|
||||
id="$(cut -f 3 <<<"$run")"
|
||||
gh api -X DELETE "/repos/$repo/actions/runs/$id"
|
||||
# shellcheck disable=SC2181
|
||||
[[ $? = 0 ]] && result="OK!" || result="BAD"
|
||||
printf "%s\t%s\n" "$result" "$run"
|
||||
|
||||
}
|
||||
|
||||
delete_runs() {
|
||||
|
||||
local id
|
||||
while read -r run; do
|
||||
delete_run "$run"
|
||||
sleep 0.25
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
main() {
|
||||
|
||||
select_runs | delete_runs
|
||||
|
||||
}
|
||||
|
||||
main
|
|
@ -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
|
||||
)
|
||||
|
|
|
@ -1,28 +1,30 @@
|
|||
#!/bin/bash
|
||||
# `$0 [TEST]`
|
||||
#!/bin/sh
|
||||
# `run-gnu-test.bash [TEST]`
|
||||
# run GNU test (or all tests if TEST is missing/null)
|
||||
# spell-checker:ignore (env/vars) BUILDDIR GNULIB SUBDIRS
|
||||
#
|
||||
# UU_MAKE_PROFILE == 'debug' | 'release' ## build profile used for *uutils* build; may be supplied by caller, defaults to 'release'
|
||||
|
||||
# spell-checker:ignore (env/vars) GNULIB SRCDIR SUBDIRS ; (utils) shellcheck
|
||||
|
||||
ME_dir="$(dirname -- "$(readlink -fm -- "$0")")"
|
||||
REPO_main_dir="$(dirname -- "${ME_dir}")"
|
||||
|
||||
echo "ME_dir='${ME_dir}'"
|
||||
echo "REPO_main_dir='${REPO_main_dir}'"
|
||||
|
||||
set -e
|
||||
|
||||
### * config (from environment with fallback defaults)
|
||||
### * config (from environment with fallback defaults); note: GNU and GNULIB are expected to be sibling repo directories
|
||||
|
||||
path_UUTILS=${path_UUTILS:-${REPO_main_dir}}
|
||||
path_GNU=${path_GNU:-${path_UUTILS}/../gnu}
|
||||
path_GNULIB=${path_GNULIB:-${path_UUTILS}/../gnulib}
|
||||
path_GNU="$(readlink -fm -- "${path_GNU:-${path_UUTILS}/../gnu}")"
|
||||
|
||||
echo "path_UUTILS='${path_UUTILS}'"
|
||||
echo "path_GNU='${path_GNU}'"
|
||||
|
||||
###
|
||||
|
||||
BUILD_DIR="$(realpath -- "${path_UUTILS}/target/release")"
|
||||
GNULIB_DIR="$(realpath -- "${path_GNULIB}")"
|
||||
|
||||
export BUILD_DIR
|
||||
export GNULIB_DIR
|
||||
|
||||
pushd "$(realpath -- "${path_GNU}")"
|
||||
cd "${path_GNU}" && echo "[ pwd:'${PWD}' ]"
|
||||
|
||||
export RUST_BACKTRACE=1
|
||||
|
||||
|
@ -31,5 +33,8 @@ if test -n "$1"; then
|
|||
export RUN_TEST="TESTS=$1"
|
||||
fi
|
||||
|
||||
# * timeout used to kill occasionally errant/"stuck" processes (note: 'release' testing takes ~1 hour; 'debug' testing takes ~2.5 hours)
|
||||
# * `gl_public_submodule_commit=` disables testing for use of a "public" gnulib commit (which will fail when using shallow gnulib checkouts)
|
||||
# * `srcdir=..` specifies the GNU source directory for tests (fixing failing/confused 'tests/factor/tNN.sh' tests and causing no harm to other tests)
|
||||
#shellcheck disable=SC2086
|
||||
timeout -sKILL 2h make -j "$(nproc)" check $RUN_TEST SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : # Kill after 4 hours in case something gets stuck in make
|
||||
timeout -sKILL 4h make -j "$(nproc)" check ${RUN_TEST} SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no gl_public_submodule_commit="" srcdir="${path_GNU}" || : # Kill after 4 hours in case something gets stuck in make
|
||||
|
|
|
@ -1,15 +1,30 @@
|
|||
#!/bin/sh
|
||||
|
||||
# spell-checker:ignore (vars) OSID
|
||||
# spell-checker:ignore (vars) OSID binfmt
|
||||
|
||||
ME_dir="$(dirname -- "$(readlink -fm -- "$0")")"
|
||||
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
|
||||
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?
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue