Skip to content

Commit cda918b

Browse files
author
oech3
committed
GnuTests: Reduce GNU deps on BSD
1 parent a7e4e91 commit cda918b

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

util/build-gnu.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33
#
44

55
# spell-checker:ignore (paths) abmon deref discrim eacces getlimits getopt ginstall inacc infloop inotify reflink ; (misc) INT_OFLOW OFLOW
6-
# spell-checker:ignore baddecode submodules xstrtol distros ; (vars/env) SRCDIR vdir rcexp xpart dired OSTYPE ; (utils) gnproc greadlink gsed multihardlink texinfo CARGOFLAGS
6+
# spell-checker:ignore baddecode submodules xstrtol distros ; (vars/env) SRCDIR vdir rcexp xpart dired OSTYPE ; (utils) greadlink gsed multihardlink texinfo CARGOFLAGS
77
# spell-checker:ignore openat TOCTOU CFLAGS
88
# spell-checker:ignore hfsplus casefold chattr
99

1010
set -e
1111

12-
# Use system's GNU version for make, nproc, readlink and sed on *BSD and macOS
12+
# Use GNU make, readlink and sed on *BSD and macOS
1313
MAKE=$(command -v gmake||command -v make)
14-
NPROC=$(command -v gnproc||command -v nproc)
15-
READLINK=$(command -v greadlink||command -v readlink)
14+
READLINK=$(command -v greadlink||command -v readlink) # Use our readlink to remove a dependency
1615
SED=$(command -v gsed||command -v sed)
1716

1817
SYSTEM_TIMEOUT=$(command -v timeout)
@@ -141,7 +140,8 @@ else
141140
"${SED}" -i 's|^"\$@|'"${SYSTEM_TIMEOUT}"' 600 "\$@|' build-aux/test-driver
142141
# Use a better diff
143142
"${SED}" -i 's|diff -c|diff -u|g' tests/Coreutils.pm
144-
"${MAKE}" -j "$("${NPROC}")"
143+
# Use our nproc for *BSD and macOS
144+
"${MAKE}" -j "$("${UU_BUILD_DIR}/nproc")"
145145

146146
# Handle generated factor tests
147147
t_first=00

util/run-gnu-test.sh

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,14 @@
22
# `run-gnu-test.bash [TEST]`
33
# run GNU test (or all tests if TEST is missing/null)
44

5-
# spell-checker:ignore (env/vars) GNULIB SRCDIR SUBDIRS OSTYPE ; (utils) shellcheck gnproc greadlink
5+
# spell-checker:ignore (env/vars) GNULIB SRCDIR SUBDIRS OSTYPE ; (utils) shellcheck greadlink
66

77
# ref: [How the GNU coreutils are tested](https://www.pixelbeat.org/docs/coreutils-testing.html) @@ <https://archive.is/p2ITW>
88
# * note: to run a single test => `make check TESTS=PATH/TO/TEST/SCRIPT SUBDIRS=. VERBOSE=yes`
99

10-
# Use GNU version for make, nproc, readlink on *BSD
11-
case "$OSTYPE" in
12-
*bsd*)
13-
MAKE="gmake"
14-
NPROC="gnproc"
15-
READLINK="greadlink"
16-
;;
17-
*)
18-
MAKE="make"
19-
NPROC="nproc"
20-
READLINK="readlink"
21-
;;
22-
esac
10+
# Use GNU make, readlink on *BSD
11+
MAKE=$(command -v gmake||command -v make)
12+
READLINK=$(command -v greadlink||command -v readlink) # Use our readlink to remove a dependency
2313

2414
ME_dir="$(dirname -- "$("${READLINK}" -fm -- "$0")")"
2515
REPO_main_dir="$(dirname -- "${ME_dir}")"
@@ -37,6 +27,9 @@ path_GNU="$("${READLINK}" -fm -- "${path_GNU:-${path_UUTILS}/../gnu}")"
3727
echo "path_UUTILS='${path_UUTILS}'"
3828
echo "path_GNU='${path_GNU}'"
3929

30+
# Use our nproc for *BSD
31+
NPROC="${path_UUTILS}/nproc"
32+
4033
###
4134

4235
cd "${path_GNU}" && echo "[ pwd:'${PWD}' ]"

0 commit comments

Comments
 (0)