2021-01-21 07:19:08 +00:00
name : GNU
on : [ push, pull_request]
jobs :
gnu :
name : Run GNU tests
runs-on : ubuntu-latest
steps :
# Checks out a copy of your repository on the ubuntu-latest machine
- name : Checkout code uutil
uses : actions/checkout@v2
with :
path : 'uutils'
- name : Chechout GNU coreutils
uses : actions/checkout@v2
with :
repository : 'coreutils/coreutils'
path : 'gnu'
- name : Chechout GNU corelib
uses : actions/checkout@v2
with :
repository : 'coreutils/gnulib'
path : 'gnulib'
fetch-depth : 0 # gnu gets upset if gnulib is a shallow checkout
- name : Install `rust` toolchain
uses : actions-rs/toolchain@v1
with :
toolchain : stable
default : true
profile : minimal # minimal component installation (ie, no documentation)
components : rustfmt
2021-01-21 22:56:02 +00:00
- name : Build binaries
2021-01-21 07:19:08 +00:00
shell : bash
run : |
2021-02-03 21:27:30 +00:00
sudo apt-get update
2021-03-14 15:59:17 +00:00
sudo apt-get install autoconf autopoint bison texinfo gperf gcc g++ gdb python-pyinotify python3-sphinx
2021-01-21 07:19:08 +00:00
pushd uutils
2021-02-03 21:27:30 +00:00
make PROFILE=release
2021-03-04 20:50:57 +00:00
BUILDDIR="$PWD/target/release/"
2021-03-14 15:59:17 +00:00
cp "${BUILDDIR}/install" "${BUILDDIR}/ginstall" # The GNU tests rename this script before running, to avoid confusion with the make target
2021-02-27 14:35:31 +00:00
# Create *sum binaries
for sum in b2sum md5sum sha1sum sha224sum sha256sum sha384sum sha512sum
do
2021-03-04 20:50:57 +00:00
sum_path="${BUILDDIR}/${sum}"
test -f "${sum_path}" || cp "${BUILDDIR}/hashsum" "${sum_path}"
2021-02-27 14:35:31 +00:00
done
2021-03-04 20:50:57 +00:00
test -f "${BUILDDIR}/[" || cp "${BUILDDIR}/test" "${BUILDDIR}/["
2021-01-21 07:19:08 +00:00
popd
GNULIB_SRCDIR="$PWD/gnulib"
pushd gnu/
2021-03-04 20:50:57 +00:00
# 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}"
2021-03-14 15:59:17 +00:00
test -f "${bin_path}" || { echo "'${binary}' was not built with uutils, using the 'false' program"; cp "${BUILDDIR}/false" "${bin_path}"; }
2021-03-04 20:50:57 +00:00
done
2021-01-21 07:19:08 +00:00
./bootstrap --gnulib-srcdir="$GNULIB_SRCDIR"
./configure --quiet --disable-gcc-warnings
2021-02-21 15:52:18 +00:00
#Add timeout to to protect against hangs
2021-03-20 22:15:47 +00:00
sed -i 's|"\$@|/usr/bin/timeout 600 "\$@|' build-aux/test-driver
2021-02-11 21:21:34 +00:00
# Change the PATH in the Makefile to test the uutils coreutils instead of the GNU coreutils
2021-01-21 07:19:08 +00:00
sed -i "s/^[[:blank:]]*PATH=.*/ PATH='${BUILDDIR//\//\\/}\$(PATH_SEPARATOR)'\"\$\$PATH\" \\\/" Makefile
sed -i 's| tr | /usr/bin/tr |' tests/init.sh
make
2021-02-03 21:30:20 +00:00
# Generate the factor tests, so they can be fixed
2021-03-14 15:59:17 +00:00
for i in {00..36}
2021-02-03 21:30:20 +00:00
do
make tests/factor/t${i}.sh
done
grep -rl 'path_prepend_' tests/* | xargs sed -i 's|path_prepend_ ./src||'
2021-03-20 22:15:47 +00:00
sed -i -e 's|^seq |/usr/bin/seq |' -e 's|sha1sum |/usr/bin/sha1sum |' tests/factor/t*sh
2021-02-21 15:51:03 +00:00
2021-02-11 21:21:34 +00:00
# Remove tests checking for --version & --help
# Not really interesting for us and logs are too big
sed -i -e '/tests\/misc\/invalid-opt.pl/ D' \
-e '/tests\/misc\/help-version.sh/ D' \
-e '/tests\/misc\/help-version-getopt.sh/ D' \
Makefile
2021-02-03 21:33:14 +00:00
2021-04-21 12:22:05 +00:00
# printf doesn't limit the values used in its arg, so this produced ~2GB of output
sed -i '/INT_OFLOW/ D' tests/misc/printf.sh
2021-02-20 17:17:03 +00:00
# Use the system coreutils where the test fails due to error in a util that is not the one being tested
2021-03-22 17:48:12 +00:00
sed -i 's|stat|/usr/bin/stat|' tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh
2021-03-20 22:15:47 +00:00
sed -i 's|ls -|/usr/bin/ls -|' tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh tests/du/8gb.sh
sed -i 's|mkdir |/usr/bin/mkdir |' tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh
2021-03-28 15:52:01 +00:00
sed -i 's|timeout \([[:digit:]]\)| /usr/bin/timeout \1|' tests/tail-2/inotify-rotate.sh tests/tail-2/inotify-dir-recreate.sh tests/tail-2/inotify-rotate-resources.sh tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh tests/tail-2/follow-name.sh tests/misc/shuf.sh # Don't break the function called 'grep_timeout'
sed -i 's|chmod |/usr/bin/chmod |' tests/du/inacc-dir.sh tests/mkdir/p-3.sh tests/tail-2/tail-n0f.sh tests/cp/fail-perm.sh tests/du/inaccessible-cwd.sh tests/mv/i-2.sh tests/chgrp/basic.sh tests/misc/shuf.sh
2021-03-20 22:15:47 +00:00
sed -i 's|sort |/usr/bin/sort |' tests/ls/hyperlink.sh tests/misc/test-N.sh
sed -i 's|split |/usr/bin/split |' tests/misc/factor-parallel.sh
sed -i 's|truncate |/usr/bin/truncate |' tests/split/fail.sh
2021-03-22 17:48:12 +00:00
sed -i 's|dd |/usr/bin/dd |' tests/du/8gb.sh tests/tail-2/big-4gb.sh tests/cp/fiemap-2.sh init.cfg
2021-03-20 22:15:47 +00:00
sed -i 's|id -|/usr/bin/id -|' tests/misc/runcon-no-reorder.sh
2021-03-21 20:49:15 +00:00
sed -i 's|touch |/usr/bin/touch |' tests/cp/preserve-link.sh tests/cp/reflink-perm.sh tests/ls/block-size.sh tests/ls/abmon-align.sh tests/ls/rt-1.sh tests/mv/update.sh tests/misc/ls-time.sh tests/misc/stat-nanoseconds.sh tests/misc/time-style.sh tests/misc/test-N.sh
sed -i 's|ln -|/usr/bin/ln -|' tests/cp/link-deref.sh
sed -i 's|printf |/usr/bin/printf |' tests/dd/ascii.sh
sed -i 's|cp |/usr/bin/cp |' tests/mv/hard-2.sh
sed -i 's|paste |/usr/bin/paste |' tests/misc/od-endian.sh
sed -i 's|seq |/usr/bin/seq |' tests/misc/sort-discrim.sh
2021-02-20 17:17:03 +00:00
2021-02-24 17:47:30 +00:00
#Add specific timeout to tests that currently hang to limit time spent waiting
2021-03-20 22:15:47 +00:00
sed -i 's|seq \$|/usr/bin/timeout 0.1 seq \$|' tests/misc/seq-precision.sh tests/misc/seq-long-double.sh
sed -i 's|cat |/usr/bin/timeout 0.1 cat |' tests/misc/cat-self.sh
2021-02-24 17:47:30 +00:00
2021-01-21 22:56:02 +00:00
test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}"
- name : Run GNU tests
shell : bash
run : |
BUILDDIR="${PWD}/uutils/target/release"
GNULIB_DIR="${PWD}/gnulib"
pushd gnu
2021-02-11 14:42:41 +00:00
2021-03-14 15:59:17 +00:00
timeout -sKILL 2h make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : # Kill after 4 hours in case something gets stuck in make
2021-02-11 14:42:41 +00:00
- name : Extract tests info
shell : bash
run : |
2021-03-21 14:45:34 +00:00
if test -f gnu/tests/test-suite.log
then
TOTAL=$( grep "# TOTAL:" gnu/tests/test-suite.log|cut -d' ' -f2-)
PASS=$( grep "# PASS:" gnu/tests/test-suite.log|cut -d' ' -f2-)
SKIP=$( grep "# SKIP:" gnu/tests/test-suite.log|cut -d' ' -f2-)
FAIL=$( grep "# FAIL:" gnu/tests/test-suite.log|cut -d' ' -f2-)
XPASS=$( grep "# XPASS:" gnu/tests/test-suite.log|cut -d' ' -f2-)
ERROR=$( grep "# ERROR:" gnu/tests/test-suite.log|cut -d' ' -f2-)
echo "::warning ::GNU testsuite = $TOTAL / $PASS / $FAIL / $ERROR"
else
echo "::error ::Failed to get summary of test results"
fi
2021-02-11 14:42:41 +00:00
2021-02-03 21:38:24 +00:00
- uses : actions/upload-artifact@v2
with :
name : test-report
path : gnu/tests/**/*.log