mirror of
https://github.com/uutils/coreutils
synced 2024-09-06 16:03:44 +00:00
125 lines
5.9 KiB
YAML
125 lines
5.9 KiB
YAML
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
|
|
- name: Build binaries
|
|
shell: bash
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install autoconf autopoint bison texinfo gperf gcc g++ gdb python-pyinotify python3-sphinx
|
|
pushd uutils
|
|
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
|
|
# Create *sum binaries
|
|
for sum in b2sum md5sum sha1sum sha224sum sha256sum sha384sum sha512sum
|
|
do
|
|
sum_path="${BUILDDIR}/${sum}"
|
|
test -f "${sum_path}" || cp "${BUILDDIR}/hashsum" "${sum_path}"
|
|
done
|
|
test -f "${BUILDDIR}/[" || cp "${BUILDDIR}/test" "${BUILDDIR}/["
|
|
popd
|
|
GNULIB_SRCDIR="$PWD/gnulib"
|
|
pushd gnu/
|
|
|
|
# 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}"; }
|
|
done
|
|
|
|
./bootstrap --gnulib-srcdir="$GNULIB_SRCDIR"
|
|
./configure --quiet --disable-gcc-warnings
|
|
#Add timeout to to protect against hangs
|
|
sed -i "s|\"\$@|$(which 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| tr | /usr/bin/tr |' tests/init.sh
|
|
make
|
|
# Generate the factor tests, so they can be fixed
|
|
for i in {00..36}
|
|
do
|
|
make tests/factor/t${i}.sh
|
|
done
|
|
grep -rl 'path_prepend_' tests/* | xargs sed -i 's|path_prepend_ ./src||'
|
|
sed -i -e 's|^seq |/usr/bin/seq |' -e "s|sha1sum |$(which sha1sum) |" tests/factor/t*sh
|
|
|
|
# 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
|
|
|
|
# Use the system coreutils where the test fails due to error in a util that is not the one being tested
|
|
sed -i "s|stat|$(which stat)|" tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh
|
|
sed -i "s|ls -|$(which ls) -|" tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh
|
|
sed -i "s|mkdir |$(which mkdir) |" tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh
|
|
sed -i "s|timeout |$(which timeout) |" 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
|
|
sed -i "s| timeout | $(which timeout) |" tests/tail-2/inotify-rotate.sh # Don't break the function called 'grep_timeout'
|
|
sed -i "s|chmod |$(which chmod) |" tests/du/inacc-dir.sh tests/mkdir/p-3.sh
|
|
sed -i "s|sort |$(which sort) |" tests/ls/hyperlink.sh tests/misc/test-N.sh
|
|
sed -i "s|split |$(which split) |" tests/misc/factor-parallel.sh
|
|
sed -i "s|truncate |$(which truncate) |" tests/split/fail.sh
|
|
sed -i "s|dd |$(which dd) |" tests/du/8gb.sh tests/tail-2/big-4gb.sh
|
|
sed -i "s|id -|$(which id) -|" tests/misc/runcon-no-reorder.sh
|
|
|
|
#Add specific timeout to tests that currently hang to limit time spent waiting
|
|
sed -i "s|seq \\$|$(which timeout) 0.1 seq \$|" tests/misc/seq-precision.sh tests/misc/seq-long-double.sh
|
|
sed -i "s|cat |$(which timeout) 0.1 cat |" tests/misc/cat-self.sh
|
|
|
|
|
|
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
|
|
|
|
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
|
|
- name: Extract tests info
|
|
shell: bash
|
|
run: |
|
|
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"
|
|
|
|
- uses: actions/upload-artifact@v2
|
|
with:
|
|
name: test-report
|
|
path: gnu/tests/**/*.log
|